Skip to content

Commit

Permalink
ASoC: topology: Bind vendor specific kcontrol handlers before standar…
Browse files Browse the repository at this point in the history
…d 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>
  • Loading branch information
Mengdong Lin authored and Mark Brown committed Aug 21, 2015
1 parent d033de5 commit 88a17d8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion include/sound/soc-topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct snd_soc_tplg_ops {
int (*manifest)(struct snd_soc_component *,
struct snd_soc_tplg_manifest *);

/* bespoke kcontrol handlers available for binding */
/* vendor specific kcontrol handlers available for binding */
const struct snd_soc_tplg_kcontrol_ops *io_ops;
int io_ops_count;
};
Expand Down
36 changes: 18 additions & 18 deletions sound/soc/soc-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand All @@ -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;

Expand Down

0 comments on commit 88a17d8

Please sign in to comment.