aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc-dapm.h1
-rw-r--r--sound/soc/soc-dapm.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 76714be19e9d..b25bf0ffc947 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -474,6 +474,7 @@ struct snd_soc_dapm_widget {
474 /* kcontrols that relate to this widget */ 474 /* kcontrols that relate to this widget */
475 int num_kcontrols; 475 int num_kcontrols;
476 const struct snd_kcontrol_new *kcontrol_news; 476 const struct snd_kcontrol_new *kcontrol_news;
477 struct snd_kcontrol **kcontrols;
477 478
478 /* widget input and outputs */ 479 /* widget input and outputs */
479 struct list_head sources; 480 struct list_head sources;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 35cc1ed00a44..85b2c94535f4 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -400,6 +400,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
400 path->long_name = NULL; 400 path->long_name = NULL;
401 return ret; 401 return ret;
402 } 402 }
403 w->kcontrols[i] = path->kcontrol;
403 } 404 }
404 } 405 }
405 return ret; 406 return ret;
@@ -442,6 +443,8 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
442 if (ret < 0) 443 if (ret < 0)
443 goto err; 444 goto err;
444 445
446 w->kcontrols[0] = kcontrol;
447
445 list_for_each_entry(path, &w->sources, list_sink) 448 list_for_each_entry(path, &w->sources, list_sink)
446 path->kcontrol = kcontrol; 449 path->kcontrol = kcontrol;
447 450
@@ -1480,6 +1483,7 @@ static void dapm_free_widgets(struct snd_soc_dapm_context *dapm)
1480 kfree(p->long_name); 1483 kfree(p->long_name);
1481 kfree(p); 1484 kfree(p);
1482 } 1485 }
1486 kfree(w->kcontrols);
1483 kfree(w->name); 1487 kfree(w->name);
1484 kfree(w); 1488 kfree(w);
1485 } 1489 }
@@ -1730,6 +1734,14 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
1730 if (w->new) 1734 if (w->new)
1731 continue; 1735 continue;
1732 1736
1737 if (w->num_kcontrols) {
1738 w->kcontrols = kzalloc(w->num_kcontrols *
1739 sizeof(struct snd_kcontrol *),
1740 GFP_KERNEL);
1741 if (!w->kcontrols)
1742 return -ENOMEM;
1743 }
1744
1733 switch(w->id) { 1745 switch(w->id) {
1734 case snd_soc_dapm_switch: 1746 case snd_soc_dapm_switch:
1735 case snd_soc_dapm_mixer: 1747 case snd_soc_dapm_mixer: