aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/soc-dapm.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index a6fb85d46416..e981a8339f88 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -366,7 +366,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
366 struct snd_soc_dapm_widget *w) 366 struct snd_soc_dapm_widget *w)
367{ 367{
368 int i, ret = 0; 368 int i, ret = 0;
369 size_t name_len; 369 size_t name_len, prefix_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; 372 const char *prefix;
@@ -376,6 +376,11 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
376 else 376 else
377 prefix = NULL; 377 prefix = NULL;
378 378
379 if (prefix)
380 prefix_len = strlen(prefix) + 1;
381 else
382 prefix_len = 0;
383
379 /* add kcontrol */ 384 /* add kcontrol */
380 for (i = 0; i < w->num_kcontrols; i++) { 385 for (i = 0; i < w->num_kcontrols; i++) {
381 386
@@ -403,8 +408,15 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
403 408
404 switch (w->id) { 409 switch (w->id) {
405 default: 410 default:
411 /* The control will get a prefix from
412 * the control creation process but
413 * we're also using the same prefix
414 * for widgets so cut the prefix off
415 * the front of the widget name.
416 */
406 snprintf(path->long_name, name_len, "%s %s", 417 snprintf(path->long_name, name_len, "%s %s",
407 w->name, w->kcontrols[i].name); 418 w->name + prefix_len,
419 w->kcontrols[i].name);
408 break; 420 break;
409 case snd_soc_dapm_mixer_named_ctl: 421 case snd_soc_dapm_mixer_named_ctl:
410 snprintf(path->long_name, name_len, "%s", 422 snprintf(path->long_name, name_len, "%s",
@@ -438,6 +450,7 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
438 struct snd_kcontrol *kcontrol; 450 struct snd_kcontrol *kcontrol;
439 struct snd_card *card = dapm->card->snd_card; 451 struct snd_card *card = dapm->card->snd_card;
440 const char *prefix; 452 const char *prefix;
453 size_t prefix_len;
441 int ret = 0; 454 int ret = 0;
442 455
443 if (!w->num_kcontrols) { 456 if (!w->num_kcontrols) {
@@ -450,7 +463,17 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
450 else 463 else
451 prefix = NULL; 464 prefix = NULL;
452 465
453 kcontrol = snd_soc_cnew(&w->kcontrols[0], w, w->name, prefix); 466 if (prefix)
467 prefix_len = strlen(prefix) + 1;
468 else
469 prefix_len = 0;
470
471 /* The control will get a prefix from the control creation
472 * process but we're also using the same prefix for widgets so
473 * cut the prefix off the front of the widget name.
474 */
475 kcontrol = snd_soc_cnew(&w->kcontrols[0], w, w->name + prefix_len,
476 prefix);
454 ret = snd_ctl_add(card, kcontrol); 477 ret = snd_ctl_add(card, kcontrol);
455 478
456 if (ret < 0) 479 if (ret < 0)