Commit 9805fe39 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next

parents 70fe99d8 656ca9d3
...@@ -481,7 +481,6 @@ struct snd_soc_dapm_route { ...@@ -481,7 +481,6 @@ struct snd_soc_dapm_route {
/* dapm audio path between two widgets */ /* dapm audio path between two widgets */
struct snd_soc_dapm_path { struct snd_soc_dapm_path {
const char *name; const char *name;
const char *long_name;
/* source (input) and sink (output) widgets */ /* source (input) and sink (output) widgets */
struct snd_soc_dapm_widget *source; struct snd_soc_dapm_widget *source;
......
...@@ -367,11 +367,10 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w, ...@@ -367,11 +367,10 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
val = soc_widget_read(w, e->reg); val = soc_widget_read(w, e->reg);
item = (val >> e->shift_l) & e->mask; item = (val >> e->shift_l) & e->mask;
p->connect = 0; if (item < e->max && !strcmp(p->name, e->texts[item]))
for (i = 0; i < e->max; i++) { p->connect = 1;
if (!(strcmp(p->name, e->texts[i])) && item == i) else
p->connect = 1; p->connect = 0;
}
} }
break; break;
case snd_soc_dapm_virt_mux: { case snd_soc_dapm_virt_mux: {
...@@ -401,11 +400,10 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w, ...@@ -401,11 +400,10 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
break; break;
} }
p->connect = 0; if (item < e->max && !strcmp(p->name, e->texts[item]))
for (i = 0; i < e->max; i++) { p->connect = 1;
if (!(strcmp(p->name, e->texts[i])) && item == i) else
p->connect = 1; p->connect = 0;
}
} }
break; break;
/* does not affect routing - always connected */ /* does not affect routing - always connected */
...@@ -509,6 +507,11 @@ static int dapm_is_shared_kcontrol(struct snd_soc_dapm_context *dapm, ...@@ -509,6 +507,11 @@ static int dapm_is_shared_kcontrol(struct snd_soc_dapm_context *dapm,
return 0; return 0;
} }
static void dapm_kcontrol_free(struct snd_kcontrol *kctl)
{
kfree(kctl->private_data);
}
/* /*
* Determine if a kcontrol is shared. If it is, look it up. If it isn't, * Determine if a kcontrol is shared. If it is, look it up. If it isn't,
* create it. Either way, add the widget into the control's widget list * create it. Either way, add the widget into the control's widget list
...@@ -615,17 +618,16 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, ...@@ -615,17 +618,16 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w,
kcontrol = snd_soc_cnew(&w->kcontrol_news[kci], wlist, name, kcontrol = snd_soc_cnew(&w->kcontrol_news[kci], wlist, name,
prefix); prefix);
kcontrol->private_free = dapm_kcontrol_free;
kfree(long_name);
ret = snd_ctl_add(card, kcontrol); ret = snd_ctl_add(card, kcontrol);
if (ret < 0) { if (ret < 0) {
dev_err(dapm->dev, dev_err(dapm->dev,
"ASoC: failed to add widget %s dapm kcontrol %s: %d\n", "ASoC: failed to add widget %s dapm kcontrol %s: %d\n",
w->name, name, ret); w->name, name, ret);
kfree(wlist); kfree(wlist);
kfree(long_name);
return ret; return ret;
} }
path->long_name = long_name;
} }
kcontrol->private_data = wlist; kcontrol->private_data = wlist;
...@@ -2105,6 +2107,14 @@ static void snd_soc_dapm_sys_remove(struct device *dev) ...@@ -2105,6 +2107,14 @@ static void snd_soc_dapm_sys_remove(struct device *dev)
device_remove_file(dev, &dev_attr_dapm_widget); device_remove_file(dev, &dev_attr_dapm_widget);
} }
static void dapm_free_path(struct snd_soc_dapm_path *path)
{
list_del(&path->list_sink);
list_del(&path->list_source);
list_del(&path->list);
kfree(path);
}
/* free all dapm widgets and resources */ /* free all dapm widgets and resources */
static void dapm_free_widgets(struct snd_soc_dapm_context *dapm) static void dapm_free_widgets(struct snd_soc_dapm_context *dapm)
{ {
...@@ -2120,20 +2130,12 @@ static void dapm_free_widgets(struct snd_soc_dapm_context *dapm) ...@@ -2120,20 +2130,12 @@ static void dapm_free_widgets(struct snd_soc_dapm_context *dapm)
* While removing the path, remove reference to it from both * While removing the path, remove reference to it from both
* source and sink widgets so that path is removed only once. * source and sink widgets so that path is removed only once.
*/ */
list_for_each_entry_safe(p, next_p, &w->sources, list_sink) { list_for_each_entry_safe(p, next_p, &w->sources, list_sink)
list_del(&p->list_sink); dapm_free_path(p);
list_del(&p->list_source);
list_del(&p->list); list_for_each_entry_safe(p, next_p, &w->sinks, list_source)
kfree(p->long_name); dapm_free_path(p);
kfree(p);
}
list_for_each_entry_safe(p, next_p, &w->sinks, list_source) {
list_del(&p->list_sink);
list_del(&p->list_source);
list_del(&p->list);
kfree(p->long_name);
kfree(p);
}
kfree(w->kcontrols); kfree(w->kcontrols);
kfree(w->name); kfree(w->name);
kfree(w); kfree(w);
...@@ -2409,10 +2411,7 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm, ...@@ -2409,10 +2411,7 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
dapm_mark_dirty(path->source, "Route removed"); dapm_mark_dirty(path->source, "Route removed");
dapm_mark_dirty(path->sink, "Route removed"); dapm_mark_dirty(path->sink, "Route removed");
list_del(&path->list); dapm_free_path(path);
list_del(&path->list_sink);
list_del(&path->list_source);
kfree(path);
} else { } else {
dev_warn(dapm->dev, "ASoC: Route %s->%s does not exist\n", dev_warn(dapm->dev, "ASoC: Route %s->%s does not exist\n",
source, sink); source, sink);
......
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