diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-08 03:53:47 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-09 07:28:18 -0500 |
commit | 46ce904f7d4788ebc2ca7894fb56b9aa5b84af2d (patch) | |
tree | eab607a6e3258d197488b04e16d9769e59103030 /sound | |
parent | 5a374524216a244d30c42545ab49f743a43b05c7 (diff) |
ASoC: Convert WM8900 to table based DAPM and control init
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/wm8900.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index e427a38032cc..f18c554efc98 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c | |||
@@ -542,7 +542,7 @@ SND_SOC_DAPM_MIXER("Right Output Mixer", WM8900_REG_POWER3, 2, 0, | |||
542 | }; | 542 | }; |
543 | 543 | ||
544 | /* Target, Path, Source */ | 544 | /* Target, Path, Source */ |
545 | static const struct snd_soc_dapm_route audio_map[] = { | 545 | static const struct snd_soc_dapm_route wm8900_dapm_routes[] = { |
546 | /* Inputs */ | 546 | /* Inputs */ |
547 | {"Left Input PGA", "LINPUT1 Switch", "LINPUT1"}, | 547 | {"Left Input PGA", "LINPUT1 Switch", "LINPUT1"}, |
548 | {"Left Input PGA", "LINPUT2 Switch", "LINPUT2"}, | 548 | {"Left Input PGA", "LINPUT2 Switch", "LINPUT2"}, |
@@ -606,17 +606,6 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
606 | {"HP_R", NULL, "Headphone Amplifier"}, | 606 | {"HP_R", NULL, "Headphone Amplifier"}, |
607 | }; | 607 | }; |
608 | 608 | ||
609 | static int wm8900_add_widgets(struct snd_soc_codec *codec) | ||
610 | { | ||
611 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
612 | |||
613 | snd_soc_dapm_new_controls(dapm, wm8900_dapm_widgets, | ||
614 | ARRAY_SIZE(wm8900_dapm_widgets)); | ||
615 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); | ||
616 | |||
617 | return 0; | ||
618 | } | ||
619 | |||
620 | static int wm8900_hw_params(struct snd_pcm_substream *substream, | 609 | static int wm8900_hw_params(struct snd_pcm_substream *substream, |
621 | struct snd_pcm_hw_params *params, | 610 | struct snd_pcm_hw_params *params, |
622 | struct snd_soc_dai *dai) | 611 | struct snd_soc_dai *dai) |
@@ -1203,10 +1192,6 @@ static int wm8900_probe(struct snd_soc_codec *codec) | |||
1203 | /* Set the DAC and mixer output bias */ | 1192 | /* Set the DAC and mixer output bias */ |
1204 | snd_soc_write(codec, WM8900_REG_OUTBIASCTL, 0x81); | 1193 | snd_soc_write(codec, WM8900_REG_OUTBIASCTL, 0x81); |
1205 | 1194 | ||
1206 | snd_soc_add_controls(codec, wm8900_snd_controls, | ||
1207 | ARRAY_SIZE(wm8900_snd_controls)); | ||
1208 | wm8900_add_widgets(codec); | ||
1209 | |||
1210 | return 0; | 1195 | return 0; |
1211 | } | 1196 | } |
1212 | 1197 | ||
@@ -1227,6 +1212,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8900 = { | |||
1227 | .reg_cache_size = ARRAY_SIZE(wm8900_reg_defaults), | 1212 | .reg_cache_size = ARRAY_SIZE(wm8900_reg_defaults), |
1228 | .reg_word_size = sizeof(u16), | 1213 | .reg_word_size = sizeof(u16), |
1229 | .reg_cache_default = wm8900_reg_defaults, | 1214 | .reg_cache_default = wm8900_reg_defaults, |
1215 | |||
1216 | .controls = wm8900_snd_controls, | ||
1217 | .num_controls = ARRAY_SIZE(wm8900_snd_controls), | ||
1218 | .dapm_widgets = wm8900_dapm_widgets, | ||
1219 | .num_dapm_widgets = ARRAY_SIZE(wm8900_dapm_widgets), | ||
1220 | .dapm_routes = wm8900_dapm_routes, | ||
1221 | .num_dapm_routes = ARRAY_SIZE(wm8900_dapm_routes), | ||
1230 | }; | 1222 | }; |
1231 | 1223 | ||
1232 | #if defined(CONFIG_SPI_MASTER) | 1224 | #if defined(CONFIG_SPI_MASTER) |