]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: Convert wm8978 to table based DAPM and control init
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 29 Dec 2011 11:15:43 +0000 (11:15 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 20 Jan 2012 13:58:19 +0000 (13:58 +0000)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/wm8978.c

index 2ba8f8c88ba6c9262d6c308f7c45886a5f8643ad..36468f85f3017d5998d27a0c8ef662be5ccc8111 100644 (file)
@@ -302,7 +302,7 @@ static const struct snd_soc_dapm_widget wm8978_dapm_widgets[] = {
        SND_SOC_DAPM_OUTPUT("RSPK"),
 };
 
-static const struct snd_soc_dapm_route audio_map[] = {
+static const struct snd_soc_dapm_route wm8978_dapm_routes[] = {
        /* Output mixer */
        {"Right Output Mixer", "PCM Playback Switch", "Right DAC"},
        {"Right Output Mixer", "Aux Playback Switch", "RAUX"},
@@ -351,18 +351,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
        {"Left Input Mixer", "MicP Switch", "LMICP"},
 };
 
-static int wm8978_add_widgets(struct snd_soc_codec *codec)
-{
-       struct snd_soc_dapm_context *dapm = &codec->dapm;
-
-       snd_soc_dapm_new_controls(dapm, wm8978_dapm_widgets,
-                                 ARRAY_SIZE(wm8978_dapm_widgets));
-       /* set up the WM8978 audio map */
-       snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
-       return 0;
-}
-
 /* PLL divisors */
 struct wm8978_pll_div {
        u32 k;
@@ -975,10 +963,6 @@ static int wm8978_probe(struct snd_soc_codec *codec)
 
        wm8978_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 
-       snd_soc_add_controls(codec, wm8978_snd_controls,
-                            ARRAY_SIZE(wm8978_snd_controls));
-       wm8978_add_widgets(codec);
-
        return 0;
 }
 
@@ -998,6 +982,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8978 = {
        .reg_cache_size = ARRAY_SIZE(wm8978_reg),
        .reg_word_size = sizeof(u16),
        .reg_cache_default = wm8978_reg,
+
+       .controls = wm8978_snd_controls,
+       .num_controls = ARRAY_SIZE(wm8978_snd_controls),
+       .dapm_widgets = wm8978_dapm_widgets,
+       .num_dapm_widgets = ARRAY_SIZE(wm8978_dapm_widgets),
+       .dapm_routes = wm8978_dapm_routes,
+       .num_dapm_routes = ARRAY_SIZE(wm8978_dapm_routes),
 };
 
 static __devinit int wm8978_i2c_probe(struct i2c_client *i2c,