aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorMengdong Lin <mengdong.lin@intel.com>2015-08-18 06:11:51 -0400
committerMark Brown <broonie@kernel.org>2015-08-21 18:26:52 -0400
commit88a17d8fb7c4a156ec13e6668b46dbbedf670ff7 (patch)
tree59bb824ba851331570d3acf19a3cd18d0bb6b878 /sound/soc
parentd033de5ceee8333e4fee3d59a956244d3736102a (diff)
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/soc')
-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 73e959c105f0..ca551b9fd100 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -66,7 +66,7 @@ struct soc_tplg {
66 u32 index; /* current block index */ 66 u32 index; /* current block index */
67 u32 req_index; /* required index, only loaded/free matching blocks */ 67 u32 req_index; /* required index, only loaded/free matching blocks */
68 68
69 /* kcontrol operations */ 69 /* vendor specific kcontrol operations */
70 const struct snd_soc_tplg_kcontrol_ops *io_ops; 70 const struct snd_soc_tplg_kcontrol_ops *io_ops;
71 int io_ops_count; 71 int io_ops_count;
72 72
@@ -513,22 +513,7 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr,
513{ 513{
514 int i; 514 int i;
515 515
516 /* try and map standard kcontrols handler first */ 516 /* try and map vendor specific kcontrol handlers first */
517 for (i = 0; i < num_ops; i++) {
518
519 if (ops[i].id == hdr->ops.put)
520 k->put = ops[i].put;
521 if (ops[i].id == hdr->ops.get)
522 k->get = ops[i].get;
523 if (ops[i].id == hdr->ops.info)
524 k->info = ops[i].info;
525 }
526
527 /* standard handlers found ? */
528 if (k->put && k->get && k->info)
529 return 0;
530
531 /* none found so try bespoke handlers */
532 for (i = 0; i < num_bops; i++) { 517 for (i = 0; i < num_bops; i++) {
533 518
534 if (k->put == NULL && bops[i].id == hdr->ops.put) 519 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,
539 k->info = bops[i].info; 524 k->info = bops[i].info;
540 } 525 }
541 526
542 /* bespoke handlers found ? */ 527 /* vendor specific handlers found ? */
528 if (k->put && k->get && k->info)
529 return 0;
530
531 /* none found so try standard kcontrol handlers */
532 for (i = 0; i < num_ops; i++) {
533
534 if (k->put == NULL && ops[i].id == hdr->ops.put)
535 k->put = ops[i].put;
536 if (k->get == NULL && ops[i].id == hdr->ops.get)
537 k->get = ops[i].get;
538 if (k->info == NULL && ops[i].id == hdr->ops.info)
539 k->info = ops[i].info;
540 }
541
542 /* standard handlers found ? */
543 if (k->put && k->get && k->info) 543 if (k->put && k->get && k->info)
544 return 0; 544 return 0;
545 545