aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/tlv.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/include/sound/tlv.h b/include/sound/tlv.h
index 7905841643df..d93a96b91875 100644
--- a/include/sound/tlv.h
+++ b/include/sound/tlv.h
@@ -34,19 +34,26 @@
34#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */ 34#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */
35#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ 35#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */
36#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ 36#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */
37#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */
37 38
39#define TLV_DB_SCALE_ITEM(min, step, mute) \
40 SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \
41 (min), ((step) & 0xffff) | ((mute) ? 0x10000 : 0)
38#define DECLARE_TLV_DB_SCALE(name, min, step, mute) \ 42#define DECLARE_TLV_DB_SCALE(name, min, step, mute) \
39unsigned int name[] = { \ 43 unsigned int name[] = { TLV_DB_SCALE_ITEM(min, step, mute) }
40 SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \
41 (min), ((step) & 0xffff) | ((mute) ? 0x10000 : 0) \
42}
43 44
44/* linear volume between min_dB and max_dB (.01dB unit) */ 45/* linear volume between min_dB and max_dB (.01dB unit) */
46#define TLV_DB_LINEAR_ITEM(min_dB, max_dB) \
47 SNDRV_CTL_TLVT_DB_LINEAR, 2 * sizeof(unsigned int), \
48 (min_dB), (max_dB)
45#define DECLARE_TLV_DB_LINEAR(name, min_dB, max_dB) \ 49#define DECLARE_TLV_DB_LINEAR(name, min_dB, max_dB) \
46unsigned int name[] = { \ 50 unsigned int name[] = { TLV_DB_LINEAR_ITEM(min_dB, max_dB) }
47 SNDRV_CTL_TLVT_DB_LINEAR, 2 * sizeof(unsigned int), \ 51
48 (min_dB), (max_dB) \ 52/* dB range container */
49} 53/* Each item is: <min> <max> <TLV> */
54/* The below assumes that each item TLV is 4 words like DB_SCALE or LINEAR */
55#define TLV_DB_RANGE_HEAD(num) \
56 SNDRV_CTL_TLVT_DB_RANGE, 6 * (num) * sizeof(unsigned int)
50 57
51#define TLV_DB_GAIN_MUTE -9999999 58#define TLV_DB_GAIN_MUTE -9999999
52 59