diff options
author | wangws | 2019-09-28 03:04:28 -0500 |
---|---|---|
committer | wangws | 2019-09-28 03:07:42 -0500 |
commit | 633a27166bcf78cb1aaf8647c50ed5c3d467d98d (patch) | |
tree | dace10dae2c70bb6feea5a504f5bfa7c61d40bde | |
parent | d76dcf920ab19341d78e9d40aa3ff1f1050f61c1 (diff) | |
download | tas2562-stereo-android-driver-633a27166bcf78cb1aaf8647c50ed5c3d467d98d.tar.gz tas2562-stereo-android-driver-633a27166bcf78cb1aaf8647c50ed5c3d467d98d.tar.xz tas2562-stereo-android-driver-633a27166bcf78cb1aaf8647c50ed5c3d467d98d.zip |
1. Fix Stereo-16bit right channel no sound.
2. Fix Stereo-16bit IV sense incorrect.
3. Optimize code format
-rw-r--r-- | dts.readme | 18 | ||||
-rw-r--r-- | tas2562-codec.c | 73 | ||||
-rw-r--r-- | tas2562-regmap.c | 90 | ||||
-rw-r--r-- | tas2562.h | 4 |
4 files changed, 123 insertions, 62 deletions
@@ -1,4 +1,22 @@ | |||
1 | example for dts: | 1 | example for dts: |
2 | |||
3 | a. for mono tas2562 | ||
4 | |||
5 | tas2562:tas2562@4c { | ||
6 | #sound-dai-cells = <0>; | ||
7 | compatible = "ti,tas2562"; | ||
8 | reg = <0x4c>; | ||
9 | ti,left-channel = <0x4c>; | ||
10 | ti,channels = <1>; /* channel number */ | ||
11 | ti,reset-gpio = <&gpio1 17 0>; | ||
12 | ti,irq-gpio = <&gpio1 15 0>; | ||
13 | status = "ok"; | ||
14 | }; | ||
15 | |||
16 | |||
17 | |||
18 | b. for stereo tas2562 | ||
19 | |||
2 | tas2562:tas2562@4c { | 20 | tas2562:tas2562@4c { |
3 | #sound-dai-cells = <0>; | 21 | #sound-dai-cells = <0>; |
4 | compatible = "ti,tas2562"; | 22 | compatible = "ti,tas2562"; |
diff --git a/tas2562-codec.c b/tas2562-codec.c index 11ed732..631cd6e 100644 --- a/tas2562-codec.c +++ b/tas2562-codec.c | |||
@@ -186,7 +186,7 @@ static int tas2562iv_get(struct snd_kcontrol *kcontrol, | |||
186 | } | 186 | } |
187 | 187 | ||
188 | tas2562iv_enable = ucontrol->value.integer.value[0]; | 188 | tas2562iv_enable = ucontrol->value.integer.value[0]; |
189 | dev_err(p_tas2562->dev, "value: 0x%x, tas2562iv_enable %d\n", | 189 | dev_info(p_tas2562->dev, "value: 0x%x, tas2562iv_enable %d\n", |
190 | value, tas2562iv_enable); | 190 | value, tas2562iv_enable); |
191 | 191 | ||
192 | return 0; | 192 | return 0; |
@@ -265,7 +265,7 @@ static int tas2562_i2c_load_data(struct tas2562_priv *p_tas2562, | |||
265 | return n_result; | 265 | return n_result; |
266 | } | 266 | } |
267 | 267 | ||
268 | #if 0 | 268 | #ifdef CONFIG_CODEC_PM |
269 | static int tas2562_codec_suspend(struct snd_soc_codec *codec) | 269 | static int tas2562_codec_suspend(struct snd_soc_codec *codec) |
270 | { | 270 | { |
271 | struct tas2562_priv *p_tas2562 = snd_soc_codec_get_drvdata(codec); | 271 | struct tas2562_priv *p_tas2562 = snd_soc_codec_get_drvdata(codec); |
@@ -304,7 +304,7 @@ static int tas2562_set_power_state(struct tas2562_priv *p_tas2562, | |||
304 | 304 | ||
305 | if ((p_tas2562->mb_mute) && (state == TAS2562_POWER_ACTIVE)) | 305 | if ((p_tas2562->mb_mute) && (state == TAS2562_POWER_ACTIVE)) |
306 | state = TAS2562_POWER_MUTE; | 306 | state = TAS2562_POWER_MUTE; |
307 | dev_err(p_tas2562->dev, "set power state: %d\n", state); | 307 | dev_info(p_tas2562->dev, "set power state: %d\n", state); |
308 | 308 | ||
309 | switch (state) { | 309 | switch (state) { |
310 | case TAS2562_POWER_ACTIVE: | 310 | case TAS2562_POWER_ACTIVE: |
@@ -390,8 +390,8 @@ static int tas2562_dac_event(struct snd_soc_dapm_widget *w, | |||
390 | break; | 390 | break; |
391 | 391 | ||
392 | } | 392 | } |
393 | return 0; | ||
394 | 393 | ||
394 | return 0; | ||
395 | } | 395 | } |
396 | 396 | ||
397 | static const struct snd_soc_dapm_widget tas2562_dapm_widgets[] = { | 397 | static const struct snd_soc_dapm_widget tas2562_dapm_widgets[] = { |
@@ -493,17 +493,32 @@ static int tas2562_iv_slot_config(struct tas2562_priv *p_tas2562) | |||
493 | p_tas2562->mn_slot_width); | 493 | p_tas2562->mn_slot_width); |
494 | 494 | ||
495 | if (p_tas2562->mn_channels == 2) { | 495 | if (p_tas2562->mn_channels == 2) { |
496 | p_tas2562->update_bits(p_tas2562, channel_left, | 496 | if (p_tas2562->mn_slot_width == 16) { |
497 | TAS2562_TDMCONFIGURATIONREG5, 0xff, 0x42); | 497 | p_tas2562->update_bits(p_tas2562, channel_left, |
498 | TAS2562_TDMCONFIGURATIONREG5, 0xff, 0x41); | ||
498 | 499 | ||
499 | p_tas2562->update_bits(p_tas2562, channel_left, | 500 | p_tas2562->update_bits(p_tas2562, channel_left, |
500 | TAS2562_TDMCONFIGURATIONREG6, 0xff, 0x40); | 501 | TAS2562_TDMCONFIGURATIONREG6, 0xff, 0x40); |
501 | 502 | ||
502 | p_tas2562->update_bits(p_tas2562, channel_right, | 503 | p_tas2562->update_bits(p_tas2562, channel_right, |
503 | TAS2562_TDMCONFIGURATIONREG5, 0xff, 0x46); | 504 | TAS2562_TDMCONFIGURATIONREG5, 0xff, 0x43); |
504 | 505 | ||
505 | p_tas2562->update_bits(p_tas2562, channel_right, | 506 | p_tas2562->update_bits(p_tas2562, channel_right, |
506 | TAS2562_TDMCONFIGURATIONREG6, 0xff, 0x44); | 507 | TAS2562_TDMCONFIGURATIONREG6, 0xff, 0x42); |
508 | } else { | ||
509 | |||
510 | p_tas2562->update_bits(p_tas2562, channel_left, | ||
511 | TAS2562_TDMCONFIGURATIONREG5, 0xff, 0x42); | ||
512 | |||
513 | p_tas2562->update_bits(p_tas2562, channel_left, | ||
514 | TAS2562_TDMCONFIGURATIONREG6, 0xff, 0x40); | ||
515 | |||
516 | p_tas2562->update_bits(p_tas2562, channel_right, | ||
517 | TAS2562_TDMCONFIGURATIONREG5, 0xff, 0x46); | ||
518 | |||
519 | p_tas2562->update_bits(p_tas2562, channel_right, | ||
520 | TAS2562_TDMCONFIGURATIONREG6, 0xff, 0x44); | ||
521 | } | ||
507 | } else if ((p_tas2562->mn_channels == 1) | 522 | } else if ((p_tas2562->mn_channels == 1) |
508 | && (p_tas2562->mn_slot_width == 32)) { | 523 | && (p_tas2562->mn_slot_width == 32)) { |
509 | p_tas2562->update_bits(p_tas2562, channel_left, | 524 | p_tas2562->update_bits(p_tas2562, channel_left, |
@@ -526,6 +541,25 @@ static int tas2562_iv_slot_config(struct tas2562_priv *p_tas2562) | |||
526 | return ret; | 541 | return ret; |
527 | } | 542 | } |
528 | 543 | ||
544 | static int tas2562_iv_bitwidth_config(struct tas2562_priv *p_tas2562) | ||
545 | { | ||
546 | int ret = 0; | ||
547 | |||
548 | if ((p_tas2562->mn_channels == 2) && (p_tas2562->mn_slot_width == 16)){ | ||
549 | ret = p_tas2562->update_bits(p_tas2562, channel_both, | ||
550 | TAS2562_TDMCONFIGURATIONREG2, | ||
551 | TAS2562_TDMCONFIGURATIONREG2_IVMONLEN76_MASK, | ||
552 | TAS2562_TDMCONFIGURATIONREG2_IVMONLEN76_8BITS); | ||
553 | } else { | ||
554 | ret = p_tas2562->update_bits(p_tas2562, channel_both, | ||
555 | TAS2562_TDMCONFIGURATIONREG2, | ||
556 | TAS2562_TDMCONFIGURATIONREG2_IVMONLEN76_MASK, | ||
557 | TAS2562_TDMCONFIGURATIONREG2_IVMONLEN76_16BITS); | ||
558 | } | ||
559 | |||
560 | return ret; | ||
561 | } | ||
562 | |||
529 | static int tas2562_set_slot(struct tas2562_priv *p_tas2562, int slot_width) | 563 | static int tas2562_set_slot(struct tas2562_priv *p_tas2562, int slot_width) |
530 | { | 564 | { |
531 | int ret = 0; | 565 | int ret = 0; |
@@ -614,6 +648,7 @@ static int tas2562_set_bitwidth(struct tas2562_priv *p_tas2562, int bitwidth) | |||
614 | TAS2562_TDMCONFIGURATIONREG2_RXSCFG54_MONO_RIGHT); | 648 | TAS2562_TDMCONFIGURATIONREG2_RXSCFG54_MONO_RIGHT); |
615 | 649 | ||
616 | tas2562_iv_slot_config(p_tas2562); | 650 | tas2562_iv_slot_config(p_tas2562); |
651 | tas2562_iv_bitwidth_config(p_tas2562); | ||
617 | 652 | ||
618 | dev_info(p_tas2562->dev, "mn_ch_size: %d\n", p_tas2562->mn_ch_size); | 653 | dev_info(p_tas2562->dev, "mn_ch_size: %d\n", p_tas2562->mn_ch_size); |
619 | p_tas2562->mn_pcm_format = bitwidth; | 654 | p_tas2562->mn_pcm_format = bitwidth; |
@@ -867,8 +902,8 @@ static int tas2562_set_fmt(struct tas2562_priv *p_tas2562, unsigned int fmt) | |||
867 | p_tas2562->update_bits(p_tas2562, channel_right, | 902 | p_tas2562->update_bits(p_tas2562, channel_right, |
868 | TAS2562_TDMCONFIGURATIONREG1, | 903 | TAS2562_TDMCONFIGURATIONREG1, |
869 | TAS2562_TDMCONFIGURATIONREG1_RXOFFSET51_MASK, | 904 | TAS2562_TDMCONFIGURATIONREG1_RXOFFSET51_MASK, |
870 | ((tdm_rx_start_slot + p_tas2562->mn_slot_width) << | 905 | (tdm_rx_start_slot << |
871 | TAS2562_TDMCONFIGURATIONREG1_RXOFFSET51_SHIFT)); | 906 | TAS2562_TDMCONFIGURATIONREG1_RXOFFSET51_SHIFT)); |
872 | } | 907 | } |
873 | 908 | ||
874 | p_tas2562->mn_asi_format = fmt; | 909 | p_tas2562->mn_asi_format = fmt; |
@@ -971,7 +1006,7 @@ static int tas2562_load_init(struct tas2562_priv *p_tas2562) | |||
971 | TAS2562_TDMConfigurationReg4, 0x11); | 1006 | TAS2562_TDMConfigurationReg4, 0x11); |
972 | if (ret < 0) | 1007 | if (ret < 0) |
973 | return ret; | 1008 | return ret; |
974 | else { | 1009 | } else { |
975 | ret = p_tas2562->write(p_tas2562, channel_both, | 1010 | ret = p_tas2562->write(p_tas2562, channel_both, |
976 | TAS2562_TDMConfigurationReg4, 0x01); | 1011 | TAS2562_TDMConfigurationReg4, 0x01); |
977 | if (ret < 0) | 1012 | if (ret < 0) |
@@ -1002,7 +1037,7 @@ static int tas2562_codec_probe(struct snd_soc_codec *codec) | |||
1002 | 1037 | ||
1003 | tas2562_load_init(p_tas2562); | 1038 | tas2562_load_init(p_tas2562); |
1004 | tas2562_iv_enable(p_tas2562, 1); | 1039 | tas2562_iv_enable(p_tas2562, 1); |
1005 | dev_err(p_tas2562->dev, "%s\n", __func__); | 1040 | dev_info(p_tas2562->dev, "%s\n", __func__); |
1006 | 1041 | ||
1007 | return 0; | 1042 | return 0; |
1008 | } | 1043 | } |
@@ -1041,13 +1076,13 @@ static struct snd_soc_codec_driver soc_codec_driver_tas2562 = { | |||
1041 | .remove = tas2562_codec_remove, | 1076 | .remove = tas2562_codec_remove, |
1042 | .read = tas2562_codec_read, | 1077 | .read = tas2562_codec_read, |
1043 | .write = tas2562_codec_write, | 1078 | .write = tas2562_codec_write, |
1044 | #if 0 | 1079 | #ifdef CONFIG_CODEC_PM |
1045 | .suspend = tas2562_codec_suspend, | 1080 | .suspend = tas2562_codec_suspend, |
1046 | .resume = tas2562_codec_resume, | 1081 | .resume = tas2562_codec_resume, |
1047 | #endif | 1082 | #endif |
1048 | .component_driver = { | 1083 | .component_driver = { |
1049 | .controls = tas2562_snd_controls, | 1084 | .controls = tas2562_snd_controls, |
1050 | .num_controls = ARRAY_SIZE(tas2562_snd_controls), | 1085 | .num_controls = ARRAY_SIZE(tas2562_snd_controls), |
1051 | .dapm_widgets = tas2562_dapm_widgets, | 1086 | .dapm_widgets = tas2562_dapm_widgets, |
1052 | .num_dapm_widgets = ARRAY_SIZE(tas2562_dapm_widgets), | 1087 | .num_dapm_widgets = ARRAY_SIZE(tas2562_dapm_widgets), |
1053 | .dapm_routes = tas2562_audio_map, | 1088 | .dapm_routes = tas2562_audio_map, |
diff --git a/tas2562-regmap.c b/tas2562-regmap.c index b081c51..a54948b 100644 --- a/tas2562-regmap.c +++ b/tas2562-regmap.c | |||
@@ -470,12 +470,19 @@ static const struct regmap_config tas2562_i2c_regmap = { | |||
470 | static void tas2562_hw_reset(struct tas2562_priv *p_tas2562) | 470 | static void tas2562_hw_reset(struct tas2562_priv *p_tas2562) |
471 | { | 471 | { |
472 | if (gpio_is_valid(p_tas2562->mn_reset_gpio)) { | 472 | if (gpio_is_valid(p_tas2562->mn_reset_gpio)) { |
473 | gpio_direction_output(p_tas2562->mn_reset_gpio, 0); | 473 | if (gpio_is_valid(p_tas2562->mn_reset_gpio2)) { |
474 | gpio_direction_output(p_tas2562->mn_reset_gpio2, 0); | 474 | gpio_direction_output(p_tas2562->mn_reset_gpio, 0); |
475 | msleep(20); | 475 | gpio_direction_output(p_tas2562->mn_reset_gpio2, 0); |
476 | gpio_direction_output(p_tas2562->mn_reset_gpio, 1); | 476 | msleep(20); |
477 | gpio_direction_output(p_tas2562->mn_reset_gpio2, 1); | 477 | gpio_direction_output(p_tas2562->mn_reset_gpio, 1); |
478 | msleep(20); | 478 | gpio_direction_output(p_tas2562->mn_reset_gpio2, 1); |
479 | msleep(20); | ||
480 | } else { | ||
481 | gpio_direction_output(p_tas2562->mn_reset_gpio, 0); | ||
482 | msleep(20); | ||
483 | gpio_direction_output(p_tas2562->mn_reset_gpio, 1); | ||
484 | msleep(20); | ||
485 | } | ||
479 | } | 486 | } |
480 | dev_err(p_tas2562->dev, "gpio up !!\n"); | 487 | dev_err(p_tas2562->dev, "gpio up !!\n"); |
481 | 488 | ||
@@ -584,7 +591,7 @@ static void irq_work_routine(struct work_struct *work) | |||
584 | goto reload; | 591 | goto reload; |
585 | 592 | ||
586 | dev_dbg(p_tas2562->dev, "IRQ status : 0x%x, 0x%x, 0x%x, 0x%x\n", | 593 | dev_dbg(p_tas2562->dev, "IRQ status : 0x%x, 0x%x, 0x%x, 0x%x\n", |
587 | nDevInt3Status, nDevInt4Status, | 594 | nDevInt1Status, nDevInt2Status, |
588 | nDevInt3Status, nDevInt4Status); | 595 | nDevInt3Status, nDevInt4Status); |
589 | 596 | ||
590 | if (((nDevInt1Status & 0x7) != 0) | 597 | if (((nDevInt1Status & 0x7) != 0) |
@@ -831,13 +838,14 @@ static int tas2562_pm_suspend(struct device *dev) | |||
831 | if(!p_tas2562){ | 838 | if(!p_tas2562){ |
832 | dev_err(p_tas2562->dev, "drvdata is NULL\n"); | 839 | dev_err(p_tas2562->dev, "drvdata is NULL\n"); |
833 | return -EINVAL; | 840 | return -EINVAL; |
834 | } | 841 | } |
835 | 842 | ||
836 | mutex_lock(&p_tas2562->codec_lock); | 843 | mutex_lock(&p_tas2562->codec_lock); |
837 | tas2562_runtime_suspend(p_tas2562); | 844 | tas2562_runtime_suspend(p_tas2562); |
838 | mutex_unlock(&p_tas2562->codec_lock); | 845 | mutex_unlock(&p_tas2562->codec_lock); |
839 | return 0; | 846 | return 0; |
840 | } | 847 | } |
848 | |||
841 | static int tas2562_pm_resume(struct device *dev) | 849 | static int tas2562_pm_resume(struct device *dev) |
842 | { | 850 | { |
843 | struct tas2562_priv *p_tas2562 = dev_get_drvdata(dev); | 851 | struct tas2562_priv *p_tas2562 = dev_get_drvdata(dev); |
@@ -845,11 +853,11 @@ static int tas2562_pm_resume(struct device *dev) | |||
845 | if(!p_tas2562){ | 853 | if(!p_tas2562){ |
846 | dev_err(p_tas2562->dev, "drvdata is NULL\n"); | 854 | dev_err(p_tas2562->dev, "drvdata is NULL\n"); |
847 | return -EINVAL; | 855 | return -EINVAL; |
848 | } | 856 | } |
849 | mutex_lock(&p_tas2562->codec_lock); | 857 | mutex_lock(&p_tas2562->codec_lock); |
850 | tas2562_runtime_resume(p_tas2562); | 858 | tas2562_runtime_resume(p_tas2562); |
851 | mutex_unlock(&p_tas2562->codec_lock); | 859 | mutex_unlock(&p_tas2562->codec_lock); |
852 | return 0; | 860 | return 0; |
853 | } | 861 | } |
854 | 862 | ||
855 | static int tas2562_parse_dt(struct device *dev, struct tas2562_priv *p_tas2562) | 863 | static int tas2562_parse_dt(struct device *dev, struct tas2562_priv *p_tas2562) |
@@ -875,18 +883,6 @@ static int tas2562_parse_dt(struct device *dev, struct tas2562_priv *p_tas2562) | |||
875 | p_tas2562->mn_l_addr); | 883 | p_tas2562->mn_l_addr); |
876 | } | 884 | } |
877 | 885 | ||
878 | if(p_tas2562->mn_channels != 1) { | ||
879 | rc = of_property_read_u32(np, "ti,right-channel", | ||
880 | &p_tas2562->mn_r_addr); | ||
881 | if (rc) { | ||
882 | dev_err(p_tas2562->dev, "Looking up %s property in node %s failed %d\n", | ||
883 | "ti,right-channel", np->full_name, rc); | ||
884 | } else { | ||
885 | dev_dbg(p_tas2562->dev, "ti,right-channel=0x%x", | ||
886 | p_tas2562->mn_r_addr); | ||
887 | } | ||
888 | } | ||
889 | |||
890 | p_tas2562->mn_reset_gpio = of_get_named_gpio(np, "ti,reset-gpio", 0); | 886 | p_tas2562->mn_reset_gpio = of_get_named_gpio(np, "ti,reset-gpio", 0); |
891 | if (!gpio_is_valid(p_tas2562->mn_reset_gpio)) { | 887 | if (!gpio_is_valid(p_tas2562->mn_reset_gpio)) { |
892 | dev_err(p_tas2562->dev, "Looking up %s property in node %s failed %d\n", | 888 | dev_err(p_tas2562->dev, "Looking up %s property in node %s failed %d\n", |
@@ -897,7 +893,26 @@ static int tas2562_parse_dt(struct device *dev, struct tas2562_priv *p_tas2562) | |||
897 | p_tas2562->mn_reset_gpio); | 893 | p_tas2562->mn_reset_gpio); |
898 | } | 894 | } |
899 | 895 | ||
896 | p_tas2562->mn_irq_gpio = of_get_named_gpio(np, "ti,irq-gpio", 0); | ||
897 | if (!gpio_is_valid(p_tas2562->mn_irq_gpio)) { | ||
898 | dev_err(p_tas2562->dev, "Looking up %s property in node %s failed %d\n", | ||
899 | "ti,irq-gpio", np->full_name, p_tas2562->mn_irq_gpio); | ||
900 | } else { | ||
901 | dev_dbg(p_tas2562->dev, "ti,irq-gpio=%d", | ||
902 | p_tas2562->mn_irq_gpio); | ||
903 | } | ||
904 | |||
900 | if(p_tas2562->mn_channels != 1) { | 905 | if(p_tas2562->mn_channels != 1) { |
906 | rc = of_property_read_u32(np, "ti,right-channel", | ||
907 | &p_tas2562->mn_r_addr); | ||
908 | if (rc) { | ||
909 | dev_err(p_tas2562->dev, "Looking up %s property in node %s failed %d\n", | ||
910 | "ti,right-channel", np->full_name, rc); | ||
911 | } else { | ||
912 | dev_dbg(p_tas2562->dev, "ti,right-channel=0x%x", | ||
913 | p_tas2562->mn_r_addr); | ||
914 | } | ||
915 | |||
901 | p_tas2562->mn_reset_gpio2 = of_get_named_gpio(np, "ti,reset-gpio2", 0); | 916 | p_tas2562->mn_reset_gpio2 = of_get_named_gpio(np, "ti,reset-gpio2", 0); |
902 | if (!gpio_is_valid(p_tas2562->mn_reset_gpio2)) { | 917 | if (!gpio_is_valid(p_tas2562->mn_reset_gpio2)) { |
903 | dev_dbg(p_tas2562->dev, "Looking up %s property in node %s failed %d\n", | 918 | dev_dbg(p_tas2562->dev, "Looking up %s property in node %s failed %d\n", |
@@ -907,18 +922,7 @@ static int tas2562_parse_dt(struct device *dev, struct tas2562_priv *p_tas2562) | |||
907 | dev_dbg(p_tas2562->dev, "ti,reset-gpio2=%d", | 922 | dev_dbg(p_tas2562->dev, "ti,reset-gpio2=%d", |
908 | p_tas2562->mn_reset_gpio2); | 923 | p_tas2562->mn_reset_gpio2); |
909 | } | 924 | } |
910 | } | ||
911 | 925 | ||
912 | p_tas2562->mn_irq_gpio = of_get_named_gpio(np, "ti,irq-gpio", 0); | ||
913 | if (!gpio_is_valid(p_tas2562->mn_irq_gpio)) { | ||
914 | dev_err(p_tas2562->dev, "Looking up %s property in node %s failed %d\n", | ||
915 | "ti,irq-gpio", np->full_name, p_tas2562->mn_irq_gpio); | ||
916 | } else { | ||
917 | dev_dbg(p_tas2562->dev, "ti,irq-gpio=%d", | ||
918 | p_tas2562->mn_irq_gpio); | ||
919 | } | ||
920 | |||
921 | if(p_tas2562->mn_channels != 1) { | ||
922 | p_tas2562->mn_irq_gpio2 = of_get_named_gpio(np, "ti,irq-gpio2", 0); | 926 | p_tas2562->mn_irq_gpio2 = of_get_named_gpio(np, "ti,irq-gpio2", 0); |
923 | if (!gpio_is_valid(p_tas2562->mn_irq_gpio2)) { | 927 | if (!gpio_is_valid(p_tas2562->mn_irq_gpio2)) { |
924 | dev_dbg(p_tas2562->dev, "Looking up %s property in node %s failed %d\n", | 928 | dev_dbg(p_tas2562->dev, "Looking up %s property in node %s failed %d\n", |
@@ -938,7 +942,7 @@ static int tas2562_i2c_probe(struct i2c_client *p_client, | |||
938 | struct tas2562_priv *p_tas2562; | 942 | struct tas2562_priv *p_tas2562; |
939 | int n_result; | 943 | int n_result; |
940 | 944 | ||
941 | dev_err(&p_client->dev, "Driver ID: %s\n", TAS2562_DRIVER_ID); | 945 | dev_info(&p_client->dev, "Driver ID: %s\n", TAS2562_DRIVER_ID); |
942 | dev_info(&p_client->dev, "%s enter\n", __func__); | 946 | dev_info(&p_client->dev, "%s enter\n", __func__); |
943 | 947 | ||
944 | p_tas2562 = devm_kzalloc(&p_client->dev, | 948 | p_tas2562 = devm_kzalloc(&p_client->dev, |
@@ -977,7 +981,8 @@ static int tas2562_i2c_probe(struct i2c_client *p_client, | |||
977 | tas2562_hw_reset(p_tas2562); | 981 | tas2562_hw_reset(p_tas2562); |
978 | } | 982 | } |
979 | 983 | ||
980 | if (gpio_is_valid(p_tas2562->mn_reset_gpio2)) { | 984 | if (gpio_is_valid(p_tas2562->mn_reset_gpio2) && |
985 | (p_tas2562->mn_channels == 2)) { | ||
981 | n_result = gpio_request(p_tas2562->mn_reset_gpio2, | 986 | n_result = gpio_request(p_tas2562->mn_reset_gpio2, |
982 | "TAS2562_RESET2"); | 987 | "TAS2562_RESET2"); |
983 | if (n_result) { | 988 | if (n_result) { |
@@ -996,10 +1001,9 @@ static int tas2562_i2c_probe(struct i2c_client *p_client, | |||
996 | p_tas2562->update_bits = tas2562_dev_update_bits; | 1001 | p_tas2562->update_bits = tas2562_dev_update_bits; |
997 | p_tas2562->hw_reset = tas2562_hw_reset; | 1002 | p_tas2562->hw_reset = tas2562_hw_reset; |
998 | p_tas2562->enable_irq = tas2562_enable_irq; | 1003 | p_tas2562->enable_irq = tas2562_enable_irq; |
999 | #if 0 | 1004 | #ifdef CONFIG_CODEC_PM |
1000 | p_tas2562->runtime_suspend = tas2562_runtime_suspend; | 1005 | p_tas2562->runtime_suspend = tas2562_runtime_suspend; |
1001 | p_tas2562->runtime_resume = tas2562_runtime_resume; | 1006 | p_tas2562->runtime_resume = tas2562_runtime_resume; |
1002 | p_tas2562->mn_power_state = TAS2562_POWER_SHUTDOWN; | ||
1003 | #endif | 1007 | #endif |
1004 | p_tas2562->mn_power_state = TAS2562_POWER_SHUTDOWN; | 1008 | p_tas2562->mn_power_state = TAS2562_POWER_SHUTDOWN; |
1005 | p_tas2562->spk_l_control = 1; | 1009 | p_tas2562->spk_l_control = 1; |
@@ -1055,7 +1059,7 @@ static int tas2562_i2c_probe(struct i2c_client *p_client, | |||
1055 | TAS2562_MISCCONFIGURATIONREG0, 0xce); | 1059 | TAS2562_MISCCONFIGURATIONREG0, 0xce); |
1056 | 1060 | ||
1057 | p_tas2562->mn_irq2 = gpio_to_irq(p_tas2562->mn_irq_gpio2); | 1061 | p_tas2562->mn_irq2 = gpio_to_irq(p_tas2562->mn_irq_gpio2); |
1058 | dev_info(p_tas2562->dev, "irq = %d\n", p_tas2562->mn_irq2); | 1062 | dev_info(p_tas2562->dev, "irq2 = %d\n", p_tas2562->mn_irq2); |
1059 | INIT_DELAYED_WORK(&p_tas2562->irq_work, irq_work_routine); | 1063 | INIT_DELAYED_WORK(&p_tas2562->irq_work, irq_work_routine); |
1060 | n_result = request_threaded_irq(p_tas2562->mn_irq2, | 1064 | n_result = request_threaded_irq(p_tas2562->mn_irq2, |
1061 | tas2562_irq_handler, | 1065 | tas2562_irq_handler, |
@@ -1150,7 +1154,7 @@ static struct i2c_driver tas2562_i2c_driver = { | |||
1150 | #if defined(CONFIG_OF) | 1154 | #if defined(CONFIG_OF) |
1151 | .of_match_table = of_match_ptr(tas2562_of_match), | 1155 | .of_match_table = of_match_ptr(tas2562_of_match), |
1152 | #endif | 1156 | #endif |
1153 | .pm = &tas2562_pm_ops, | 1157 | .pm = &tas2562_pm_ops, |
1154 | }, | 1158 | }, |
1155 | .probe = tas2562_i2c_probe, | 1159 | .probe = tas2562_i2c_probe, |
1156 | .remove = tas2562_i2c_remove, | 1160 | .remove = tas2562_i2c_remove, |
@@ -109,6 +109,10 @@ | |||
109 | 109 | ||
110 | /* TDM Configuration Reg2 */ | 110 | /* TDM Configuration Reg2 */ |
111 | #define TAS2562_TDMCONFIGURATIONREG2 TAS2562_REG(0x0, 0x0, 0x08) | 111 | #define TAS2562_TDMCONFIGURATIONREG2 TAS2562_REG(0x0, 0x0, 0x08) |
112 | #define TAS2562_TDMCONFIGURATIONREG2_IVMONLEN76_MASK (0x3 << 6) | ||
113 | #define TAS2562_TDMCONFIGURATIONREG2_IVMONLEN76_8BITS (0x2 << 6) | ||
114 | #define TAS2562_TDMCONFIGURATIONREG2_IVMONLEN76_12BITS (0x1 << 6) | ||
115 | #define TAS2562_TDMCONFIGURATIONREG2_IVMONLEN76_16BITS (0x0 << 6) | ||
112 | #define TAS2562_TDMCONFIGURATIONREG2_RXSCFG54_MASK (0x3 << 4) | 116 | #define TAS2562_TDMCONFIGURATIONREG2_RXSCFG54_MASK (0x3 << 4) |
113 | #define TAS2562_TDMCONFIGURATIONREG2_RXSCFG54_MONO_I2C (0x0 << 4) | 117 | #define TAS2562_TDMCONFIGURATIONREG2_RXSCFG54_MONO_I2C (0x0 << 4) |
114 | #define TAS2562_TDMCONFIGURATIONREG2_RXSCFG54_MONO_LEFT (0x1 << 4) | 118 | #define TAS2562_TDMCONFIGURATIONREG2_RXSCFG54_MONO_LEFT (0x1 << 4) |