ASoC: neo1973_wm8753: Convert to table based setup

Use table based setup to register the controls and DAPM widgets and routes.
This on one hand makes the code a bit shorter and cleaner and on the other hand
the board level DAPM elements get registered in the card's DAPM context rather
than in the CODEC's DAPM context.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
Lars-Peter Clausen 2014-03-01 16:17:03 +01:00 committed by Mark Brown
parent 61e7fe2577
commit 4f07c9ccdf

View file

@ -272,48 +272,29 @@ static const struct snd_kcontrol_new neo1973_wm8753_controls[] = {
static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
int ret;
struct snd_soc_card *card = rtd->card;
/* set up NC codec pins */
snd_soc_dapm_nc_pin(dapm, "OUT3");
snd_soc_dapm_nc_pin(dapm, "OUT4");
snd_soc_dapm_nc_pin(dapm, "LINE1");
snd_soc_dapm_nc_pin(dapm, "LINE2");
/* Add neo1973 specific widgets */
ret = snd_soc_dapm_new_controls(dapm, neo1973_wm8753_dapm_widgets,
ARRAY_SIZE(neo1973_wm8753_dapm_widgets));
if (ret)
return ret;
/* add neo1973 specific controls */
ret = snd_soc_add_card_controls(rtd->card, neo1973_wm8753_controls,
ARRAY_SIZE(neo1973_wm8753_controls));
if (ret)
return ret;
/* set up neo1973 specific audio routes */
ret = snd_soc_dapm_add_routes(dapm, neo1973_wm8753_routes,
ARRAY_SIZE(neo1973_wm8753_routes));
if (ret)
return ret;
snd_soc_dapm_nc_pin(&codec->dapm, "OUT3");
snd_soc_dapm_nc_pin(&codec->dapm, "OUT4");
snd_soc_dapm_nc_pin(&codec->dapm, "LINE1");
snd_soc_dapm_nc_pin(&codec->dapm, "LINE2");
/* set endpoints to default off mode */
snd_soc_dapm_disable_pin(dapm, "GSM Line Out");
snd_soc_dapm_disable_pin(dapm, "GSM Line In");
snd_soc_dapm_disable_pin(dapm, "Headset Mic");
snd_soc_dapm_disable_pin(dapm, "Handset Mic");
snd_soc_dapm_disable_pin(dapm, "Stereo Out");
snd_soc_dapm_disable_pin(dapm, "Handset Spk");
snd_soc_dapm_disable_pin(&card->dapm, "GSM Line Out");
snd_soc_dapm_disable_pin(&card->dapm, "GSM Line In");
snd_soc_dapm_disable_pin(&card->dapm, "Headset Mic");
snd_soc_dapm_disable_pin(&card->dapm, "Handset Mic");
snd_soc_dapm_disable_pin(&card->dapm, "Stereo Out");
snd_soc_dapm_disable_pin(&card->dapm, "Handset Spk");
/* allow audio paths from the GSM modem to run during suspend */
snd_soc_dapm_ignore_suspend(dapm, "GSM Line Out");
snd_soc_dapm_ignore_suspend(dapm, "GSM Line In");
snd_soc_dapm_ignore_suspend(dapm, "Headset Mic");
snd_soc_dapm_ignore_suspend(dapm, "Handset Mic");
snd_soc_dapm_ignore_suspend(dapm, "Stereo Out");
snd_soc_dapm_ignore_suspend(dapm, "Handset Spk");
snd_soc_dapm_ignore_suspend(&card->dapm, "GSM Line Out");
snd_soc_dapm_ignore_suspend(&card->dapm, "GSM Line In");
snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic");
snd_soc_dapm_ignore_suspend(&card->dapm, "Handset Mic");
snd_soc_dapm_ignore_suspend(&card->dapm, "Stereo Out");
snd_soc_dapm_ignore_suspend(&card->dapm, "Handset Spk");
return 0;
}
@ -367,6 +348,13 @@ static struct snd_soc_card neo1973 = {
.num_aux_devs = ARRAY_SIZE(neo1973_aux_devs),
.codec_conf = neo1973_codec_conf,
.num_configs = ARRAY_SIZE(neo1973_codec_conf),
.controls = neo1973_wm8753_controls,
.num_controls = ARRAY_SIZE(neo1973_wm8753_controls),
.dapm_widgets = neo1973_wm8753_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(neo1973_wm8753_dapm_widgets),
.dapm_routes = neo1973_wm8753_routes,
.num_dapm_routes = ARRAY_SIZE(neo1973_wm8753_routes),
};
static struct platform_device *neo1973_snd_device;