summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMengdong Lin <mengdong.lin@intel.com>2015-08-18 18:11:51 +0800
committerMark Brown <broonie@kernel.org>2015-08-21 15:26:52 -0700
commit88a17d8fb7c4a156ec13e6668b46dbbedf670ff7 (patch)
tree59bb824ba851331570d3acf19a3cd18d0bb6b878 /sound
parentd033de5ceee8333e4fee3d59a956244d3736102a (diff)
downloadlinux-0-day-88a17d8fb7c4a156ec13e6668b46dbbedf670ff7.tar.gz
linux-0-day-88a17d8fb7c4a156ec13e6668b46dbbedf670ff7.tar.xz
ASoC: topology: Bind vendor specific kcontrol handlers before standard ones
Vendor specific handlers should override standard handlers. So we can handle things in the order from specific to generic. Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-topology.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 73e959c105f02..ca551b9fd1009 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -66,7 +66,7 @@ struct soc_tplg {
u32 index; /* current block index */
u32 req_index; /* required index, only loaded/free matching blocks */
- /* kcontrol operations */
+ /* vendor specific kcontrol operations */
const struct snd_soc_tplg_kcontrol_ops *io_ops;
int io_ops_count;
@@ -513,22 +513,7 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr,
{
int i;
- /* try and map standard kcontrols handler first */
- for (i = 0; i < num_ops; i++) {
-
- if (ops[i].id == hdr->ops.put)
- k->put = ops[i].put;
- if (ops[i].id == hdr->ops.get)
- k->get = ops[i].get;
- if (ops[i].id == hdr->ops.info)
- k->info = ops[i].info;
- }
-
- /* standard handlers found ? */
- if (k->put && k->get && k->info)
- return 0;
-
- /* none found so try bespoke handlers */
+ /* try and map vendor specific kcontrol handlers first */
for (i = 0; i < num_bops; i++) {
if (k->put == NULL && bops[i].id == hdr->ops.put)
@@ -539,7 +524,22 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr,
k->info = bops[i].info;
}
- /* bespoke handlers found ? */
+ /* vendor specific handlers found ? */
+ if (k->put && k->get && k->info)
+ return 0;
+
+ /* none found so try standard kcontrol handlers */
+ for (i = 0; i < num_ops; i++) {
+
+ if (k->put == NULL && ops[i].id == hdr->ops.put)
+ k->put = ops[i].put;
+ if (k->get == NULL && ops[i].id == hdr->ops.get)
+ k->get = ops[i].get;
+ if (k->info == NULL && ops[i].id == hdr->ops.info)
+ k->info = ops[i].info;
+ }
+
+ /* standard handlers found ? */
if (k->put && k->get && k->info)
return 0;