diff options
author | Ian Molton <ian@mnementh.co.uk> | 2009-01-08 19:23:21 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-01-09 05:39:49 -0500 |
commit | 3e8e1952e3a3dd59b11233a532ca68e6471742d9 (patch) | |
tree | 3dff59c0b09cbcbc0e4b80a00cecd507219a821c /sound/soc/codecs/tlv320aic3x.c | |
parent | a6ba2b2dabb583e7820e567fb309d771b50cb9ff (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/tlv320aic3x.c')
-rw-r--r-- | sound/soc/codecs/tlv320aic3x.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index b47a749c5ea2..36ab0198ca3f 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -311,22 +311,6 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { | |||
311 | SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), | 311 | SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), |
312 | }; | 312 | }; |
313 | 313 | ||
314 | /* add non dapm controls */ | ||
315 | static int aic3x_add_controls(struct snd_soc_codec *codec) | ||
316 | { | ||
317 | int err, i; | ||
318 | |||
319 | for (i = 0; i < ARRAY_SIZE(aic3x_snd_controls); i++) { | ||
320 | err = snd_ctl_add(codec->card, | ||
321 | snd_soc_cnew(&aic3x_snd_controls[i], | ||
322 | codec, NULL)); | ||
323 | if (err < 0) | ||
324 | return err; | ||
325 | } | ||
326 | |||
327 | return 0; | ||
328 | } | ||
329 | |||
330 | /* Left DAC Mux */ | 314 | /* Left DAC Mux */ |
331 | static const struct snd_kcontrol_new aic3x_left_dac_mux_controls = | 315 | static const struct snd_kcontrol_new aic3x_left_dac_mux_controls = |
332 | SOC_DAPM_ENUM("Route", aic3x_enum[LDAC_ENUM]); | 316 | SOC_DAPM_ENUM("Route", aic3x_enum[LDAC_ENUM]); |
@@ -1224,7 +1208,8 @@ static int aic3x_init(struct snd_soc_device *socdev) | |||
1224 | aic3x_write(codec, AIC3X_GPIO1_REG, (setup->gpio_func[0] & 0xf) << 4); | 1208 | aic3x_write(codec, AIC3X_GPIO1_REG, (setup->gpio_func[0] & 0xf) << 4); |
1225 | aic3x_write(codec, AIC3X_GPIO2_REG, (setup->gpio_func[1] & 0xf) << 4); | 1209 | aic3x_write(codec, AIC3X_GPIO2_REG, (setup->gpio_func[1] & 0xf) << 4); |
1226 | 1210 | ||
1227 | aic3x_add_controls(codec); | 1211 | snd_soc_add_controls(codec, aic3x_snd_controls, |
1212 | ARRAY_SIZE(aic3x_snd_controls)); | ||
1228 | aic3x_add_widgets(codec); | 1213 | aic3x_add_widgets(codec); |
1229 | ret = snd_soc_init_card(socdev); | 1214 | ret = snd_soc_init_card(socdev); |
1230 | if (ret < 0) { | 1215 | if (ret < 0) { |