aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8510.c
diff options
context:
space:
mode:
authorIan Molton <ian@mnementh.co.uk>2009-01-08 19:23:21 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-01-09 05:39:49 -0500
commit3e8e1952e3a3dd59b11233a532ca68e6471742d9 (patch)
tree3dff59c0b09cbcbc0e4b80a00cecd507219a821c /sound/soc/codecs/wm8510.c
parenta6ba2b2dabb583e7820e567fb309d771b50cb9ff (diff)
ASoC: cleanup duplicated code.
Many codec drivers were implementing cookie-cutter copies of the function that adds kcontrols to the codec. This patch moves this code to a common function snd_soc_add_controls() in soc-core.c and updates all drivers using copies of this function to use the new common version. [Edited to raise priority of error log message and document parameters. -- broonie] Signed-off-by: Ian Molton <ian@mnementh.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8510.c')
-rw-r--r--sound/soc/codecs/wm8510.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index 40f8238df717..abe7cce87714 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -171,22 +171,6 @@ SOC_SINGLE("Capture Boost(+20dB)", WM8510_ADCBOOST, 8, 1, 0),
171SOC_SINGLE("Mono Playback Switch", WM8510_MONOMIX, 6, 1, 1), 171SOC_SINGLE("Mono Playback Switch", WM8510_MONOMIX, 6, 1, 1),
172}; 172};
173 173
174/* add non dapm controls */
175static int wm8510_add_controls(struct snd_soc_codec *codec)
176{
177 int err, i;
178
179 for (i = 0; i < ARRAY_SIZE(wm8510_snd_controls); i++) {
180 err = snd_ctl_add(codec->card,
181 snd_soc_cnew(&wm8510_snd_controls[i], codec,
182 NULL));
183 if (err < 0)
184 return err;
185 }
186
187 return 0;
188}
189
190/* Speaker Output Mixer */ 174/* Speaker Output Mixer */
191static const struct snd_kcontrol_new wm8510_speaker_mixer_controls[] = { 175static const struct snd_kcontrol_new wm8510_speaker_mixer_controls[] = {
192SOC_DAPM_SINGLE("Line Bypass Switch", WM8510_SPKMIX, 1, 1, 0), 176SOC_DAPM_SINGLE("Line Bypass Switch", WM8510_SPKMIX, 1, 1, 0),
@@ -656,7 +640,8 @@ static int wm8510_init(struct snd_soc_device *socdev)
656 /* power on device */ 640 /* power on device */
657 codec->bias_level = SND_SOC_BIAS_OFF; 641 codec->bias_level = SND_SOC_BIAS_OFF;
658 wm8510_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 642 wm8510_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
659 wm8510_add_controls(codec); 643 snd_soc_add_controls(codec, wm8510_snd_controls,
644 ARRAY_SIZE(wm8510_snd_controls));
660 wm8510_add_widgets(codec); 645 wm8510_add_widgets(codec);
661 ret = snd_soc_init_card(socdev); 646 ret = snd_soc_init_card(socdev);
662 if (ret < 0) { 647 if (ret < 0) {