History

ASoC: topology: Update TLV support so we can support more TLV types

Currently the TLV topology structure is targeted at only supporting the DB scale data. This patch extends support for the other TLV types so they can be easily added at a later stage. TLV structure is moved to common topology control header since it's a common field for controls and can be processed in a general way. Users must set a proper access flag for a control since it's used to decide if the TLV field is valid and if a TLV callback is needed. Removed the following fields from topology TLV struct: - size/count: type can decide the size. - numid: not needed to initialize TLV for kcontrol. - data: replaced by the type specific struct. Added TLV structure to generic control header and removed TLV structure from mixer control.

Mengdong Lin committed 11 years ago

Commit 28a87ee1 parent 113adf22 files · +54 −23Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/sound/asoc.h+13−6
@@ -137,11 +137,19 @@ struct snd_soc_tplg_private { · 136 unmodified lines
137137 /*
138138 * Kcontrol TLV data.
139139 */
140+struct snd_soc_tplg_tlv_dbscale {
141+ __le32 min;
142+ __le32 step;
143+ __le32 mute;
144+} __attribute__((packed));
145+
140146 struct snd_soc_tplg_ctl_tlv {
141− __le32 size; /* in bytes aligned to 4 */
142− __le32 numid; /* control element numeric identification */
143− __le32 count; /* number of elem in data array */
144− __le32 data[SND_SOC_TPLG_TLV_SIZE];
147+ __le32 size; /* in bytes of this structure */
148+ __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */
149+ union {
150+ __le32 data[SND_SOC_TPLG_TLV_SIZE];
151+ struct snd_soc_tplg_tlv_dbscale scale;
152+ };
145153 } __attribute__((packed));
146154
147155 /*
@@ -172,7 +180,7 @@ struct snd_soc_tplg_ctl_hdr { · 24 unmodified lines
172180 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
173181 __le32 access;
174182 struct snd_soc_tplg_kcontrol_ops_id ops;
175− __le32 tlv_size; /* non zero means control has TLV data */
183+ struct snd_soc_tplg_ctl_tlv tlv;
176184 } __attribute__((packed));
177185
178186 /*
@@ -260,7 +268,6 @@ struct snd_soc_tplg_mixer_control { · 81 unmodified lines
260268 __le32 invert;
261269 __le32 num_channels;
262270 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
263− struct snd_soc_tplg_ctl_tlv tlv;
264271 struct snd_soc_tplg_private priv;
265272 } __attribute__((packed));
266273