diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-03-08 12:23:24 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-03-08 13:56:35 -0500 |
commit | efb7ac3f9c28fcb379c51f987b63174f727b7453 (patch) | |
tree | 0da50b269bc9f6fc9832144d9cc8ea4a64bc7b9f /sound/soc/soc-dapm.c | |
parent | c4ef87867b42bd1fa7d6dacaa28bf07cf741a724 (diff) |
ASoC: Fix prefixing of DAPM controls by factoring prefix into snd_soc_cnew()
Currently will ignore prefixes when creating DAPM controls. Since currently
all control creation goes through snd_soc_cnew() we can fix this by factoring
the prefixing into that function.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r-- | sound/soc/soc-dapm.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 570db8819d9b..a6fb85d46416 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -369,6 +369,12 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm, | |||
369 | size_t name_len; | 369 | size_t name_len; |
370 | struct snd_soc_dapm_path *path; | 370 | struct snd_soc_dapm_path *path; |
371 | struct snd_card *card = dapm->card->snd_card; | 371 | struct snd_card *card = dapm->card->snd_card; |
372 | const char *prefix; | ||
373 | |||
374 | if (dapm->codec) | ||
375 | prefix = dapm->codec->name_prefix; | ||
376 | else | ||
377 | prefix = NULL; | ||
372 | 378 | ||
373 | /* add kcontrol */ | 379 | /* add kcontrol */ |
374 | for (i = 0; i < w->num_kcontrols; i++) { | 380 | for (i = 0; i < w->num_kcontrols; i++) { |
@@ -409,7 +415,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm, | |||
409 | path->long_name[name_len - 1] = '\0'; | 415 | path->long_name[name_len - 1] = '\0'; |
410 | 416 | ||
411 | path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w, | 417 | path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w, |
412 | path->long_name); | 418 | path->long_name, prefix); |
413 | ret = snd_ctl_add(card, path->kcontrol); | 419 | ret = snd_ctl_add(card, path->kcontrol); |
414 | if (ret < 0) { | 420 | if (ret < 0) { |
415 | dev_err(dapm->dev, | 421 | dev_err(dapm->dev, |
@@ -431,6 +437,7 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm, | |||
431 | struct snd_soc_dapm_path *path = NULL; | 437 | struct snd_soc_dapm_path *path = NULL; |
432 | struct snd_kcontrol *kcontrol; | 438 | struct snd_kcontrol *kcontrol; |
433 | struct snd_card *card = dapm->card->snd_card; | 439 | struct snd_card *card = dapm->card->snd_card; |
440 | const char *prefix; | ||
434 | int ret = 0; | 441 | int ret = 0; |
435 | 442 | ||
436 | if (!w->num_kcontrols) { | 443 | if (!w->num_kcontrols) { |
@@ -438,7 +445,12 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm, | |||
438 | return -EINVAL; | 445 | return -EINVAL; |
439 | } | 446 | } |
440 | 447 | ||
441 | kcontrol = snd_soc_cnew(&w->kcontrols[0], w, w->name); | 448 | if (dapm->codec) |
449 | prefix = dapm->codec->name_prefix; | ||
450 | else | ||
451 | prefix = NULL; | ||
452 | |||
453 | kcontrol = snd_soc_cnew(&w->kcontrols[0], w, w->name, prefix); | ||
442 | ret = snd_ctl_add(card, kcontrol); | 454 | ret = snd_ctl_add(card, kcontrol); |
443 | 455 | ||
444 | if (ret < 0) | 456 | if (ret < 0) |