diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-03-08 17:23:24 +0000 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-03-08 18:56:35 +0000 |
commit | efb7ac3f9c28fcb379c51f987b63174f727b7453 (patch) | |
tree | 0da50b269bc9f6fc9832144d9cc8ea4a64bc7b9f /sound/soc/soc-dapm.c | |
parent | c4ef87867b42bd1fa7d6dacaa28bf07cf741a724 (diff) | |
download | blackbird-op-linux-efb7ac3f9c28fcb379c51f987b63174f727b7453.tar.gz blackbird-op-linux-efb7ac3f9c28fcb379c51f987b63174f727b7453.zip |
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, size_t name_len; struct snd_soc_dapm_path *path; struct snd_card *card = dapm->card->snd_card; + const char *prefix; + + if (dapm->codec) + prefix = dapm->codec->name_prefix; + else + prefix = NULL; /* add kcontrol */ for (i = 0; i < w->num_kcontrols; i++) { @@ -409,7 +415,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm, path->long_name[name_len - 1] = '\0'; path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w, - path->long_name); + path->long_name, prefix); ret = snd_ctl_add(card, path->kcontrol); if (ret < 0) { dev_err(dapm->dev, @@ -431,6 +437,7 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm, struct snd_soc_dapm_path *path = NULL; struct snd_kcontrol *kcontrol; struct snd_card *card = dapm->card->snd_card; + const char *prefix; int ret = 0; if (!w->num_kcontrols) { @@ -438,7 +445,12 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm, return -EINVAL; } - kcontrol = snd_soc_cnew(&w->kcontrols[0], w, w->name); + if (dapm->codec) + prefix = dapm->codec->name_prefix; + else + prefix = NULL; + + kcontrol = snd_soc_cnew(&w->kcontrols[0], w, w->name, prefix); ret = snd_ctl_add(card, kcontrol); if (ret < 0) |