diff options
author | Mark Brown <broonie@kernel.org> | 2015-02-09 02:10:03 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-02-09 02:10:03 -0500 |
commit | e1e62305afa275b435c8215dc0e799e6f188fe4f (patch) | |
tree | def8ca2756b48e5e948c65e9f5aa5d932a763c14 | |
parent | 103004749235915190b81108f6bf4dbf53f220b9 (diff) | |
parent | 60d66c9a24907c8c965be4c7d15f67bd9d54b553 (diff) |
Merge remote-tracking branch 'asoc/topic/w-codec' into asoc-next
54 files changed, 366 insertions, 224 deletions
diff --git a/include/sound/rt5677.h b/include/sound/rt5677.h index d9eb7d861cd0..a6207043ac3c 100644 --- a/include/sound/rt5677.h +++ b/include/sound/rt5677.h | |||
@@ -37,6 +37,9 @@ struct rt5677_platform_data { | |||
37 | OFF, GPIO4, GPIO5 and GPIO6 respectively */ | 37 | OFF, GPIO4, GPIO5 and GPIO6 respectively */ |
38 | unsigned int jd2_gpio; | 38 | unsigned int jd2_gpio; |
39 | unsigned int jd3_gpio; | 39 | unsigned int jd3_gpio; |
40 | |||
41 | /* Set MICBIAS1 VDD 1v8 or 3v3 */ | ||
42 | bool micbias1_vdd_3v3; | ||
40 | }; | 43 | }; |
41 | 44 | ||
42 | #endif | 45 | #endif |
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index a2a0cf6e74fd..8d7416e46861 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -525,7 +525,6 @@ struct snd_soc_dapm_widget { | |||
525 | enum snd_soc_dapm_type id; | 525 | enum snd_soc_dapm_type id; |
526 | const char *name; /* widget name */ | 526 | const char *name; /* widget name */ |
527 | const char *sname; /* stream name */ | 527 | const char *sname; /* stream name */ |
528 | struct snd_soc_codec *codec; | ||
529 | struct list_head list; | 528 | struct list_head list; |
530 | struct snd_soc_dapm_context *dapm; | 529 | struct snd_soc_dapm_context *dapm; |
531 | 530 | ||
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index a2bf27f4baab..a0f265327fdf 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c | |||
@@ -386,7 +386,7 @@ static int snd_soc_put_volsw_2r_out(struct snd_kcontrol *kcontrol, | |||
386 | static int pm860x_rsync_event(struct snd_soc_dapm_widget *w, | 386 | static int pm860x_rsync_event(struct snd_soc_dapm_widget *w, |
387 | struct snd_kcontrol *kcontrol, int event) | 387 | struct snd_kcontrol *kcontrol, int event) |
388 | { | 388 | { |
389 | struct snd_soc_codec *codec = w->codec; | 389 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
390 | 390 | ||
391 | /* | 391 | /* |
392 | * In order to avoid current on the load, mute power-on and power-off | 392 | * In order to avoid current on the load, mute power-on and power-off |
@@ -403,7 +403,7 @@ static int pm860x_rsync_event(struct snd_soc_dapm_widget *w, | |||
403 | static int pm860x_dac_event(struct snd_soc_dapm_widget *w, | 403 | static int pm860x_dac_event(struct snd_soc_dapm_widget *w, |
404 | struct snd_kcontrol *kcontrol, int event) | 404 | struct snd_kcontrol *kcontrol, int event) |
405 | { | 405 | { |
406 | struct snd_soc_codec *codec = w->codec; | 406 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
407 | unsigned int dac = 0; | 407 | unsigned int dac = 0; |
408 | int data; | 408 | int data; |
409 | 409 | ||
diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c index 686cacb0e835..632e89f793a7 100644 --- a/sound/soc/codecs/ak4671.c +++ b/sound/soc/codecs/ak4671.c | |||
@@ -163,7 +163,7 @@ static const struct snd_kcontrol_new ak4671_snd_controls[] = { | |||
163 | static int ak4671_out2_event(struct snd_soc_dapm_widget *w, | 163 | static int ak4671_out2_event(struct snd_soc_dapm_widget *w, |
164 | struct snd_kcontrol *kcontrol, int event) | 164 | struct snd_kcontrol *kcontrol, int event) |
165 | { | 165 | { |
166 | struct snd_soc_codec *codec = w->codec; | 166 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
167 | 167 | ||
168 | switch (event) { | 168 | switch (event) { |
169 | case SND_SOC_DAPM_POST_PMU: | 169 | case SND_SOC_DAPM_POST_PMU: |
diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index bdf8c5ac8ca4..0e357996864b 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c | |||
@@ -55,18 +55,20 @@ static inline int alc5623_reset(struct snd_soc_codec *codec) | |||
55 | static int amp_mixer_event(struct snd_soc_dapm_widget *w, | 55 | static int amp_mixer_event(struct snd_soc_dapm_widget *w, |
56 | struct snd_kcontrol *kcontrol, int event) | 56 | struct snd_kcontrol *kcontrol, int event) |
57 | { | 57 | { |
58 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
59 | |||
58 | /* to power-on/off class-d amp generators/speaker */ | 60 | /* to power-on/off class-d amp generators/speaker */ |
59 | /* need to write to 'index-46h' register : */ | 61 | /* need to write to 'index-46h' register : */ |
60 | /* so write index num (here 0x46) to reg 0x6a */ | 62 | /* so write index num (here 0x46) to reg 0x6a */ |
61 | /* and then 0xffff/0 to reg 0x6c */ | 63 | /* and then 0xffff/0 to reg 0x6c */ |
62 | snd_soc_write(w->codec, ALC5623_HID_CTRL_INDEX, 0x46); | 64 | snd_soc_write(codec, ALC5623_HID_CTRL_INDEX, 0x46); |
63 | 65 | ||
64 | switch (event) { | 66 | switch (event) { |
65 | case SND_SOC_DAPM_PRE_PMU: | 67 | case SND_SOC_DAPM_PRE_PMU: |
66 | snd_soc_write(w->codec, ALC5623_HID_CTRL_DATA, 0xFFFF); | 68 | snd_soc_write(codec, ALC5623_HID_CTRL_DATA, 0xFFFF); |
67 | break; | 69 | break; |
68 | case SND_SOC_DAPM_POST_PMD: | 70 | case SND_SOC_DAPM_POST_PMD: |
69 | snd_soc_write(w->codec, ALC5623_HID_CTRL_DATA, 0); | 71 | snd_soc_write(codec, ALC5623_HID_CTRL_DATA, 0); |
70 | break; | 72 | break; |
71 | } | 73 | } |
72 | 74 | ||
diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index d1fdbc266631..dd012c7b2d2c 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c | |||
@@ -116,18 +116,20 @@ static inline int alc5632_reset(struct regmap *map) | |||
116 | static int amp_mixer_event(struct snd_soc_dapm_widget *w, | 116 | static int amp_mixer_event(struct snd_soc_dapm_widget *w, |
117 | struct snd_kcontrol *kcontrol, int event) | 117 | struct snd_kcontrol *kcontrol, int event) |
118 | { | 118 | { |
119 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
120 | |||
119 | /* to power-on/off class-d amp generators/speaker */ | 121 | /* to power-on/off class-d amp generators/speaker */ |
120 | /* need to write to 'index-46h' register : */ | 122 | /* need to write to 'index-46h' register : */ |
121 | /* so write index num (here 0x46) to reg 0x6a */ | 123 | /* so write index num (here 0x46) to reg 0x6a */ |
122 | /* and then 0xffff/0 to reg 0x6c */ | 124 | /* and then 0xffff/0 to reg 0x6c */ |
123 | snd_soc_write(w->codec, ALC5632_HID_CTRL_INDEX, 0x46); | 125 | snd_soc_write(codec, ALC5632_HID_CTRL_INDEX, 0x46); |
124 | 126 | ||
125 | switch (event) { | 127 | switch (event) { |
126 | case SND_SOC_DAPM_PRE_PMU: | 128 | case SND_SOC_DAPM_PRE_PMU: |
127 | snd_soc_write(w->codec, ALC5632_HID_CTRL_DATA, 0xFFFF); | 129 | snd_soc_write(codec, ALC5632_HID_CTRL_DATA, 0xFFFF); |
128 | break; | 130 | break; |
129 | case SND_SOC_DAPM_POST_PMD: | 131 | case SND_SOC_DAPM_POST_PMD: |
130 | snd_soc_write(w->codec, ALC5632_HID_CTRL_DATA, 0); | 132 | snd_soc_write(codec, ALC5632_HID_CTRL_DATA, 0); |
131 | break; | 133 | break; |
132 | } | 134 | } |
133 | 135 | ||
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 9550d7433ad0..29202610dd0d 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -84,7 +84,7 @@ static int arizona_spk_ev(struct snd_soc_dapm_widget *w, | |||
84 | struct snd_kcontrol *kcontrol, | 84 | struct snd_kcontrol *kcontrol, |
85 | int event) | 85 | int event) |
86 | { | 86 | { |
87 | struct snd_soc_codec *codec = w->codec; | 87 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
88 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | 88 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); |
89 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | 89 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); |
90 | bool manual_ena = false; | 90 | bool manual_ena = false; |
@@ -692,7 +692,8 @@ static void arizona_in_set_vu(struct snd_soc_codec *codec, int ena) | |||
692 | int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, | 692 | int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, |
693 | int event) | 693 | int event) |
694 | { | 694 | { |
695 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(w->codec); | 695 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
696 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | ||
696 | unsigned int reg; | 697 | unsigned int reg; |
697 | 698 | ||
698 | if (w->shift % 2) | 699 | if (w->shift % 2) |
@@ -705,25 +706,25 @@ int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, | |||
705 | priv->in_pending++; | 706 | priv->in_pending++; |
706 | break; | 707 | break; |
707 | case SND_SOC_DAPM_POST_PMU: | 708 | case SND_SOC_DAPM_POST_PMU: |
708 | snd_soc_update_bits(w->codec, reg, ARIZONA_IN1L_MUTE, 0); | 709 | snd_soc_update_bits(codec, reg, ARIZONA_IN1L_MUTE, 0); |
709 | 710 | ||
710 | /* If this is the last input pending then allow VU */ | 711 | /* If this is the last input pending then allow VU */ |
711 | priv->in_pending--; | 712 | priv->in_pending--; |
712 | if (priv->in_pending == 0) { | 713 | if (priv->in_pending == 0) { |
713 | msleep(1); | 714 | msleep(1); |
714 | arizona_in_set_vu(w->codec, 1); | 715 | arizona_in_set_vu(codec, 1); |
715 | } | 716 | } |
716 | break; | 717 | break; |
717 | case SND_SOC_DAPM_PRE_PMD: | 718 | case SND_SOC_DAPM_PRE_PMD: |
718 | snd_soc_update_bits(w->codec, reg, | 719 | snd_soc_update_bits(codec, reg, |
719 | ARIZONA_IN1L_MUTE | ARIZONA_IN_VU, | 720 | ARIZONA_IN1L_MUTE | ARIZONA_IN_VU, |
720 | ARIZONA_IN1L_MUTE | ARIZONA_IN_VU); | 721 | ARIZONA_IN1L_MUTE | ARIZONA_IN_VU); |
721 | break; | 722 | break; |
722 | case SND_SOC_DAPM_POST_PMD: | 723 | case SND_SOC_DAPM_POST_PMD: |
723 | /* Disable volume updates if no inputs are enabled */ | 724 | /* Disable volume updates if no inputs are enabled */ |
724 | reg = snd_soc_read(w->codec, ARIZONA_INPUT_ENABLES); | 725 | reg = snd_soc_read(codec, ARIZONA_INPUT_ENABLES); |
725 | if (reg == 0) | 726 | if (reg == 0) |
726 | arizona_in_set_vu(w->codec, 0); | 727 | arizona_in_set_vu(codec, 0); |
727 | } | 728 | } |
728 | 729 | ||
729 | return 0; | 730 | return 0; |
@@ -734,7 +735,25 @@ int arizona_out_ev(struct snd_soc_dapm_widget *w, | |||
734 | struct snd_kcontrol *kcontrol, | 735 | struct snd_kcontrol *kcontrol, |
735 | int event) | 736 | int event) |
736 | { | 737 | { |
738 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
739 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | ||
740 | |||
737 | switch (event) { | 741 | switch (event) { |
742 | case SND_SOC_DAPM_PRE_PMU: | ||
743 | switch (w->shift) { | ||
744 | case ARIZONA_OUT1L_ENA_SHIFT: | ||
745 | case ARIZONA_OUT1R_ENA_SHIFT: | ||
746 | case ARIZONA_OUT2L_ENA_SHIFT: | ||
747 | case ARIZONA_OUT2R_ENA_SHIFT: | ||
748 | case ARIZONA_OUT3L_ENA_SHIFT: | ||
749 | case ARIZONA_OUT3R_ENA_SHIFT: | ||
750 | priv->out_up_pending++; | ||
751 | priv->out_up_delay += 17; | ||
752 | break; | ||
753 | default: | ||
754 | break; | ||
755 | } | ||
756 | break; | ||
738 | case SND_SOC_DAPM_POST_PMU: | 757 | case SND_SOC_DAPM_POST_PMU: |
739 | switch (w->shift) { | 758 | switch (w->shift) { |
740 | case ARIZONA_OUT1L_ENA_SHIFT: | 759 | case ARIZONA_OUT1L_ENA_SHIFT: |
@@ -743,13 +762,50 @@ int arizona_out_ev(struct snd_soc_dapm_widget *w, | |||
743 | case ARIZONA_OUT2R_ENA_SHIFT: | 762 | case ARIZONA_OUT2R_ENA_SHIFT: |
744 | case ARIZONA_OUT3L_ENA_SHIFT: | 763 | case ARIZONA_OUT3L_ENA_SHIFT: |
745 | case ARIZONA_OUT3R_ENA_SHIFT: | 764 | case ARIZONA_OUT3R_ENA_SHIFT: |
746 | msleep(17); | 765 | priv->out_up_pending--; |
766 | if (!priv->out_up_pending) { | ||
767 | msleep(priv->out_up_delay); | ||
768 | priv->out_up_delay = 0; | ||
769 | } | ||
747 | break; | 770 | break; |
748 | 771 | ||
749 | default: | 772 | default: |
750 | break; | 773 | break; |
751 | } | 774 | } |
752 | break; | 775 | break; |
776 | case SND_SOC_DAPM_PRE_PMD: | ||
777 | switch (w->shift) { | ||
778 | case ARIZONA_OUT1L_ENA_SHIFT: | ||
779 | case ARIZONA_OUT1R_ENA_SHIFT: | ||
780 | case ARIZONA_OUT2L_ENA_SHIFT: | ||
781 | case ARIZONA_OUT2R_ENA_SHIFT: | ||
782 | case ARIZONA_OUT3L_ENA_SHIFT: | ||
783 | case ARIZONA_OUT3R_ENA_SHIFT: | ||
784 | priv->out_down_pending++; | ||
785 | priv->out_down_delay++; | ||
786 | break; | ||
787 | default: | ||
788 | break; | ||
789 | } | ||
790 | break; | ||
791 | case SND_SOC_DAPM_POST_PMD: | ||
792 | switch (w->shift) { | ||
793 | case ARIZONA_OUT1L_ENA_SHIFT: | ||
794 | case ARIZONA_OUT1R_ENA_SHIFT: | ||
795 | case ARIZONA_OUT2L_ENA_SHIFT: | ||
796 | case ARIZONA_OUT2R_ENA_SHIFT: | ||
797 | case ARIZONA_OUT3L_ENA_SHIFT: | ||
798 | case ARIZONA_OUT3R_ENA_SHIFT: | ||
799 | priv->out_down_pending--; | ||
800 | if (!priv->out_down_pending) { | ||
801 | msleep(priv->out_down_delay); | ||
802 | priv->out_down_delay = 0; | ||
803 | } | ||
804 | break; | ||
805 | default: | ||
806 | break; | ||
807 | } | ||
808 | break; | ||
753 | } | 809 | } |
754 | 810 | ||
755 | return 0; | 811 | return 0; |
@@ -760,7 +816,8 @@ int arizona_hp_ev(struct snd_soc_dapm_widget *w, | |||
760 | struct snd_kcontrol *kcontrol, | 816 | struct snd_kcontrol *kcontrol, |
761 | int event) | 817 | int event) |
762 | { | 818 | { |
763 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(w->codec); | 819 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
820 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | ||
764 | struct arizona *arizona = priv->arizona; | 821 | struct arizona *arizona = priv->arizona; |
765 | unsigned int mask = 1 << w->shift; | 822 | unsigned int mask = 1 << w->shift; |
766 | unsigned int val; | 823 | unsigned int val; |
@@ -772,6 +829,9 @@ int arizona_hp_ev(struct snd_soc_dapm_widget *w, | |||
772 | case SND_SOC_DAPM_PRE_PMD: | 829 | case SND_SOC_DAPM_PRE_PMD: |
773 | val = 0; | 830 | val = 0; |
774 | break; | 831 | break; |
832 | case SND_SOC_DAPM_PRE_PMU: | ||
833 | case SND_SOC_DAPM_POST_PMD: | ||
834 | return arizona_out_ev(w, kcontrol, event); | ||
775 | default: | 835 | default: |
776 | return -EINVAL; | 836 | return -EINVAL; |
777 | } | 837 | } |
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h index 942cfb197b6d..11ff899b0272 100644 --- a/sound/soc/codecs/arizona.h +++ b/sound/soc/codecs/arizona.h | |||
@@ -77,6 +77,11 @@ struct arizona_priv { | |||
77 | int num_inputs; | 77 | int num_inputs; |
78 | unsigned int in_pending; | 78 | unsigned int in_pending; |
79 | 79 | ||
80 | unsigned int out_up_pending; | ||
81 | unsigned int out_up_delay; | ||
82 | unsigned int out_down_pending; | ||
83 | unsigned int out_down_delay; | ||
84 | |||
80 | unsigned int spk_ena:2; | 85 | unsigned int spk_ena:2; |
81 | unsigned int spk_ena_pending:1; | 86 | unsigned int spk_ena_pending:1; |
82 | }; | 87 | }; |
diff --git a/sound/soc/codecs/da732x.c b/sound/soc/codecs/da732x.c index 61b2f9a2eef1..ffe96175a8a5 100644 --- a/sound/soc/codecs/da732x.c +++ b/sound/soc/codecs/da732x.c | |||
@@ -609,7 +609,7 @@ static const struct snd_kcontrol_new da732x_snd_controls[] = { | |||
609 | static int da732x_adc_event(struct snd_soc_dapm_widget *w, | 609 | static int da732x_adc_event(struct snd_soc_dapm_widget *w, |
610 | struct snd_kcontrol *kcontrol, int event) | 610 | struct snd_kcontrol *kcontrol, int event) |
611 | { | 611 | { |
612 | struct snd_soc_codec *codec = w->codec; | 612 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
613 | 613 | ||
614 | switch (event) { | 614 | switch (event) { |
615 | case SND_SOC_DAPM_POST_PMU: | 615 | case SND_SOC_DAPM_POST_PMU: |
@@ -663,7 +663,7 @@ static int da732x_adc_event(struct snd_soc_dapm_widget *w, | |||
663 | static int da732x_out_pga_event(struct snd_soc_dapm_widget *w, | 663 | static int da732x_out_pga_event(struct snd_soc_dapm_widget *w, |
664 | struct snd_kcontrol *kcontrol, int event) | 664 | struct snd_kcontrol *kcontrol, int event) |
665 | { | 665 | { |
666 | struct snd_soc_codec *codec = w->codec; | 666 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
667 | 667 | ||
668 | switch (event) { | 668 | switch (event) { |
669 | case SND_SOC_DAPM_POST_PMU: | 669 | case SND_SOC_DAPM_POST_PMU: |
diff --git a/sound/soc/codecs/pcm3008.c b/sound/soc/codecs/pcm3008.c index 7e73fa4b3183..8fb445f33f6f 100644 --- a/sound/soc/codecs/pcm3008.c +++ b/sound/soc/codecs/pcm3008.c | |||
@@ -32,7 +32,7 @@ static int pcm3008_dac_ev(struct snd_soc_dapm_widget *w, | |||
32 | struct snd_kcontrol *kcontrol, | 32 | struct snd_kcontrol *kcontrol, |
33 | int event) | 33 | int event) |
34 | { | 34 | { |
35 | struct snd_soc_codec *codec = w->codec; | 35 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
36 | struct pcm3008_setup_data *setup = codec->dev->platform_data; | 36 | struct pcm3008_setup_data *setup = codec->dev->platform_data; |
37 | 37 | ||
38 | gpio_set_value_cansleep(setup->pdda_pin, | 38 | gpio_set_value_cansleep(setup->pdda_pin, |
@@ -45,7 +45,7 @@ static int pcm3008_adc_ev(struct snd_soc_dapm_widget *w, | |||
45 | struct snd_kcontrol *kcontrol, | 45 | struct snd_kcontrol *kcontrol, |
46 | int event) | 46 | int event) |
47 | { | 47 | { |
48 | struct snd_soc_codec *codec = w->codec; | 48 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
49 | struct pcm3008_setup_data *setup = codec->dev->platform_data; | 49 | struct pcm3008_setup_data *setup = codec->dev->platform_data; |
50 | 50 | ||
51 | gpio_set_value_cansleep(setup->pdad_pin, | 51 | gpio_set_value_cansleep(setup->pdad_pin, |
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index f14d335b07b1..d0698891b69e 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c | |||
@@ -405,7 +405,8 @@ EXPORT_SYMBOL_GPL(rt286_mic_detect); | |||
405 | static int is_mclk_mode(struct snd_soc_dapm_widget *source, | 405 | static int is_mclk_mode(struct snd_soc_dapm_widget *source, |
406 | struct snd_soc_dapm_widget *sink) | 406 | struct snd_soc_dapm_widget *sink) |
407 | { | 407 | { |
408 | struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(source->codec); | 408 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); |
409 | struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec); | ||
409 | 410 | ||
410 | if (rt286->clk_id == RT286_SCLK_S_MCLK) | 411 | if (rt286->clk_id == RT286_SCLK_S_MCLK) |
411 | return 1; | 412 | return 1; |
@@ -504,7 +505,7 @@ SOC_DAPM_ENUM("SPO source", rt286_spo_enum); | |||
504 | static int rt286_spk_event(struct snd_soc_dapm_widget *w, | 505 | static int rt286_spk_event(struct snd_soc_dapm_widget *w, |
505 | struct snd_kcontrol *kcontrol, int event) | 506 | struct snd_kcontrol *kcontrol, int event) |
506 | { | 507 | { |
507 | struct snd_soc_codec *codec = w->codec; | 508 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
508 | 509 | ||
509 | switch (event) { | 510 | switch (event) { |
510 | case SND_SOC_DAPM_POST_PMU: | 511 | case SND_SOC_DAPM_POST_PMU: |
@@ -526,7 +527,7 @@ static int rt286_spk_event(struct snd_soc_dapm_widget *w, | |||
526 | static int rt286_set_dmic1_event(struct snd_soc_dapm_widget *w, | 527 | static int rt286_set_dmic1_event(struct snd_soc_dapm_widget *w, |
527 | struct snd_kcontrol *kcontrol, int event) | 528 | struct snd_kcontrol *kcontrol, int event) |
528 | { | 529 | { |
529 | struct snd_soc_codec *codec = w->codec; | 530 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
530 | 531 | ||
531 | switch (event) { | 532 | switch (event) { |
532 | case SND_SOC_DAPM_POST_PMU: | 533 | case SND_SOC_DAPM_POST_PMU: |
@@ -545,7 +546,7 @@ static int rt286_set_dmic1_event(struct snd_soc_dapm_widget *w, | |||
545 | static int rt286_vref_event(struct snd_soc_dapm_widget *w, | 546 | static int rt286_vref_event(struct snd_soc_dapm_widget *w, |
546 | struct snd_kcontrol *kcontrol, int event) | 547 | struct snd_kcontrol *kcontrol, int event) |
547 | { | 548 | { |
548 | struct snd_soc_codec *codec = w->codec; | 549 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
549 | 550 | ||
550 | switch (event) { | 551 | switch (event) { |
551 | case SND_SOC_DAPM_PRE_PMU: | 552 | case SND_SOC_DAPM_PRE_PMU: |
@@ -563,7 +564,7 @@ static int rt286_vref_event(struct snd_soc_dapm_widget *w, | |||
563 | static int rt286_ldo2_event(struct snd_soc_dapm_widget *w, | 564 | static int rt286_ldo2_event(struct snd_soc_dapm_widget *w, |
564 | struct snd_kcontrol *kcontrol, int event) | 565 | struct snd_kcontrol *kcontrol, int event) |
565 | { | 566 | { |
566 | struct snd_soc_codec *codec = w->codec; | 567 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
567 | 568 | ||
568 | switch (event) { | 569 | switch (event) { |
569 | case SND_SOC_DAPM_POST_PMU: | 570 | case SND_SOC_DAPM_POST_PMU: |
@@ -582,7 +583,7 @@ static int rt286_ldo2_event(struct snd_soc_dapm_widget *w, | |||
582 | static int rt286_mic1_event(struct snd_soc_dapm_widget *w, | 583 | static int rt286_mic1_event(struct snd_soc_dapm_widget *w, |
583 | struct snd_kcontrol *kcontrol, int event) | 584 | struct snd_kcontrol *kcontrol, int event) |
584 | { | 585 | { |
585 | struct snd_soc_codec *codec = w->codec; | 586 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
586 | 587 | ||
587 | switch (event) { | 588 | switch (event) { |
588 | case SND_SOC_DAPM_PRE_PMU: | 589 | case SND_SOC_DAPM_PRE_PMU: |
diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index 6d7b7ca7d530..c61852742ee3 100644 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c | |||
@@ -287,70 +287,78 @@ static const struct snd_kcontrol_new rt5631_snd_controls[] = { | |||
287 | static int check_sysclk1_source(struct snd_soc_dapm_widget *source, | 287 | static int check_sysclk1_source(struct snd_soc_dapm_widget *source, |
288 | struct snd_soc_dapm_widget *sink) | 288 | struct snd_soc_dapm_widget *sink) |
289 | { | 289 | { |
290 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
290 | unsigned int reg; | 291 | unsigned int reg; |
291 | 292 | ||
292 | reg = snd_soc_read(source->codec, RT5631_GLOBAL_CLK_CTRL); | 293 | reg = snd_soc_read(codec, RT5631_GLOBAL_CLK_CTRL); |
293 | return reg & RT5631_SYSCLK_SOUR_SEL_PLL; | 294 | return reg & RT5631_SYSCLK_SOUR_SEL_PLL; |
294 | } | 295 | } |
295 | 296 | ||
296 | static int check_dmic_used(struct snd_soc_dapm_widget *source, | 297 | static int check_dmic_used(struct snd_soc_dapm_widget *source, |
297 | struct snd_soc_dapm_widget *sink) | 298 | struct snd_soc_dapm_widget *sink) |
298 | { | 299 | { |
299 | struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(source->codec); | 300 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); |
301 | struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec); | ||
300 | return rt5631->dmic_used_flag; | 302 | return rt5631->dmic_used_flag; |
301 | } | 303 | } |
302 | 304 | ||
303 | static int check_dacl_to_outmixl(struct snd_soc_dapm_widget *source, | 305 | static int check_dacl_to_outmixl(struct snd_soc_dapm_widget *source, |
304 | struct snd_soc_dapm_widget *sink) | 306 | struct snd_soc_dapm_widget *sink) |
305 | { | 307 | { |
308 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
306 | unsigned int reg; | 309 | unsigned int reg; |
307 | 310 | ||
308 | reg = snd_soc_read(source->codec, RT5631_OUTMIXER_L_CTRL); | 311 | reg = snd_soc_read(codec, RT5631_OUTMIXER_L_CTRL); |
309 | return !(reg & RT5631_M_DAC_L_TO_OUTMIXER_L); | 312 | return !(reg & RT5631_M_DAC_L_TO_OUTMIXER_L); |
310 | } | 313 | } |
311 | 314 | ||
312 | static int check_dacr_to_outmixr(struct snd_soc_dapm_widget *source, | 315 | static int check_dacr_to_outmixr(struct snd_soc_dapm_widget *source, |
313 | struct snd_soc_dapm_widget *sink) | 316 | struct snd_soc_dapm_widget *sink) |
314 | { | 317 | { |
318 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
315 | unsigned int reg; | 319 | unsigned int reg; |
316 | 320 | ||
317 | reg = snd_soc_read(source->codec, RT5631_OUTMIXER_R_CTRL); | 321 | reg = snd_soc_read(codec, RT5631_OUTMIXER_R_CTRL); |
318 | return !(reg & RT5631_M_DAC_R_TO_OUTMIXER_R); | 322 | return !(reg & RT5631_M_DAC_R_TO_OUTMIXER_R); |
319 | } | 323 | } |
320 | 324 | ||
321 | static int check_dacl_to_spkmixl(struct snd_soc_dapm_widget *source, | 325 | static int check_dacl_to_spkmixl(struct snd_soc_dapm_widget *source, |
322 | struct snd_soc_dapm_widget *sink) | 326 | struct snd_soc_dapm_widget *sink) |
323 | { | 327 | { |
328 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
324 | unsigned int reg; | 329 | unsigned int reg; |
325 | 330 | ||
326 | reg = snd_soc_read(source->codec, RT5631_SPK_MIXER_CTRL); | 331 | reg = snd_soc_read(codec, RT5631_SPK_MIXER_CTRL); |
327 | return !(reg & RT5631_M_DAC_L_TO_SPKMIXER_L); | 332 | return !(reg & RT5631_M_DAC_L_TO_SPKMIXER_L); |
328 | } | 333 | } |
329 | 334 | ||
330 | static int check_dacr_to_spkmixr(struct snd_soc_dapm_widget *source, | 335 | static int check_dacr_to_spkmixr(struct snd_soc_dapm_widget *source, |
331 | struct snd_soc_dapm_widget *sink) | 336 | struct snd_soc_dapm_widget *sink) |
332 | { | 337 | { |
338 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
333 | unsigned int reg; | 339 | unsigned int reg; |
334 | 340 | ||
335 | reg = snd_soc_read(source->codec, RT5631_SPK_MIXER_CTRL); | 341 | reg = snd_soc_read(codec, RT5631_SPK_MIXER_CTRL); |
336 | return !(reg & RT5631_M_DAC_R_TO_SPKMIXER_R); | 342 | return !(reg & RT5631_M_DAC_R_TO_SPKMIXER_R); |
337 | } | 343 | } |
338 | 344 | ||
339 | static int check_adcl_select(struct snd_soc_dapm_widget *source, | 345 | static int check_adcl_select(struct snd_soc_dapm_widget *source, |
340 | struct snd_soc_dapm_widget *sink) | 346 | struct snd_soc_dapm_widget *sink) |
341 | { | 347 | { |
348 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
342 | unsigned int reg; | 349 | unsigned int reg; |
343 | 350 | ||
344 | reg = snd_soc_read(source->codec, RT5631_ADC_REC_MIXER); | 351 | reg = snd_soc_read(codec, RT5631_ADC_REC_MIXER); |
345 | return !(reg & RT5631_M_MIC1_TO_RECMIXER_L); | 352 | return !(reg & RT5631_M_MIC1_TO_RECMIXER_L); |
346 | } | 353 | } |
347 | 354 | ||
348 | static int check_adcr_select(struct snd_soc_dapm_widget *source, | 355 | static int check_adcr_select(struct snd_soc_dapm_widget *source, |
349 | struct snd_soc_dapm_widget *sink) | 356 | struct snd_soc_dapm_widget *sink) |
350 | { | 357 | { |
358 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
351 | unsigned int reg; | 359 | unsigned int reg; |
352 | 360 | ||
353 | reg = snd_soc_read(source->codec, RT5631_ADC_REC_MIXER); | 361 | reg = snd_soc_read(codec, RT5631_ADC_REC_MIXER); |
354 | return !(reg & RT5631_M_MIC2_TO_RECMIXER_R); | 362 | return !(reg & RT5631_M_MIC2_TO_RECMIXER_R); |
355 | } | 363 | } |
356 | 364 | ||
@@ -556,7 +564,7 @@ static void depop_seq_mute_stage(struct snd_soc_codec *codec, int enable) | |||
556 | static int hp_event(struct snd_soc_dapm_widget *w, | 564 | static int hp_event(struct snd_soc_dapm_widget *w, |
557 | struct snd_kcontrol *kcontrol, int event) | 565 | struct snd_kcontrol *kcontrol, int event) |
558 | { | 566 | { |
559 | struct snd_soc_codec *codec = w->codec; | 567 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
560 | struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec); | 568 | struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec); |
561 | 569 | ||
562 | switch (event) { | 570 | switch (event) { |
@@ -590,7 +598,7 @@ static int hp_event(struct snd_soc_dapm_widget *w, | |||
590 | static int set_dmic_params(struct snd_soc_dapm_widget *w, | 598 | static int set_dmic_params(struct snd_soc_dapm_widget *w, |
591 | struct snd_kcontrol *kcontrol, int event) | 599 | struct snd_kcontrol *kcontrol, int event) |
592 | { | 600 | { |
593 | struct snd_soc_codec *codec = w->codec; | 601 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
594 | struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec); | 602 | struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec); |
595 | 603 | ||
596 | switch (rt5631->rx_rate) { | 604 | switch (rt5631->rx_rate) { |
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index 1ff726c29249..178e55d4d481 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c | |||
@@ -458,7 +458,7 @@ static const struct snd_kcontrol_new rt5640_specific_snd_controls[] = { | |||
458 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, | 458 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, |
459 | struct snd_kcontrol *kcontrol, int event) | 459 | struct snd_kcontrol *kcontrol, int event) |
460 | { | 460 | { |
461 | struct snd_soc_codec *codec = w->codec; | 461 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
462 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); | 462 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); |
463 | int idx = -EINVAL; | 463 | int idx = -EINVAL; |
464 | 464 | ||
@@ -475,9 +475,10 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w, | |||
475 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, | 475 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, |
476 | struct snd_soc_dapm_widget *sink) | 476 | struct snd_soc_dapm_widget *sink) |
477 | { | 477 | { |
478 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
478 | unsigned int val; | 479 | unsigned int val; |
479 | 480 | ||
480 | val = snd_soc_read(source->codec, RT5640_GLB_CLK); | 481 | val = snd_soc_read(codec, RT5640_GLB_CLK); |
481 | val &= RT5640_SCLK_SRC_MASK; | 482 | val &= RT5640_SCLK_SRC_MASK; |
482 | if (val == RT5640_SCLK_SRC_PLL1) | 483 | if (val == RT5640_SCLK_SRC_PLL1) |
483 | return 1; | 484 | return 1; |
@@ -963,7 +964,7 @@ static void rt5640_pmu_depop(struct snd_soc_codec *codec) | |||
963 | static int rt5640_hp_event(struct snd_soc_dapm_widget *w, | 964 | static int rt5640_hp_event(struct snd_soc_dapm_widget *w, |
964 | struct snd_kcontrol *kcontrol, int event) | 965 | struct snd_kcontrol *kcontrol, int event) |
965 | { | 966 | { |
966 | struct snd_soc_codec *codec = w->codec; | 967 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
967 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); | 968 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); |
968 | 969 | ||
969 | switch (event) { | 970 | switch (event) { |
@@ -987,7 +988,7 @@ static int rt5640_hp_event(struct snd_soc_dapm_widget *w, | |||
987 | static int rt5640_hp_power_event(struct snd_soc_dapm_widget *w, | 988 | static int rt5640_hp_power_event(struct snd_soc_dapm_widget *w, |
988 | struct snd_kcontrol *kcontrol, int event) | 989 | struct snd_kcontrol *kcontrol, int event) |
989 | { | 990 | { |
990 | struct snd_soc_codec *codec = w->codec; | 991 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
991 | 992 | ||
992 | switch (event) { | 993 | switch (event) { |
993 | case SND_SOC_DAPM_POST_PMU: | 994 | case SND_SOC_DAPM_POST_PMU: |
@@ -1003,7 +1004,7 @@ static int rt5640_hp_power_event(struct snd_soc_dapm_widget *w, | |||
1003 | static int rt5640_hp_post_event(struct snd_soc_dapm_widget *w, | 1004 | static int rt5640_hp_post_event(struct snd_soc_dapm_widget *w, |
1004 | struct snd_kcontrol *kcontrol, int event) | 1005 | struct snd_kcontrol *kcontrol, int event) |
1005 | { | 1006 | { |
1006 | struct snd_soc_codec *codec = w->codec; | 1007 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1007 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); | 1008 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); |
1008 | 1009 | ||
1009 | switch (event) { | 1010 | switch (event) { |
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 27141e2df878..068dfd5c7640 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -527,7 +527,7 @@ static const struct snd_kcontrol_new rt5645_snd_controls[] = { | |||
527 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, | 527 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, |
528 | struct snd_kcontrol *kcontrol, int event) | 528 | struct snd_kcontrol *kcontrol, int event) |
529 | { | 529 | { |
530 | struct snd_soc_codec *codec = w->codec; | 530 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
531 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 531 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); |
532 | int idx = -EINVAL; | 532 | int idx = -EINVAL; |
533 | 533 | ||
@@ -544,9 +544,10 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w, | |||
544 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, | 544 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, |
545 | struct snd_soc_dapm_widget *sink) | 545 | struct snd_soc_dapm_widget *sink) |
546 | { | 546 | { |
547 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
547 | unsigned int val; | 548 | unsigned int val; |
548 | 549 | ||
549 | val = snd_soc_read(source->codec, RT5645_GLB_CLK); | 550 | val = snd_soc_read(codec, RT5645_GLB_CLK); |
550 | val &= RT5645_SCLK_SRC_MASK; | 551 | val &= RT5645_SCLK_SRC_MASK; |
551 | if (val == RT5645_SCLK_SRC_PLL1) | 552 | if (val == RT5645_SCLK_SRC_PLL1) |
552 | return 1; | 553 | return 1; |
@@ -557,6 +558,7 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, | |||
557 | static int is_using_asrc(struct snd_soc_dapm_widget *source, | 558 | static int is_using_asrc(struct snd_soc_dapm_widget *source, |
558 | struct snd_soc_dapm_widget *sink) | 559 | struct snd_soc_dapm_widget *sink) |
559 | { | 560 | { |
561 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
560 | unsigned int reg, shift, val; | 562 | unsigned int reg, shift, val; |
561 | 563 | ||
562 | switch (source->shift) { | 564 | switch (source->shift) { |
@@ -588,7 +590,7 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source, | |||
588 | return 0; | 590 | return 0; |
589 | } | 591 | } |
590 | 592 | ||
591 | val = (snd_soc_read(source->codec, reg) >> shift) & 0xf; | 593 | val = (snd_soc_read(codec, reg) >> shift) & 0xf; |
592 | switch (val) { | 594 | switch (val) { |
593 | case 1: | 595 | case 1: |
594 | case 2: | 596 | case 2: |
@@ -1144,7 +1146,7 @@ static void hp_amp_power(struct snd_soc_codec *codec, int on) | |||
1144 | static int rt5645_hp_event(struct snd_soc_dapm_widget *w, | 1146 | static int rt5645_hp_event(struct snd_soc_dapm_widget *w, |
1145 | struct snd_kcontrol *kcontrol, int event) | 1147 | struct snd_kcontrol *kcontrol, int event) |
1146 | { | 1148 | { |
1147 | struct snd_soc_codec *codec = w->codec; | 1149 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1148 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 1150 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); |
1149 | 1151 | ||
1150 | switch (event) { | 1152 | switch (event) { |
@@ -1205,7 +1207,7 @@ static int rt5645_hp_event(struct snd_soc_dapm_widget *w, | |||
1205 | static int rt5645_spk_event(struct snd_soc_dapm_widget *w, | 1207 | static int rt5645_spk_event(struct snd_soc_dapm_widget *w, |
1206 | struct snd_kcontrol *kcontrol, int event) | 1208 | struct snd_kcontrol *kcontrol, int event) |
1207 | { | 1209 | { |
1208 | struct snd_soc_codec *codec = w->codec; | 1210 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1209 | 1211 | ||
1210 | switch (event) { | 1212 | switch (event) { |
1211 | case SND_SOC_DAPM_POST_PMU: | 1213 | case SND_SOC_DAPM_POST_PMU: |
@@ -1232,7 +1234,7 @@ static int rt5645_spk_event(struct snd_soc_dapm_widget *w, | |||
1232 | static int rt5645_lout_event(struct snd_soc_dapm_widget *w, | 1234 | static int rt5645_lout_event(struct snd_soc_dapm_widget *w, |
1233 | struct snd_kcontrol *kcontrol, int event) | 1235 | struct snd_kcontrol *kcontrol, int event) |
1234 | { | 1236 | { |
1235 | struct snd_soc_codec *codec = w->codec; | 1237 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1236 | 1238 | ||
1237 | switch (event) { | 1239 | switch (event) { |
1238 | case SND_SOC_DAPM_POST_PMU: | 1240 | case SND_SOC_DAPM_POST_PMU: |
@@ -1262,7 +1264,7 @@ static int rt5645_lout_event(struct snd_soc_dapm_widget *w, | |||
1262 | static int rt5645_bst2_event(struct snd_soc_dapm_widget *w, | 1264 | static int rt5645_bst2_event(struct snd_soc_dapm_widget *w, |
1263 | struct snd_kcontrol *kcontrol, int event) | 1265 | struct snd_kcontrol *kcontrol, int event) |
1264 | { | 1266 | { |
1265 | struct snd_soc_codec *codec = w->codec; | 1267 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1266 | 1268 | ||
1267 | switch (event) { | 1269 | switch (event) { |
1268 | case SND_SOC_DAPM_POST_PMU: | 1270 | case SND_SOC_DAPM_POST_PMU: |
diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c index bb0a3ab5416c..9f4c7be6d798 100644 --- a/sound/soc/codecs/rt5651.c +++ b/sound/soc/codecs/rt5651.c | |||
@@ -376,7 +376,7 @@ static const struct snd_kcontrol_new rt5651_snd_controls[] = { | |||
376 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, | 376 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, |
377 | struct snd_kcontrol *kcontrol, int event) | 377 | struct snd_kcontrol *kcontrol, int event) |
378 | { | 378 | { |
379 | struct snd_soc_codec *codec = w->codec; | 379 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
380 | struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec); | 380 | struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec); |
381 | int idx = -EINVAL; | 381 | int idx = -EINVAL; |
382 | 382 | ||
@@ -394,9 +394,10 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w, | |||
394 | static int is_sysclk_from_pll(struct snd_soc_dapm_widget *source, | 394 | static int is_sysclk_from_pll(struct snd_soc_dapm_widget *source, |
395 | struct snd_soc_dapm_widget *sink) | 395 | struct snd_soc_dapm_widget *sink) |
396 | { | 396 | { |
397 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
397 | unsigned int val; | 398 | unsigned int val; |
398 | 399 | ||
399 | val = snd_soc_read(source->codec, RT5651_GLB_CLK); | 400 | val = snd_soc_read(codec, RT5651_GLB_CLK); |
400 | val &= RT5651_SCLK_SRC_MASK; | 401 | val &= RT5651_SCLK_SRC_MASK; |
401 | if (val == RT5651_SCLK_SRC_PLL1) | 402 | if (val == RT5651_SCLK_SRC_PLL1) |
402 | return 1; | 403 | return 1; |
@@ -731,7 +732,7 @@ static const struct snd_kcontrol_new rt5651_pdm_r_mux = | |||
731 | static int rt5651_amp_power_event(struct snd_soc_dapm_widget *w, | 732 | static int rt5651_amp_power_event(struct snd_soc_dapm_widget *w, |
732 | struct snd_kcontrol *kcontrol, int event) | 733 | struct snd_kcontrol *kcontrol, int event) |
733 | { | 734 | { |
734 | struct snd_soc_codec *codec = w->codec; | 735 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
735 | struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec); | 736 | struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec); |
736 | 737 | ||
737 | switch (event) { | 738 | switch (event) { |
@@ -769,7 +770,7 @@ static int rt5651_amp_power_event(struct snd_soc_dapm_widget *w, | |||
769 | static int rt5651_hp_event(struct snd_soc_dapm_widget *w, | 770 | static int rt5651_hp_event(struct snd_soc_dapm_widget *w, |
770 | struct snd_kcontrol *kcontrol, int event) | 771 | struct snd_kcontrol *kcontrol, int event) |
771 | { | 772 | { |
772 | struct snd_soc_codec *codec = w->codec; | 773 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
773 | struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec); | 774 | struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec); |
774 | 775 | ||
775 | switch (event) { | 776 | switch (event) { |
@@ -813,7 +814,8 @@ static int rt5651_hp_event(struct snd_soc_dapm_widget *w, | |||
813 | static int rt5651_hp_post_event(struct snd_soc_dapm_widget *w, | 814 | static int rt5651_hp_post_event(struct snd_soc_dapm_widget *w, |
814 | struct snd_kcontrol *kcontrol, int event) | 815 | struct snd_kcontrol *kcontrol, int event) |
815 | { | 816 | { |
816 | struct snd_soc_codec *codec = w->codec; | 817 | |
818 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
817 | struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec); | 819 | struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec); |
818 | 820 | ||
819 | switch (event) { | 821 | switch (event) { |
@@ -833,7 +835,7 @@ static int rt5651_hp_post_event(struct snd_soc_dapm_widget *w, | |||
833 | static int rt5651_bst1_event(struct snd_soc_dapm_widget *w, | 835 | static int rt5651_bst1_event(struct snd_soc_dapm_widget *w, |
834 | struct snd_kcontrol *kcontrol, int event) | 836 | struct snd_kcontrol *kcontrol, int event) |
835 | { | 837 | { |
836 | struct snd_soc_codec *codec = w->codec; | 838 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
837 | 839 | ||
838 | switch (event) { | 840 | switch (event) { |
839 | case SND_SOC_DAPM_POST_PMU: | 841 | case SND_SOC_DAPM_POST_PMU: |
@@ -856,7 +858,7 @@ static int rt5651_bst1_event(struct snd_soc_dapm_widget *w, | |||
856 | static int rt5651_bst2_event(struct snd_soc_dapm_widget *w, | 858 | static int rt5651_bst2_event(struct snd_soc_dapm_widget *w, |
857 | struct snd_kcontrol *kcontrol, int event) | 859 | struct snd_kcontrol *kcontrol, int event) |
858 | { | 860 | { |
859 | struct snd_soc_codec *codec = w->codec; | 861 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
860 | 862 | ||
861 | switch (event) { | 863 | switch (event) { |
862 | case SND_SOC_DAPM_POST_PMU: | 864 | case SND_SOC_DAPM_POST_PMU: |
@@ -879,7 +881,7 @@ static int rt5651_bst2_event(struct snd_soc_dapm_widget *w, | |||
879 | static int rt5651_bst3_event(struct snd_soc_dapm_widget *w, | 881 | static int rt5651_bst3_event(struct snd_soc_dapm_widget *w, |
880 | struct snd_kcontrol *kcontrol, int event) | 882 | struct snd_kcontrol *kcontrol, int event) |
881 | { | 883 | { |
882 | struct snd_soc_codec *codec = w->codec; | 884 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
883 | 885 | ||
884 | switch (event) { | 886 | switch (event) { |
885 | case SND_SOC_DAPM_POST_PMU: | 887 | case SND_SOC_DAPM_POST_PMU: |
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index 0a027bc94399..f5b054de481e 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c | |||
@@ -500,7 +500,7 @@ static const struct snd_kcontrol_new rt5670_snd_controls[] = { | |||
500 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, | 500 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, |
501 | struct snd_kcontrol *kcontrol, int event) | 501 | struct snd_kcontrol *kcontrol, int event) |
502 | { | 502 | { |
503 | struct snd_soc_codec *codec = w->codec; | 503 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
504 | struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); | 504 | struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); |
505 | int idx = -EINVAL; | 505 | int idx = -EINVAL; |
506 | 506 | ||
@@ -517,9 +517,10 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w, | |||
517 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, | 517 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, |
518 | struct snd_soc_dapm_widget *sink) | 518 | struct snd_soc_dapm_widget *sink) |
519 | { | 519 | { |
520 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
520 | unsigned int val; | 521 | unsigned int val; |
521 | 522 | ||
522 | val = snd_soc_read(source->codec, RT5670_GLB_CLK); | 523 | val = snd_soc_read(codec, RT5670_GLB_CLK); |
523 | val &= RT5670_SCLK_SRC_MASK; | 524 | val &= RT5670_SCLK_SRC_MASK; |
524 | if (val == RT5670_SCLK_SRC_PLL1) | 525 | if (val == RT5670_SCLK_SRC_PLL1) |
525 | return 1; | 526 | return 1; |
@@ -530,6 +531,7 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, | |||
530 | static int is_using_asrc(struct snd_soc_dapm_widget *source, | 531 | static int is_using_asrc(struct snd_soc_dapm_widget *source, |
531 | struct snd_soc_dapm_widget *sink) | 532 | struct snd_soc_dapm_widget *sink) |
532 | { | 533 | { |
534 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
533 | unsigned int reg, shift, val; | 535 | unsigned int reg, shift, val; |
534 | 536 | ||
535 | switch (source->shift) { | 537 | switch (source->shift) { |
@@ -565,7 +567,7 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source, | |||
565 | return 0; | 567 | return 0; |
566 | } | 568 | } |
567 | 569 | ||
568 | val = (snd_soc_read(source->codec, reg) >> shift) & 0xf; | 570 | val = (snd_soc_read(codec, reg) >> shift) & 0xf; |
569 | switch (val) { | 571 | switch (val) { |
570 | case 1: | 572 | case 1: |
571 | case 2: | 573 | case 2: |
@@ -1148,7 +1150,7 @@ static const struct snd_kcontrol_new rt5670_vad_adc_mux = | |||
1148 | static int rt5670_hp_power_event(struct snd_soc_dapm_widget *w, | 1150 | static int rt5670_hp_power_event(struct snd_soc_dapm_widget *w, |
1149 | struct snd_kcontrol *kcontrol, int event) | 1151 | struct snd_kcontrol *kcontrol, int event) |
1150 | { | 1152 | { |
1151 | struct snd_soc_codec *codec = w->codec; | 1153 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1152 | struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); | 1154 | struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); |
1153 | 1155 | ||
1154 | switch (event) { | 1156 | switch (event) { |
@@ -1184,7 +1186,7 @@ static int rt5670_hp_power_event(struct snd_soc_dapm_widget *w, | |||
1184 | static int rt5670_hp_event(struct snd_soc_dapm_widget *w, | 1186 | static int rt5670_hp_event(struct snd_soc_dapm_widget *w, |
1185 | struct snd_kcontrol *kcontrol, int event) | 1187 | struct snd_kcontrol *kcontrol, int event) |
1186 | { | 1188 | { |
1187 | struct snd_soc_codec *codec = w->codec; | 1189 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1188 | struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); | 1190 | struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); |
1189 | 1191 | ||
1190 | switch (event) { | 1192 | switch (event) { |
@@ -1234,7 +1236,7 @@ static int rt5670_hp_event(struct snd_soc_dapm_widget *w, | |||
1234 | static int rt5670_bst1_event(struct snd_soc_dapm_widget *w, | 1236 | static int rt5670_bst1_event(struct snd_soc_dapm_widget *w, |
1235 | struct snd_kcontrol *kcontrol, int event) | 1237 | struct snd_kcontrol *kcontrol, int event) |
1236 | { | 1238 | { |
1237 | struct snd_soc_codec *codec = w->codec; | 1239 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1238 | 1240 | ||
1239 | switch (event) { | 1241 | switch (event) { |
1240 | case SND_SOC_DAPM_POST_PMU: | 1242 | case SND_SOC_DAPM_POST_PMU: |
@@ -1257,7 +1259,7 @@ static int rt5670_bst1_event(struct snd_soc_dapm_widget *w, | |||
1257 | static int rt5670_bst2_event(struct snd_soc_dapm_widget *w, | 1259 | static int rt5670_bst2_event(struct snd_soc_dapm_widget *w, |
1258 | struct snd_kcontrol *kcontrol, int event) | 1260 | struct snd_kcontrol *kcontrol, int event) |
1259 | { | 1261 | { |
1260 | struct snd_soc_codec *codec = w->codec; | 1262 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1261 | 1263 | ||
1262 | switch (event) { | 1264 | switch (event) { |
1263 | case SND_SOC_DAPM_POST_PMU: | 1265 | case SND_SOC_DAPM_POST_PMU: |
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index d27630accf03..26fc538f03b1 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c | |||
@@ -896,7 +896,7 @@ static const struct snd_kcontrol_new rt5677_snd_controls[] = { | |||
896 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, | 896 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, |
897 | struct snd_kcontrol *kcontrol, int event) | 897 | struct snd_kcontrol *kcontrol, int event) |
898 | { | 898 | { |
899 | struct snd_soc_codec *codec = w->codec; | 899 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
900 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 900 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
901 | int idx = rl6231_calc_dmic_clk(rt5677->sysclk); | 901 | int idx = rl6231_calc_dmic_clk(rt5677->sysclk); |
902 | 902 | ||
@@ -911,7 +911,8 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w, | |||
911 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, | 911 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, |
912 | struct snd_soc_dapm_widget *sink) | 912 | struct snd_soc_dapm_widget *sink) |
913 | { | 913 | { |
914 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(source->codec); | 914 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); |
915 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | ||
915 | unsigned int val; | 916 | unsigned int val; |
916 | 917 | ||
917 | regmap_read(rt5677->regmap, RT5677_GLB_CLK1, &val); | 918 | regmap_read(rt5677->regmap, RT5677_GLB_CLK1, &val); |
@@ -925,6 +926,8 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, | |||
925 | static int is_using_asrc(struct snd_soc_dapm_widget *source, | 926 | static int is_using_asrc(struct snd_soc_dapm_widget *source, |
926 | struct snd_soc_dapm_widget *sink) | 927 | struct snd_soc_dapm_widget *sink) |
927 | { | 928 | { |
929 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
930 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | ||
928 | unsigned int reg, shift, val; | 931 | unsigned int reg, shift, val; |
929 | 932 | ||
930 | if (source->reg == RT5677_ASRC_1) { | 933 | if (source->reg == RT5677_ASRC_1) { |
@@ -991,7 +994,9 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source, | |||
991 | } | 994 | } |
992 | } | 995 | } |
993 | 996 | ||
994 | val = (snd_soc_read(source->codec, reg) >> shift) & 0xf; | 997 | regmap_read(rt5677->regmap, reg, &val); |
998 | val = (val >> shift) & 0xf; | ||
999 | |||
995 | switch (val) { | 1000 | switch (val) { |
996 | case 1 ... 6: | 1001 | case 1 ... 6: |
997 | return 1; | 1002 | return 1; |
@@ -2122,7 +2127,7 @@ static const struct snd_kcontrol_new rt5677_if2_dac7_tdm_sel_mux = | |||
2122 | static int rt5677_bst1_event(struct snd_soc_dapm_widget *w, | 2127 | static int rt5677_bst1_event(struct snd_soc_dapm_widget *w, |
2123 | struct snd_kcontrol *kcontrol, int event) | 2128 | struct snd_kcontrol *kcontrol, int event) |
2124 | { | 2129 | { |
2125 | struct snd_soc_codec *codec = w->codec; | 2130 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
2126 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2131 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
2127 | 2132 | ||
2128 | switch (event) { | 2133 | switch (event) { |
@@ -2146,7 +2151,7 @@ static int rt5677_bst1_event(struct snd_soc_dapm_widget *w, | |||
2146 | static int rt5677_bst2_event(struct snd_soc_dapm_widget *w, | 2151 | static int rt5677_bst2_event(struct snd_soc_dapm_widget *w, |
2147 | struct snd_kcontrol *kcontrol, int event) | 2152 | struct snd_kcontrol *kcontrol, int event) |
2148 | { | 2153 | { |
2149 | struct snd_soc_codec *codec = w->codec; | 2154 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
2150 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2155 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
2151 | 2156 | ||
2152 | switch (event) { | 2157 | switch (event) { |
@@ -2170,7 +2175,7 @@ static int rt5677_bst2_event(struct snd_soc_dapm_widget *w, | |||
2170 | static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w, | 2175 | static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w, |
2171 | struct snd_kcontrol *kcontrol, int event) | 2176 | struct snd_kcontrol *kcontrol, int event) |
2172 | { | 2177 | { |
2173 | struct snd_soc_codec *codec = w->codec; | 2178 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
2174 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2179 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
2175 | 2180 | ||
2176 | switch (event) { | 2181 | switch (event) { |
@@ -2192,7 +2197,7 @@ static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w, | |||
2192 | static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w, | 2197 | static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w, |
2193 | struct snd_kcontrol *kcontrol, int event) | 2198 | struct snd_kcontrol *kcontrol, int event) |
2194 | { | 2199 | { |
2195 | struct snd_soc_codec *codec = w->codec; | 2200 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
2196 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2201 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
2197 | 2202 | ||
2198 | switch (event) { | 2203 | switch (event) { |
@@ -2214,7 +2219,7 @@ static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w, | |||
2214 | static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w, | 2219 | static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w, |
2215 | struct snd_kcontrol *kcontrol, int event) | 2220 | struct snd_kcontrol *kcontrol, int event) |
2216 | { | 2221 | { |
2217 | struct snd_soc_codec *codec = w->codec; | 2222 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
2218 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2223 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
2219 | 2224 | ||
2220 | switch (event) { | 2225 | switch (event) { |
@@ -2241,7 +2246,7 @@ static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w, | |||
2241 | static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w, | 2246 | static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w, |
2242 | struct snd_kcontrol *kcontrol, int event) | 2247 | struct snd_kcontrol *kcontrol, int event) |
2243 | { | 2248 | { |
2244 | struct snd_soc_codec *codec = w->codec; | 2249 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
2245 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2250 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
2246 | unsigned int value; | 2251 | unsigned int value; |
2247 | 2252 | ||
@@ -2264,7 +2269,7 @@ static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w, | |||
2264 | static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w, | 2269 | static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w, |
2265 | struct snd_kcontrol *kcontrol, int event) | 2270 | struct snd_kcontrol *kcontrol, int event) |
2266 | { | 2271 | { |
2267 | struct snd_soc_codec *codec = w->codec; | 2272 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
2268 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2273 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
2269 | unsigned int value; | 2274 | unsigned int value; |
2270 | 2275 | ||
@@ -2287,7 +2292,7 @@ static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w, | |||
2287 | static int rt5677_vref_event(struct snd_soc_dapm_widget *w, | 2292 | static int rt5677_vref_event(struct snd_soc_dapm_widget *w, |
2288 | struct snd_kcontrol *kcontrol, int event) | 2293 | struct snd_kcontrol *kcontrol, int event) |
2289 | { | 2294 | { |
2290 | struct snd_soc_codec *codec = w->codec; | 2295 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
2291 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2296 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
2292 | 2297 | ||
2293 | switch (event) { | 2298 | switch (event) { |
@@ -4098,7 +4103,8 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | |||
4098 | unsigned int rx_mask, int slots, int slot_width) | 4103 | unsigned int rx_mask, int slots, int slot_width) |
4099 | { | 4104 | { |
4100 | struct snd_soc_codec *codec = dai->codec; | 4105 | struct snd_soc_codec *codec = dai->codec; |
4101 | unsigned int val = 0; | 4106 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
4107 | unsigned int val = 0, slot_width_25 = 0; | ||
4102 | 4108 | ||
4103 | if (rx_mask || tx_mask) | 4109 | if (rx_mask || tx_mask) |
4104 | val |= (1 << 12); | 4110 | val |= (1 << 12); |
@@ -4122,6 +4128,8 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | |||
4122 | case 20: | 4128 | case 20: |
4123 | val |= (1 << 8); | 4129 | val |= (1 << 8); |
4124 | break; | 4130 | break; |
4131 | case 25: | ||
4132 | slot_width_25 = 0x8080; | ||
4125 | case 24: | 4133 | case 24: |
4126 | val |= (2 << 8); | 4134 | val |= (2 << 8); |
4127 | break; | 4135 | break; |
@@ -4135,10 +4143,16 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | |||
4135 | 4143 | ||
4136 | switch (dai->id) { | 4144 | switch (dai->id) { |
4137 | case RT5677_AIF1: | 4145 | case RT5677_AIF1: |
4138 | snd_soc_update_bits(codec, RT5677_TDM1_CTRL1, 0x1f00, val); | 4146 | regmap_update_bits(rt5677->regmap, RT5677_TDM1_CTRL1, 0x1f00, |
4147 | val); | ||
4148 | regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x8000, | ||
4149 | slot_width_25); | ||
4139 | break; | 4150 | break; |
4140 | case RT5677_AIF2: | 4151 | case RT5677_AIF2: |
4141 | snd_soc_update_bits(codec, RT5677_TDM2_CTRL1, 0x1f00, val); | 4152 | regmap_update_bits(rt5677->regmap, RT5677_TDM2_CTRL1, 0x1f00, |
4153 | val); | ||
4154 | regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x80, | ||
4155 | slot_width_25); | ||
4142 | break; | 4156 | break; |
4143 | default: | 4157 | default: |
4144 | break; | 4158 | break; |
@@ -4923,6 +4937,11 @@ static int rt5677_i2c_probe(struct i2c_client *i2c, | |||
4923 | RT5677_GPIO5_DIR_OUT); | 4937 | RT5677_GPIO5_DIR_OUT); |
4924 | } | 4938 | } |
4925 | 4939 | ||
4940 | if (rt5677->pdata.micbias1_vdd_3v3) | ||
4941 | regmap_update_bits(rt5677->regmap, RT5677_MICBIAS, | ||
4942 | RT5677_MICBIAS1_CTRL_VDD_MASK, | ||
4943 | RT5677_MICBIAS1_CTRL_VDD_3_3V); | ||
4944 | |||
4926 | rt5677_init_gpio(i2c); | 4945 | rt5677_init_gpio(i2c); |
4927 | rt5677_init_irq(i2c); | 4946 | rt5677_init_irq(i2c); |
4928 | 4947 | ||
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index aa98be32bb60..e182e6569bbd 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -155,18 +155,19 @@ struct sgtl5000_priv { | |||
155 | static int mic_bias_event(struct snd_soc_dapm_widget *w, | 155 | static int mic_bias_event(struct snd_soc_dapm_widget *w, |
156 | struct snd_kcontrol *kcontrol, int event) | 156 | struct snd_kcontrol *kcontrol, int event) |
157 | { | 157 | { |
158 | struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(w->codec); | 158 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
159 | struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); | ||
159 | 160 | ||
160 | switch (event) { | 161 | switch (event) { |
161 | case SND_SOC_DAPM_POST_PMU: | 162 | case SND_SOC_DAPM_POST_PMU: |
162 | /* change mic bias resistor */ | 163 | /* change mic bias resistor */ |
163 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_MIC_CTRL, | 164 | snd_soc_update_bits(codec, SGTL5000_CHIP_MIC_CTRL, |
164 | SGTL5000_BIAS_R_MASK, | 165 | SGTL5000_BIAS_R_MASK, |
165 | sgtl5000->micbias_resistor << SGTL5000_BIAS_R_SHIFT); | 166 | sgtl5000->micbias_resistor << SGTL5000_BIAS_R_SHIFT); |
166 | break; | 167 | break; |
167 | 168 | ||
168 | case SND_SOC_DAPM_PRE_PMD: | 169 | case SND_SOC_DAPM_PRE_PMD: |
169 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_MIC_CTRL, | 170 | snd_soc_update_bits(codec, SGTL5000_CHIP_MIC_CTRL, |
170 | SGTL5000_BIAS_R_MASK, 0); | 171 | SGTL5000_BIAS_R_MASK, 0); |
171 | break; | 172 | break; |
172 | } | 173 | } |
@@ -181,11 +182,12 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w, | |||
181 | static int power_vag_event(struct snd_soc_dapm_widget *w, | 182 | static int power_vag_event(struct snd_soc_dapm_widget *w, |
182 | struct snd_kcontrol *kcontrol, int event) | 183 | struct snd_kcontrol *kcontrol, int event) |
183 | { | 184 | { |
185 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
184 | const u32 mask = SGTL5000_DAC_POWERUP | SGTL5000_ADC_POWERUP; | 186 | const u32 mask = SGTL5000_DAC_POWERUP | SGTL5000_ADC_POWERUP; |
185 | 187 | ||
186 | switch (event) { | 188 | switch (event) { |
187 | case SND_SOC_DAPM_POST_PMU: | 189 | case SND_SOC_DAPM_POST_PMU: |
188 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, | 190 | snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, |
189 | SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); | 191 | SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); |
190 | break; | 192 | break; |
191 | 193 | ||
@@ -195,9 +197,9 @@ static int power_vag_event(struct snd_soc_dapm_widget *w, | |||
195 | * operational to prevent inadvertently starving the | 197 | * operational to prevent inadvertently starving the |
196 | * other one of them. | 198 | * other one of them. |
197 | */ | 199 | */ |
198 | if ((snd_soc_read(w->codec, SGTL5000_CHIP_ANA_POWER) & | 200 | if ((snd_soc_read(codec, SGTL5000_CHIP_ANA_POWER) & |
199 | mask) != mask) { | 201 | mask) != mask) { |
200 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, | 202 | snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, |
201 | SGTL5000_VAG_POWERUP, 0); | 203 | SGTL5000_VAG_POWERUP, 0); |
202 | msleep(400); | 204 | msleep(400); |
203 | } | 205 | } |
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index 1f451a1946eb..47b257e41809 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c | |||
@@ -233,16 +233,18 @@ static int sn95031_set_vaud_bias(struct snd_soc_codec *codec, | |||
233 | static int sn95031_vhs_event(struct snd_soc_dapm_widget *w, | 233 | static int sn95031_vhs_event(struct snd_soc_dapm_widget *w, |
234 | struct snd_kcontrol *kcontrol, int event) | 234 | struct snd_kcontrol *kcontrol, int event) |
235 | { | 235 | { |
236 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
237 | |||
236 | if (SND_SOC_DAPM_EVENT_ON(event)) { | 238 | if (SND_SOC_DAPM_EVENT_ON(event)) { |
237 | pr_debug("VHS SND_SOC_DAPM_EVENT_ON doing rail startup now\n"); | 239 | pr_debug("VHS SND_SOC_DAPM_EVENT_ON doing rail startup now\n"); |
238 | /* power up the rail */ | 240 | /* power up the rail */ |
239 | snd_soc_write(w->codec, SN95031_VHSP, 0x3D); | 241 | snd_soc_write(codec, SN95031_VHSP, 0x3D); |
240 | snd_soc_write(w->codec, SN95031_VHSN, 0x3F); | 242 | snd_soc_write(codec, SN95031_VHSN, 0x3F); |
241 | msleep(1); | 243 | msleep(1); |
242 | } else if (SND_SOC_DAPM_EVENT_OFF(event)) { | 244 | } else if (SND_SOC_DAPM_EVENT_OFF(event)) { |
243 | pr_debug("VHS SND_SOC_DAPM_EVENT_OFF doing rail shutdown\n"); | 245 | pr_debug("VHS SND_SOC_DAPM_EVENT_OFF doing rail shutdown\n"); |
244 | snd_soc_write(w->codec, SN95031_VHSP, 0xC4); | 246 | snd_soc_write(codec, SN95031_VHSP, 0xC4); |
245 | snd_soc_write(w->codec, SN95031_VHSN, 0x04); | 247 | snd_soc_write(codec, SN95031_VHSN, 0x04); |
246 | } | 248 | } |
247 | return 0; | 249 | return 0; |
248 | } | 250 | } |
@@ -250,14 +252,16 @@ static int sn95031_vhs_event(struct snd_soc_dapm_widget *w, | |||
250 | static int sn95031_vihf_event(struct snd_soc_dapm_widget *w, | 252 | static int sn95031_vihf_event(struct snd_soc_dapm_widget *w, |
251 | struct snd_kcontrol *kcontrol, int event) | 253 | struct snd_kcontrol *kcontrol, int event) |
252 | { | 254 | { |
255 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
256 | |||
253 | if (SND_SOC_DAPM_EVENT_ON(event)) { | 257 | if (SND_SOC_DAPM_EVENT_ON(event)) { |
254 | pr_debug("VIHF SND_SOC_DAPM_EVENT_ON doing rail startup now\n"); | 258 | pr_debug("VIHF SND_SOC_DAPM_EVENT_ON doing rail startup now\n"); |
255 | /* power up the rail */ | 259 | /* power up the rail */ |
256 | snd_soc_write(w->codec, SN95031_VIHF, 0x27); | 260 | snd_soc_write(codec, SN95031_VIHF, 0x27); |
257 | msleep(1); | 261 | msleep(1); |
258 | } else if (SND_SOC_DAPM_EVENT_OFF(event)) { | 262 | } else if (SND_SOC_DAPM_EVENT_OFF(event)) { |
259 | pr_debug("VIHF SND_SOC_DAPM_EVENT_OFF doing rail shutdown\n"); | 263 | pr_debug("VIHF SND_SOC_DAPM_EVENT_OFF doing rail shutdown\n"); |
260 | snd_soc_write(w->codec, SN95031_VIHF, 0x24); | 264 | snd_soc_write(codec, SN95031_VIHF, 0x24); |
261 | } | 265 | } |
262 | return 0; | 266 | return 0; |
263 | } | 267 | } |
@@ -265,6 +269,7 @@ static int sn95031_vihf_event(struct snd_soc_dapm_widget *w, | |||
265 | static int sn95031_dmic12_event(struct snd_soc_dapm_widget *w, | 269 | static int sn95031_dmic12_event(struct snd_soc_dapm_widget *w, |
266 | struct snd_kcontrol *k, int event) | 270 | struct snd_kcontrol *k, int event) |
267 | { | 271 | { |
272 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
268 | unsigned int ldo = 0, clk_dir = 0, data_dir = 0; | 273 | unsigned int ldo = 0, clk_dir = 0, data_dir = 0; |
269 | 274 | ||
270 | if (SND_SOC_DAPM_EVENT_ON(event)) { | 275 | if (SND_SOC_DAPM_EVENT_ON(event)) { |
@@ -273,15 +278,16 @@ static int sn95031_dmic12_event(struct snd_soc_dapm_widget *w, | |||
273 | data_dir = BIT(7); | 278 | data_dir = BIT(7); |
274 | } | 279 | } |
275 | /* program DMIC LDO, clock and set clock */ | 280 | /* program DMIC LDO, clock and set clock */ |
276 | snd_soc_update_bits(w->codec, SN95031_MICBIAS, BIT(5)|BIT(4), ldo); | 281 | snd_soc_update_bits(codec, SN95031_MICBIAS, BIT(5)|BIT(4), ldo); |
277 | snd_soc_update_bits(w->codec, SN95031_DMICBUF0123, BIT(0), clk_dir); | 282 | snd_soc_update_bits(codec, SN95031_DMICBUF0123, BIT(0), clk_dir); |
278 | snd_soc_update_bits(w->codec, SN95031_DMICBUF0123, BIT(7), data_dir); | 283 | snd_soc_update_bits(codec, SN95031_DMICBUF0123, BIT(7), data_dir); |
279 | return 0; | 284 | return 0; |
280 | } | 285 | } |
281 | 286 | ||
282 | static int sn95031_dmic34_event(struct snd_soc_dapm_widget *w, | 287 | static int sn95031_dmic34_event(struct snd_soc_dapm_widget *w, |
283 | struct snd_kcontrol *k, int event) | 288 | struct snd_kcontrol *k, int event) |
284 | { | 289 | { |
290 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
285 | unsigned int ldo = 0, clk_dir = 0, data_dir = 0; | 291 | unsigned int ldo = 0, clk_dir = 0, data_dir = 0; |
286 | 292 | ||
287 | if (SND_SOC_DAPM_EVENT_ON(event)) { | 293 | if (SND_SOC_DAPM_EVENT_ON(event)) { |
@@ -290,22 +296,23 @@ static int sn95031_dmic34_event(struct snd_soc_dapm_widget *w, | |||
290 | data_dir = BIT(1); | 296 | data_dir = BIT(1); |
291 | } | 297 | } |
292 | /* program DMIC LDO, clock and set clock */ | 298 | /* program DMIC LDO, clock and set clock */ |
293 | snd_soc_update_bits(w->codec, SN95031_MICBIAS, BIT(5)|BIT(4), ldo); | 299 | snd_soc_update_bits(codec, SN95031_MICBIAS, BIT(5)|BIT(4), ldo); |
294 | snd_soc_update_bits(w->codec, SN95031_DMICBUF0123, BIT(2), clk_dir); | 300 | snd_soc_update_bits(codec, SN95031_DMICBUF0123, BIT(2), clk_dir); |
295 | snd_soc_update_bits(w->codec, SN95031_DMICBUF45, BIT(1), data_dir); | 301 | snd_soc_update_bits(codec, SN95031_DMICBUF45, BIT(1), data_dir); |
296 | return 0; | 302 | return 0; |
297 | } | 303 | } |
298 | 304 | ||
299 | static int sn95031_dmic56_event(struct snd_soc_dapm_widget *w, | 305 | static int sn95031_dmic56_event(struct snd_soc_dapm_widget *w, |
300 | struct snd_kcontrol *k, int event) | 306 | struct snd_kcontrol *k, int event) |
301 | { | 307 | { |
308 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
302 | unsigned int ldo = 0; | 309 | unsigned int ldo = 0; |
303 | 310 | ||
304 | if (SND_SOC_DAPM_EVENT_ON(event)) | 311 | if (SND_SOC_DAPM_EVENT_ON(event)) |
305 | ldo = BIT(7)|BIT(6); | 312 | ldo = BIT(7)|BIT(6); |
306 | 313 | ||
307 | /* program DMIC LDO */ | 314 | /* program DMIC LDO */ |
308 | snd_soc_update_bits(w->codec, SN95031_MICBIAS, BIT(7)|BIT(6), ldo); | 315 | snd_soc_update_bits(codec, SN95031_MICBIAS, BIT(7)|BIT(6), ldo); |
309 | return 0; | 316 | return 0; |
310 | } | 317 | } |
311 | 318 | ||
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index dc3223d6eca1..c86dd9aae157 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c | |||
@@ -349,7 +349,8 @@ static int aic31xx_wait_bits(struct aic31xx_priv *aic31xx, unsigned int reg, | |||
349 | static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w, | 349 | static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w, |
350 | struct snd_kcontrol *kcontrol, int event) | 350 | struct snd_kcontrol *kcontrol, int event) |
351 | { | 351 | { |
352 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(w->codec); | 352 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
353 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); | ||
353 | unsigned int reg = AIC31XX_DACFLAG1; | 354 | unsigned int reg = AIC31XX_DACFLAG1; |
354 | unsigned int mask; | 355 | unsigned int mask; |
355 | 356 | ||
@@ -377,7 +378,7 @@ static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w, | |||
377 | reg = AIC31XX_ADCFLAG; | 378 | reg = AIC31XX_ADCFLAG; |
378 | break; | 379 | break; |
379 | default: | 380 | default: |
380 | dev_err(w->codec->dev, "Unknown widget '%s' calling %s\n", | 381 | dev_err(codec->dev, "Unknown widget '%s' calling %s\n", |
381 | w->name, __func__); | 382 | w->name, __func__); |
382 | return -EINVAL; | 383 | return -EINVAL; |
383 | } | 384 | } |
@@ -388,7 +389,7 @@ static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w, | |||
388 | case SND_SOC_DAPM_POST_PMD: | 389 | case SND_SOC_DAPM_POST_PMD: |
389 | return aic31xx_wait_bits(aic31xx, reg, mask, 0, 5000, 100); | 390 | return aic31xx_wait_bits(aic31xx, reg, mask, 0, 5000, 100); |
390 | default: | 391 | default: |
391 | dev_dbg(w->codec->dev, | 392 | dev_dbg(codec->dev, |
392 | "Unhandled dapm widget event %d from %s\n", | 393 | "Unhandled dapm widget event %d from %s\n", |
393 | event, w->name); | 394 | event, w->name); |
394 | } | 395 | } |
@@ -433,7 +434,7 @@ static const struct snd_kcontrol_new aic31xx_dapm_spr_switch = | |||
433 | static int mic_bias_event(struct snd_soc_dapm_widget *w, | 434 | static int mic_bias_event(struct snd_soc_dapm_widget *w, |
434 | struct snd_kcontrol *kcontrol, int event) | 435 | struct snd_kcontrol *kcontrol, int event) |
435 | { | 436 | { |
436 | struct snd_soc_codec *codec = w->codec; | 437 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
437 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); | 438 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); |
438 | 439 | ||
439 | switch (event) { | 440 | switch (event) { |
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index dd222b10ce13..07603d142923 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -197,7 +197,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, | |||
197 | static int mic_bias_event(struct snd_soc_dapm_widget *w, | 197 | static int mic_bias_event(struct snd_soc_dapm_widget *w, |
198 | struct snd_kcontrol *kcontrol, int event) | 198 | struct snd_kcontrol *kcontrol, int event) |
199 | { | 199 | { |
200 | struct snd_soc_codec *codec = w->codec; | 200 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
201 | struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); | 201 | struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); |
202 | 202 | ||
203 | switch (event) { | 203 | switch (event) { |
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index 0fe2ced5b09f..4e3e607dec13 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
@@ -423,17 +423,18 @@ exit: | |||
423 | static int dac33_playback_event(struct snd_soc_dapm_widget *w, | 423 | static int dac33_playback_event(struct snd_soc_dapm_widget *w, |
424 | struct snd_kcontrol *kcontrol, int event) | 424 | struct snd_kcontrol *kcontrol, int event) |
425 | { | 425 | { |
426 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(w->codec); | 426 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
427 | struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); | ||
427 | 428 | ||
428 | switch (event) { | 429 | switch (event) { |
429 | case SND_SOC_DAPM_PRE_PMU: | 430 | case SND_SOC_DAPM_PRE_PMU: |
430 | if (likely(dac33->substream)) { | 431 | if (likely(dac33->substream)) { |
431 | dac33_calculate_times(dac33->substream, w->codec); | 432 | dac33_calculate_times(dac33->substream, codec); |
432 | dac33_prepare_chip(dac33->substream, w->codec); | 433 | dac33_prepare_chip(dac33->substream, codec); |
433 | } | 434 | } |
434 | break; | 435 | break; |
435 | case SND_SOC_DAPM_POST_PMD: | 436 | case SND_SOC_DAPM_POST_PMD: |
436 | dac33_disable_digital(w->codec); | 437 | dac33_disable_digital(codec); |
437 | break; | 438 | break; |
438 | } | 439 | } |
439 | return 0; | 440 | return 0; |
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 44af3188afb9..d04693e9cf9f 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -567,12 +567,13 @@ static const struct snd_kcontrol_new twl4030_dapm_dbypassv_control = | |||
567 | static int pin_name##pga_event(struct snd_soc_dapm_widget *w, \ | 567 | static int pin_name##pga_event(struct snd_soc_dapm_widget *w, \ |
568 | struct snd_kcontrol *kcontrol, int event) \ | 568 | struct snd_kcontrol *kcontrol, int event) \ |
569 | { \ | 569 | { \ |
570 | struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); \ | 570 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); \ |
571 | struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); \ | ||
571 | \ | 572 | \ |
572 | switch (event) { \ | 573 | switch (event) { \ |
573 | case SND_SOC_DAPM_POST_PMU: \ | 574 | case SND_SOC_DAPM_POST_PMU: \ |
574 | twl4030->pin_name##_enabled = 1; \ | 575 | twl4030->pin_name##_enabled = 1; \ |
575 | twl4030_write(w->codec, reg, twl4030_read(w->codec, reg)); \ | 576 | twl4030_write(codec, reg, twl4030_read(codec, reg)); \ |
576 | break; \ | 577 | break; \ |
577 | case SND_SOC_DAPM_POST_PMD: \ | 578 | case SND_SOC_DAPM_POST_PMD: \ |
578 | twl4030->pin_name##_enabled = 0; \ | 579 | twl4030->pin_name##_enabled = 0; \ |
@@ -621,12 +622,14 @@ static void handsfree_ramp(struct snd_soc_codec *codec, int reg, int ramp) | |||
621 | static int handsfreelpga_event(struct snd_soc_dapm_widget *w, | 622 | static int handsfreelpga_event(struct snd_soc_dapm_widget *w, |
622 | struct snd_kcontrol *kcontrol, int event) | 623 | struct snd_kcontrol *kcontrol, int event) |
623 | { | 624 | { |
625 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
626 | |||
624 | switch (event) { | 627 | switch (event) { |
625 | case SND_SOC_DAPM_POST_PMU: | 628 | case SND_SOC_DAPM_POST_PMU: |
626 | handsfree_ramp(w->codec, TWL4030_REG_HFL_CTL, 1); | 629 | handsfree_ramp(codec, TWL4030_REG_HFL_CTL, 1); |
627 | break; | 630 | break; |
628 | case SND_SOC_DAPM_POST_PMD: | 631 | case SND_SOC_DAPM_POST_PMD: |
629 | handsfree_ramp(w->codec, TWL4030_REG_HFL_CTL, 0); | 632 | handsfree_ramp(codec, TWL4030_REG_HFL_CTL, 0); |
630 | break; | 633 | break; |
631 | } | 634 | } |
632 | return 0; | 635 | return 0; |
@@ -635,12 +638,14 @@ static int handsfreelpga_event(struct snd_soc_dapm_widget *w, | |||
635 | static int handsfreerpga_event(struct snd_soc_dapm_widget *w, | 638 | static int handsfreerpga_event(struct snd_soc_dapm_widget *w, |
636 | struct snd_kcontrol *kcontrol, int event) | 639 | struct snd_kcontrol *kcontrol, int event) |
637 | { | 640 | { |
641 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
642 | |||
638 | switch (event) { | 643 | switch (event) { |
639 | case SND_SOC_DAPM_POST_PMU: | 644 | case SND_SOC_DAPM_POST_PMU: |
640 | handsfree_ramp(w->codec, TWL4030_REG_HFR_CTL, 1); | 645 | handsfree_ramp(codec, TWL4030_REG_HFR_CTL, 1); |
641 | break; | 646 | break; |
642 | case SND_SOC_DAPM_POST_PMD: | 647 | case SND_SOC_DAPM_POST_PMD: |
643 | handsfree_ramp(w->codec, TWL4030_REG_HFR_CTL, 0); | 648 | handsfree_ramp(codec, TWL4030_REG_HFR_CTL, 0); |
644 | break; | 649 | break; |
645 | } | 650 | } |
646 | return 0; | 651 | return 0; |
@@ -649,19 +654,23 @@ static int handsfreerpga_event(struct snd_soc_dapm_widget *w, | |||
649 | static int vibramux_event(struct snd_soc_dapm_widget *w, | 654 | static int vibramux_event(struct snd_soc_dapm_widget *w, |
650 | struct snd_kcontrol *kcontrol, int event) | 655 | struct snd_kcontrol *kcontrol, int event) |
651 | { | 656 | { |
652 | twl4030_write(w->codec, TWL4030_REG_VIBRA_SET, 0xff); | 657 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
658 | |||
659 | twl4030_write(codec, TWL4030_REG_VIBRA_SET, 0xff); | ||
653 | return 0; | 660 | return 0; |
654 | } | 661 | } |
655 | 662 | ||
656 | static int apll_event(struct snd_soc_dapm_widget *w, | 663 | static int apll_event(struct snd_soc_dapm_widget *w, |
657 | struct snd_kcontrol *kcontrol, int event) | 664 | struct snd_kcontrol *kcontrol, int event) |
658 | { | 665 | { |
666 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
667 | |||
659 | switch (event) { | 668 | switch (event) { |
660 | case SND_SOC_DAPM_PRE_PMU: | 669 | case SND_SOC_DAPM_PRE_PMU: |
661 | twl4030_apll_enable(w->codec, 1); | 670 | twl4030_apll_enable(codec, 1); |
662 | break; | 671 | break; |
663 | case SND_SOC_DAPM_POST_PMD: | 672 | case SND_SOC_DAPM_POST_PMD: |
664 | twl4030_apll_enable(w->codec, 0); | 673 | twl4030_apll_enable(codec, 0); |
665 | break; | 674 | break; |
666 | } | 675 | } |
667 | return 0; | 676 | return 0; |
@@ -670,23 +679,24 @@ static int apll_event(struct snd_soc_dapm_widget *w, | |||
670 | static int aif_event(struct snd_soc_dapm_widget *w, | 679 | static int aif_event(struct snd_soc_dapm_widget *w, |
671 | struct snd_kcontrol *kcontrol, int event) | 680 | struct snd_kcontrol *kcontrol, int event) |
672 | { | 681 | { |
682 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
673 | u8 audio_if; | 683 | u8 audio_if; |
674 | 684 | ||
675 | audio_if = twl4030_read(w->codec, TWL4030_REG_AUDIO_IF); | 685 | audio_if = twl4030_read(codec, TWL4030_REG_AUDIO_IF); |
676 | switch (event) { | 686 | switch (event) { |
677 | case SND_SOC_DAPM_PRE_PMU: | 687 | case SND_SOC_DAPM_PRE_PMU: |
678 | /* Enable AIF */ | 688 | /* Enable AIF */ |
679 | /* enable the PLL before we use it to clock the DAI */ | 689 | /* enable the PLL before we use it to clock the DAI */ |
680 | twl4030_apll_enable(w->codec, 1); | 690 | twl4030_apll_enable(codec, 1); |
681 | 691 | ||
682 | twl4030_write(w->codec, TWL4030_REG_AUDIO_IF, | 692 | twl4030_write(codec, TWL4030_REG_AUDIO_IF, |
683 | audio_if | TWL4030_AIF_EN); | 693 | audio_if | TWL4030_AIF_EN); |
684 | break; | 694 | break; |
685 | case SND_SOC_DAPM_POST_PMD: | 695 | case SND_SOC_DAPM_POST_PMD: |
686 | /* disable the DAI before we stop it's source PLL */ | 696 | /* disable the DAI before we stop it's source PLL */ |
687 | twl4030_write(w->codec, TWL4030_REG_AUDIO_IF, | 697 | twl4030_write(codec, TWL4030_REG_AUDIO_IF, |
688 | audio_if & ~TWL4030_AIF_EN); | 698 | audio_if & ~TWL4030_AIF_EN); |
689 | twl4030_apll_enable(w->codec, 0); | 699 | twl4030_apll_enable(codec, 0); |
690 | break; | 700 | break; |
691 | } | 701 | } |
692 | return 0; | 702 | return 0; |
@@ -758,20 +768,21 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp) | |||
758 | static int headsetlpga_event(struct snd_soc_dapm_widget *w, | 768 | static int headsetlpga_event(struct snd_soc_dapm_widget *w, |
759 | struct snd_kcontrol *kcontrol, int event) | 769 | struct snd_kcontrol *kcontrol, int event) |
760 | { | 770 | { |
761 | struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); | 771 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
772 | struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); | ||
762 | 773 | ||
763 | switch (event) { | 774 | switch (event) { |
764 | case SND_SOC_DAPM_POST_PMU: | 775 | case SND_SOC_DAPM_POST_PMU: |
765 | /* Do the ramp-up only once */ | 776 | /* Do the ramp-up only once */ |
766 | if (!twl4030->hsr_enabled) | 777 | if (!twl4030->hsr_enabled) |
767 | headset_ramp(w->codec, 1); | 778 | headset_ramp(codec, 1); |
768 | 779 | ||
769 | twl4030->hsl_enabled = 1; | 780 | twl4030->hsl_enabled = 1; |
770 | break; | 781 | break; |
771 | case SND_SOC_DAPM_POST_PMD: | 782 | case SND_SOC_DAPM_POST_PMD: |
772 | /* Do the ramp-down only if both headsetL/R is disabled */ | 783 | /* Do the ramp-down only if both headsetL/R is disabled */ |
773 | if (!twl4030->hsr_enabled) | 784 | if (!twl4030->hsr_enabled) |
774 | headset_ramp(w->codec, 0); | 785 | headset_ramp(codec, 0); |
775 | 786 | ||
776 | twl4030->hsl_enabled = 0; | 787 | twl4030->hsl_enabled = 0; |
777 | break; | 788 | break; |
@@ -782,20 +793,21 @@ static int headsetlpga_event(struct snd_soc_dapm_widget *w, | |||
782 | static int headsetrpga_event(struct snd_soc_dapm_widget *w, | 793 | static int headsetrpga_event(struct snd_soc_dapm_widget *w, |
783 | struct snd_kcontrol *kcontrol, int event) | 794 | struct snd_kcontrol *kcontrol, int event) |
784 | { | 795 | { |
785 | struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); | 796 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
797 | struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); | ||
786 | 798 | ||
787 | switch (event) { | 799 | switch (event) { |
788 | case SND_SOC_DAPM_POST_PMU: | 800 | case SND_SOC_DAPM_POST_PMU: |
789 | /* Do the ramp-up only once */ | 801 | /* Do the ramp-up only once */ |
790 | if (!twl4030->hsl_enabled) | 802 | if (!twl4030->hsl_enabled) |
791 | headset_ramp(w->codec, 1); | 803 | headset_ramp(codec, 1); |
792 | 804 | ||
793 | twl4030->hsr_enabled = 1; | 805 | twl4030->hsr_enabled = 1; |
794 | break; | 806 | break; |
795 | case SND_SOC_DAPM_POST_PMD: | 807 | case SND_SOC_DAPM_POST_PMD: |
796 | /* Do the ramp-down only if both headsetL/R is disabled */ | 808 | /* Do the ramp-down only if both headsetL/R is disabled */ |
797 | if (!twl4030->hsl_enabled) | 809 | if (!twl4030->hsl_enabled) |
798 | headset_ramp(w->codec, 0); | 810 | headset_ramp(codec, 0); |
799 | 811 | ||
800 | twl4030->hsr_enabled = 0; | 812 | twl4030->hsr_enabled = 0; |
801 | break; | 813 | break; |
@@ -806,7 +818,8 @@ static int headsetrpga_event(struct snd_soc_dapm_widget *w, | |||
806 | static int digimic_event(struct snd_soc_dapm_widget *w, | 818 | static int digimic_event(struct snd_soc_dapm_widget *w, |
807 | struct snd_kcontrol *kcontrol, int event) | 819 | struct snd_kcontrol *kcontrol, int event) |
808 | { | 820 | { |
809 | struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); | 821 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
822 | struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); | ||
810 | struct twl4030_codec_data *pdata = twl4030->pdata; | 823 | struct twl4030_codec_data *pdata = twl4030->pdata; |
811 | 824 | ||
812 | if (pdata && pdata->digimic_delay) | 825 | if (pdata && pdata->digimic_delay) |
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 90f47f988b3f..aeec27b6f1af 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
@@ -234,7 +234,7 @@ static int headset_power_mode(struct snd_soc_codec *codec, int high_perf) | |||
234 | static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, | 234 | static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, |
235 | struct snd_kcontrol *kcontrol, int event) | 235 | struct snd_kcontrol *kcontrol, int event) |
236 | { | 236 | { |
237 | struct snd_soc_codec *codec = w->codec; | 237 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
238 | u8 hslctl, hsrctl; | 238 | u8 hslctl, hsrctl; |
239 | 239 | ||
240 | /* | 240 | /* |
@@ -261,7 +261,7 @@ static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, | |||
261 | static int twl6040_ep_drv_event(struct snd_soc_dapm_widget *w, | 261 | static int twl6040_ep_drv_event(struct snd_soc_dapm_widget *w, |
262 | struct snd_kcontrol *kcontrol, int event) | 262 | struct snd_kcontrol *kcontrol, int event) |
263 | { | 263 | { |
264 | struct snd_soc_codec *codec = w->codec; | 264 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
265 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); | 265 | struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); |
266 | int ret = 0; | 266 | int ret = 0; |
267 | 267 | ||
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index 34ef65c52a7d..8d9de49a5052 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c | |||
@@ -683,7 +683,7 @@ static const struct snd_kcontrol_new wm2000_controls[] = { | |||
683 | static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w, | 683 | static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w, |
684 | struct snd_kcontrol *kcontrol, int event) | 684 | struct snd_kcontrol *kcontrol, int event) |
685 | { | 685 | { |
686 | struct snd_soc_codec *codec = w->codec; | 686 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
687 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 687 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); |
688 | int ret; | 688 | int ret; |
689 | 689 | ||
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index b80970dc2d2f..ea09db585aa1 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c | |||
@@ -775,7 +775,8 @@ static int wm5100_out_ev(struct snd_soc_dapm_widget *w, | |||
775 | struct snd_kcontrol *kcontrol, | 775 | struct snd_kcontrol *kcontrol, |
776 | int event) | 776 | int event) |
777 | { | 777 | { |
778 | struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(w->codec); | 778 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
779 | struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); | ||
779 | 780 | ||
780 | switch (w->reg) { | 781 | switch (w->reg) { |
781 | case WM5100_CHANNEL_ENABLES_1: | 782 | case WM5100_CHANNEL_ENABLES_1: |
@@ -839,7 +840,7 @@ static int wm5100_post_ev(struct snd_soc_dapm_widget *w, | |||
839 | struct snd_kcontrol *kcontrol, | 840 | struct snd_kcontrol *kcontrol, |
840 | int event) | 841 | int event) |
841 | { | 842 | { |
842 | struct snd_soc_codec *codec = w->codec; | 843 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
843 | struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); | 844 | struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); |
844 | int ret; | 845 | int ret; |
845 | 846 | ||
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index f439ae052128..6d0fe0ac95a3 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include <linux/mfd/arizona/core.h> | 29 | #include <linux/mfd/arizona/core.h> |
30 | #include <linux/mfd/arizona/registers.h> | 30 | #include <linux/mfd/arizona/registers.h> |
31 | #include <asm/unaligned.h> | ||
31 | 32 | ||
32 | #include "arizona.h" | 33 | #include "arizona.h" |
33 | #include "wm5102.h" | 34 | #include "wm5102.h" |
@@ -580,7 +581,7 @@ static const struct reg_default wm5102_sysclk_revb_patch[] = { | |||
580 | static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w, | 581 | static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w, |
581 | struct snd_kcontrol *kcontrol, int event) | 582 | struct snd_kcontrol *kcontrol, int event) |
582 | { | 583 | { |
583 | struct snd_soc_codec *codec = w->codec; | 584 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
584 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | 585 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); |
585 | struct regmap *regmap = arizona->regmap; | 586 | struct regmap *regmap = arizona->regmap; |
586 | const struct reg_default *patch = NULL; | 587 | const struct reg_default *patch = NULL; |
@@ -617,11 +618,10 @@ static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol, | |||
617 | { | 618 | { |
618 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 619 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
619 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | 620 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); |
620 | uint16_t data; | ||
621 | 621 | ||
622 | mutex_lock(&arizona->dac_comp_lock); | 622 | mutex_lock(&arizona->dac_comp_lock); |
623 | data = cpu_to_be16(arizona->dac_comp_coeff); | 623 | put_unaligned_be16(arizona->dac_comp_coeff, |
624 | memcpy(ucontrol->value.bytes.data, &data, sizeof(data)); | 624 | ucontrol->value.bytes.data); |
625 | mutex_unlock(&arizona->dac_comp_lock); | 625 | mutex_unlock(&arizona->dac_comp_lock); |
626 | 626 | ||
627 | return 0; | 627 | return 0; |
@@ -1272,19 +1272,24 @@ SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1, | |||
1272 | 1272 | ||
1273 | SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM, | 1273 | SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM, |
1274 | ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, | 1274 | ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, |
1275 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 1275 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
1276 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
1276 | SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM, | 1277 | SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM, |
1277 | ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, | 1278 | ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, |
1278 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 1279 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
1280 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
1279 | SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1, | 1281 | SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1, |
1280 | ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 1282 | ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
1281 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 1283 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
1284 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
1282 | SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1, | 1285 | SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1, |
1283 | ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 1286 | ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
1284 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 1287 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
1288 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
1285 | SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1, | 1289 | SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1, |
1286 | ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 1290 | ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
1287 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 1291 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
1292 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
1288 | SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, | 1293 | SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, |
1289 | ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 1294 | ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
1290 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 1295 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index 4456b38a3ef5..fbaeddb3e903 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c | |||
@@ -134,7 +134,7 @@ static const struct reg_default wm5110_sysclk_revd_patch[] = { | |||
134 | static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w, | 134 | static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w, |
135 | struct snd_kcontrol *kcontrol, int event) | 135 | struct snd_kcontrol *kcontrol, int event) |
136 | { | 136 | { |
137 | struct snd_soc_codec *codec = w->codec; | 137 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
138 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | 138 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); |
139 | struct regmap *regmap = arizona->regmap; | 139 | struct regmap *regmap = arizona->regmap; |
140 | const struct reg_default *patch = NULL; | 140 | const struct reg_default *patch = NULL; |
@@ -905,22 +905,28 @@ SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0, | |||
905 | 905 | ||
906 | SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM, | 906 | SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM, |
907 | ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, | 907 | ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, |
908 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 908 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
909 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
909 | SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM, | 910 | SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM, |
910 | ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, | 911 | ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, |
911 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 912 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
913 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
912 | SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1, | 914 | SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1, |
913 | ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 915 | ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
914 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 916 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
917 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
915 | SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1, | 918 | SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1, |
916 | ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 919 | ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
917 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 920 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
921 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
918 | SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1, | 922 | SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1, |
919 | ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 923 | ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
920 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 924 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
925 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
921 | SND_SOC_DAPM_PGA_E("OUT3R", ARIZONA_OUTPUT_ENABLES_1, | 926 | SND_SOC_DAPM_PGA_E("OUT3R", ARIZONA_OUTPUT_ENABLES_1, |
922 | ARIZONA_OUT3R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 927 | ARIZONA_OUT3R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
923 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 928 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
929 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
924 | SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, | 930 | SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, |
925 | ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 931 | ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
926 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 932 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 574579b98872..c81a9eab3e3e 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -259,7 +259,7 @@ static void wm8350_pga_work(struct work_struct *work) | |||
259 | static int pga_event(struct snd_soc_dapm_widget *w, | 259 | static int pga_event(struct snd_soc_dapm_widget *w, |
260 | struct snd_kcontrol *kcontrol, int event) | 260 | struct snd_kcontrol *kcontrol, int event) |
261 | { | 261 | { |
262 | struct snd_soc_codec *codec = w->codec; | 262 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
263 | struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); | 263 | struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); |
264 | struct wm8350_output *out; | 264 | struct wm8350_output *out; |
265 | 265 | ||
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index 8ee446987aa9..b0d84e552fca 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c | |||
@@ -324,6 +324,7 @@ SOC_SINGLE("RIN34 Mute Switch", WM8400_RIGHT_LINE_INPUT_3_4_VOLUME, | |||
324 | static int outmixer_event (struct snd_soc_dapm_widget *w, | 324 | static int outmixer_event (struct snd_soc_dapm_widget *w, |
325 | struct snd_kcontrol * kcontrol, int event) | 325 | struct snd_kcontrol * kcontrol, int event) |
326 | { | 326 | { |
327 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
327 | struct soc_mixer_control *mc = | 328 | struct soc_mixer_control *mc = |
328 | (struct soc_mixer_control *)kcontrol->private_value; | 329 | (struct soc_mixer_control *)kcontrol->private_value; |
329 | u32 reg_shift = mc->shift; | 330 | u32 reg_shift = mc->shift; |
@@ -332,7 +333,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w, | |||
332 | 333 | ||
333 | switch (reg_shift) { | 334 | switch (reg_shift) { |
334 | case WM8400_SPEAKER_MIXER | (WM8400_LDSPK << 8) : | 335 | case WM8400_SPEAKER_MIXER | (WM8400_LDSPK << 8) : |
335 | reg = snd_soc_read(w->codec, WM8400_OUTPUT_MIXER1); | 336 | reg = snd_soc_read(codec, WM8400_OUTPUT_MIXER1); |
336 | if (reg & WM8400_LDLO) { | 337 | if (reg & WM8400_LDLO) { |
337 | printk(KERN_WARNING | 338 | printk(KERN_WARNING |
338 | "Cannot set as Output Mixer 1 LDLO Set\n"); | 339 | "Cannot set as Output Mixer 1 LDLO Set\n"); |
@@ -340,7 +341,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w, | |||
340 | } | 341 | } |
341 | break; | 342 | break; |
342 | case WM8400_SPEAKER_MIXER | (WM8400_RDSPK << 8): | 343 | case WM8400_SPEAKER_MIXER | (WM8400_RDSPK << 8): |
343 | reg = snd_soc_read(w->codec, WM8400_OUTPUT_MIXER2); | 344 | reg = snd_soc_read(codec, WM8400_OUTPUT_MIXER2); |
344 | if (reg & WM8400_RDRO) { | 345 | if (reg & WM8400_RDRO) { |
345 | printk(KERN_WARNING | 346 | printk(KERN_WARNING |
346 | "Cannot set as Output Mixer 2 RDRO Set\n"); | 347 | "Cannot set as Output Mixer 2 RDRO Set\n"); |
@@ -348,7 +349,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w, | |||
348 | } | 349 | } |
349 | break; | 350 | break; |
350 | case WM8400_OUTPUT_MIXER1 | (WM8400_LDLO << 8): | 351 | case WM8400_OUTPUT_MIXER1 | (WM8400_LDLO << 8): |
351 | reg = snd_soc_read(w->codec, WM8400_SPEAKER_MIXER); | 352 | reg = snd_soc_read(codec, WM8400_SPEAKER_MIXER); |
352 | if (reg & WM8400_LDSPK) { | 353 | if (reg & WM8400_LDSPK) { |
353 | printk(KERN_WARNING | 354 | printk(KERN_WARNING |
354 | "Cannot set as Speaker Mixer LDSPK Set\n"); | 355 | "Cannot set as Speaker Mixer LDSPK Set\n"); |
@@ -356,7 +357,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w, | |||
356 | } | 357 | } |
357 | break; | 358 | break; |
358 | case WM8400_OUTPUT_MIXER2 | (WM8400_RDRO << 8): | 359 | case WM8400_OUTPUT_MIXER2 | (WM8400_RDRO << 8): |
359 | reg = snd_soc_read(w->codec, WM8400_SPEAKER_MIXER); | 360 | reg = snd_soc_read(codec, WM8400_SPEAKER_MIXER); |
360 | if (reg & WM8400_RDSPK) { | 361 | if (reg & WM8400_RDSPK) { |
361 | printk(KERN_WARNING | 362 | printk(KERN_WARNING |
362 | "Cannot set as Speaker Mixer RDSPK Set\n"); | 363 | "Cannot set as Speaker Mixer RDSPK Set\n"); |
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index b115ed815db9..098c143f44d6 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
@@ -217,7 +217,8 @@ SND_SOC_DAPM_INPUT("LLINEIN"), | |||
217 | static int wm8731_check_osc(struct snd_soc_dapm_widget *source, | 217 | static int wm8731_check_osc(struct snd_soc_dapm_widget *source, |
218 | struct snd_soc_dapm_widget *sink) | 218 | struct snd_soc_dapm_widget *sink) |
219 | { | 219 | { |
220 | struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(source->codec); | 220 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); |
221 | struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); | ||
221 | 222 | ||
222 | return wm8731->sysclk_type == WM8731_SYSCLK_XTAL; | 223 | return wm8731->sysclk_type == WM8731_SYSCLK_XTAL; |
223 | } | 224 | } |
diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index 180e7a098726..53e977da2f86 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c | |||
@@ -308,9 +308,7 @@ static const struct snd_soc_dapm_route wm8770_intercon[] = { | |||
308 | static int vout12supply_event(struct snd_soc_dapm_widget *w, | 308 | static int vout12supply_event(struct snd_soc_dapm_widget *w, |
309 | struct snd_kcontrol *kcontrol, int event) | 309 | struct snd_kcontrol *kcontrol, int event) |
310 | { | 310 | { |
311 | struct snd_soc_codec *codec; | 311 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
312 | |||
313 | codec = w->codec; | ||
314 | 312 | ||
315 | switch (event) { | 313 | switch (event) { |
316 | case SND_SOC_DAPM_PRE_PMU: | 314 | case SND_SOC_DAPM_PRE_PMU: |
@@ -327,9 +325,7 @@ static int vout12supply_event(struct snd_soc_dapm_widget *w, | |||
327 | static int vout34supply_event(struct snd_soc_dapm_widget *w, | 325 | static int vout34supply_event(struct snd_soc_dapm_widget *w, |
328 | struct snd_kcontrol *kcontrol, int event) | 326 | struct snd_kcontrol *kcontrol, int event) |
329 | { | 327 | { |
330 | struct snd_soc_codec *codec; | 328 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
331 | |||
332 | codec = w->codec; | ||
333 | 329 | ||
334 | switch (event) { | 330 | switch (event) { |
335 | case SND_SOC_DAPM_PRE_PMU: | 331 | case SND_SOC_DAPM_PRE_PMU: |
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index 3a0d4b7d692f..2eb986c19b88 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c | |||
@@ -224,7 +224,7 @@ static void wm8900_reset(struct snd_soc_codec *codec) | |||
224 | static int wm8900_hp_event(struct snd_soc_dapm_widget *w, | 224 | static int wm8900_hp_event(struct snd_soc_dapm_widget *w, |
225 | struct snd_kcontrol *kcontrol, int event) | 225 | struct snd_kcontrol *kcontrol, int event) |
226 | { | 226 | { |
227 | struct snd_soc_codec *codec = w->codec; | 227 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
228 | u16 hpctl1 = snd_soc_read(codec, WM8900_REG_HPCTL1); | 228 | u16 hpctl1 = snd_soc_read(codec, WM8900_REG_HPCTL1); |
229 | 229 | ||
230 | switch (event) { | 230 | switch (event) { |
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index cc6b0ef98a34..dde462c082be 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -260,7 +260,7 @@ static int wm8903_cp_event(struct snd_soc_dapm_widget *w, | |||
260 | static int wm8903_dcs_event(struct snd_soc_dapm_widget *w, | 260 | static int wm8903_dcs_event(struct snd_soc_dapm_widget *w, |
261 | struct snd_kcontrol *kcontrol, int event) | 261 | struct snd_kcontrol *kcontrol, int event) |
262 | { | 262 | { |
263 | struct snd_soc_codec *codec = w->codec; | 263 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
264 | struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); | 264 | struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); |
265 | 265 | ||
266 | switch (event) { | 266 | switch (event) { |
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 75b87c5c0f04..c5eaa0198ef0 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -673,7 +673,7 @@ static int cp_event(struct snd_soc_dapm_widget *w, | |||
673 | static int sysclk_event(struct snd_soc_dapm_widget *w, | 673 | static int sysclk_event(struct snd_soc_dapm_widget *w, |
674 | struct snd_kcontrol *kcontrol, int event) | 674 | struct snd_kcontrol *kcontrol, int event) |
675 | { | 675 | { |
676 | struct snd_soc_codec *codec = w->codec; | 676 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
677 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 677 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); |
678 | 678 | ||
679 | switch (event) { | 679 | switch (event) { |
@@ -711,7 +711,7 @@ static int sysclk_event(struct snd_soc_dapm_widget *w, | |||
711 | static int out_pga_event(struct snd_soc_dapm_widget *w, | 711 | static int out_pga_event(struct snd_soc_dapm_widget *w, |
712 | struct snd_kcontrol *kcontrol, int event) | 712 | struct snd_kcontrol *kcontrol, int event) |
713 | { | 713 | { |
714 | struct snd_soc_codec *codec = w->codec; | 714 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
715 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 715 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); |
716 | int reg, val; | 716 | int reg, val; |
717 | int dcs_mask; | 717 | int dcs_mask; |
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index 1173f7fef5a7..1ab2d462afad 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c | |||
@@ -333,7 +333,7 @@ static int wm8955_configure_clocking(struct snd_soc_codec *codec) | |||
333 | static int wm8955_sysclk(struct snd_soc_dapm_widget *w, | 333 | static int wm8955_sysclk(struct snd_soc_dapm_widget *w, |
334 | struct snd_kcontrol *kcontrol, int event) | 334 | struct snd_kcontrol *kcontrol, int event) |
335 | { | 335 | { |
336 | struct snd_soc_codec *codec = w->codec; | 336 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
337 | int ret = 0; | 337 | int ret = 0; |
338 | 338 | ||
339 | /* Always disable the clocks - if we're doing reconfiguration this | 339 | /* Always disable the clocks - if we're doing reconfiguration this |
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c index 3cbc82b33292..c799cca5abeb 100644 --- a/sound/soc/codecs/wm8958-dsp2.c +++ b/sound/soc/codecs/wm8958-dsp2.c | |||
@@ -418,7 +418,7 @@ static void wm8958_dsp_apply(struct snd_soc_codec *codec, int path, int start) | |||
418 | int wm8958_aif_ev(struct snd_soc_dapm_widget *w, | 418 | int wm8958_aif_ev(struct snd_soc_dapm_widget *w, |
419 | struct snd_kcontrol *kcontrol, int event) | 419 | struct snd_kcontrol *kcontrol, int event) |
420 | { | 420 | { |
421 | struct snd_soc_codec *codec = w->codec; | 421 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
422 | int i; | 422 | int i; |
423 | 423 | ||
424 | switch (event) { | 424 | switch (event) { |
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index eeffd05384b4..95e2c1bfc809 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c | |||
@@ -194,7 +194,7 @@ static bool wm8961_readable(struct device *dev, unsigned int reg) | |||
194 | static int wm8961_hp_event(struct snd_soc_dapm_widget *w, | 194 | static int wm8961_hp_event(struct snd_soc_dapm_widget *w, |
195 | struct snd_kcontrol *kcontrol, int event) | 195 | struct snd_kcontrol *kcontrol, int event) |
196 | { | 196 | { |
197 | struct snd_soc_codec *codec = w->codec; | 197 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
198 | u16 hp_reg = snd_soc_read(codec, WM8961_ANALOGUE_HP_0); | 198 | u16 hp_reg = snd_soc_read(codec, WM8961_ANALOGUE_HP_0); |
199 | u16 cp_reg = snd_soc_read(codec, WM8961_CHARGE_PUMP_1); | 199 | u16 cp_reg = snd_soc_read(codec, WM8961_CHARGE_PUMP_1); |
200 | u16 pwr_reg = snd_soc_read(codec, WM8961_PWR_MGMT_2); | 200 | u16 pwr_reg = snd_soc_read(codec, WM8961_PWR_MGMT_2); |
@@ -286,7 +286,7 @@ static int wm8961_hp_event(struct snd_soc_dapm_widget *w, | |||
286 | static int wm8961_spk_event(struct snd_soc_dapm_widget *w, | 286 | static int wm8961_spk_event(struct snd_soc_dapm_widget *w, |
287 | struct snd_kcontrol *kcontrol, int event) | 287 | struct snd_kcontrol *kcontrol, int event) |
288 | { | 288 | { |
289 | struct snd_soc_codec *codec = w->codec; | 289 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
290 | u16 pwr_reg = snd_soc_read(codec, WM8961_PWR_MGMT_2); | 290 | u16 pwr_reg = snd_soc_read(codec, WM8961_PWR_MGMT_2); |
291 | u16 spk_reg = snd_soc_read(codec, WM8961_CLASS_D_CONTROL_1); | 291 | u16 spk_reg = snd_soc_read(codec, WM8961_CLASS_D_CONTROL_1); |
292 | 292 | ||
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index d32d554f5b34..118b0034ba23 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
@@ -1866,7 +1866,7 @@ static int cp_event(struct snd_soc_dapm_widget *w, | |||
1866 | static int hp_event(struct snd_soc_dapm_widget *w, | 1866 | static int hp_event(struct snd_soc_dapm_widget *w, |
1867 | struct snd_kcontrol *kcontrol, int event) | 1867 | struct snd_kcontrol *kcontrol, int event) |
1868 | { | 1868 | { |
1869 | struct snd_soc_codec *codec = w->codec; | 1869 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1870 | int timeout; | 1870 | int timeout; |
1871 | int reg; | 1871 | int reg; |
1872 | int expected = (WM8962_DCS_STARTUP_DONE_HP1L | | 1872 | int expected = (WM8962_DCS_STARTUP_DONE_HP1L | |
@@ -1960,7 +1960,7 @@ static int hp_event(struct snd_soc_dapm_widget *w, | |||
1960 | static int out_pga_event(struct snd_soc_dapm_widget *w, | 1960 | static int out_pga_event(struct snd_soc_dapm_widget *w, |
1961 | struct snd_kcontrol *kcontrol, int event) | 1961 | struct snd_kcontrol *kcontrol, int event) |
1962 | { | 1962 | { |
1963 | struct snd_soc_codec *codec = w->codec; | 1963 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1964 | int reg; | 1964 | int reg; |
1965 | 1965 | ||
1966 | switch (w->shift) { | 1966 | switch (w->shift) { |
@@ -1993,7 +1993,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
1993 | static int dsp2_event(struct snd_soc_dapm_widget *w, | 1993 | static int dsp2_event(struct snd_soc_dapm_widget *w, |
1994 | struct snd_kcontrol *kcontrol, int event) | 1994 | struct snd_kcontrol *kcontrol, int event) |
1995 | { | 1995 | { |
1996 | struct snd_soc_codec *codec = w->codec; | 1996 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1997 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | 1997 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); |
1998 | 1998 | ||
1999 | switch (event) { | 1999 | switch (event) { |
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index e418199155a8..baff2cc222a6 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c | |||
@@ -244,7 +244,7 @@ SOC_DOUBLE_R_TLV("Output 2 Playback Volume", WM8988_LOUT2V, WM8988_ROUT2V, | |||
244 | static int wm8988_lrc_control(struct snd_soc_dapm_widget *w, | 244 | static int wm8988_lrc_control(struct snd_soc_dapm_widget *w, |
245 | struct snd_kcontrol *kcontrol, int event) | 245 | struct snd_kcontrol *kcontrol, int event) |
246 | { | 246 | { |
247 | struct snd_soc_codec *codec = w->codec; | 247 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
248 | u16 adctl2 = snd_soc_read(codec, WM8988_ADCTL2); | 248 | u16 adctl2 = snd_soc_read(codec, WM8988_ADCTL2); |
249 | 249 | ||
250 | /* Use the DAC to gate LRC if active, otherwise use ADC */ | 250 | /* Use the DAC to gate LRC if active, otherwise use ADC */ |
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 8a584229310a..c93bffcb3cfb 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
@@ -374,13 +374,14 @@ SOC_SINGLE("RIN34 Mute Switch", WM8990_RIGHT_LINE_INPUT_3_4_VOLUME, | |||
374 | static int outmixer_event(struct snd_soc_dapm_widget *w, | 374 | static int outmixer_event(struct snd_soc_dapm_widget *w, |
375 | struct snd_kcontrol *kcontrol, int event) | 375 | struct snd_kcontrol *kcontrol, int event) |
376 | { | 376 | { |
377 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
377 | u32 reg_shift = kcontrol->private_value & 0xfff; | 378 | u32 reg_shift = kcontrol->private_value & 0xfff; |
378 | int ret = 0; | 379 | int ret = 0; |
379 | u16 reg; | 380 | u16 reg; |
380 | 381 | ||
381 | switch (reg_shift) { | 382 | switch (reg_shift) { |
382 | case WM8990_SPEAKER_MIXER | (WM8990_LDSPK_BIT << 8) : | 383 | case WM8990_SPEAKER_MIXER | (WM8990_LDSPK_BIT << 8) : |
383 | reg = snd_soc_read(w->codec, WM8990_OUTPUT_MIXER1); | 384 | reg = snd_soc_read(codec, WM8990_OUTPUT_MIXER1); |
384 | if (reg & WM8990_LDLO) { | 385 | if (reg & WM8990_LDLO) { |
385 | printk(KERN_WARNING | 386 | printk(KERN_WARNING |
386 | "Cannot set as Output Mixer 1 LDLO Set\n"); | 387 | "Cannot set as Output Mixer 1 LDLO Set\n"); |
@@ -388,7 +389,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w, | |||
388 | } | 389 | } |
389 | break; | 390 | break; |
390 | case WM8990_SPEAKER_MIXER | (WM8990_RDSPK_BIT << 8): | 391 | case WM8990_SPEAKER_MIXER | (WM8990_RDSPK_BIT << 8): |
391 | reg = snd_soc_read(w->codec, WM8990_OUTPUT_MIXER2); | 392 | reg = snd_soc_read(codec, WM8990_OUTPUT_MIXER2); |
392 | if (reg & WM8990_RDRO) { | 393 | if (reg & WM8990_RDRO) { |
393 | printk(KERN_WARNING | 394 | printk(KERN_WARNING |
394 | "Cannot set as Output Mixer 2 RDRO Set\n"); | 395 | "Cannot set as Output Mixer 2 RDRO Set\n"); |
@@ -396,7 +397,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w, | |||
396 | } | 397 | } |
397 | break; | 398 | break; |
398 | case WM8990_OUTPUT_MIXER1 | (WM8990_LDLO_BIT << 8): | 399 | case WM8990_OUTPUT_MIXER1 | (WM8990_LDLO_BIT << 8): |
399 | reg = snd_soc_read(w->codec, WM8990_SPEAKER_MIXER); | 400 | reg = snd_soc_read(codec, WM8990_SPEAKER_MIXER); |
400 | if (reg & WM8990_LDSPK) { | 401 | if (reg & WM8990_LDSPK) { |
401 | printk(KERN_WARNING | 402 | printk(KERN_WARNING |
402 | "Cannot set as Speaker Mixer LDSPK Set\n"); | 403 | "Cannot set as Speaker Mixer LDSPK Set\n"); |
@@ -404,7 +405,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w, | |||
404 | } | 405 | } |
405 | break; | 406 | break; |
406 | case WM8990_OUTPUT_MIXER2 | (WM8990_RDRO_BIT << 8): | 407 | case WM8990_OUTPUT_MIXER2 | (WM8990_RDRO_BIT << 8): |
407 | reg = snd_soc_read(w->codec, WM8990_SPEAKER_MIXER); | 408 | reg = snd_soc_read(codec, WM8990_SPEAKER_MIXER); |
408 | if (reg & WM8990_RDSPK) { | 409 | if (reg & WM8990_RDSPK) { |
409 | printk(KERN_WARNING | 410 | printk(KERN_WARNING |
410 | "Cannot set as Speaker Mixer RDSPK Set\n"); | 411 | "Cannot set as Speaker Mixer RDSPK Set\n"); |
diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c index b0ac2c3e31b9..49df0dc607e6 100644 --- a/sound/soc/codecs/wm8991.c +++ b/sound/soc/codecs/wm8991.c | |||
@@ -382,13 +382,14 @@ static const struct snd_kcontrol_new wm8991_snd_controls[] = { | |||
382 | static int outmixer_event(struct snd_soc_dapm_widget *w, | 382 | static int outmixer_event(struct snd_soc_dapm_widget *w, |
383 | struct snd_kcontrol *kcontrol, int event) | 383 | struct snd_kcontrol *kcontrol, int event) |
384 | { | 384 | { |
385 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | ||
385 | u32 reg_shift = kcontrol->private_value & 0xfff; | 386 | u32 reg_shift = kcontrol->private_value & 0xfff; |
386 | int ret = 0; | 387 | int ret = 0; |
387 | u16 reg; | 388 | u16 reg; |
388 | 389 | ||
389 | switch (reg_shift) { | 390 | switch (reg_shift) { |
390 | case WM8991_SPEAKER_MIXER | (WM8991_LDSPK_BIT << 8): | 391 | case WM8991_SPEAKER_MIXER | (WM8991_LDSPK_BIT << 8): |
391 | reg = snd_soc_read(w->codec, WM8991_OUTPUT_MIXER1); | 392 | reg = snd_soc_read(codec, WM8991_OUTPUT_MIXER1); |
392 | if (reg & WM8991_LDLO) { | 393 | if (reg & WM8991_LDLO) { |
393 | printk(KERN_WARNING | 394 | printk(KERN_WARNING |
394 | "Cannot set as Output Mixer 1 LDLO Set\n"); | 395 | "Cannot set as Output Mixer 1 LDLO Set\n"); |
@@ -397,7 +398,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w, | |||
397 | break; | 398 | break; |
398 | 399 | ||
399 | case WM8991_SPEAKER_MIXER | (WM8991_RDSPK_BIT << 8): | 400 | case WM8991_SPEAKER_MIXER | (WM8991_RDSPK_BIT << 8): |
400 | reg = snd_soc_read(w->codec, WM8991_OUTPUT_MIXER2); | 401 | reg = snd_soc_read(codec, WM8991_OUTPUT_MIXER2); |
401 | if (reg & WM8991_RDRO) { | 402 | if (reg & WM8991_RDRO) { |
402 | printk(KERN_WARNING | 403 | printk(KERN_WARNING |
403 | "Cannot set as Output Mixer 2 RDRO Set\n"); | 404 | "Cannot set as Output Mixer 2 RDRO Set\n"); |
@@ -406,7 +407,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w, | |||
406 | break; | 407 | break; |
407 | 408 | ||
408 | case WM8991_OUTPUT_MIXER1 | (WM8991_LDLO_BIT << 8): | 409 | case WM8991_OUTPUT_MIXER1 | (WM8991_LDLO_BIT << 8): |
409 | reg = snd_soc_read(w->codec, WM8991_SPEAKER_MIXER); | 410 | reg = snd_soc_read(codec, WM8991_SPEAKER_MIXER); |
410 | if (reg & WM8991_LDSPK) { | 411 | if (reg & WM8991_LDSPK) { |
411 | printk(KERN_WARNING | 412 | printk(KERN_WARNING |
412 | "Cannot set as Speaker Mixer LDSPK Set\n"); | 413 | "Cannot set as Speaker Mixer LDSPK Set\n"); |
@@ -415,7 +416,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w, | |||
415 | break; | 416 | break; |
416 | 417 | ||
417 | case WM8991_OUTPUT_MIXER2 | (WM8991_RDRO_BIT << 8): | 418 | case WM8991_OUTPUT_MIXER2 | (WM8991_RDRO_BIT << 8): |
418 | reg = snd_soc_read(w->codec, WM8991_SPEAKER_MIXER); | 419 | reg = snd_soc_read(codec, WM8991_SPEAKER_MIXER); |
419 | if (reg & WM8991_RDSPK) { | 420 | if (reg & WM8991_RDSPK) { |
420 | printk(KERN_WARNING | 421 | printk(KERN_WARNING |
421 | "Cannot set as Speaker Mixer RDSPK Set\n"); | 422 | "Cannot set as Speaker Mixer RDSPK Set\n"); |
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index 53c6fe359496..2e70a270eb28 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c | |||
@@ -810,7 +810,7 @@ SOC_SINGLE_TLV("EQ5 Volume", WM8993_EQ6, 0, 24, 0, eq_tlv), | |||
810 | static int clk_sys_event(struct snd_soc_dapm_widget *w, | 810 | static int clk_sys_event(struct snd_soc_dapm_widget *w, |
811 | struct snd_kcontrol *kcontrol, int event) | 811 | struct snd_kcontrol *kcontrol, int event) |
812 | { | 812 | { |
813 | struct snd_soc_codec *codec = w->codec; | 813 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
814 | 814 | ||
815 | switch (event) { | 815 | switch (event) { |
816 | case SND_SOC_DAPM_PRE_PMU: | 816 | case SND_SOC_DAPM_PRE_PMU: |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 1b97de2e4e67..4fbc7689339a 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -249,7 +249,8 @@ static int configure_clock(struct snd_soc_codec *codec) | |||
249 | static int check_clk_sys(struct snd_soc_dapm_widget *source, | 249 | static int check_clk_sys(struct snd_soc_dapm_widget *source, |
250 | struct snd_soc_dapm_widget *sink) | 250 | struct snd_soc_dapm_widget *sink) |
251 | { | 251 | { |
252 | int reg = snd_soc_read(source->codec, WM8994_CLOCKING_1); | 252 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); |
253 | int reg = snd_soc_read(codec, WM8994_CLOCKING_1); | ||
253 | const char *clk; | 254 | const char *clk; |
254 | 255 | ||
255 | /* Check what we're currently using for CLK_SYS */ | 256 | /* Check what we're currently using for CLK_SYS */ |
@@ -806,7 +807,7 @@ static void active_dereference(struct snd_soc_codec *codec) | |||
806 | static int clk_sys_event(struct snd_soc_dapm_widget *w, | 807 | static int clk_sys_event(struct snd_soc_dapm_widget *w, |
807 | struct snd_kcontrol *kcontrol, int event) | 808 | struct snd_kcontrol *kcontrol, int event) |
808 | { | 809 | { |
809 | struct snd_soc_codec *codec = w->codec; | 810 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
810 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 811 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
811 | 812 | ||
812 | switch (event) { | 813 | switch (event) { |
@@ -981,7 +982,7 @@ static void vmid_dereference(struct snd_soc_codec *codec) | |||
981 | static int vmid_event(struct snd_soc_dapm_widget *w, | 982 | static int vmid_event(struct snd_soc_dapm_widget *w, |
982 | struct snd_kcontrol *kcontrol, int event) | 983 | struct snd_kcontrol *kcontrol, int event) |
983 | { | 984 | { |
984 | struct snd_soc_codec *codec = w->codec; | 985 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
985 | 986 | ||
986 | switch (event) { | 987 | switch (event) { |
987 | case SND_SOC_DAPM_PRE_PMU: | 988 | case SND_SOC_DAPM_PRE_PMU: |
@@ -1037,7 +1038,7 @@ static bool wm8994_check_class_w_digital(struct snd_soc_codec *codec) | |||
1037 | static int aif1clk_ev(struct snd_soc_dapm_widget *w, | 1038 | static int aif1clk_ev(struct snd_soc_dapm_widget *w, |
1038 | struct snd_kcontrol *kcontrol, int event) | 1039 | struct snd_kcontrol *kcontrol, int event) |
1039 | { | 1040 | { |
1040 | struct snd_soc_codec *codec = w->codec; | 1041 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1041 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 1042 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
1042 | struct wm8994 *control = wm8994->wm8994; | 1043 | struct wm8994 *control = wm8994->wm8994; |
1043 | int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA; | 1044 | int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA; |
@@ -1135,7 +1136,7 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w, | |||
1135 | static int aif2clk_ev(struct snd_soc_dapm_widget *w, | 1136 | static int aif2clk_ev(struct snd_soc_dapm_widget *w, |
1136 | struct snd_kcontrol *kcontrol, int event) | 1137 | struct snd_kcontrol *kcontrol, int event) |
1137 | { | 1138 | { |
1138 | struct snd_soc_codec *codec = w->codec; | 1139 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1139 | int i; | 1140 | int i; |
1140 | int dac; | 1141 | int dac; |
1141 | int adc; | 1142 | int adc; |
@@ -1220,7 +1221,7 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w, | |||
1220 | static int aif1clk_late_ev(struct snd_soc_dapm_widget *w, | 1221 | static int aif1clk_late_ev(struct snd_soc_dapm_widget *w, |
1221 | struct snd_kcontrol *kcontrol, int event) | 1222 | struct snd_kcontrol *kcontrol, int event) |
1222 | { | 1223 | { |
1223 | struct snd_soc_codec *codec = w->codec; | 1224 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1224 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 1225 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
1225 | 1226 | ||
1226 | switch (event) { | 1227 | switch (event) { |
@@ -1238,7 +1239,7 @@ static int aif1clk_late_ev(struct snd_soc_dapm_widget *w, | |||
1238 | static int aif2clk_late_ev(struct snd_soc_dapm_widget *w, | 1239 | static int aif2clk_late_ev(struct snd_soc_dapm_widget *w, |
1239 | struct snd_kcontrol *kcontrol, int event) | 1240 | struct snd_kcontrol *kcontrol, int event) |
1240 | { | 1241 | { |
1241 | struct snd_soc_codec *codec = w->codec; | 1242 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1242 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 1243 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
1243 | 1244 | ||
1244 | switch (event) { | 1245 | switch (event) { |
@@ -1256,7 +1257,7 @@ static int aif2clk_late_ev(struct snd_soc_dapm_widget *w, | |||
1256 | static int late_enable_ev(struct snd_soc_dapm_widget *w, | 1257 | static int late_enable_ev(struct snd_soc_dapm_widget *w, |
1257 | struct snd_kcontrol *kcontrol, int event) | 1258 | struct snd_kcontrol *kcontrol, int event) |
1258 | { | 1259 | { |
1259 | struct snd_soc_codec *codec = w->codec; | 1260 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1260 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 1261 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
1261 | 1262 | ||
1262 | switch (event) { | 1263 | switch (event) { |
@@ -1289,7 +1290,7 @@ static int late_enable_ev(struct snd_soc_dapm_widget *w, | |||
1289 | static int late_disable_ev(struct snd_soc_dapm_widget *w, | 1290 | static int late_disable_ev(struct snd_soc_dapm_widget *w, |
1290 | struct snd_kcontrol *kcontrol, int event) | 1291 | struct snd_kcontrol *kcontrol, int event) |
1291 | { | 1292 | { |
1292 | struct snd_soc_codec *codec = w->codec; | 1293 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1293 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 1294 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
1294 | 1295 | ||
1295 | switch (event) { | 1296 | switch (event) { |
@@ -1331,7 +1332,7 @@ static int micbias_ev(struct snd_soc_dapm_widget *w, | |||
1331 | static int dac_ev(struct snd_soc_dapm_widget *w, | 1332 | static int dac_ev(struct snd_soc_dapm_widget *w, |
1332 | struct snd_kcontrol *kcontrol, int event) | 1333 | struct snd_kcontrol *kcontrol, int event) |
1333 | { | 1334 | { |
1334 | struct snd_soc_codec *codec = w->codec; | 1335 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1335 | unsigned int mask = 1 << w->shift; | 1336 | unsigned int mask = 1 << w->shift; |
1336 | 1337 | ||
1337 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | 1338 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, |
@@ -1372,7 +1373,7 @@ SOC_DAPM_SINGLE("DAC1 Switch", WM8994_SPEAKER_MIXER, 0, 1, 0), | |||
1372 | static int post_ev(struct snd_soc_dapm_widget *w, | 1373 | static int post_ev(struct snd_soc_dapm_widget *w, |
1373 | struct snd_kcontrol *kcontrol, int event) | 1374 | struct snd_kcontrol *kcontrol, int event) |
1374 | { | 1375 | { |
1375 | struct snd_soc_codec *codec = w->codec; | 1376 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1376 | dev_dbg(codec->dev, "SRC status: %x\n", | 1377 | dev_dbg(codec->dev, "SRC status: %x\n", |
1377 | snd_soc_read(codec, | 1378 | snd_soc_read(codec, |
1378 | WM8994_RATE_STATUS)); | 1379 | WM8994_RATE_STATUS)); |
diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c index c280f0a3a424..79e1aead5131 100644 --- a/sound/soc/codecs/wm8995.c +++ b/sound/soc/codecs/wm8995.c | |||
@@ -534,10 +534,11 @@ static void wm8995_update_class_w(struct snd_soc_codec *codec) | |||
534 | static int check_clk_sys(struct snd_soc_dapm_widget *source, | 534 | static int check_clk_sys(struct snd_soc_dapm_widget *source, |
535 | struct snd_soc_dapm_widget *sink) | 535 | struct snd_soc_dapm_widget *sink) |
536 | { | 536 | { |
537 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
537 | unsigned int reg; | 538 | unsigned int reg; |
538 | const char *clk; | 539 | const char *clk; |
539 | 540 | ||
540 | reg = snd_soc_read(source->codec, WM8995_CLOCKING_1); | 541 | reg = snd_soc_read(codec, WM8995_CLOCKING_1); |
541 | /* Check what we're currently using for CLK_SYS */ | 542 | /* Check what we're currently using for CLK_SYS */ |
542 | if (reg & WM8995_SYSCLK_SRC) | 543 | if (reg & WM8995_SYSCLK_SRC) |
543 | clk = "AIF2CLK"; | 544 | clk = "AIF2CLK"; |
@@ -560,9 +561,7 @@ static int wm8995_put_class_w(struct snd_kcontrol *kcontrol, | |||
560 | static int hp_supply_event(struct snd_soc_dapm_widget *w, | 561 | static int hp_supply_event(struct snd_soc_dapm_widget *w, |
561 | struct snd_kcontrol *kcontrol, int event) | 562 | struct snd_kcontrol *kcontrol, int event) |
562 | { | 563 | { |
563 | struct snd_soc_codec *codec; | 564 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
564 | |||
565 | codec = w->codec; | ||
566 | 565 | ||
567 | switch (event) { | 566 | switch (event) { |
568 | case SND_SOC_DAPM_PRE_PMU: | 567 | case SND_SOC_DAPM_PRE_PMU: |
@@ -611,10 +610,9 @@ static void dc_servo_cmd(struct snd_soc_codec *codec, | |||
611 | static int hp_event(struct snd_soc_dapm_widget *w, | 610 | static int hp_event(struct snd_soc_dapm_widget *w, |
612 | struct snd_kcontrol *kcontrol, int event) | 611 | struct snd_kcontrol *kcontrol, int event) |
613 | { | 612 | { |
614 | struct snd_soc_codec *codec; | 613 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
615 | unsigned int reg; | 614 | unsigned int reg; |
616 | 615 | ||
617 | codec = w->codec; | ||
618 | reg = snd_soc_read(codec, WM8995_ANALOGUE_HP_1); | 616 | reg = snd_soc_read(codec, WM8995_ANALOGUE_HP_1); |
619 | 617 | ||
620 | switch (event) { | 618 | switch (event) { |
@@ -761,9 +759,7 @@ static int configure_clock(struct snd_soc_codec *codec) | |||
761 | static int clk_sys_event(struct snd_soc_dapm_widget *w, | 759 | static int clk_sys_event(struct snd_soc_dapm_widget *w, |
762 | struct snd_kcontrol *kcontrol, int event) | 760 | struct snd_kcontrol *kcontrol, int event) |
763 | { | 761 | { |
764 | struct snd_soc_codec *codec; | 762 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
765 | |||
766 | codec = w->codec; | ||
767 | 763 | ||
768 | switch (event) { | 764 | switch (event) { |
769 | case SND_SOC_DAPM_PRE_PMU: | 765 | case SND_SOC_DAPM_PRE_PMU: |
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index b1dcc11c1b23..dc92d5e4e942 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c | |||
@@ -599,7 +599,7 @@ static void wm8996_bg_disable(struct snd_soc_codec *codec) | |||
599 | static int bg_event(struct snd_soc_dapm_widget *w, | 599 | static int bg_event(struct snd_soc_dapm_widget *w, |
600 | struct snd_kcontrol *kcontrol, int event) | 600 | struct snd_kcontrol *kcontrol, int event) |
601 | { | 601 | { |
602 | struct snd_soc_codec *codec = w->codec; | 602 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
603 | int ret = 0; | 603 | int ret = 0; |
604 | 604 | ||
605 | switch (event) { | 605 | switch (event) { |
@@ -634,7 +634,8 @@ static int cp_event(struct snd_soc_dapm_widget *w, | |||
634 | static int rmv_short_event(struct snd_soc_dapm_widget *w, | 634 | static int rmv_short_event(struct snd_soc_dapm_widget *w, |
635 | struct snd_kcontrol *kcontrol, int event) | 635 | struct snd_kcontrol *kcontrol, int event) |
636 | { | 636 | { |
637 | struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(w->codec); | 637 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
638 | struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); | ||
638 | 639 | ||
639 | /* Record which outputs we enabled */ | 640 | /* Record which outputs we enabled */ |
640 | switch (event) { | 641 | switch (event) { |
@@ -758,7 +759,8 @@ static void wm8996_seq_notifier(struct snd_soc_dapm_context *dapm, | |||
758 | static int dcs_start(struct snd_soc_dapm_widget *w, | 759 | static int dcs_start(struct snd_soc_dapm_widget *w, |
759 | struct snd_kcontrol *kcontrol, int event) | 760 | struct snd_kcontrol *kcontrol, int event) |
760 | { | 761 | { |
761 | struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(w->codec); | 762 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
763 | struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); | ||
762 | 764 | ||
763 | switch (event) { | 765 | switch (event) { |
764 | case SND_SOC_DAPM_POST_PMU: | 766 | case SND_SOC_DAPM_POST_PMU: |
diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c index 7e8bfe27566b..a4d11770630c 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c | |||
@@ -84,7 +84,7 @@ static const struct reg_default wm8997_sysclk_reva_patch[] = { | |||
84 | static int wm8997_sysclk_ev(struct snd_soc_dapm_widget *w, | 84 | static int wm8997_sysclk_ev(struct snd_soc_dapm_widget *w, |
85 | struct snd_kcontrol *kcontrol, int event) | 85 | struct snd_kcontrol *kcontrol, int event) |
86 | { | 86 | { |
87 | struct snd_soc_codec *codec = w->codec; | 87 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
88 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | 88 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); |
89 | struct regmap *regmap = arizona->regmap; | 89 | struct regmap *regmap = arizona->regmap; |
90 | const struct reg_default *patch = NULL; | 90 | const struct reg_default *patch = NULL; |
@@ -610,13 +610,16 @@ SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1, | |||
610 | 610 | ||
611 | SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM, | 611 | SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM, |
612 | ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, | 612 | ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, |
613 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 613 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
614 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
614 | SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM, | 615 | SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM, |
615 | ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, | 616 | ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev, |
616 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 617 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
618 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
617 | SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1, | 619 | SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1, |
618 | ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 620 | ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
619 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 621 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD | |
622 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU), | ||
620 | SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, | 623 | SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, |
621 | ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 624 | ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
622 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 625 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index b1d946facd57..13a3f335ea5b 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
@@ -734,7 +734,7 @@ static int configure_clock(struct snd_soc_codec *codec) | |||
734 | static int clk_sys_event(struct snd_soc_dapm_widget *w, | 734 | static int clk_sys_event(struct snd_soc_dapm_widget *w, |
735 | struct snd_kcontrol *kcontrol, int event) | 735 | struct snd_kcontrol *kcontrol, int event) |
736 | { | 736 | { |
737 | struct snd_soc_codec *codec = w->codec; | 737 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
738 | struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); | 738 | struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); |
739 | 739 | ||
740 | /* This should be done on init() for bypass paths */ | 740 | /* This should be done on init() for bypass paths */ |
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index 6ffe8dc4f3fa..60d243c904f5 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c | |||
@@ -254,7 +254,7 @@ SOC_SINGLE_TLV("MIXOUTR IN2B Volume", WM9090_OUTPUT_MIXER4, 0, 3, 1, | |||
254 | static int hp_ev(struct snd_soc_dapm_widget *w, | 254 | static int hp_ev(struct snd_soc_dapm_widget *w, |
255 | struct snd_kcontrol *kcontrol, int event) | 255 | struct snd_kcontrol *kcontrol, int event) |
256 | { | 256 | { |
257 | struct snd_soc_codec *codec = w->codec; | 257 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
258 | unsigned int reg = snd_soc_read(codec, WM9090_ANALOGUE_HP_0); | 258 | unsigned int reg = snd_soc_read(codec, WM9090_ANALOGUE_HP_0); |
259 | 259 | ||
260 | switch (event) { | 260 | switch (event) { |
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index 6ab1122a3872..68222917b396 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -217,7 +217,7 @@ SOC_SINGLE("3D Depth", AC97_REC_GAIN_MIC, 0, 15, 1), | |||
217 | static int wm9713_voice_shutdown(struct snd_soc_dapm_widget *w, | 217 | static int wm9713_voice_shutdown(struct snd_soc_dapm_widget *w, |
218 | struct snd_kcontrol *kcontrol, int event) | 218 | struct snd_kcontrol *kcontrol, int event) |
219 | { | 219 | { |
220 | struct snd_soc_codec *codec = w->codec; | 220 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
221 | u16 status, rate; | 221 | u16 status, rate; |
222 | 222 | ||
223 | if (WARN_ON(event != SND_SOC_DAPM_PRE_PMD)) | 223 | if (WARN_ON(event != SND_SOC_DAPM_PRE_PMD)) |
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 720d6e852986..ff67b334065b 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c | |||
@@ -1373,7 +1373,7 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w, | |||
1373 | struct snd_kcontrol *kcontrol, | 1373 | struct snd_kcontrol *kcontrol, |
1374 | int event) | 1374 | int event) |
1375 | { | 1375 | { |
1376 | struct snd_soc_codec *codec = w->codec; | 1376 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1377 | struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); | 1377 | struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); |
1378 | struct wm_adsp *dsp = &dsps[w->shift]; | 1378 | struct wm_adsp *dsp = &dsps[w->shift]; |
1379 | struct wm_adsp_alg_region *alg_region; | 1379 | struct wm_adsp_alg_region *alg_region; |
@@ -1605,7 +1605,7 @@ err: | |||
1605 | int wm_adsp2_early_event(struct snd_soc_dapm_widget *w, | 1605 | int wm_adsp2_early_event(struct snd_soc_dapm_widget *w, |
1606 | struct snd_kcontrol *kcontrol, int event) | 1606 | struct snd_kcontrol *kcontrol, int event) |
1607 | { | 1607 | { |
1608 | struct snd_soc_codec *codec = w->codec; | 1608 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1609 | struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); | 1609 | struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); |
1610 | struct wm_adsp *dsp = &dsps[w->shift]; | 1610 | struct wm_adsp *dsp = &dsps[w->shift]; |
1611 | 1611 | ||
@@ -1626,7 +1626,7 @@ EXPORT_SYMBOL_GPL(wm_adsp2_early_event); | |||
1626 | int wm_adsp2_event(struct snd_soc_dapm_widget *w, | 1626 | int wm_adsp2_event(struct snd_soc_dapm_widget *w, |
1627 | struct snd_kcontrol *kcontrol, int event) | 1627 | struct snd_kcontrol *kcontrol, int event) |
1628 | { | 1628 | { |
1629 | struct snd_soc_codec *codec = w->codec; | 1629 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
1630 | struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); | 1630 | struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); |
1631 | struct wm_adsp *dsp = &dsps[w->shift]; | 1631 | struct wm_adsp *dsp = &dsps[w->shift]; |
1632 | struct wm_adsp_alg_region *alg_region; | 1632 | struct wm_adsp_alg_region *alg_region; |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 374537d5e179..8366e19657a7 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -500,7 +500,7 @@ SOC_SINGLE_TLV("LINEOUT2 Volume", WM8993_LINE_OUTPUTS_VOLUME, 0, 1, 1, | |||
500 | static int hp_supply_event(struct snd_soc_dapm_widget *w, | 500 | static int hp_supply_event(struct snd_soc_dapm_widget *w, |
501 | struct snd_kcontrol *kcontrol, int event) | 501 | struct snd_kcontrol *kcontrol, int event) |
502 | { | 502 | { |
503 | struct snd_soc_codec *codec = w->codec; | 503 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
504 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); | 504 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); |
505 | 505 | ||
506 | switch (event) { | 506 | switch (event) { |
@@ -542,7 +542,7 @@ static int hp_supply_event(struct snd_soc_dapm_widget *w, | |||
542 | static int hp_event(struct snd_soc_dapm_widget *w, | 542 | static int hp_event(struct snd_soc_dapm_widget *w, |
543 | struct snd_kcontrol *kcontrol, int event) | 543 | struct snd_kcontrol *kcontrol, int event) |
544 | { | 544 | { |
545 | struct snd_soc_codec *codec = w->codec; | 545 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
546 | unsigned int reg = snd_soc_read(codec, WM8993_ANALOGUE_HP_0); | 546 | unsigned int reg = snd_soc_read(codec, WM8993_ANALOGUE_HP_0); |
547 | 547 | ||
548 | switch (event) { | 548 | switch (event) { |
@@ -594,7 +594,7 @@ static int hp_event(struct snd_soc_dapm_widget *w, | |||
594 | static int earpiece_event(struct snd_soc_dapm_widget *w, | 594 | static int earpiece_event(struct snd_soc_dapm_widget *w, |
595 | struct snd_kcontrol *control, int event) | 595 | struct snd_kcontrol *control, int event) |
596 | { | 596 | { |
597 | struct snd_soc_codec *codec = w->codec; | 597 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
598 | u16 reg = snd_soc_read(codec, WM8993_ANTIPOP1) & ~WM8993_HPOUT2_IN_ENA; | 598 | u16 reg = snd_soc_read(codec, WM8993_ANTIPOP1) & ~WM8993_HPOUT2_IN_ENA; |
599 | 599 | ||
600 | switch (event) { | 600 | switch (event) { |
@@ -619,7 +619,7 @@ static int earpiece_event(struct snd_soc_dapm_widget *w, | |||
619 | static int lineout_event(struct snd_soc_dapm_widget *w, | 619 | static int lineout_event(struct snd_soc_dapm_widget *w, |
620 | struct snd_kcontrol *control, int event) | 620 | struct snd_kcontrol *control, int event) |
621 | { | 621 | { |
622 | struct snd_soc_codec *codec = w->codec; | 622 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
623 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); | 623 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); |
624 | bool *flag; | 624 | bool *flag; |
625 | 625 | ||
@@ -649,7 +649,7 @@ static int lineout_event(struct snd_soc_dapm_widget *w, | |||
649 | static int micbias_event(struct snd_soc_dapm_widget *w, | 649 | static int micbias_event(struct snd_soc_dapm_widget *w, |
650 | struct snd_kcontrol *kcontrol, int event) | 650 | struct snd_kcontrol *kcontrol, int event) |
651 | { | 651 | { |
652 | struct snd_soc_codec *codec = w->codec; | 652 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
653 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); | 653 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); |
654 | 654 | ||
655 | switch (w->shift) { | 655 | switch (w->shift) { |
diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c index 396dbd51a64f..a9615a574546 100644 --- a/sound/soc/pxa/mioa701_wm9713.c +++ b/sound/soc/pxa/mioa701_wm9713.c | |||
@@ -81,7 +81,7 @@ static int rear_amp_power(struct snd_soc_codec *codec, int power) | |||
81 | static int rear_amp_event(struct snd_soc_dapm_widget *widget, | 81 | static int rear_amp_event(struct snd_soc_dapm_widget *widget, |
82 | struct snd_kcontrol *kctl, int event) | 82 | struct snd_kcontrol *kctl, int event) |
83 | { | 83 | { |
84 | struct snd_soc_codec *codec = widget->codec; | 84 | struct snd_soc_codec *codec = widget->dapm->card->rtd[0].codec; |
85 | 85 | ||
86 | return rear_amp_power(codec, SND_SOC_DAPM_EVENT_ON(event)); | 86 | return rear_amp_power(codec, SND_SOC_DAPM_EVENT_ON(event)); |
87 | } | 87 | } |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index ff0bce1a2d2c..b6f88202b8c9 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -3139,8 +3139,6 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
3139 | } | 3139 | } |
3140 | 3140 | ||
3141 | w->dapm = dapm; | 3141 | w->dapm = dapm; |
3142 | if (dapm->component) | ||
3143 | w->codec = dapm->component->codec; | ||
3144 | INIT_LIST_HEAD(&w->sources); | 3142 | INIT_LIST_HEAD(&w->sources); |
3145 | INIT_LIST_HEAD(&w->sinks); | 3143 | INIT_LIST_HEAD(&w->sinks); |
3146 | INIT_LIST_HEAD(&w->list); | 3144 | INIT_LIST_HEAD(&w->list); |