aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/samsung
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-03-01 10:17:03 -0500
committerMark Brown <broonie@linaro.org>2014-03-02 20:35:04 -0500
commit4f07c9ccdf92155dd8a216eee262f2954a6d69a2 (patch)
treed1351360b6e70968841a14bc099d5d7b198ef883 /sound/soc/samsung
parent61e7fe2577479a1f2650c3fe41c6c842797dddf6 (diff)
ASoC: neo1973_wm8753: Convert to table based 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/soc/samsung')
-rw-r--r--sound/soc/samsung/neo1973_wm8753.c60
1 files changed, 24 insertions, 36 deletions
diff --git a/sound/soc/samsung/neo1973_wm8753.c b/sound/soc/samsung/neo1973_wm8753.c
index 0125d9d5fbe7..b0800337b79e 100644
--- a/sound/soc/samsung/neo1973_wm8753.c
+++ b/sound/soc/samsung/neo1973_wm8753.c
@@ -272,48 +272,29 @@ static const struct snd_kcontrol_new neo1973_wm8753_controls[] = {
272static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd) 272static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd)
273{ 273{
274 struct snd_soc_codec *codec = rtd->codec; 274 struct snd_soc_codec *codec = rtd->codec;
275 struct snd_soc_dapm_context *dapm = &codec->dapm; 275 struct snd_soc_card *card = rtd->card;
276 int ret;
277 276
278 /* set up NC codec pins */ 277 /* set up NC codec pins */
279 snd_soc_dapm_nc_pin(dapm, "OUT3"); 278 snd_soc_dapm_nc_pin(&codec->dapm, "OUT3");
280 snd_soc_dapm_nc_pin(dapm, "OUT4"); 279 snd_soc_dapm_nc_pin(&codec->dapm, "OUT4");
281 snd_soc_dapm_nc_pin(dapm, "LINE1"); 280 snd_soc_dapm_nc_pin(&codec->dapm, "LINE1");
282 snd_soc_dapm_nc_pin(dapm, "LINE2"); 281 snd_soc_dapm_nc_pin(&codec->dapm, "LINE2");
283
284 /* Add neo1973 specific widgets */
285 ret = snd_soc_dapm_new_controls(dapm, neo1973_wm8753_dapm_widgets,
286 ARRAY_SIZE(neo1973_wm8753_dapm_widgets));
287 if (ret)
288 return ret;
289
290 /* add neo1973 specific controls */
291 ret = snd_soc_add_card_controls(rtd->card, neo1973_wm8753_controls,
292 ARRAY_SIZE(neo1973_wm8753_controls));
293 if (ret)
294 return ret;
295
296 /* set up neo1973 specific audio routes */
297 ret = snd_soc_dapm_add_routes(dapm, neo1973_wm8753_routes,
298 ARRAY_SIZE(neo1973_wm8753_routes));
299 if (ret)
300 return ret;
301 282
302 /* set endpoints to default off mode */ 283 /* set endpoints to default off mode */
303 snd_soc_dapm_disable_pin(dapm, "GSM Line Out"); 284 snd_soc_dapm_disable_pin(&card->dapm, "GSM Line Out");
304 snd_soc_dapm_disable_pin(dapm, "GSM Line In"); 285 snd_soc_dapm_disable_pin(&card->dapm, "GSM Line In");
305 snd_soc_dapm_disable_pin(dapm, "Headset Mic"); 286 snd_soc_dapm_disable_pin(&card->dapm, "Headset Mic");
306 snd_soc_dapm_disable_pin(dapm, "Handset Mic"); 287 snd_soc_dapm_disable_pin(&card->dapm, "Handset Mic");
307 snd_soc_dapm_disable_pin(dapm, "Stereo Out"); 288 snd_soc_dapm_disable_pin(&card->dapm, "Stereo Out");
308 snd_soc_dapm_disable_pin(dapm, "Handset Spk"); 289 snd_soc_dapm_disable_pin(&card->dapm, "Handset Spk");
309 290
310 /* allow audio paths from the GSM modem to run during suspend */ 291 /* allow audio paths from the GSM modem to run during suspend */
311 snd_soc_dapm_ignore_suspend(dapm, "GSM Line Out"); 292 snd_soc_dapm_ignore_suspend(&card->dapm, "GSM Line Out");
312 snd_soc_dapm_ignore_suspend(dapm, "GSM Line In"); 293 snd_soc_dapm_ignore_suspend(&card->dapm, "GSM Line In");
313 snd_soc_dapm_ignore_suspend(dapm, "Headset Mic"); 294 snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic");
314 snd_soc_dapm_ignore_suspend(dapm, "Handset Mic"); 295 snd_soc_dapm_ignore_suspend(&card->dapm, "Handset Mic");
315 snd_soc_dapm_ignore_suspend(dapm, "Stereo Out"); 296 snd_soc_dapm_ignore_suspend(&card->dapm, "Stereo Out");
316 snd_soc_dapm_ignore_suspend(dapm, "Handset Spk"); 297 snd_soc_dapm_ignore_suspend(&card->dapm, "Handset Spk");
317 298
318 return 0; 299 return 0;
319} 300}
@@ -367,6 +348,13 @@ static struct snd_soc_card neo1973 = {
367 .num_aux_devs = ARRAY_SIZE(neo1973_aux_devs), 348 .num_aux_devs = ARRAY_SIZE(neo1973_aux_devs),
368 .codec_conf = neo1973_codec_conf, 349 .codec_conf = neo1973_codec_conf,
369 .num_configs = ARRAY_SIZE(neo1973_codec_conf), 350 .num_configs = ARRAY_SIZE(neo1973_codec_conf),
351
352 .controls = neo1973_wm8753_controls,
353 .num_controls = ARRAY_SIZE(neo1973_wm8753_controls),
354 .dapm_widgets = neo1973_wm8753_dapm_widgets,
355 .num_dapm_widgets = ARRAY_SIZE(neo1973_wm8753_dapm_widgets),
356 .dapm_routes = neo1973_wm8753_routes,
357 .num_dapm_routes = ARRAY_SIZE(neo1973_wm8753_routes),
370}; 358};
371 359
372static struct platform_device *neo1973_snd_device; 360static struct platform_device *neo1973_snd_device;