diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-03-12 10:27:33 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-04-14 12:27:16 -0400 |
commit | 81fc5dd4d19faa3dda886910cb8fdad639fa828b (patch) | |
tree | 0828908c0d8e43515428043621bda18bc81a7119 /sound | |
parent | 74a1672068c7f52f1525a5fca17cdc1ed6961239 (diff) |
ASoC: omap: rx51: Convert to table based control and DAPM setup
Use table based setup to register the controls and DAPM widgets and routes. This
on one hand makes the code a bit shorter and cleaner and on the other hand the
board level DAPM elements get registered in the card's DAPM context rather than
in the CODEC's DAPM context.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/omap/rx51.c | 47 |
1 files changed, 7 insertions, 40 deletions
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c index 7fb3d4b10370..2b4641123142 100644 --- a/sound/soc/omap/rx51.c +++ b/sound/soc/omap/rx51.c | |||
@@ -237,9 +237,6 @@ static const struct snd_soc_dapm_widget aic34_dapm_widgets[] = { | |||
237 | SND_SOC_DAPM_HP("Headphone Jack", rx51_hp_event), | 237 | SND_SOC_DAPM_HP("Headphone Jack", rx51_hp_event), |
238 | SND_SOC_DAPM_MIC("HS Mic", NULL), | 238 | SND_SOC_DAPM_MIC("HS Mic", NULL), |
239 | SND_SOC_DAPM_LINE("FM Transmitter", NULL), | 239 | SND_SOC_DAPM_LINE("FM Transmitter", NULL), |
240 | }; | ||
241 | |||
242 | static const struct snd_soc_dapm_widget aic34_dapm_widgetsb[] = { | ||
243 | SND_SOC_DAPM_SPK("Earphone", NULL), | 240 | SND_SOC_DAPM_SPK("Earphone", NULL), |
244 | }; | 241 | }; |
245 | 242 | ||
@@ -253,9 +250,7 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
253 | 250 | ||
254 | {"DMic Rate 64", NULL, "Mic Bias"}, | 251 | {"DMic Rate 64", NULL, "Mic Bias"}, |
255 | {"Mic Bias", NULL, "DMic"}, | 252 | {"Mic Bias", NULL, "DMic"}, |
256 | }; | ||
257 | 253 | ||
258 | static const struct snd_soc_dapm_route audio_mapb[] = { | ||
259 | {"b LINE2R", NULL, "MONO_LOUT"}, | 254 | {"b LINE2R", NULL, "MONO_LOUT"}, |
260 | {"Earphone", NULL, "b HPLOUT"}, | 255 | {"Earphone", NULL, "b HPLOUT"}, |
261 | 256 | ||
@@ -281,9 +276,6 @@ static const struct snd_kcontrol_new aic34_rx51_controls[] = { | |||
281 | SOC_ENUM_EXT("Jack Function", rx51_enum[2], | 276 | SOC_ENUM_EXT("Jack Function", rx51_enum[2], |
282 | rx51_get_jack, rx51_set_jack), | 277 | rx51_get_jack, rx51_set_jack), |
283 | SOC_DAPM_PIN_SWITCH("FM Transmitter"), | 278 | SOC_DAPM_PIN_SWITCH("FM Transmitter"), |
284 | }; | ||
285 | |||
286 | static const struct snd_kcontrol_new aic34_rx51_controlsb[] = { | ||
287 | SOC_DAPM_PIN_SWITCH("Earphone"), | 279 | SOC_DAPM_PIN_SWITCH("Earphone"), |
288 | }; | 280 | }; |
289 | 281 | ||
@@ -298,19 +290,6 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) | |||
298 | snd_soc_dapm_nc_pin(dapm, "MIC3R"); | 290 | snd_soc_dapm_nc_pin(dapm, "MIC3R"); |
299 | snd_soc_dapm_nc_pin(dapm, "LINE1R"); | 291 | snd_soc_dapm_nc_pin(dapm, "LINE1R"); |
300 | 292 | ||
301 | /* Add RX-51 specific controls */ | ||
302 | err = snd_soc_add_card_controls(rtd->card, aic34_rx51_controls, | ||
303 | ARRAY_SIZE(aic34_rx51_controls)); | ||
304 | if (err < 0) | ||
305 | return err; | ||
306 | |||
307 | /* Add RX-51 specific widgets */ | ||
308 | snd_soc_dapm_new_controls(dapm, aic34_dapm_widgets, | ||
309 | ARRAY_SIZE(aic34_dapm_widgets)); | ||
310 | |||
311 | /* Set up RX-51 specific audio path audio_map */ | ||
312 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); | ||
313 | |||
314 | err = tpa6130a2_add_controls(codec); | 293 | err = tpa6130a2_add_controls(codec); |
315 | if (err < 0) | 294 | if (err < 0) |
316 | return err; | 295 | return err; |
@@ -333,24 +312,6 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd) | |||
333 | return err; | 312 | return err; |
334 | } | 313 | } |
335 | 314 | ||
336 | static int rx51_aic34b_init(struct snd_soc_dapm_context *dapm) | ||
337 | { | ||
338 | int err; | ||
339 | |||
340 | err = snd_soc_add_card_controls(dapm->card, aic34_rx51_controlsb, | ||
341 | ARRAY_SIZE(aic34_rx51_controlsb)); | ||
342 | if (err < 0) | ||
343 | return err; | ||
344 | |||
345 | err = snd_soc_dapm_new_controls(dapm, aic34_dapm_widgetsb, | ||
346 | ARRAY_SIZE(aic34_dapm_widgetsb)); | ||
347 | if (err < 0) | ||
348 | return 0; | ||
349 | |||
350 | return snd_soc_dapm_add_routes(dapm, audio_mapb, | ||
351 | ARRAY_SIZE(audio_mapb)); | ||
352 | } | ||
353 | |||
354 | /* Digital audio interface glue - connects codec <--> CPU */ | 315 | /* Digital audio interface glue - connects codec <--> CPU */ |
355 | static struct snd_soc_dai_link rx51_dai[] = { | 316 | static struct snd_soc_dai_link rx51_dai[] = { |
356 | { | 317 | { |
@@ -371,7 +332,6 @@ static struct snd_soc_aux_dev rx51_aux_dev[] = { | |||
371 | { | 332 | { |
372 | .name = "TLV320AIC34b", | 333 | .name = "TLV320AIC34b", |
373 | .codec_name = "tlv320aic3x-codec.2-0019", | 334 | .codec_name = "tlv320aic3x-codec.2-0019", |
374 | .init = rx51_aic34b_init, | ||
375 | }, | 335 | }, |
376 | }; | 336 | }; |
377 | 337 | ||
@@ -392,6 +352,13 @@ static struct snd_soc_card rx51_sound_card = { | |||
392 | .num_aux_devs = ARRAY_SIZE(rx51_aux_dev), | 352 | .num_aux_devs = ARRAY_SIZE(rx51_aux_dev), |
393 | .codec_conf = rx51_codec_conf, | 353 | .codec_conf = rx51_codec_conf, |
394 | .num_configs = ARRAY_SIZE(rx51_codec_conf), | 354 | .num_configs = ARRAY_SIZE(rx51_codec_conf), |
355 | |||
356 | .controls = aic34_rx51_controls, | ||
357 | .num_controls = ARRAY_SIZE(aic34_rx51_controls), | ||
358 | .dapm_widgets = aic34_dapm_widgets, | ||
359 | .num_dapm_widgets = ARRAY_SIZE(aic34_dapm_widgets), | ||
360 | .dapm_routes = audio_map, | ||
361 | .num_dapm_routes = ARRAY_SIZE(audio_map), | ||
395 | }; | 362 | }; |
396 | 363 | ||
397 | static struct platform_device *rx51_snd_device; | 364 | static struct platform_device *rx51_snd_device; |