[alsa-devel] [PATCH] ASoC: Add accessor macros for TLV items

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Tue Mar 27 20:39:45 CEST 2018


This patch adds macros for accessing the type, length, min, mute
and step items in TLV data. These will be used by drivers to extract
the TLV data while loading topology.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
---
 include/sound/tlv.h      | 5 +++++
 include/uapi/sound/tlv.h | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/include/sound/tlv.h b/include/sound/tlv.h
index 3677ebb928d5..8fa379e8a568 100644
--- a/include/sound/tlv.h
+++ b/include/sound/tlv.h
@@ -49,6 +49,11 @@
 
 #define TLV_DB_GAIN_MUTE		SNDRV_CTL_TLVD_DB_GAIN_MUTE
 
+#define TLV_ITEM_TYPE			SNDRV_CTL_TLVD_ITEM_TYPE
+#define TLV_ITEM_LEN			SNDRV_CTL_TLVD_ITEM_LEN
+#define TLV_DB_MIN			SNDRV_CTL_TLVD_DB_SCALE_MIN
+#define TLV_DB_MUTE_AND_STEP		SNDRV_CTL_TLVD_DB_SCALE_MUTE_AND_STEP
+
 /*
  * The below assumes that each item TLV is 4 words like DB_SCALE or LINEAR.
  * This is an old fasion and obsoleted by commit bf1d1c9b6179("ALSA: tlv: add
diff --git a/include/uapi/sound/tlv.h b/include/uapi/sound/tlv.h
index be5371f09a62..f3fba49ef6e8 100644
--- a/include/uapi/sound/tlv.h
+++ b/include/uapi/sound/tlv.h
@@ -60,6 +60,13 @@
 	unsigned int name[] = { \
 		SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \
 	}
+/* Accessor macros for TLV type and len */
+#define SNDRV_CTL_TLVD_ITEM_TYPE		0
+#define SNDRV_CTL_TLVD_ITEM_LEN			1
+
+/* Accessor macros for min, mute and step values from dB scale type TLV */
+#define SNDRV_CTL_TLVD_DB_SCALE_MIN		2
+#define SNDRV_CTL_TLVD_DB_SCALE_MUTE_AND_STEP	3
 
 /* dB scale specified with min/max values instead of step */
 #define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \
-- 
2.14.1



More information about the Alsa-devel mailing list