topology: Add support for parsing vendor tuples

Vendor can define several tuple arrays in 'SectionVendorTuples', as
well as the reference to a vendor token list object.

A later patche will copy vendor tuples in ABI format to the private
buffer of its parent data object in the building phase.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Mengdong Lin 2016-04-07 15:29:43 +08:00 committed by Takashi Iwai
parent 9b751b38cb
commit fdb9a6d19f
5 changed files with 283 additions and 1 deletions

View file

@ -70,6 +70,7 @@ struct snd_tplg {
struct list_head text_list;
struct list_head pdata_list;
struct list_head token_list;
struct list_head tuple_list;
struct list_head pcm_config_list;
struct list_head pcm_caps_list;
@ -97,6 +98,28 @@ struct tplg_vendor_tokens {
unsigned int num_tokens;
struct tplg_token token[0];
};
/* element for vendor tuples */
struct tplg_tuple {
char token[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
union {
char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
char uuid[16];
unsigned int value;
};
};
struct tplg_tuple_set {
unsigned int type; /* uuid, bool, byte, short, word, string*/
unsigned int num_tuples;
struct tplg_tuple tuple[0];
};
struct tplg_vendor_tuples {
unsigned int num_sets;
struct tplg_tuple_set **set;
};
/* topology element */
struct tplg_elem {
@ -130,6 +153,7 @@ struct tplg_elem {
struct snd_soc_tplg_ctl_tlv *tlv;
struct snd_soc_tplg_private *data;
struct tplg_vendor_tokens *tokens;
struct tplg_vendor_tuples *tuples;
};
/* an element may refer to other elements:
@ -166,6 +190,11 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg,
int tplg_parse_tokens(snd_tplg_t *tplg, snd_config_t *cfg,
void *private ATTRIBUTE_UNUSED);
int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg,
void *private ATTRIBUTE_UNUSED);
void tplg_free_tuples(void *obj);
int tplg_parse_control_bytes(snd_tplg_t *tplg,
snd_config_t *cfg, void *private ATTRIBUTE_UNUSED);