Commit fad59888 authored by Stephen Warren's avatar Stephen Warren Committed by Mark Brown

ASoC: Add w->kcontrols, and populate it

Future changes will need reference to the kcontrol created for a given
kcontrol_new. Store the created kcontrol values now.
Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Acked-by: default avatarLiam Girdwood <lrg@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 82cfecdc
...@@ -474,6 +474,7 @@ struct snd_soc_dapm_widget { ...@@ -474,6 +474,7 @@ struct snd_soc_dapm_widget {
/* kcontrols that relate to this widget */ /* kcontrols that relate to this widget */
int num_kcontrols; int num_kcontrols;
const struct snd_kcontrol_new *kcontrol_news; const struct snd_kcontrol_new *kcontrol_news;
struct snd_kcontrol **kcontrols;
/* widget input and outputs */ /* widget input and outputs */
struct list_head sources; struct list_head sources;
......
...@@ -400,6 +400,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm, ...@@ -400,6 +400,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
path->long_name = NULL; path->long_name = NULL;
return ret; return ret;
} }
w->kcontrols[i] = path->kcontrol;
} }
} }
return ret; return ret;
...@@ -442,6 +443,8 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm, ...@@ -442,6 +443,8 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
if (ret < 0) if (ret < 0)
goto err; goto err;
w->kcontrols[0] = kcontrol;
list_for_each_entry(path, &w->sources, list_sink) list_for_each_entry(path, &w->sources, list_sink)
path->kcontrol = kcontrol; path->kcontrol = kcontrol;
...@@ -1480,6 +1483,7 @@ static void dapm_free_widgets(struct snd_soc_dapm_context *dapm) ...@@ -1480,6 +1483,7 @@ static void dapm_free_widgets(struct snd_soc_dapm_context *dapm)
kfree(p->long_name); kfree(p->long_name);
kfree(p); kfree(p);
} }
kfree(w->kcontrols);
kfree(w->name); kfree(w->name);
kfree(w); kfree(w);
} }
...@@ -1730,6 +1734,14 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) ...@@ -1730,6 +1734,14 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
if (w->new) if (w->new)
continue; continue;
if (w->num_kcontrols) {
w->kcontrols = kzalloc(w->num_kcontrols *
sizeof(struct snd_kcontrol *),
GFP_KERNEL);
if (!w->kcontrols)
return -ENOMEM;
}
switch(w->id) { switch(w->id) {
case snd_soc_dapm_switch: case snd_soc_dapm_switch:
case snd_soc_dapm_mixer: case snd_soc_dapm_mixer:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment