ASoC: Convert WM8400 to table based DAPM and control init
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 3 Dec 2011 11:34:34 +0000 (11:34 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 3 Dec 2011 21:35:11 +0000 (21:35 +0000)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/wm8400.c

index aef7e4dcefdd63049cd4efb64b66a6c25c0ea48b..898979d23010e3f5f50cc00070c4d6d56b92b58f 100644 (file)
@@ -353,13 +353,6 @@ SOC_SINGLE("RIN34 Mute Switch", WM8400_RIGHT_LINE_INPUT_3_4_VOLUME,
 
 };
 
-/* add non dapm controls */
-static int wm8400_add_controls(struct snd_soc_codec *codec)
-{
-       return snd_soc_add_controls(codec, wm8400_snd_controls,
-                               ARRAY_SIZE(wm8400_snd_controls));
-}
-
 /*
  * _DAPM_ Controls
  */
@@ -783,7 +776,7 @@ SND_SOC_DAPM_OUTPUT("RON"),
 SND_SOC_DAPM_OUTPUT("Internal DAC Sink"),
 };
 
-static const struct snd_soc_dapm_route audio_map[] = {
+static const struct snd_soc_dapm_route wm8400_dapm_routes[] = {
        /* Make DACs turn on when playing even if not mixed into any outputs */
        {"Internal DAC Sink", NULL, "Left DAC"},
        {"Internal DAC Sink", NULL, "Right DAC"},
@@ -909,17 +902,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
        {"RON", NULL, "RONMIX"},
 };
 
-static int wm8400_add_widgets(struct snd_soc_codec *codec)
-{
-       struct snd_soc_dapm_context *dapm = &codec->dapm;
-
-       snd_soc_dapm_new_controls(dapm, wm8400_dapm_widgets,
-                                 ARRAY_SIZE(wm8400_dapm_widgets));
-       snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
-       return 0;
-}
-
 /*
  * Clock after FLL and dividers
  */
@@ -1421,8 +1403,6 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
                ret = -EINVAL;
                goto err_regulator;
        }
-       wm8400_add_controls(codec);
-       wm8400_add_widgets(codec);
        return 0;
 
 err_regulator:
@@ -1451,6 +1431,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8400 = {
        .read = wm8400_read,
        .write = wm8400_write,
        .set_bias_level = wm8400_set_bias_level,
+
+       .controls = wm8400_snd_controls,
+       .num_controls = ARRAY_SIZE(wm8400_snd_controls),
+       .dapm_widgets = wm8400_dapm_widgets,
+       .num_dapm_widgets = ARRAY_SIZE(wm8400_dapm_widgets),
+       .dapm_routes = wm8400_dapm_routes,
+       .num_dapm_routes = ARRAY_SIZE(wm8400_dapm_routes),
 };
 
 static int __devinit wm8400_probe(struct platform_device *pdev)