]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Merge branch 'topic/arizona' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
authorMark Brown <broonie@kernel.org>
Tue, 27 Jan 2015 23:50:47 +0000 (23:50 +0000)
committerMark Brown <broonie@kernel.org>
Tue, 27 Jan 2015 23:52:44 +0000 (23:52 +0000)
53 files changed:
include/sound/rt5677.h
include/sound/soc-dapm.h
sound/soc/codecs/88pm860x-codec.c
sound/soc/codecs/ak4671.c
sound/soc/codecs/alc5623.c
sound/soc/codecs/alc5632.c
sound/soc/codecs/arizona.c
sound/soc/codecs/da732x.c
sound/soc/codecs/pcm3008.c
sound/soc/codecs/rt286.c
sound/soc/codecs/rt5631.c
sound/soc/codecs/rt5640.c
sound/soc/codecs/rt5645.c
sound/soc/codecs/rt5651.c
sound/soc/codecs/rt5670.c
sound/soc/codecs/rt5677.c
sound/soc/codecs/sgtl5000.c
sound/soc/codecs/sn95031.c
sound/soc/codecs/tlv320aic31xx.c
sound/soc/codecs/tlv320aic3x.c
sound/soc/codecs/tlv320dac33.c
sound/soc/codecs/twl4030.c
sound/soc/codecs/twl6040.c
sound/soc/codecs/wm2000.c
sound/soc/codecs/wm5100.c
sound/soc/codecs/wm5102.c
sound/soc/codecs/wm5110.c
sound/soc/codecs/wm8350.c
sound/soc/codecs/wm8400.c
sound/soc/codecs/wm8731.c
sound/soc/codecs/wm8770.c
sound/soc/codecs/wm8900.c
sound/soc/codecs/wm8903.c
sound/soc/codecs/wm8904.c
sound/soc/codecs/wm8955.c
sound/soc/codecs/wm8958-dsp2.c
sound/soc/codecs/wm8961.c
sound/soc/codecs/wm8962.c
sound/soc/codecs/wm8988.c
sound/soc/codecs/wm8990.c
sound/soc/codecs/wm8991.c
sound/soc/codecs/wm8993.c
sound/soc/codecs/wm8994.c
sound/soc/codecs/wm8995.c
sound/soc/codecs/wm8996.c
sound/soc/codecs/wm8997.c
sound/soc/codecs/wm9081.c
sound/soc/codecs/wm9090.c
sound/soc/codecs/wm9713.c
sound/soc/codecs/wm_adsp.c
sound/soc/codecs/wm_hubs.c
sound/soc/pxa/mioa701_wm9713.c
sound/soc/soc-dapm.c

index d9eb7d861cd0da77722e178b3c3f94ee88ba9b99..a6207043ac3c7f80f1def8b4fb2025f0dd1a05ca 100644 (file)
@@ -37,6 +37,9 @@ struct rt5677_platform_data {
                OFF, GPIO4, GPIO5 and GPIO6 respectively */
        unsigned int jd2_gpio;
        unsigned int jd3_gpio;
+
+       /* Set MICBIAS1 VDD 1v8 or 3v3 */
+       bool micbias1_vdd_3v3;
 };
 
 #endif
index 89823cfe6f043147b3798b78ac4034831d25c790..cc7104ab966019202fb65a7c5decd4472256c5b3 100644 (file)
@@ -526,7 +526,6 @@ struct snd_soc_dapm_widget {
        enum snd_soc_dapm_type id;
        const char *name;               /* widget name */
        const char *sname;      /* stream name */
-       struct snd_soc_codec *codec;
        struct list_head list;
        struct snd_soc_dapm_context *dapm;
 
index a2bf27f4baab6339f03fc2b040fe81b80bdb9714..a0f265327fdf8949e15b17187732d1da8702a7a9 100644 (file)
@@ -386,7 +386,7 @@ static int snd_soc_put_volsw_2r_out(struct snd_kcontrol *kcontrol,
 static int pm860x_rsync_event(struct snd_soc_dapm_widget *w,
                              struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        /*
         * 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,
 static int pm860x_dac_event(struct snd_soc_dapm_widget *w,
                            struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        unsigned int dac = 0;
        int data;
 
index 686cacb0e835aad904f79778ea83f65fabfab16b..632e89f793a78d2691dfb2e33b3516f0f483aeee 100644 (file)
@@ -163,7 +163,7 @@ static const struct snd_kcontrol_new ak4671_snd_controls[] = {
 static int ak4671_out2_event(struct snd_soc_dapm_widget *w,
                struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
index bdf8c5ac8ca460b8e07310674f90109cc6e6965a..0e357996864bd141f4d57283c03fba3b0e11b8d7 100644 (file)
@@ -55,18 +55,20 @@ static inline int alc5623_reset(struct snd_soc_codec *codec)
 static int amp_mixer_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+
        /* to power-on/off class-d amp generators/speaker */
        /* need to write to 'index-46h' register :        */
        /* so write index num (here 0x46) to reg 0x6a     */
        /* and then 0xffff/0 to reg 0x6c                  */
-       snd_soc_write(w->codec, ALC5623_HID_CTRL_INDEX, 0x46);
+       snd_soc_write(codec, ALC5623_HID_CTRL_INDEX, 0x46);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
-               snd_soc_write(w->codec, ALC5623_HID_CTRL_DATA, 0xFFFF);
+               snd_soc_write(codec, ALC5623_HID_CTRL_DATA, 0xFFFF);
                break;
        case SND_SOC_DAPM_POST_PMD:
-               snd_soc_write(w->codec, ALC5623_HID_CTRL_DATA, 0);
+               snd_soc_write(codec, ALC5623_HID_CTRL_DATA, 0);
                break;
        }
 
index d1fdbc266631b36aebf4c249bf2bea9e94c8064c..dd012c7b2d2c6f9dbbabfeb6c67f42d7c5806897 100644 (file)
@@ -116,18 +116,20 @@ static inline int alc5632_reset(struct regmap *map)
 static int amp_mixer_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+
        /* to power-on/off class-d amp generators/speaker */
        /* need to write to 'index-46h' register :        */
        /* so write index num (here 0x46) to reg 0x6a     */
        /* and then 0xffff/0 to reg 0x6c                  */
-       snd_soc_write(w->codec, ALC5632_HID_CTRL_INDEX, 0x46);
+       snd_soc_write(codec, ALC5632_HID_CTRL_INDEX, 0x46);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
-               snd_soc_write(w->codec, ALC5632_HID_CTRL_DATA, 0xFFFF);
+               snd_soc_write(codec, ALC5632_HID_CTRL_DATA, 0xFFFF);
                break;
        case SND_SOC_DAPM_POST_PMD:
-               snd_soc_write(w->codec, ALC5632_HID_CTRL_DATA, 0);
+               snd_soc_write(codec, ALC5632_HID_CTRL_DATA, 0);
                break;
        }
 
index 32bc609f23e44bcaf7d3c299e7f625d9953154a9..29202610dd0dd90d72329265633844a3d833d640 100644 (file)
@@ -84,7 +84,7 @@ static int arizona_spk_ev(struct snd_soc_dapm_widget *w,
                          struct snd_kcontrol *kcontrol,
                          int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
        struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
        bool manual_ena = false;
@@ -692,7 +692,8 @@ static void arizona_in_set_vu(struct snd_soc_codec *codec, int ena)
 int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
                  int event)
 {
-       struct arizona_priv *priv = snd_soc_codec_get_drvdata(w->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
        unsigned int reg;
 
        if (w->shift % 2)
@@ -705,25 +706,25 @@ int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
                priv->in_pending++;
                break;
        case SND_SOC_DAPM_POST_PMU:
-               snd_soc_update_bits(w->codec, reg, ARIZONA_IN1L_MUTE, 0);
+               snd_soc_update_bits(codec, reg, ARIZONA_IN1L_MUTE, 0);
 
                /* If this is the last input pending then allow VU */
                priv->in_pending--;
                if (priv->in_pending == 0) {
                        msleep(1);
-                       arizona_in_set_vu(w->codec, 1);
+                       arizona_in_set_vu(codec, 1);
                }
                break;
        case SND_SOC_DAPM_PRE_PMD:
-               snd_soc_update_bits(w->codec, reg,
+               snd_soc_update_bits(codec, reg,
                                    ARIZONA_IN1L_MUTE | ARIZONA_IN_VU,
                                    ARIZONA_IN1L_MUTE | ARIZONA_IN_VU);
                break;
        case SND_SOC_DAPM_POST_PMD:
                /* Disable volume updates if no inputs are enabled */
-               reg = snd_soc_read(w->codec, ARIZONA_INPUT_ENABLES);
+               reg = snd_soc_read(codec, ARIZONA_INPUT_ENABLES);
                if (reg == 0)
-                       arizona_in_set_vu(w->codec, 0);
+                       arizona_in_set_vu(codec, 0);
        }
 
        return 0;
@@ -734,7 +735,8 @@ int arizona_out_ev(struct snd_soc_dapm_widget *w,
                   struct snd_kcontrol *kcontrol,
                   int event)
 {
-       struct arizona_priv *priv = snd_soc_codec_get_drvdata(w->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
@@ -814,7 +816,8 @@ int arizona_hp_ev(struct snd_soc_dapm_widget *w,
                   struct snd_kcontrol *kcontrol,
                   int event)
 {
-       struct arizona_priv *priv = snd_soc_codec_get_drvdata(w->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
        struct arizona *arizona = priv->arizona;
        unsigned int mask = 1 << w->shift;
        unsigned int val;
index 61b2f9a2eef1b87d8daea13ab83d90779a883fc5..ffe96175a8a5ac62ee4721c1f17a54c305d447c7 100644 (file)
@@ -609,7 +609,7 @@ static const struct snd_kcontrol_new da732x_snd_controls[] = {
 static int da732x_adc_event(struct snd_soc_dapm_widget *w,
                            struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -663,7 +663,7 @@ static int da732x_adc_event(struct snd_soc_dapm_widget *w,
 static int da732x_out_pga_event(struct snd_soc_dapm_widget *w,
                                struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
index 7e73fa4b3183851f55d5660ce3e7ee4d95c549d5..8fb445f33f6f2a23c0d30f15c37ef590609c91cc 100644 (file)
@@ -32,7 +32,7 @@ static int pcm3008_dac_ev(struct snd_soc_dapm_widget *w,
                          struct snd_kcontrol *kcontrol,
                          int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct pcm3008_setup_data *setup = codec->dev->platform_data;
 
        gpio_set_value_cansleep(setup->pdda_pin,
@@ -45,7 +45,7 @@ static int pcm3008_adc_ev(struct snd_soc_dapm_widget *w,
                          struct snd_kcontrol *kcontrol,
                          int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct pcm3008_setup_data *setup = codec->dev->platform_data;
 
        gpio_set_value_cansleep(setup->pdad_pin,
index 2cd4fe463102d4532458e1ed3402abd276be8fc1..8104d2285602b9fcedbbfa440c2f9a1f22960105 100644 (file)
@@ -403,7 +403,8 @@ EXPORT_SYMBOL_GPL(rt286_mic_detect);
 static int is_mclk_mode(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
-       struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(source->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
+       struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec);
 
        if (rt286->clk_id == RT286_SCLK_S_MCLK)
                return 1;
@@ -417,6 +418,8 @@ static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, 0, 1000, 0);
 static const struct snd_kcontrol_new rt286_snd_controls[] = {
        SOC_DOUBLE_R_TLV("DAC0 Playback Volume", RT286_DACL_GAIN,
                            RT286_DACR_GAIN, 0, 0x7f, 0, out_vol_tlv),
+       SOC_DOUBLE_R("ADC0 Capture Switch", RT286_ADCL_GAIN,
+                           RT286_ADCR_GAIN, 7, 1, 1),
        SOC_DOUBLE_R_TLV("ADC0 Capture Volume", RT286_ADCL_GAIN,
                            RT286_ADCR_GAIN, 0, 0x7f, 0, out_vol_tlv),
        SOC_SINGLE_TLV("AMIC Volume", RT286_MIC_GAIN,
@@ -500,7 +503,7 @@ SOC_DAPM_ENUM("SPO source", rt286_spo_enum);
 static int rt286_spk_event(struct snd_soc_dapm_widget *w,
                            struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -522,7 +525,7 @@ static int rt286_spk_event(struct snd_soc_dapm_widget *w,
 static int rt286_set_dmic1_event(struct snd_soc_dapm_widget *w,
                                  struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -538,36 +541,10 @@ static int rt286_set_dmic1_event(struct snd_soc_dapm_widget *w,
        return 0;
 }
 
-static int rt286_adc_event(struct snd_soc_dapm_widget *w,
-                            struct snd_kcontrol *kcontrol, int event)
-{
-       struct snd_soc_codec *codec = w->codec;
-       unsigned int nid;
-
-       nid = (w->reg >> 20) & 0xff;
-
-       switch (event) {
-       case SND_SOC_DAPM_POST_PMU:
-               snd_soc_update_bits(codec,
-                       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, nid, 0),
-                       0x7080, 0x7000);
-               break;
-       case SND_SOC_DAPM_PRE_PMD:
-               snd_soc_update_bits(codec,
-                       VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, nid, 0),
-                       0x7080, 0x7080);
-               break;
-       default:
-               return 0;
-       }
-
-       return 0;
-}
-
 static int rt286_vref_event(struct snd_soc_dapm_widget *w,
                             struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
@@ -585,7 +562,7 @@ static int rt286_vref_event(struct snd_soc_dapm_widget *w,
 static int rt286_ldo2_event(struct snd_soc_dapm_widget *w,
                             struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -604,7 +581,7 @@ static int rt286_ldo2_event(struct snd_soc_dapm_widget *w,
 static int rt286_mic1_event(struct snd_soc_dapm_widget *w,
                             struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
@@ -667,12 +644,10 @@ static const struct snd_soc_dapm_widget rt286_dapm_widgets[] = {
        SND_SOC_DAPM_ADC("ADC 1", NULL, SND_SOC_NOPM, 0, 0),
 
        /* ADC Mux */
-       SND_SOC_DAPM_MUX_E("ADC 0 Mux", RT286_SET_POWER(RT286_ADC_IN1), 0, 1,
-               &rt286_adc0_mux, rt286_adc_event, SND_SOC_DAPM_PRE_PMD |
-               SND_SOC_DAPM_POST_PMU),
-       SND_SOC_DAPM_MUX_E("ADC 1 Mux", RT286_SET_POWER(RT286_ADC_IN2), 0, 1,
-               &rt286_adc1_mux, rt286_adc_event, SND_SOC_DAPM_PRE_PMD |
-               SND_SOC_DAPM_POST_PMU),
+       SND_SOC_DAPM_MUX("ADC 0 Mux", RT286_SET_POWER(RT286_ADC_IN1), 0, 1,
+               &rt286_adc0_mux),
+       SND_SOC_DAPM_MUX("ADC 1 Mux", RT286_SET_POWER(RT286_ADC_IN2), 0, 1,
+               &rt286_adc1_mux),
 
        /* Audio Interface */
        SND_SOC_DAPM_AIF_IN("AIF1RX", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0),
@@ -861,10 +836,8 @@ static int rt286_hw_params(struct snd_pcm_substream *substream,
                RT286_I2S_CTRL1, 0x0018, d_len_code << 3);
        dev_dbg(codec->dev, "format val = 0x%x\n", val);
 
-       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-               snd_soc_update_bits(codec, RT286_DAC_FORMAT, 0x407f, val);
-       else
-               snd_soc_update_bits(codec, RT286_ADC_FORMAT, 0x407f, val);
+       snd_soc_update_bits(codec, RT286_DAC_FORMAT, 0x407f, val);
+       snd_soc_update_bits(codec, RT286_ADC_FORMAT, 0x407f, val);
 
        return 0;
 }
index 6d7b7ca7d530f034d2e972ba8070c03280e22bd0..c61852742ee30889c3fa482135acd1960324602f 100644 (file)
@@ -287,70 +287,78 @@ static const struct snd_kcontrol_new rt5631_snd_controls[] = {
 static int check_sysclk1_source(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int reg;
 
-       reg = snd_soc_read(source->codec, RT5631_GLOBAL_CLK_CTRL);
+       reg = snd_soc_read(codec, RT5631_GLOBAL_CLK_CTRL);
        return reg & RT5631_SYSCLK_SOUR_SEL_PLL;
 }
 
 static int check_dmic_used(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
-       struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(source->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
+       struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec);
        return rt5631->dmic_used_flag;
 }
 
 static int check_dacl_to_outmixl(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int reg;
 
-       reg = snd_soc_read(source->codec, RT5631_OUTMIXER_L_CTRL);
+       reg = snd_soc_read(codec, RT5631_OUTMIXER_L_CTRL);
        return !(reg & RT5631_M_DAC_L_TO_OUTMIXER_L);
 }
 
 static int check_dacr_to_outmixr(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int reg;
 
-       reg = snd_soc_read(source->codec, RT5631_OUTMIXER_R_CTRL);
+       reg = snd_soc_read(codec, RT5631_OUTMIXER_R_CTRL);
        return !(reg & RT5631_M_DAC_R_TO_OUTMIXER_R);
 }
 
 static int check_dacl_to_spkmixl(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int reg;
 
-       reg = snd_soc_read(source->codec, RT5631_SPK_MIXER_CTRL);
+       reg = snd_soc_read(codec, RT5631_SPK_MIXER_CTRL);
        return !(reg & RT5631_M_DAC_L_TO_SPKMIXER_L);
 }
 
 static int check_dacr_to_spkmixr(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int reg;
 
-       reg = snd_soc_read(source->codec, RT5631_SPK_MIXER_CTRL);
+       reg = snd_soc_read(codec, RT5631_SPK_MIXER_CTRL);
        return !(reg & RT5631_M_DAC_R_TO_SPKMIXER_R);
 }
 
 static int check_adcl_select(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int reg;
 
-       reg = snd_soc_read(source->codec, RT5631_ADC_REC_MIXER);
+       reg = snd_soc_read(codec, RT5631_ADC_REC_MIXER);
        return !(reg & RT5631_M_MIC1_TO_RECMIXER_L);
 }
 
 static int check_adcr_select(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int reg;
 
-       reg = snd_soc_read(source->codec, RT5631_ADC_REC_MIXER);
+       reg = snd_soc_read(codec, RT5631_ADC_REC_MIXER);
        return !(reg & RT5631_M_MIC2_TO_RECMIXER_R);
 }
 
@@ -556,7 +564,7 @@ static void depop_seq_mute_stage(struct snd_soc_codec *codec, int enable)
 static int hp_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -590,7 +598,7 @@ static int hp_event(struct snd_soc_dapm_widget *w,
 static int set_dmic_params(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec);
 
        switch (rt5631->rx_rate) {
index c3f2decd643c9ba7eb57eec8a644091bc440376d..b386958de042205a37d054fed66fc0bca3acf5a3 100644 (file)
@@ -458,7 +458,7 @@ static const struct snd_kcontrol_new rt5640_specific_snd_controls[] = {
 static int set_dmic_clk(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
        int idx = -EINVAL;
 
@@ -475,9 +475,10 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
 static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int val;
 
-       val = snd_soc_read(source->codec, RT5640_GLB_CLK);
+       val = snd_soc_read(codec, RT5640_GLB_CLK);
        val &= RT5640_SCLK_SRC_MASK;
        if (val == RT5640_SCLK_SRC_PLL1)
                return 1;
@@ -963,7 +964,7 @@ static void rt5640_pmu_depop(struct snd_soc_codec *codec)
 static int rt5640_hp_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -987,7 +988,7 @@ static int rt5640_hp_event(struct snd_soc_dapm_widget *w,
 static int rt5640_hp_power_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -1003,7 +1004,7 @@ static int rt5640_hp_power_event(struct snd_soc_dapm_widget *w,
 static int rt5640_hp_post_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
index 27141e2df878a65204fc31cc9486fb099319bd26..068dfd5c76407e77194d5d80f4904afcb492f2b2 100644 (file)
@@ -527,7 +527,7 @@ static const struct snd_kcontrol_new rt5645_snd_controls[] = {
 static int set_dmic_clk(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec);
        int idx = -EINVAL;
 
@@ -544,9 +544,10 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
 static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int val;
 
-       val = snd_soc_read(source->codec, RT5645_GLB_CLK);
+       val = snd_soc_read(codec, RT5645_GLB_CLK);
        val &= RT5645_SCLK_SRC_MASK;
        if (val == RT5645_SCLK_SRC_PLL1)
                return 1;
@@ -557,6 +558,7 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
 static int is_using_asrc(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int reg, shift, val;
 
        switch (source->shift) {
@@ -588,7 +590,7 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source,
                return 0;
        }
 
-       val = (snd_soc_read(source->codec, reg) >> shift) & 0xf;
+       val = (snd_soc_read(codec, reg) >> shift) & 0xf;
        switch (val) {
        case 1:
        case 2:
@@ -1144,7 +1146,7 @@ static void hp_amp_power(struct snd_soc_codec *codec, int on)
 static int rt5645_hp_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -1205,7 +1207,7 @@ static int rt5645_hp_event(struct snd_soc_dapm_widget *w,
 static int rt5645_spk_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -1232,7 +1234,7 @@ static int rt5645_spk_event(struct snd_soc_dapm_widget *w,
 static int rt5645_lout_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -1262,7 +1264,7 @@ static int rt5645_lout_event(struct snd_soc_dapm_widget *w,
 static int rt5645_bst2_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
index bb0a3ab5416cb2fe9fbc4e79c40e31340b374935..9f4c7be6d798691c70b953c65751904b68c66db1 100644 (file)
@@ -376,7 +376,7 @@ static const struct snd_kcontrol_new rt5651_snd_controls[] = {
 static int set_dmic_clk(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec);
        int idx = -EINVAL;
 
@@ -394,9 +394,10 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
 static int is_sysclk_from_pll(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int val;
 
-       val = snd_soc_read(source->codec, RT5651_GLB_CLK);
+       val = snd_soc_read(codec, RT5651_GLB_CLK);
        val &= RT5651_SCLK_SRC_MASK;
        if (val == RT5651_SCLK_SRC_PLL1)
                return 1;
@@ -731,7 +732,7 @@ static const struct snd_kcontrol_new rt5651_pdm_r_mux =
 static int rt5651_amp_power_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -769,7 +770,7 @@ static int rt5651_amp_power_event(struct snd_soc_dapm_widget *w,
 static int rt5651_hp_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -813,7 +814,8 @@ static int rt5651_hp_event(struct snd_soc_dapm_widget *w,
 static int rt5651_hp_post_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5651_priv *rt5651 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -833,7 +835,7 @@ static int rt5651_hp_post_event(struct snd_soc_dapm_widget *w,
 static int rt5651_bst1_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -856,7 +858,7 @@ static int rt5651_bst1_event(struct snd_soc_dapm_widget *w,
 static int rt5651_bst2_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -879,7 +881,7 @@ static int rt5651_bst2_event(struct snd_soc_dapm_widget *w,
 static int rt5651_bst3_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
index 8a0833de1665bcd39594d27bbc323e4ea3d35ba0..697aabf456a55dc4eb1f874cc9c4d684c50a2382 100644 (file)
@@ -498,7 +498,7 @@ static const struct snd_kcontrol_new rt5670_snd_controls[] = {
 static int set_dmic_clk(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
        int idx = -EINVAL;
 
@@ -515,9 +515,10 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
 static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int val;
 
-       val = snd_soc_read(source->codec, RT5670_GLB_CLK);
+       val = snd_soc_read(codec, RT5670_GLB_CLK);
        val &= RT5670_SCLK_SRC_MASK;
        if (val == RT5670_SCLK_SRC_PLL1)
                return 1;
@@ -528,6 +529,7 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
 static int is_using_asrc(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int reg, shift, val;
 
        switch (source->shift) {
@@ -563,7 +565,7 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source,
                return 0;
        }
 
-       val = (snd_soc_read(source->codec, reg) >> shift) & 0xf;
+       val = (snd_soc_read(codec, reg) >> shift) & 0xf;
        switch (val) {
        case 1:
        case 2:
@@ -1146,7 +1148,7 @@ static const struct snd_kcontrol_new rt5670_vad_adc_mux =
 static int rt5670_hp_power_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -1182,7 +1184,7 @@ static int rt5670_hp_power_event(struct snd_soc_dapm_widget *w,
 static int rt5670_hp_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -1232,7 +1234,7 @@ static int rt5670_hp_event(struct snd_soc_dapm_widget *w,
 static int rt5670_bst1_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
@@ -1255,7 +1257,7 @@ static int rt5670_bst1_event(struct snd_soc_dapm_widget *w,
 static int rt5670_bst2_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
index 81fe1464d2686661047aad6f2b9334f5d6a65c22..8f0bd86481d3923070f1d532d94bbd4b90f0830c 100644 (file)
@@ -895,7 +895,7 @@ static const struct snd_kcontrol_new rt5677_snd_controls[] = {
 static int set_dmic_clk(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
        int idx = rl6231_calc_dmic_clk(rt5677->sysclk);
 
@@ -910,7 +910,8 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
 static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
-       struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(source->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
+       struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
        unsigned int val;
 
        regmap_read(rt5677->regmap, RT5677_GLB_CLK1, &val);
@@ -921,6 +922,101 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
                return 0;
 }
 
+static int is_using_asrc(struct snd_soc_dapm_widget *source,
+                        struct snd_soc_dapm_widget *sink)
+{
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
+       struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
+       unsigned int reg, shift, val;
+
+       if (source->reg == RT5677_ASRC_1) {
+               switch (source->shift) {
+               case 12:
+                       reg = RT5677_ASRC_4;
+                       shift = 0;
+                       break;
+               case 13:
+                       reg = RT5677_ASRC_4;
+                       shift = 4;
+                       break;
+               case 14:
+                       reg = RT5677_ASRC_4;
+                       shift = 8;
+                       break;
+               case 15:
+                       reg = RT5677_ASRC_4;
+                       shift = 12;
+                       break;
+               default:
+                       return 0;
+               }
+       } else {
+               switch (source->shift) {
+               case 0:
+                       reg = RT5677_ASRC_6;
+                       shift = 8;
+                       break;
+               case 1:
+                       reg = RT5677_ASRC_6;
+                       shift = 12;
+                       break;
+               case 2:
+                       reg = RT5677_ASRC_5;
+                       shift = 0;
+                       break;
+               case 3:
+                       reg = RT5677_ASRC_5;
+                       shift = 4;
+                       break;
+               case 4:
+                       reg = RT5677_ASRC_5;
+                       shift = 8;
+                       break;
+               case 5:
+                       reg = RT5677_ASRC_5;
+                       shift = 12;
+                       break;
+               case 12:
+                       reg = RT5677_ASRC_3;
+                       shift = 0;
+                       break;
+               case 13:
+                       reg = RT5677_ASRC_3;
+                       shift = 4;
+                       break;
+               case 14:
+                       reg = RT5677_ASRC_3;
+                       shift = 12;
+                       break;
+               default:
+                       return 0;
+               }
+       }
+
+       regmap_read(rt5677->regmap, reg, &val);
+       val = (val >> shift) & 0xf;
+
+       switch (val) {
+       case 1 ... 6:
+               return 1;
+       default:
+               return 0;
+       }
+
+}
+
+static int can_use_asrc(struct snd_soc_dapm_widget *source,
+                        struct snd_soc_dapm_widget *sink)
+{
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
+       struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
+
+       if (rt5677->sysclk > rt5677->lrck[RT5677_AIF1] * 384)
+               return 1;
+
+       return 0;
+}
+
 /* Digital Mixer */
 static const struct snd_kcontrol_new rt5677_sto1_adc_l_mix[] = {
        SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO1_ADC_MIXER,
@@ -2030,7 +2126,7 @@ static const struct snd_kcontrol_new rt5677_if2_dac7_tdm_sel_mux =
 static int rt5677_bst1_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -2054,7 +2150,7 @@ static int rt5677_bst1_event(struct snd_soc_dapm_widget *w,
 static int rt5677_bst2_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -2078,14 +2174,18 @@ static int rt5677_bst2_event(struct snd_soc_dapm_widget *w,
 static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
-       case SND_SOC_DAPM_POST_PMU:
+       case SND_SOC_DAPM_PRE_PMU:
                regmap_update_bits(rt5677->regmap, RT5677_PLL1_CTRL2, 0x2, 0x2);
+               break;
+
+       case SND_SOC_DAPM_POST_PMU:
                regmap_update_bits(rt5677->regmap, RT5677_PLL1_CTRL2, 0x2, 0x0);
                break;
+
        default:
                return 0;
        }
@@ -2096,14 +2196,18 @@ static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w,
 static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
-       case SND_SOC_DAPM_POST_PMU:
+       case SND_SOC_DAPM_PRE_PMU:
                regmap_update_bits(rt5677->regmap, RT5677_PLL2_CTRL2, 0x2, 0x2);
+               break;
+
+       case SND_SOC_DAPM_POST_PMU:
                regmap_update_bits(rt5677->regmap, RT5677_PLL2_CTRL2, 0x2, 0x0);
                break;
+
        default:
                return 0;
        }
@@ -2114,7 +2218,7 @@ static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w,
 static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -2141,7 +2245,7 @@ static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w,
 static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
        unsigned int value;
 
@@ -2164,7 +2268,7 @@ static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w,
 static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
        unsigned int value;
 
@@ -2187,7 +2291,7 @@ static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w,
 static int rt5677_vref_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -2211,9 +2315,50 @@ static int rt5677_vref_event(struct snd_soc_dapm_widget *w,
 
 static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = {
        SND_SOC_DAPM_SUPPLY("PLL1", RT5677_PWR_ANLG2, RT5677_PWR_PLL1_BIT,
-               0, rt5677_set_pll1_event, SND_SOC_DAPM_POST_PMU),
+               0, rt5677_set_pll1_event, SND_SOC_DAPM_PRE_PMU |
+               SND_SOC_DAPM_POST_PMU),
        SND_SOC_DAPM_SUPPLY("PLL2", RT5677_PWR_ANLG2, RT5677_PWR_PLL2_BIT,
-               0, rt5677_set_pll2_event, SND_SOC_DAPM_POST_PMU),
+               0, rt5677_set_pll2_event, SND_SOC_DAPM_PRE_PMU |
+               SND_SOC_DAPM_POST_PMU),
+
+       /* ASRC */
+       SND_SOC_DAPM_SUPPLY_S("I2S1 ASRC", 1, RT5677_ASRC_1, 0, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY_S("I2S2 ASRC", 1, RT5677_ASRC_1, 1, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY_S("I2S3 ASRC", 1, RT5677_ASRC_1, 2, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY_S("I2S4 ASRC", 1, RT5677_ASRC_1, 3, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY_S("DAC STO ASRC", 1, RT5677_ASRC_2, 14, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY_S("DAC MONO2 L ASRC", 1, RT5677_ASRC_2, 13, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("DAC MONO2 R ASRC", 1, RT5677_ASRC_2, 12, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("DAC MONO3 L ASRC", 1, RT5677_ASRC_1, 15, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("DAC MONO3 R ASRC", 1, RT5677_ASRC_1, 14, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("DAC MONO4 L ASRC", 1, RT5677_ASRC_1, 13, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("DAC MONO4 R ASRC", 1, RT5677_ASRC_1, 12, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("DMIC STO1 ASRC", 1, RT5677_ASRC_2, 11, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("DMIC STO2 ASRC", 1, RT5677_ASRC_2, 10, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("DMIC STO3 ASRC", 1, RT5677_ASRC_2, 9, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("DMIC STO4 ASRC", 1, RT5677_ASRC_2, 8, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("DMIC MONO L ASRC", 1, RT5677_ASRC_2, 7, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("DMIC MONO R ASRC", 1, RT5677_ASRC_2, 6, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("ADC STO1 ASRC", 1, RT5677_ASRC_2, 5, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY_S("ADC STO2 ASRC", 1, RT5677_ASRC_2, 4, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY_S("ADC STO3 ASRC", 1, RT5677_ASRC_2, 3, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY_S("ADC STO4 ASRC", 1, RT5677_ASRC_2, 2, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY_S("ADC MONO L ASRC", 1, RT5677_ASRC_2, 1, 0, NULL,
+               0),
+       SND_SOC_DAPM_SUPPLY_S("ADC MONO R ASRC", 1, RT5677_ASRC_2, 0, 0, NULL,
+               0),
 
        /* Input Side */
        /* micbias */
@@ -2645,10 +2790,18 @@ static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = {
        /* DAC Mixer */
        SND_SOC_DAPM_SUPPLY("dac stereo1 filter", RT5677_PWR_DIG2,
                RT5677_PWR_DAC_S1F_BIT, 0, NULL, 0),
-       SND_SOC_DAPM_SUPPLY("dac mono left filter", RT5677_PWR_DIG2,
+       SND_SOC_DAPM_SUPPLY("dac mono2 left filter", RT5677_PWR_DIG2,
                RT5677_PWR_DAC_M2F_L_BIT, 0, NULL, 0),
-       SND_SOC_DAPM_SUPPLY("dac mono right filter", RT5677_PWR_DIG2,
+       SND_SOC_DAPM_SUPPLY("dac mono2 right filter", RT5677_PWR_DIG2,
                RT5677_PWR_DAC_M2F_R_BIT, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY("dac mono3 left filter", RT5677_PWR_DIG2,
+               RT5677_PWR_DAC_M3F_L_BIT, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY("dac mono3 right filter", RT5677_PWR_DIG2,
+               RT5677_PWR_DAC_M3F_R_BIT, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY("dac mono4 left filter", RT5677_PWR_DIG2,
+               RT5677_PWR_DAC_M4F_L_BIT, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY("dac mono4 right filter", RT5677_PWR_DIG2,
+               RT5677_PWR_DAC_M4F_R_BIT, 0, NULL, 0),
 
        SND_SOC_DAPM_MIXER("Stereo DAC MIXL", SND_SOC_NOPM, 0, 0,
                rt5677_sto1_dac_l_mix, ARRAY_SIZE(rt5677_sto1_dac_l_mix)),
@@ -2721,6 +2874,31 @@ static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = {
 };
 
 static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
+       { "Stereo1 DMIC Mux", NULL, "DMIC STO1 ASRC", can_use_asrc },
+       { "Stereo2 DMIC Mux", NULL, "DMIC STO2 ASRC", can_use_asrc },
+       { "Stereo3 DMIC Mux", NULL, "DMIC STO3 ASRC", can_use_asrc },
+       { "Stereo4 DMIC Mux", NULL, "DMIC STO4 ASRC", can_use_asrc },
+       { "Mono DMIC L Mux", NULL, "DMIC MONO L ASRC", can_use_asrc },
+       { "Mono DMIC R Mux", NULL, "DMIC MONO R ASRC", can_use_asrc },
+       { "I2S1", NULL, "I2S1 ASRC", can_use_asrc},
+       { "I2S2", NULL, "I2S2 ASRC", can_use_asrc},
+       { "I2S3", NULL, "I2S3 ASRC", can_use_asrc},
+       { "I2S4", NULL, "I2S4 ASRC", can_use_asrc},
+
+       { "dac stereo1 filter", NULL, "DAC STO ASRC", is_using_asrc },
+       { "dac mono2 left filter", NULL, "DAC MONO2 L ASRC", is_using_asrc },
+       { "dac mono2 right filter", NULL, "DAC MONO2 R ASRC", is_using_asrc },
+       { "dac mono3 left filter", NULL, "DAC MONO3 L ASRC", is_using_asrc },
+       { "dac mono3 right filter", NULL, "DAC MONO3 R ASRC", is_using_asrc },
+       { "dac mono4 left filter", NULL, "DAC MONO4 L ASRC", is_using_asrc },
+       { "dac mono4 right filter", NULL, "DAC MONO4 R ASRC", is_using_asrc },
+       { "adc stereo1 filter", NULL, "ADC STO1 ASRC", is_using_asrc },
+       { "adc stereo2 filter", NULL, "ADC STO2 ASRC", is_using_asrc },
+       { "adc stereo3 filter", NULL, "ADC STO3 ASRC", is_using_asrc },
+       { "adc stereo4 filter", NULL, "ADC STO4 ASRC", is_using_asrc },
+       { "adc mono left filter", NULL, "ADC MONO L ASRC", is_using_asrc },
+       { "adc mono right filter", NULL, "ADC MONO R ASRC", is_using_asrc },
+
        { "DMIC1", NULL, "DMIC L1" },
        { "DMIC1", NULL, "DMIC R1" },
        { "DMIC2", NULL, "DMIC L2" },
@@ -2851,8 +3029,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
 
        { "Stereo1 ADC MIXL", NULL, "Sto1 ADC MIXL" },
        { "Stereo1 ADC MIXL", NULL, "adc stereo1 filter" },
-       { "adc stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll },
-
        { "Stereo1 ADC MIXR", NULL, "Sto1 ADC MIXR" },
        { "Stereo1 ADC MIXR", NULL, "adc stereo1 filter" },
        { "adc stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll },
@@ -2873,8 +3049,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
 
        { "Stereo2 ADC MIXL", NULL, "Stereo2 ADC LR Mux" },
        { "Stereo2 ADC MIXL", NULL, "adc stereo2 filter" },
-       { "adc stereo2 filter", NULL, "PLL1", is_sys_clk_from_pll },
-
        { "Stereo2 ADC MIXR", NULL, "Sto2 ADC MIXR" },
        { "Stereo2 ADC MIXR", NULL, "adc stereo2 filter" },
        { "adc stereo2 filter", NULL, "PLL1", is_sys_clk_from_pll },
@@ -2889,8 +3063,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
 
        { "Stereo3 ADC MIXL", NULL, "Sto3 ADC MIXL" },
        { "Stereo3 ADC MIXL", NULL, "adc stereo3 filter" },
-       { "adc stereo3 filter", NULL, "PLL1", is_sys_clk_from_pll },
-
        { "Stereo3 ADC MIXR", NULL, "Sto3 ADC MIXR" },
        { "Stereo3 ADC MIXR", NULL, "adc stereo3 filter" },
        { "adc stereo3 filter", NULL, "PLL1", is_sys_clk_from_pll },
@@ -2905,8 +3077,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
 
        { "Stereo4 ADC MIXL", NULL, "Sto4 ADC MIXL" },
        { "Stereo4 ADC MIXL", NULL, "adc stereo4 filter" },
-       { "adc stereo4 filter", NULL, "PLL1", is_sys_clk_from_pll },
-
        { "Stereo4 ADC MIXR", NULL, "Sto4 ADC MIXR" },
        { "Stereo4 ADC MIXR", NULL, "adc stereo4 filter" },
        { "adc stereo4 filter", NULL, "PLL1", is_sys_clk_from_pll },
@@ -3455,10 +3625,8 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
 
        { "DAC1 MIXL", "Stereo ADC Switch", "ADDA1 Mux" },
        { "DAC1 MIXL", "DAC1 Switch", "DAC1 Mux" },
-       { "DAC1 MIXL", NULL, "dac stereo1 filter" },
        { "DAC1 MIXR", "Stereo ADC Switch", "ADDA1 Mux" },
        { "DAC1 MIXR", "DAC1 Switch", "DAC1 Mux" },
-       { "DAC1 MIXR", NULL, "dac stereo1 filter" },
 
        { "DAC1 FS", NULL, "DAC1 MIXL" },
        { "DAC1 FS", NULL, "DAC1 MIXR" },
@@ -3525,35 +3693,46 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
        { "Stereo DAC MIXR", "DAC2 R Switch", "DAC2 R Mux" },
        { "Stereo DAC MIXR", "DAC1 L Switch", "DAC1 MIXL" },
        { "Stereo DAC MIXR", NULL, "dac stereo1 filter" },
+       { "dac stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll },
 
        { "Mono DAC MIXL", "ST L Switch", "Sidetone Mux" },
        { "Mono DAC MIXL", "DAC1 L Switch", "DAC1 MIXL" },
        { "Mono DAC MIXL", "DAC2 L Switch", "DAC2 L Mux" },
        { "Mono DAC MIXL", "DAC2 R Switch", "DAC2 R Mux" },
-       { "Mono DAC MIXL", NULL, "dac mono left filter" },
+       { "Mono DAC MIXL", NULL, "dac mono2 left filter" },
+       { "dac mono2 left filter", NULL, "PLL1", is_sys_clk_from_pll },
        { "Mono DAC MIXR", "ST R Switch", "Sidetone Mux" },
        { "Mono DAC MIXR", "DAC1 R Switch", "DAC1 MIXR" },
        { "Mono DAC MIXR", "DAC2 R Switch", "DAC2 R Mux" },
        { "Mono DAC MIXR", "DAC2 L Switch", "DAC2 L Mux" },
-       { "Mono DAC MIXR", NULL, "dac mono right filter" },
+       { "Mono DAC MIXR", NULL, "dac mono2 right filter" },
+       { "dac mono2 right filter", NULL, "PLL1", is_sys_clk_from_pll },
 
        { "DD1 MIXL", "Sto DAC Mix L Switch", "Stereo DAC MIXL" },
        { "DD1 MIXL", "Mono DAC Mix L Switch", "Mono DAC MIXL" },
        { "DD1 MIXL", "DAC3 L Switch", "DAC3 L Mux" },
        { "DD1 MIXL", "DAC3 R Switch", "DAC3 R Mux" },
+       { "DD1 MIXL", NULL, "dac mono3 left filter" },
+       { "dac mono3 left filter", NULL, "PLL1", is_sys_clk_from_pll },
        { "DD1 MIXR", "Sto DAC Mix R Switch", "Stereo DAC MIXR" },
        { "DD1 MIXR", "Mono DAC Mix R Switch", "Mono DAC MIXR" },
        { "DD1 MIXR", "DAC3 L Switch", "DAC3 L Mux" },
        { "DD1 MIXR", "DAC3 R Switch", "DAC3 R Mux" },
+       { "DD1 MIXR", NULL, "dac mono3 right filter" },
+       { "dac mono3 right filter", NULL, "PLL1", is_sys_clk_from_pll },
 
        { "DD2 MIXL", "Sto DAC Mix L Switch", "Stereo DAC MIXL" },
        { "DD2 MIXL", "Mono DAC Mix L Switch", "Mono DAC MIXL" },
        { "DD2 MIXL", "DAC4 L Switch", "DAC4 L Mux" },
        { "DD2 MIXL", "DAC4 R Switch", "DAC4 R Mux" },
+       { "DD2 MIXL", NULL, "dac mono4 left filter" },
+       { "dac mono4 left filter", NULL, "PLL1", is_sys_clk_from_pll },
        { "DD2 MIXR", "Sto DAC Mix R Switch", "Stereo DAC MIXR" },
        { "DD2 MIXR", "Mono DAC Mix R Switch", "Mono DAC MIXR" },
        { "DD2 MIXR", "DAC4 L Switch", "DAC4 L Mux" },
        { "DD2 MIXR", "DAC4 R Switch", "DAC4 R Mux" },
+       { "DD2 MIXR", NULL, "dac mono4 right filter" },
+       { "dac mono4 right filter", NULL, "PLL1", is_sys_clk_from_pll },
 
        { "Stereo DAC MIX", NULL, "Stereo DAC MIXL" },
        { "Stereo DAC MIX", NULL, "Stereo DAC MIXR" },
@@ -3575,11 +3754,8 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
        { "DAC3 SRC Mux", "DD MIX2L", "DD2 MIXL" },
 
        { "DAC 1", NULL, "DAC12 SRC Mux" },
-       { "DAC 1", NULL, "PLL1", is_sys_clk_from_pll },
        { "DAC 2", NULL, "DAC12 SRC Mux" },
-       { "DAC 2", NULL, "PLL1", is_sys_clk_from_pll },
        { "DAC 3", NULL, "DAC3 SRC Mux" },
-       { "DAC 3", NULL, "PLL1", is_sys_clk_from_pll },
 
        { "PDM1 L Mux", "STO1 DAC MIX", "Stereo DAC MIXL" },
        { "PDM1 L Mux", "MONO DAC MIX", "Mono DAC MIXL" },
@@ -3926,7 +4102,8 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
                        unsigned int rx_mask, int slots, int slot_width)
 {
        struct snd_soc_codec *codec = dai->codec;
-       unsigned int val = 0;
+       struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
+       unsigned int val = 0, slot_width_25 = 0;
 
        if (rx_mask || tx_mask)
                val |= (1 << 12);
@@ -3950,6 +4127,8 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
        case 20:
                val |= (1 << 8);
                break;
+       case 25:
+               slot_width_25 = 0x8080;
        case 24:
                val |= (2 << 8);
                break;
@@ -3963,10 +4142,16 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
 
        switch (dai->id) {
        case RT5677_AIF1:
-               snd_soc_update_bits(codec, RT5677_TDM1_CTRL1, 0x1f00, val);
+               regmap_update_bits(rt5677->regmap, RT5677_TDM1_CTRL1, 0x1f00,
+                       val);
+               regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x8000,
+                       slot_width_25);
                break;
        case RT5677_AIF2:
-               snd_soc_update_bits(codec, RT5677_TDM2_CTRL1, 0x1f00, val);
+               regmap_update_bits(rt5677->regmap, RT5677_TDM2_CTRL1, 0x1f00,
+                       val);
+               regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x80,
+                       slot_width_25);
                break;
        default:
                break;
@@ -4751,6 +4936,11 @@ static int rt5677_i2c_probe(struct i2c_client *i2c,
                                        RT5677_GPIO5_DIR_OUT);
        }
 
+       if (rt5677->pdata.micbias1_vdd_3v3)
+               regmap_update_bits(rt5677->regmap, RT5677_MICBIAS,
+                       RT5677_MICBIAS1_CTRL_VDD_MASK,
+                       RT5677_MICBIAS1_CTRL_VDD_3_3V);
+
        rt5677_init_gpio(i2c);
        rt5677_init_irq(i2c);
 
index 29cf7ce610f4707feeaba22425daedbe50491ba4..6d6ba3a1d25a182307945beef478617935e77fd0 100644 (file)
@@ -155,18 +155,19 @@ struct sgtl5000_priv {
 static int mic_bias_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(w->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
                /* change mic bias resistor */
-               snd_soc_update_bits(w->codec, SGTL5000_CHIP_MIC_CTRL,
+               snd_soc_update_bits(codec, SGTL5000_CHIP_MIC_CTRL,
                        SGTL5000_BIAS_R_MASK,
                        sgtl5000->micbias_resistor << SGTL5000_BIAS_R_SHIFT);
                break;
 
        case SND_SOC_DAPM_PRE_PMD:
-               snd_soc_update_bits(w->codec, SGTL5000_CHIP_MIC_CTRL,
+               snd_soc_update_bits(codec, SGTL5000_CHIP_MIC_CTRL,
                                SGTL5000_BIAS_R_MASK, 0);
                break;
        }
@@ -181,11 +182,12 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w,
 static int power_vag_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        const u32 mask = SGTL5000_DAC_POWERUP | SGTL5000_ADC_POWERUP;
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
-               snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
+               snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
                        SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP);
                break;
 
@@ -195,9 +197,9 @@ static int power_vag_event(struct snd_soc_dapm_widget *w,
                 * operational to prevent inadvertently starving the
                 * other one of them.
                 */
-               if ((snd_soc_read(w->codec, SGTL5000_CHIP_ANA_POWER) &
+               if ((snd_soc_read(codec, SGTL5000_CHIP_ANA_POWER) &
                                mask) != mask) {
-                       snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
+                       snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
                                SGTL5000_VAG_POWERUP, 0);
                        msleep(400);
                }
index 1f451a1946eb259c4734b68a2e2f273279c35dec..47b257e4180965f38be5c393cab204945f444b7f 100644 (file)
@@ -233,16 +233,18 @@ static int sn95031_set_vaud_bias(struct snd_soc_codec *codec,
 static int sn95031_vhs_event(struct snd_soc_dapm_widget *w,
                    struct snd_kcontrol *kcontrol, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+
        if (SND_SOC_DAPM_EVENT_ON(event)) {
                pr_debug("VHS SND_SOC_DAPM_EVENT_ON doing rail startup now\n");
                /* power up the rail */
-               snd_soc_write(w->codec, SN95031_VHSP, 0x3D);
-               snd_soc_write(w->codec, SN95031_VHSN, 0x3F);
+               snd_soc_write(codec, SN95031_VHSP, 0x3D);
+               snd_soc_write(codec, SN95031_VHSN, 0x3F);
                msleep(1);
        } else if (SND_SOC_DAPM_EVENT_OFF(event)) {
                pr_debug("VHS SND_SOC_DAPM_EVENT_OFF doing rail shutdown\n");
-               snd_soc_write(w->codec, SN95031_VHSP, 0xC4);
-               snd_soc_write(w->codec, SN95031_VHSN, 0x04);
+               snd_soc_write(codec, SN95031_VHSP, 0xC4);
+               snd_soc_write(codec, SN95031_VHSN, 0x04);
        }
        return 0;
 }
@@ -250,14 +252,16 @@ static int sn95031_vhs_event(struct snd_soc_dapm_widget *w,
 static int sn95031_vihf_event(struct snd_soc_dapm_widget *w,
                    struct snd_kcontrol *kcontrol, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+
        if (SND_SOC_DAPM_EVENT_ON(event)) {
                pr_debug("VIHF SND_SOC_DAPM_EVENT_ON doing rail startup now\n");
                /* power up the rail */
-               snd_soc_write(w->codec, SN95031_VIHF, 0x27);
+               snd_soc_write(codec, SN95031_VIHF, 0x27);
                msleep(1);
        } else if (SND_SOC_DAPM_EVENT_OFF(event)) {
                pr_debug("VIHF SND_SOC_DAPM_EVENT_OFF doing rail shutdown\n");
-               snd_soc_write(w->codec, SN95031_VIHF, 0x24);
+               snd_soc_write(codec, SN95031_VIHF, 0x24);
        }
        return 0;
 }
@@ -265,6 +269,7 @@ static int sn95031_vihf_event(struct snd_soc_dapm_widget *w,
 static int sn95031_dmic12_event(struct snd_soc_dapm_widget *w,
                        struct snd_kcontrol *k, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        unsigned int ldo = 0, clk_dir = 0, data_dir = 0;
 
        if (SND_SOC_DAPM_EVENT_ON(event)) {
@@ -273,15 +278,16 @@ static int sn95031_dmic12_event(struct snd_soc_dapm_widget *w,
                data_dir = BIT(7);
        }
        /* program DMIC LDO, clock and set clock */
-       snd_soc_update_bits(w->codec, SN95031_MICBIAS, BIT(5)|BIT(4), ldo);
-       snd_soc_update_bits(w->codec, SN95031_DMICBUF0123, BIT(0), clk_dir);
-       snd_soc_update_bits(w->codec, SN95031_DMICBUF0123, BIT(7), data_dir);
+       snd_soc_update_bits(codec, SN95031_MICBIAS, BIT(5)|BIT(4), ldo);
+       snd_soc_update_bits(codec, SN95031_DMICBUF0123, BIT(0), clk_dir);
+       snd_soc_update_bits(codec, SN95031_DMICBUF0123, BIT(7), data_dir);
        return 0;
 }
 
 static int sn95031_dmic34_event(struct snd_soc_dapm_widget *w,
                        struct snd_kcontrol *k, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        unsigned int ldo = 0, clk_dir = 0, data_dir = 0;
 
        if (SND_SOC_DAPM_EVENT_ON(event)) {
@@ -290,22 +296,23 @@ static int sn95031_dmic34_event(struct snd_soc_dapm_widget *w,
                data_dir = BIT(1);
        }
        /* program DMIC LDO, clock and set clock */
-       snd_soc_update_bits(w->codec, SN95031_MICBIAS, BIT(5)|BIT(4), ldo);
-       snd_soc_update_bits(w->codec, SN95031_DMICBUF0123, BIT(2), clk_dir);
-       snd_soc_update_bits(w->codec, SN95031_DMICBUF45, BIT(1), data_dir);
+       snd_soc_update_bits(codec, SN95031_MICBIAS, BIT(5)|BIT(4), ldo);
+       snd_soc_update_bits(codec, SN95031_DMICBUF0123, BIT(2), clk_dir);
+       snd_soc_update_bits(codec, SN95031_DMICBUF45, BIT(1), data_dir);
        return 0;
 }
 
 static int sn95031_dmic56_event(struct snd_soc_dapm_widget *w,
                        struct snd_kcontrol *k, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        unsigned int ldo = 0;
 
        if (SND_SOC_DAPM_EVENT_ON(event))
                ldo = BIT(7)|BIT(6);
 
        /* program DMIC LDO */
-       snd_soc_update_bits(w->codec, SN95031_MICBIAS, BIT(7)|BIT(6), ldo);
+       snd_soc_update_bits(codec, SN95031_MICBIAS, BIT(7)|BIT(6), ldo);
        return 0;
 }
 
index dc3223d6eca1884a0faa44f9510e1ecb946ceae2..c86dd9aae1576670925b0ae1ce4b7959e5f199e4 100644 (file)
@@ -349,7 +349,8 @@ static int aic31xx_wait_bits(struct aic31xx_priv *aic31xx, unsigned int reg,
 static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w,
                                    struct snd_kcontrol *kcontrol, int event)
 {
-       struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(w->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
        unsigned int reg = AIC31XX_DACFLAG1;
        unsigned int mask;
 
@@ -377,7 +378,7 @@ static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w,
                reg = AIC31XX_ADCFLAG;
                break;
        default:
-               dev_err(w->codec->dev, "Unknown widget '%s' calling %s\n",
+               dev_err(codec->dev, "Unknown widget '%s' calling %s\n",
                        w->name, __func__);
                return -EINVAL;
        }
@@ -388,7 +389,7 @@ static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w,
        case SND_SOC_DAPM_POST_PMD:
                return aic31xx_wait_bits(aic31xx, reg, mask, 0, 5000, 100);
        default:
-               dev_dbg(w->codec->dev,
+               dev_dbg(codec->dev,
                        "Unhandled dapm widget event %d from %s\n",
                        event, w->name);
        }
@@ -433,7 +434,7 @@ static const struct snd_kcontrol_new aic31xx_dapm_spr_switch =
 static int mic_bias_event(struct snd_soc_dapm_widget *w,
                          struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
index b7ebce054b4ebe673ceeb23fa73118a1c9c74998..a78ad361f494182214aa7ca7124a29c95f6afb77 100644 (file)
@@ -197,7 +197,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
 static int mic_bias_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
index 0fe2ced5b09fc72324fd2e9ac89c1ec3cf0d06cb..4e3e607dec13085df4cbc4a3d198ae5cacf78c32 100644 (file)
@@ -423,17 +423,18 @@ exit:
 static int dac33_playback_event(struct snd_soc_dapm_widget *w,
                struct snd_kcontrol *kcontrol, int event)
 {
-       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(w->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
                if (likely(dac33->substream)) {
-                       dac33_calculate_times(dac33->substream, w->codec);
-                       dac33_prepare_chip(dac33->substream, w->codec);
+                       dac33_calculate_times(dac33->substream, codec);
+                       dac33_prepare_chip(dac33->substream, codec);
                }
                break;
        case SND_SOC_DAPM_POST_PMD:
-               dac33_disable_digital(w->codec);
+               dac33_disable_digital(codec);
                break;
        }
        return 0;
index 44af3188afb9c6e50e9e097e4c97c0ffb15f4023..d04693e9cf9f8c9b362b212b04058e7fe6ee2278 100644 (file)
@@ -567,12 +567,13 @@ static const struct snd_kcontrol_new twl4030_dapm_dbypassv_control =
 static int pin_name##pga_event(struct snd_soc_dapm_widget *w,          \
                               struct snd_kcontrol *kcontrol, int event) \
 {                                                                      \
-       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec); \
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);   \
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); \
                                                                        \
        switch (event) {                                                \
        case SND_SOC_DAPM_POST_PMU:                                     \
                twl4030->pin_name##_enabled = 1;                        \
-               twl4030_write(w->codec, reg, twl4030_read(w->codec, reg)); \
+               twl4030_write(codec, reg, twl4030_read(codec, reg));    \
                break;                                                  \
        case SND_SOC_DAPM_POST_PMD:                                     \
                twl4030->pin_name##_enabled = 0;                        \
@@ -621,12 +622,14 @@ static void handsfree_ramp(struct snd_soc_codec *codec, int reg, int ramp)
 static int handsfreelpga_event(struct snd_soc_dapm_widget *w,
                               struct snd_kcontrol *kcontrol, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
-               handsfree_ramp(w->codec, TWL4030_REG_HFL_CTL, 1);
+               handsfree_ramp(codec, TWL4030_REG_HFL_CTL, 1);
                break;
        case SND_SOC_DAPM_POST_PMD:
-               handsfree_ramp(w->codec, TWL4030_REG_HFL_CTL, 0);
+               handsfree_ramp(codec, TWL4030_REG_HFL_CTL, 0);
                break;
        }
        return 0;
@@ -635,12 +638,14 @@ static int handsfreelpga_event(struct snd_soc_dapm_widget *w,
 static int handsfreerpga_event(struct snd_soc_dapm_widget *w,
                               struct snd_kcontrol *kcontrol, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
-               handsfree_ramp(w->codec, TWL4030_REG_HFR_CTL, 1);
+               handsfree_ramp(codec, TWL4030_REG_HFR_CTL, 1);
                break;
        case SND_SOC_DAPM_POST_PMD:
-               handsfree_ramp(w->codec, TWL4030_REG_HFR_CTL, 0);
+               handsfree_ramp(codec, TWL4030_REG_HFR_CTL, 0);
                break;
        }
        return 0;
@@ -649,19 +654,23 @@ static int handsfreerpga_event(struct snd_soc_dapm_widget *w,
 static int vibramux_event(struct snd_soc_dapm_widget *w,
                          struct snd_kcontrol *kcontrol, int event)
 {
-       twl4030_write(w->codec, TWL4030_REG_VIBRA_SET, 0xff);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+
+       twl4030_write(codec, TWL4030_REG_VIBRA_SET, 0xff);
        return 0;
 }
 
 static int apll_event(struct snd_soc_dapm_widget *w,
                      struct snd_kcontrol *kcontrol, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
-               twl4030_apll_enable(w->codec, 1);
+               twl4030_apll_enable(codec, 1);
                break;
        case SND_SOC_DAPM_POST_PMD:
-               twl4030_apll_enable(w->codec, 0);
+               twl4030_apll_enable(codec, 0);
                break;
        }
        return 0;
@@ -670,23 +679,24 @@ static int apll_event(struct snd_soc_dapm_widget *w,
 static int aif_event(struct snd_soc_dapm_widget *w,
                     struct snd_kcontrol *kcontrol, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        u8 audio_if;
 
-       audio_if = twl4030_read(w->codec, TWL4030_REG_AUDIO_IF);
+       audio_if = twl4030_read(codec, TWL4030_REG_AUDIO_IF);
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
                /* Enable AIF */
                /* enable the PLL before we use it to clock the DAI */
-               twl4030_apll_enable(w->codec, 1);
+               twl4030_apll_enable(codec, 1);
 
-               twl4030_write(w->codec, TWL4030_REG_AUDIO_IF,
+               twl4030_write(codec, TWL4030_REG_AUDIO_IF,
                              audio_if | TWL4030_AIF_EN);
                break;
        case SND_SOC_DAPM_POST_PMD:
                /* disable the DAI before we stop it's source PLL */
-               twl4030_write(w->codec, TWL4030_REG_AUDIO_IF,
+               twl4030_write(codec, TWL4030_REG_AUDIO_IF,
                              audio_if &  ~TWL4030_AIF_EN);
-               twl4030_apll_enable(w->codec, 0);
+               twl4030_apll_enable(codec, 0);
                break;
        }
        return 0;
@@ -758,20 +768,21 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
 static int headsetlpga_event(struct snd_soc_dapm_widget *w,
                             struct snd_kcontrol *kcontrol, int event)
 {
-       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
                /* Do the ramp-up only once */
                if (!twl4030->hsr_enabled)
-                       headset_ramp(w->codec, 1);
+                       headset_ramp(codec, 1);
 
                twl4030->hsl_enabled = 1;
                break;
        case SND_SOC_DAPM_POST_PMD:
                /* Do the ramp-down only if both headsetL/R is disabled */
                if (!twl4030->hsr_enabled)
-                       headset_ramp(w->codec, 0);
+                       headset_ramp(codec, 0);
 
                twl4030->hsl_enabled = 0;
                break;
@@ -782,20 +793,21 @@ static int headsetlpga_event(struct snd_soc_dapm_widget *w,
 static int headsetrpga_event(struct snd_soc_dapm_widget *w,
                             struct snd_kcontrol *kcontrol, int event)
 {
-       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
                /* Do the ramp-up only once */
                if (!twl4030->hsl_enabled)
-                       headset_ramp(w->codec, 1);
+                       headset_ramp(codec, 1);
 
                twl4030->hsr_enabled = 1;
                break;
        case SND_SOC_DAPM_POST_PMD:
                /* Do the ramp-down only if both headsetL/R is disabled */
                if (!twl4030->hsl_enabled)
-                       headset_ramp(w->codec, 0);
+                       headset_ramp(codec, 0);
 
                twl4030->hsr_enabled = 0;
                break;
@@ -806,7 +818,8 @@ static int headsetrpga_event(struct snd_soc_dapm_widget *w,
 static int digimic_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
-       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(w->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
        struct twl4030_codec_data *pdata = twl4030->pdata;
 
        if (pdata && pdata->digimic_delay)
index 90f47f988b3fe3b1e28321df538c1ba2f7d9bb4f..aeec27b6f1af76aca729aacd35e872b01eb05362 100644 (file)
@@ -234,7 +234,7 @@ static int headset_power_mode(struct snd_soc_codec *codec, int high_perf)
 static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w,
                        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        u8 hslctl, hsrctl;
 
        /*
@@ -261,7 +261,7 @@ static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w,
 static int twl6040_ep_drv_event(struct snd_soc_dapm_widget *w,
                        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
        int ret = 0;
 
index 34ef65c52a7d9425e84a6c9ba475f5cfdb664ea9..8d9de49a50524bb4e88ebd62cb580e17239b07d6 100644 (file)
@@ -683,7 +683,7 @@ static const struct snd_kcontrol_new wm2000_controls[] = {
 static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w,
                                  struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
        int ret;
 
index b80970dc2d2f14c9edbbe2e333f65843f0e33b88..ea09db585aa1fd266f391aadbde5fa78c71318db 100644 (file)
@@ -775,7 +775,8 @@ static int wm5100_out_ev(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol,
                         int event)
 {
-       struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(w->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec);
 
        switch (w->reg) {
        case WM5100_CHANNEL_ENABLES_1:
@@ -839,7 +840,7 @@ static int wm5100_post_ev(struct snd_soc_dapm_widget *w,
                          struct snd_kcontrol *kcontrol,
                          int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec);
        int ret;
 
index 154d67d7f249c38f6e3cd0875c0c722ce9fba2a8..6d0fe0ac95a3f6121d87c52cfa4f17f6ec844651 100644 (file)
@@ -581,7 +581,7 @@ static const struct reg_default wm5102_sysclk_revb_patch[] = {
 static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w,
                            struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
        struct regmap *regmap = arizona->regmap;
        const struct reg_default *patch = NULL;
index 33eefec54be41c9e6705802337f371aeba81673b..fbaeddb3e9033a3044b4995265dce2849b348160 100644 (file)
@@ -134,7 +134,7 @@ static const struct reg_default wm5110_sysclk_revd_patch[] = {
 static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w,
                            struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
        struct regmap *regmap = arizona->regmap;
        const struct reg_default *patch = NULL;
index 574579b988726a41b7b8d7b4e8615359b1aa4e12..c81a9eab3e3e5113121a9e2c90f1971a410d41fe 100644 (file)
@@ -259,7 +259,7 @@ static void wm8350_pga_work(struct work_struct *work)
 static int pga_event(struct snd_soc_dapm_widget *w,
                     struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
        struct wm8350_output *out;
 
index 8ee446987aa9e4999f9b0a4098adee220b7d0f66..b0d84e552fca758786100c5eca18b746013a1d61 100644 (file)
@@ -324,6 +324,7 @@ SOC_SINGLE("RIN34 Mute Switch", WM8400_RIGHT_LINE_INPUT_3_4_VOLUME,
 static int outmixer_event (struct snd_soc_dapm_widget *w,
        struct snd_kcontrol * kcontrol, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct soc_mixer_control *mc =
                (struct soc_mixer_control *)kcontrol->private_value;
        u32 reg_shift = mc->shift;
@@ -332,7 +333,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
 
        switch (reg_shift) {
        case WM8400_SPEAKER_MIXER | (WM8400_LDSPK << 8) :
-               reg = snd_soc_read(w->codec, WM8400_OUTPUT_MIXER1);
+               reg = snd_soc_read(codec, WM8400_OUTPUT_MIXER1);
                if (reg & WM8400_LDLO) {
                        printk(KERN_WARNING
                        "Cannot set as Output Mixer 1 LDLO Set\n");
@@ -340,7 +341,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
                }
                break;
        case WM8400_SPEAKER_MIXER | (WM8400_RDSPK << 8):
-               reg = snd_soc_read(w->codec, WM8400_OUTPUT_MIXER2);
+               reg = snd_soc_read(codec, WM8400_OUTPUT_MIXER2);
                if (reg & WM8400_RDRO) {
                        printk(KERN_WARNING
                        "Cannot set as Output Mixer 2 RDRO Set\n");
@@ -348,7 +349,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
                }
                break;
        case WM8400_OUTPUT_MIXER1 | (WM8400_LDLO << 8):
-               reg = snd_soc_read(w->codec, WM8400_SPEAKER_MIXER);
+               reg = snd_soc_read(codec, WM8400_SPEAKER_MIXER);
                if (reg & WM8400_LDSPK) {
                        printk(KERN_WARNING
                        "Cannot set as Speaker Mixer LDSPK Set\n");
@@ -356,7 +357,7 @@ static int outmixer_event (struct snd_soc_dapm_widget *w,
                }
                break;
        case WM8400_OUTPUT_MIXER2 | (WM8400_RDRO << 8):
-               reg = snd_soc_read(w->codec, WM8400_SPEAKER_MIXER);
+               reg = snd_soc_read(codec, WM8400_SPEAKER_MIXER);
                if (reg & WM8400_RDSPK) {
                        printk(KERN_WARNING
                        "Cannot set as Speaker Mixer RDSPK Set\n");
index b9211b42f6e919f0603eabda95ca332eea71dfb6..e129c81ad219a70277c826f46119aa24e0e918b4 100644 (file)
@@ -217,7 +217,8 @@ SND_SOC_DAPM_INPUT("LLINEIN"),
 static int wm8731_check_osc(struct snd_soc_dapm_widget *source,
                            struct snd_soc_dapm_widget *sink)
 {
-       struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(source->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
+       struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
 
        return wm8731->sysclk_type == WM8731_SYSCLK_XTAL;
 }
index 180e7a09872618469e59f7b9b845c2553c460262..53e977da2f86d325c0366efae3e3ba121e49fedd 100644 (file)
@@ -308,9 +308,7 @@ static const struct snd_soc_dapm_route wm8770_intercon[] = {
 static int vout12supply_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec;
-
-       codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
@@ -327,9 +325,7 @@ static int vout12supply_event(struct snd_soc_dapm_widget *w,
 static int vout34supply_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec;
-
-       codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
index 3a0d4b7d692fcc2bd77eb017374d6139a3bb5df3..2eb986c19b886a48e9d367623adf353a94796689 100644 (file)
@@ -224,7 +224,7 @@ static void wm8900_reset(struct snd_soc_codec *codec)
 static int wm8900_hp_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        u16 hpctl1 = snd_soc_read(codec, WM8900_REG_HPCTL1);
 
        switch (event) {
index cc6b0ef98a345e9b8832bb4c09d1312451d7d070..dde462c082be0eb6124e0f881b9a1ed936e34c77 100644 (file)
@@ -260,7 +260,7 @@ static int wm8903_cp_event(struct snd_soc_dapm_widget *w,
 static int wm8903_dcs_event(struct snd_soc_dapm_widget *w,
                            struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
index 4d2d2b1380d59d2b8e1043acbdd29d314eef1b97..a0f8a62636603be3a0b025a11124b4efc6d5b9b3 100644 (file)
@@ -673,7 +673,7 @@ static int cp_event(struct snd_soc_dapm_widget *w,
 static int sysclk_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -711,7 +711,7 @@ static int sysclk_event(struct snd_soc_dapm_widget *w,
 static int out_pga_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
        int reg, val;
        int dcs_mask;
index 1173f7fef5a76dcb9f1954c2c23568e7f5c99123..1ab2d462afadfb24a7205638a779bb0152eb702a 100644 (file)
@@ -333,7 +333,7 @@ static int wm8955_configure_clocking(struct snd_soc_codec *codec)
 static int wm8955_sysclk(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        int ret = 0;
 
        /* Always disable the clocks - if we're doing reconfiguration this
index 3cbc82b3329288e8d16f33acaa4782dac147a542..c799cca5abeb704645687b863ccedfc6749e9ac2 100644 (file)
@@ -418,7 +418,7 @@ static void wm8958_dsp_apply(struct snd_soc_codec *codec, int path, int start)
 int wm8958_aif_ev(struct snd_soc_dapm_widget *w,
                  struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        int i;
 
        switch (event) {
index eeffd05384b40e5e15c11f22cbf2cbe7d46a33f7..95e2c1bfc809ff1a0d9c20b6f280c0afed491239 100644 (file)
@@ -194,7 +194,7 @@ static bool wm8961_readable(struct device *dev, unsigned int reg)
 static int wm8961_hp_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        u16 hp_reg = snd_soc_read(codec, WM8961_ANALOGUE_HP_0);
        u16 cp_reg = snd_soc_read(codec, WM8961_CHARGE_PUMP_1);
        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,
 static int wm8961_spk_event(struct snd_soc_dapm_widget *w,
                            struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        u16 pwr_reg = snd_soc_read(codec, WM8961_PWR_MGMT_2);
        u16 spk_reg = snd_soc_read(codec, WM8961_CLASS_D_CONTROL_1);
 
index d32d554f5b34e5c3c3a0d0786aa0fe501dc1368e..118b0034ba235d238bfc5c137db7681126bba45b 100644 (file)
@@ -1866,7 +1866,7 @@ static int cp_event(struct snd_soc_dapm_widget *w,
 static int hp_event(struct snd_soc_dapm_widget *w,
                    struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        int timeout;
        int reg;
        int expected = (WM8962_DCS_STARTUP_DONE_HP1L |
@@ -1960,7 +1960,7 @@ static int hp_event(struct snd_soc_dapm_widget *w,
 static int out_pga_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        int reg;
 
        switch (w->shift) {
@@ -1993,7 +1993,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
 static int dsp2_event(struct snd_soc_dapm_widget *w,
                      struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
index e418199155a8824d0a5cb6fb2cb02b22ffd1c3b8..baff2cc222a67e0c0d713ed42b11443f6a326742 100644 (file)
@@ -244,7 +244,7 @@ SOC_DOUBLE_R_TLV("Output 2 Playback Volume", WM8988_LOUT2V, WM8988_ROUT2V,
 static int wm8988_lrc_control(struct snd_soc_dapm_widget *w,
                              struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        u16 adctl2 = snd_soc_read(codec, WM8988_ADCTL2);
 
        /* Use the DAC to gate LRC if active, otherwise use ADC */
index 8a584229310a72daba726678b8e2342b3e431d23..c93bffcb3cfba2e3953b53b571e046a9553ff5a0 100644 (file)
@@ -374,13 +374,14 @@ SOC_SINGLE("RIN34 Mute Switch", WM8990_RIGHT_LINE_INPUT_3_4_VOLUME,
 static int outmixer_event(struct snd_soc_dapm_widget *w,
        struct snd_kcontrol *kcontrol, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        u32 reg_shift = kcontrol->private_value & 0xfff;
        int ret = 0;
        u16 reg;
 
        switch (reg_shift) {
        case WM8990_SPEAKER_MIXER | (WM8990_LDSPK_BIT << 8) :
-               reg = snd_soc_read(w->codec, WM8990_OUTPUT_MIXER1);
+               reg = snd_soc_read(codec, WM8990_OUTPUT_MIXER1);
                if (reg & WM8990_LDLO) {
                        printk(KERN_WARNING
                        "Cannot set as Output Mixer 1 LDLO Set\n");
@@ -388,7 +389,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w,
                }
                break;
        case WM8990_SPEAKER_MIXER | (WM8990_RDSPK_BIT << 8):
-               reg = snd_soc_read(w->codec, WM8990_OUTPUT_MIXER2);
+               reg = snd_soc_read(codec, WM8990_OUTPUT_MIXER2);
                if (reg & WM8990_RDRO) {
                        printk(KERN_WARNING
                        "Cannot set as Output Mixer 2 RDRO Set\n");
@@ -396,7 +397,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w,
                }
                break;
        case WM8990_OUTPUT_MIXER1 | (WM8990_LDLO_BIT << 8):
-               reg = snd_soc_read(w->codec, WM8990_SPEAKER_MIXER);
+               reg = snd_soc_read(codec, WM8990_SPEAKER_MIXER);
                if (reg & WM8990_LDSPK) {
                        printk(KERN_WARNING
                        "Cannot set as Speaker Mixer LDSPK Set\n");
@@ -404,7 +405,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w,
                }
                break;
        case WM8990_OUTPUT_MIXER2 | (WM8990_RDRO_BIT << 8):
-               reg = snd_soc_read(w->codec, WM8990_SPEAKER_MIXER);
+               reg = snd_soc_read(codec, WM8990_SPEAKER_MIXER);
                if (reg & WM8990_RDSPK) {
                        printk(KERN_WARNING
                        "Cannot set as Speaker Mixer RDSPK Set\n");
index b0ac2c3e31b9b09a84552eeda9765dec043d023f..49df0dc607e67f41252cd6c56eb38cc0abdf06dc 100644 (file)
@@ -382,13 +382,14 @@ static const struct snd_kcontrol_new wm8991_snd_controls[] = {
 static int outmixer_event(struct snd_soc_dapm_widget *w,
                          struct snd_kcontrol *kcontrol, int event)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        u32 reg_shift = kcontrol->private_value & 0xfff;
        int ret = 0;
        u16 reg;
 
        switch (reg_shift) {
        case WM8991_SPEAKER_MIXER | (WM8991_LDSPK_BIT << 8):
-               reg = snd_soc_read(w->codec, WM8991_OUTPUT_MIXER1);
+               reg = snd_soc_read(codec, WM8991_OUTPUT_MIXER1);
                if (reg & WM8991_LDLO) {
                        printk(KERN_WARNING
                               "Cannot set as Output Mixer 1 LDLO Set\n");
@@ -397,7 +398,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w,
                break;
 
        case WM8991_SPEAKER_MIXER | (WM8991_RDSPK_BIT << 8):
-               reg = snd_soc_read(w->codec, WM8991_OUTPUT_MIXER2);
+               reg = snd_soc_read(codec, WM8991_OUTPUT_MIXER2);
                if (reg & WM8991_RDRO) {
                        printk(KERN_WARNING
                               "Cannot set as Output Mixer 2 RDRO Set\n");
@@ -406,7 +407,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w,
                break;
 
        case WM8991_OUTPUT_MIXER1 | (WM8991_LDLO_BIT << 8):
-               reg = snd_soc_read(w->codec, WM8991_SPEAKER_MIXER);
+               reg = snd_soc_read(codec, WM8991_SPEAKER_MIXER);
                if (reg & WM8991_LDSPK) {
                        printk(KERN_WARNING
                               "Cannot set as Speaker Mixer LDSPK Set\n");
@@ -415,7 +416,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w,
                break;
 
        case WM8991_OUTPUT_MIXER2 | (WM8991_RDRO_BIT << 8):
-               reg = snd_soc_read(w->codec, WM8991_SPEAKER_MIXER);
+               reg = snd_soc_read(codec, WM8991_SPEAKER_MIXER);
                if (reg & WM8991_RDSPK) {
                        printk(KERN_WARNING
                               "Cannot set as Speaker Mixer RDSPK Set\n");
index 53c6fe35949675fab58000a661390adefd802f89..2e70a270eb2894f36ccb5cacd3fd618dee45256c 100644 (file)
@@ -810,7 +810,7 @@ SOC_SINGLE_TLV("EQ5 Volume", WM8993_EQ6, 0, 24, 0, eq_tlv),
 static int clk_sys_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
index 1b97de2e4e67126f918097abc24e8932d40995ec..4fbc7689339a8903f724fa9aefcb6feb31dad54f 100644 (file)
@@ -249,7 +249,8 @@ static int configure_clock(struct snd_soc_codec *codec)
 static int check_clk_sys(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
-       int reg = snd_soc_read(source->codec, WM8994_CLOCKING_1);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
+       int reg = snd_soc_read(codec, WM8994_CLOCKING_1);
        const char *clk;
 
        /* Check what we're currently using for CLK_SYS */
@@ -806,7 +807,7 @@ static void active_dereference(struct snd_soc_codec *codec)
 static int clk_sys_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -981,7 +982,7 @@ static void vmid_dereference(struct snd_soc_codec *codec)
 static int vmid_event(struct snd_soc_dapm_widget *w,
                      struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
@@ -1037,7 +1038,7 @@ static bool wm8994_check_class_w_digital(struct snd_soc_codec *codec)
 static int aif1clk_ev(struct snd_soc_dapm_widget *w,
                      struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
        struct wm8994 *control = wm8994->wm8994;
        int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA;
@@ -1135,7 +1136,7 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
 static int aif2clk_ev(struct snd_soc_dapm_widget *w,
                      struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        int i;
        int dac;
        int adc;
@@ -1220,7 +1221,7 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
 static int aif1clk_late_ev(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -1238,7 +1239,7 @@ static int aif1clk_late_ev(struct snd_soc_dapm_widget *w,
 static int aif2clk_late_ev(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -1256,7 +1257,7 @@ static int aif2clk_late_ev(struct snd_soc_dapm_widget *w,
 static int late_enable_ev(struct snd_soc_dapm_widget *w,
                          struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -1289,7 +1290,7 @@ static int late_enable_ev(struct snd_soc_dapm_widget *w,
 static int late_disable_ev(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -1331,7 +1332,7 @@ static int micbias_ev(struct snd_soc_dapm_widget *w,
 static int dac_ev(struct snd_soc_dapm_widget *w,
                  struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        unsigned int mask = 1 << w->shift;
 
        snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
@@ -1372,7 +1373,7 @@ SOC_DAPM_SINGLE("DAC1 Switch", WM8994_SPEAKER_MIXER, 0, 1, 0),
 static int post_ev(struct snd_soc_dapm_widget *w,
            struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        dev_dbg(codec->dev, "SRC status: %x\n",
                snd_soc_read(codec,
                             WM8994_RATE_STATUS));
index c280f0a3a424303ebba6def4972d4e644fc479f8..79e1aead51318eb5d0509f9ecccf654f8aad1977 100644 (file)
@@ -534,10 +534,11 @@ static void wm8995_update_class_w(struct snd_soc_codec *codec)
 static int check_clk_sys(struct snd_soc_dapm_widget *source,
                         struct snd_soc_dapm_widget *sink)
 {
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
        unsigned int reg;
        const char *clk;
 
-       reg = snd_soc_read(source->codec, WM8995_CLOCKING_1);
+       reg = snd_soc_read(codec, WM8995_CLOCKING_1);
        /* Check what we're currently using for CLK_SYS */
        if (reg & WM8995_SYSCLK_SRC)
                clk = "AIF2CLK";
@@ -560,9 +561,7 @@ static int wm8995_put_class_w(struct snd_kcontrol *kcontrol,
 static int hp_supply_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec;
-
-       codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
@@ -611,10 +610,9 @@ static void dc_servo_cmd(struct snd_soc_codec *codec,
 static int hp_event(struct snd_soc_dapm_widget *w,
                    struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        unsigned int reg;
 
-       codec = w->codec;
        reg = snd_soc_read(codec, WM8995_ANALOGUE_HP_1);
 
        switch (event) {
@@ -761,9 +759,7 @@ static int configure_clock(struct snd_soc_codec *codec)
 static int clk_sys_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec;
-
-       codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 
        switch (event) {
        case SND_SOC_DAPM_PRE_PMU:
index b1dcc11c1b23bd0134940d2f9571d14b9e1dac92..dc92d5e4e9426e8157104361d4a71f675769f00d 100644 (file)
@@ -599,7 +599,7 @@ static void wm8996_bg_disable(struct snd_soc_codec *codec)
 static int bg_event(struct snd_soc_dapm_widget *w,
                    struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        int ret = 0;
 
        switch (event) {
@@ -634,7 +634,8 @@ static int cp_event(struct snd_soc_dapm_widget *w,
 static int rmv_short_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(w->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
 
        /* Record which outputs we enabled */
        switch (event) {
@@ -758,7 +759,8 @@ static void wm8996_seq_notifier(struct snd_soc_dapm_context *dapm,
 static int dcs_start(struct snd_soc_dapm_widget *w,
                     struct snd_kcontrol *kcontrol, int event)
 {
-       struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(w->codec);
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
+       struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
        case SND_SOC_DAPM_POST_PMU:
index 911132943b50057a44a24dc530ec783904d37dd4..a4d11770630cdd9bd169836c5e14e0f8dfc5633b 100644 (file)
@@ -84,7 +84,7 @@ static const struct reg_default wm8997_sysclk_reva_patch[] = {
 static int wm8997_sysclk_ev(struct snd_soc_dapm_widget *w,
                            struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
        struct regmap *regmap = arizona->regmap;
        const struct reg_default *patch = NULL;
index b1d946facd57f1796815f5f157848f0569d547b5..13a3f335ea5b6cb4bfeecd8ed0eb9ce13a1bb7ce 100644 (file)
@@ -734,7 +734,7 @@ static int configure_clock(struct snd_soc_codec *codec)
 static int clk_sys_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
 
        /* This should be done on init() for bypass paths */
index 6ffe8dc4f3fad5ba5a08544bda7e062fecef3f79..60d243c904f529597399c408c8426c2ca879ccd6 100644 (file)
@@ -254,7 +254,7 @@ SOC_SINGLE_TLV("MIXOUTR IN2B Volume", WM9090_OUTPUT_MIXER4, 0, 3, 1,
 static int hp_ev(struct snd_soc_dapm_widget *w,
                 struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        unsigned int reg = snd_soc_read(codec, WM9090_ANALOGUE_HP_0);
 
        switch (event) {
index 71b9d5b0734d22c54284172184fede22fc4e5c48..e5807de796cd66afcffe7117f3128d2ccf2bc54a 100644 (file)
@@ -217,7 +217,7 @@ SOC_SINGLE("3D Depth", AC97_REC_GAIN_MIC, 0, 15, 1),
 static int wm9713_voice_shutdown(struct snd_soc_dapm_widget *w,
                                 struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        u16 status, rate;
 
        if (WARN_ON(event != SND_SOC_DAPM_PRE_PMD))
index 720d6e852986c3e7c6b0b1128876b7c4c4fa4ffb..ff67b334065badc1011807648ac671a4d07765bf 100644 (file)
@@ -1373,7 +1373,7 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,
                   struct snd_kcontrol *kcontrol,
                   int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec);
        struct wm_adsp *dsp = &dsps[w->shift];
        struct wm_adsp_alg_region *alg_region;
@@ -1605,7 +1605,7 @@ err:
 int wm_adsp2_early_event(struct snd_soc_dapm_widget *w,
                   struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec);
        struct wm_adsp *dsp = &dsps[w->shift];
 
@@ -1626,7 +1626,7 @@ EXPORT_SYMBOL_GPL(wm_adsp2_early_event);
 int wm_adsp2_event(struct snd_soc_dapm_widget *w,
                   struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec);
        struct wm_adsp *dsp = &dsps[w->shift];
        struct wm_adsp_alg_region *alg_region;
index 374537d5e179c6615ec98e1787536659c4a83ff0..8366e19657a73708fc4d65f5c3a13a449618ca92 100644 (file)
@@ -500,7 +500,7 @@ SOC_SINGLE_TLV("LINEOUT2 Volume", WM8993_LINE_OUTPUTS_VOLUME, 0, 1, 1,
 static int hp_supply_event(struct snd_soc_dapm_widget *w,
                           struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
 
        switch (event) {
@@ -542,7 +542,7 @@ static int hp_supply_event(struct snd_soc_dapm_widget *w,
 static int hp_event(struct snd_soc_dapm_widget *w,
                    struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        unsigned int reg = snd_soc_read(codec, WM8993_ANALOGUE_HP_0);
 
        switch (event) {
@@ -594,7 +594,7 @@ static int hp_event(struct snd_soc_dapm_widget *w,
 static int earpiece_event(struct snd_soc_dapm_widget *w,
                          struct snd_kcontrol *control, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        u16 reg = snd_soc_read(codec, WM8993_ANTIPOP1) & ~WM8993_HPOUT2_IN_ENA;
 
        switch (event) {
@@ -619,7 +619,7 @@ static int earpiece_event(struct snd_soc_dapm_widget *w,
 static int lineout_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *control, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
        bool *flag;
 
@@ -649,7 +649,7 @@ static int lineout_event(struct snd_soc_dapm_widget *w,
 static int micbias_event(struct snd_soc_dapm_widget *w,
                         struct snd_kcontrol *kcontrol, int event)
 {
-       struct snd_soc_codec *codec = w->codec;
+       struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
        struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
 
        switch (w->shift) {
index 396dbd51a64f0183d787841b78a35adffd96de2f..a9615a574546988f6fc8e83fe5a018dc05528cba 100644 (file)
@@ -81,7 +81,7 @@ static int rear_amp_power(struct snd_soc_codec *codec, int power)
 static int rear_amp_event(struct snd_soc_dapm_widget *widget,
                          struct snd_kcontrol *kctl, int event)
 {
-       struct snd_soc_codec *codec = widget->codec;
+       struct snd_soc_codec *codec = widget->dapm->card->rtd[0].codec;
 
        return rear_amp_power(codec, SND_SOC_DAPM_EVENT_ON(event));
 }
index c5136bb1f9821afe43bae8a2f9bece210e699952..f6ae254e33ef968762a639bd1de81e8e5d8e2c99 100644 (file)
@@ -3130,8 +3130,6 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
        }
 
        w->dapm = dapm;
-       if (dapm->component)
-               w->codec = dapm->component->codec;
        INIT_LIST_HEAD(&w->sources);
        INIT_LIST_HEAD(&w->sinks);
        INIT_LIST_HEAD(&w->list);