aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8753.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/wm8753.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/wm8753.c')
-rw-r--r--sound/soc/codecs/wm8753.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 6c21b50c9375..7283178e0eb5 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -339,21 +339,6 @@ SOC_ENUM("ADC Data Select", wm8753_enum[27]),
339SOC_ENUM("ROUT2 Phase", wm8753_enum[28]), 339SOC_ENUM("ROUT2 Phase", wm8753_enum[28]),
340}; 340};
341 341
342/* add non dapm controls */
343static int wm8753_add_controls(struct snd_soc_codec *codec)
344{
345 int err, i;
346
347 for (i = 0; i < ARRAY_SIZE(wm8753_snd_controls); i++) {
348 err = snd_ctl_add(codec->card,
349 snd_soc_cnew(&wm8753_snd_controls[i],
350 codec, NULL));
351 if (err < 0)
352 return err;
353 }
354 return 0;
355}
356
357/* 342/*
358 * _DAPM_ Controls 343 * _DAPM_ Controls
359 */ 344 */
@@ -1603,7 +1588,8 @@ static int wm8753_init(struct snd_soc_device *socdev)
1603 reg = wm8753_read_reg_cache(codec, WM8753_RINVOL); 1588 reg = wm8753_read_reg_cache(codec, WM8753_RINVOL);
1604 wm8753_write(codec, WM8753_RINVOL, reg | 0x0100); 1589 wm8753_write(codec, WM8753_RINVOL, reg | 0x0100);
1605 1590
1606 wm8753_add_controls(codec); 1591 snd_soc_add_controls(codec, wm8753_snd_controls,
1592 ARRAY_SIZE(wm8753_snd_controls));
1607 wm8753_add_widgets(codec); 1593 wm8753_add_widgets(codec);
1608 ret = snd_soc_init_card(socdev); 1594 ret = snd_soc_init_card(socdev);
1609 if (ret < 0) { 1595 if (ret < 0) {