summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-09-06 12:15:34 +0200
committerJaroslav Kysela <perex@suse.cz>2006-09-23 10:46:11 +0200
commit55a29af5ed5d914f017e6a7c613a4d7cc34f82d9 (patch)
tree74f44500e741a0ad0cbfd5bb182b3d98da107401
parent[ALSA] hdsp - Fix auto-updating of firmware (diff)
downloadlinux-55a29af5ed5d914f017e6a7c613a4d7cc34f82d9.tar.xz
linux-55a29af5ed5d914f017e6a7c613a4d7cc34f82d9.zip
[ALSA] Add definition of TLV dB range compound
Added the definition of TLV dB range compound. It contains one or more dB-range or linear-volume TLV entries with min/max ranges. Used for volume controls with non-linear curves. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-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 @@
#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */
#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */
#define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */
+#define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */
+#define TLV_DB_SCALE_ITEM(min, step, mute) \
+ SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \
+ (min), ((step) & 0xffff) | ((mute) ? 0x10000 : 0)
#define DECLARE_TLV_DB_SCALE(name, min, step, mute) \
-unsigned int name[] = { \
- SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \
- (min), ((step) & 0xffff) | ((mute) ? 0x10000 : 0) \
-}
+ unsigned int name[] = { TLV_DB_SCALE_ITEM(min, step, mute) }
/* linear volume between min_dB and max_dB (.01dB unit) */
+#define TLV_DB_LINEAR_ITEM(min_dB, max_dB) \
+ SNDRV_CTL_TLVT_DB_LINEAR, 2 * sizeof(unsigned int), \
+ (min_dB), (max_dB)
#define DECLARE_TLV_DB_LINEAR(name, min_dB, max_dB) \
-unsigned int name[] = { \
- SNDRV_CTL_TLVT_DB_LINEAR, 2 * sizeof(unsigned int), \
- (min_dB), (max_dB) \
-}
+ unsigned int name[] = { TLV_DB_LINEAR_ITEM(min_dB, max_dB) }
+
+/* dB range container */
+/* Each item is: <min> <max> <TLV> */
+/* The below assumes that each item TLV is 4 words like DB_SCALE or LINEAR */
+#define TLV_DB_RANGE_HEAD(num) \
+ SNDRV_CTL_TLVT_DB_RANGE, 6 * (num) * sizeof(unsigned int)
#define TLV_DB_GAIN_MUTE -9999999