ASoC: twl6040: Replace w->codec snd_soc_dapm_to_codec(w->dapm)
[deliverable/linux.git] / sound / soc / codecs / wm8961.c
index 41d23e920ad53c4b07cd560d9402c5c961acb7d6..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);
 
@@ -835,7 +835,6 @@ static struct snd_soc_dai_driver wm8961_dai = {
 
 static int wm8961_probe(struct snd_soc_codec *codec)
 {
-       struct snd_soc_dapm_context *dapm = &codec->dapm;
        u16 reg;
 
        /* Enable class W */
@@ -871,50 +870,33 @@ static int wm8961_probe(struct snd_soc_codec *codec)
        reg &= ~WM8961_MANUAL_MODE;
        snd_soc_write(codec, WM8961_CLOCKING_3, reg);
 
-       wm8961_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-
-       snd_soc_add_codec_controls(codec, wm8961_snd_controls,
-                               ARRAY_SIZE(wm8961_snd_controls));
-       snd_soc_dapm_new_controls(dapm, wm8961_dapm_widgets,
-                                 ARRAY_SIZE(wm8961_dapm_widgets));
-       snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));
-
-       return 0;
-}
-
-static int wm8961_remove(struct snd_soc_codec *codec)
-{
-       wm8961_set_bias_level(codec, SND_SOC_BIAS_OFF);
        return 0;
 }
 
 #ifdef CONFIG_PM
-static int wm8961_suspend(struct snd_soc_codec *codec)
-{
-       wm8961_set_bias_level(codec, SND_SOC_BIAS_OFF);
-
-       return 0;
-}
 
 static int wm8961_resume(struct snd_soc_codec *codec)
 {
        snd_soc_cache_sync(codec);
 
-       wm8961_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-
        return 0;
 }
 #else
-#define wm8961_suspend NULL
 #define wm8961_resume NULL
 #endif
 
 static struct snd_soc_codec_driver soc_codec_dev_wm8961 = {
        .probe =        wm8961_probe,
-       .remove =       wm8961_remove,
-       .suspend =      wm8961_suspend,
        .resume =       wm8961_resume,
        .set_bias_level = wm8961_set_bias_level,
+       .suspend_bias_off = true,
+
+       .controls = wm8961_snd_controls,
+       .num_controls = ARRAY_SIZE(wm8961_snd_controls),
+       .dapm_widgets = wm8961_dapm_widgets,
+       .num_dapm_widgets = ARRAY_SIZE(wm8961_dapm_widgets),
+       .dapm_routes = audio_paths,
+       .num_dapm_routes = ARRAY_SIZE(audio_paths),
 };
 
 static const struct regmap_config wm8961_regmap = {
This page took 0.025514 seconds and 5 git commands to generate.