ASoC: wm8962: Replace direct snd_soc_codec dapm field access
[deliverable/linux.git] / sound / soc / codecs / wm8962.c
index 118b0034ba235d238bfc5c137db7681126bba45b..c5748fd4f2962a816308faf605f7aee7116b970a 100644 (file)
@@ -2361,7 +2361,7 @@ static int wm8962_add_widgets(struct snd_soc_codec *codec)
 {
        struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
        struct wm8962_pdata *pdata = &wm8962->pdata;
-       struct snd_soc_dapm_context *dapm = &codec->dapm;
+       struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
 
        snd_soc_add_codec_controls(codec, wm8962_snd_controls,
                             ARRAY_SIZE(wm8962_snd_controls));
@@ -2446,13 +2446,13 @@ static void wm8962_configure_bclk(struct snd_soc_codec *codec)
         * So we here provisionally enable it and then disable it afterward
         * if current bias_level hasn't reached SND_SOC_BIAS_ON.
         */
-       if (codec->dapm.bias_level != SND_SOC_BIAS_ON)
+       if (snd_soc_codec_get_bias_level(codec) != SND_SOC_BIAS_ON)
                snd_soc_update_bits(codec, WM8962_CLOCKING2,
                                WM8962_SYSCLK_ENA_MASK, WM8962_SYSCLK_ENA);
 
        dspclk = snd_soc_read(codec, WM8962_CLOCKING1);
 
-       if (codec->dapm.bias_level != SND_SOC_BIAS_ON)
+       if (snd_soc_codec_get_bias_level(codec) != SND_SOC_BIAS_ON)
                snd_soc_update_bits(codec, WM8962_CLOCKING2,
                                WM8962_SYSCLK_ENA_MASK, 0);
 
@@ -2510,9 +2510,6 @@ static void wm8962_configure_bclk(struct snd_soc_codec *codec)
 static int wm8962_set_bias_level(struct snd_soc_codec *codec,
                                 enum snd_soc_bias_level level)
 {
-       if (level == codec->dapm.bias_level)
-               return 0;
-
        switch (level) {
        case SND_SOC_BIAS_ON:
                break;
@@ -2530,7 +2527,7 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
                snd_soc_update_bits(codec, WM8962_PWR_MGMT_1,
                                    WM8962_VMID_SEL_MASK, 0x100);
 
-               if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
+               if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF)
                        msleep(100);
                break;
 
@@ -2538,7 +2535,6 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
                break;
        }
 
-       codec->dapm.bias_level = level;
        return 0;
 }
 
@@ -2614,7 +2610,7 @@ static int wm8962_hw_params(struct snd_pcm_substream *substream,
        dev_dbg(codec->dev, "hw_params set BCLK %dHz LRCLK %dHz\n",
                wm8962->bclk, wm8962->lrclk);
 
-       if (codec->dapm.bias_level == SND_SOC_BIAS_ON)
+       if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_ON)
                wm8962_configure_bclk(codec);
 
        return 0;
@@ -3118,7 +3114,7 @@ static irqreturn_t wm8962_irq(int irq, void *data)
 int wm8962_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
 {
        struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
-       struct snd_soc_dapm_context *dapm = &codec->dapm;
+       struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        int irq_mask, enable;
 
        wm8962->jack = jack;
@@ -3164,7 +3160,7 @@ static void wm8962_beep_work(struct work_struct *work)
        struct wm8962_priv *wm8962 =
                container_of(work, struct wm8962_priv, beep_work);
        struct snd_soc_codec *codec = wm8962->codec;
-       struct snd_soc_dapm_context *dapm = &codec->dapm;
+       struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        int i;
        int reg = 0;
        int best = 0;
@@ -3415,6 +3411,7 @@ static void wm8962_free_gpio(struct snd_soc_codec *codec)
 
 static int wm8962_probe(struct snd_soc_codec *codec)
 {
+       struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
        int ret;
        struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
        int i;
@@ -3462,7 +3459,7 @@ static int wm8962_probe(struct snd_soc_codec *codec)
        }
        if (!dmicclk || !dmicdat) {
                dev_dbg(codec->dev, "DMIC not in use, disabling\n");
-               snd_soc_dapm_nc_pin(&codec->dapm, "DMICDAT");
+               snd_soc_dapm_nc_pin(dapm, "DMICDAT");
        }
        if (dmicclk != dmicdat)
                dev_warn(codec->dev, "DMIC GPIOs partially configured\n");
This page took 0.026746 seconds and 5 git commands to generate.