aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm9713.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/wm9713.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/wm9713.c')
-rw-r--r--sound/soc/codecs/wm9713.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index f3ca8aaf0139..a45622620db7 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -190,21 +190,6 @@ SOC_SINGLE("3D Lower Cut-off Switch", AC97_REC_GAIN_MIC, 4, 1, 0),
190SOC_SINGLE("3D Depth", AC97_REC_GAIN_MIC, 0, 15, 1), 190SOC_SINGLE("3D Depth", AC97_REC_GAIN_MIC, 0, 15, 1),
191}; 191};
192 192
193/* add non dapm controls */
194static int wm9713_add_controls(struct snd_soc_codec *codec)
195{
196 int err, i;
197
198 for (i = 0; i < ARRAY_SIZE(wm9713_snd_ac97_controls); i++) {
199 err = snd_ctl_add(codec->card,
200 snd_soc_cnew(&wm9713_snd_ac97_controls[i],
201 codec, NULL));
202 if (err < 0)
203 return err;
204 }
205 return 0;
206}
207
208/* We have to create a fake left and right HP mixers because 193/* We have to create a fake left and right HP mixers because
209 * the codec only has a single control that is shared by both channels. 194 * the codec only has a single control that is shared by both channels.
210 * This makes it impossible to determine the audio path using the current 195 * This makes it impossible to determine the audio path using the current
@@ -1245,7 +1230,8 @@ static int wm9713_soc_probe(struct platform_device *pdev)
1245 reg = ac97_read(codec, AC97_CD) & 0x7fff; 1230 reg = ac97_read(codec, AC97_CD) & 0x7fff;
1246 ac97_write(codec, AC97_CD, reg); 1231 ac97_write(codec, AC97_CD, reg);
1247 1232
1248 wm9713_add_controls(codec); 1233 snd_soc_add_controls(codec, wm9713_snd_ac97_controls,
1234 ARRAY_SIZE(wm9713_snd_ac97_controls));
1249 wm9713_add_widgets(codec); 1235 wm9713_add_widgets(codec);
1250 ret = snd_soc_init_card(socdev); 1236 ret = snd_soc_init_card(socdev);
1251 if (ret < 0) 1237 if (ret < 0)