ASoC: Convert WM8400 to table based DAPM and control init

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Mark Brown 2011-12-03 11:34:34 +00:00
parent e6c94e9f6d
commit b4505ab141
1 changed files with 8 additions and 21 deletions

View 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 * _DAPM_ Controls
*/ */
@ -783,7 +776,7 @@ SND_SOC_DAPM_OUTPUT("RON"),
SND_SOC_DAPM_OUTPUT("Internal DAC Sink"), 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 */ /* Make DACs turn on when playing even if not mixed into any outputs */
{"Internal DAC Sink", NULL, "Left DAC"}, {"Internal DAC Sink", NULL, "Left DAC"},
{"Internal DAC Sink", NULL, "Right DAC"}, {"Internal DAC Sink", NULL, "Right DAC"},
@ -909,17 +902,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
{"RON", NULL, "RONMIX"}, {"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 * Clock after FLL and dividers
*/ */
@ -1421,8 +1403,6 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
ret = -EINVAL; ret = -EINVAL;
goto err_regulator; goto err_regulator;
} }
wm8400_add_controls(codec);
wm8400_add_widgets(codec);
return 0; return 0;
err_regulator: err_regulator:
@ -1451,6 +1431,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8400 = {
.read = wm8400_read, .read = wm8400_read,
.write = wm8400_write, .write = wm8400_write,
.set_bias_level = wm8400_set_bias_level, .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) static int __devinit wm8400_probe(struct platform_device *pdev)