ASoC: Convert WM8741 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 17:15:06 +00:00
parent f235c649c1
commit 0e62780f5f

View File

@ -85,24 +85,13 @@ SND_SOC_DAPM_OUTPUT("VOUTRP"),
SND_SOC_DAPM_OUTPUT("VOUTRN"), SND_SOC_DAPM_OUTPUT("VOUTRN"),
}; };
static const struct snd_soc_dapm_route intercon[] = { static const struct snd_soc_dapm_route wm8741_dapm_routes[] = {
{ "VOUTLP", NULL, "DACL" }, { "VOUTLP", NULL, "DACL" },
{ "VOUTLN", NULL, "DACL" }, { "VOUTLN", NULL, "DACL" },
{ "VOUTRP", NULL, "DACR" }, { "VOUTRP", NULL, "DACR" },
{ "VOUTRN", NULL, "DACR" }, { "VOUTRN", NULL, "DACR" },
}; };
static int wm8741_add_widgets(struct snd_soc_codec *codec)
{
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, wm8741_dapm_widgets,
ARRAY_SIZE(wm8741_dapm_widgets));
snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
return 0;
}
static struct { static struct {
int value; int value;
int ratio; int ratio;
@ -456,10 +445,6 @@ static int wm8741_probe(struct snd_soc_codec *codec)
snd_soc_update_bits(codec, WM8741_DACRMSB_ATTENUATION, snd_soc_update_bits(codec, WM8741_DACRMSB_ATTENUATION,
WM8741_UPDATERM, WM8741_UPDATERM); WM8741_UPDATERM, WM8741_UPDATERM);
snd_soc_add_controls(codec, wm8741_snd_controls,
ARRAY_SIZE(wm8741_snd_controls));
wm8741_add_widgets(codec);
dev_dbg(codec->dev, "Successful registration\n"); dev_dbg(codec->dev, "Successful registration\n");
return ret; return ret;
@ -488,6 +473,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8741 = {
.reg_cache_size = ARRAY_SIZE(wm8741_reg_defaults), .reg_cache_size = ARRAY_SIZE(wm8741_reg_defaults),
.reg_word_size = sizeof(u16), .reg_word_size = sizeof(u16),
.reg_cache_default = wm8741_reg_defaults, .reg_cache_default = wm8741_reg_defaults,
.controls = wm8741_snd_controls,
.num_controls = ARRAY_SIZE(wm8741_snd_controls),
.dapm_widgets = wm8741_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8741_dapm_widgets),
.dapm_routes = wm8741_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(wm8741_dapm_routes),
}; };
static const struct of_device_id wm8741_of_match[] = { static const struct of_device_id wm8741_of_match[] = {