aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@suse.cz>2006-06-01 12:34:01 -0400
committerJaroslav Kysela <perex@suse.cz>2006-09-23 04:36:42 -0400
commit42750b04c5baa7c5ffdf0a8be2b9b320efdf069f (patch)
tree52aea8f1eeb44405b67bc5b381cce6bc20e2bff6 /include
parent3eeab61aa3ddd3c0bedb7449ada1599de22fdb5a (diff)
[ALSA] Control API - TLV implementation for additional information like dB scale
This patch implements a TLV mechanism to transfer an additional information like dB scale to the user space. The types might be extended in future. Acked-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'include')
-rw-r--r--include/sound/asound.h9
-rw-r--r--include/sound/control.h2
-rw-r--r--include/sound/tlv.h43
3 files changed, 53 insertions, 1 deletions
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 41885f48ad91..76a20406bd18 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -688,7 +688,7 @@ struct snd_timer_tread {
688 * * 688 * *
689 ****************************************************************************/ 689 ****************************************************************************/
690 690
691#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 3) 691#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 4)
692 692
693struct snd_ctl_card_info { 693struct snd_ctl_card_info {
694 int card; /* card number */ 694 int card; /* card number */
@@ -818,6 +818,12 @@ struct snd_ctl_elem_value {
818 unsigned char reserved[128-sizeof(struct timespec)]; 818 unsigned char reserved[128-sizeof(struct timespec)];
819}; 819};
820 820
821struct snd_ctl_tlv {
822 unsigned int numid; /* control element numeric identification */
823 unsigned int length; /* in bytes aligned to 4 */
824 unsigned int tlv[0]; /* first TLV */
825};
826
821enum { 827enum {
822 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int), 828 SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int),
823 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info), 829 SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info),
@@ -831,6 +837,7 @@ enum {
831 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info), 837 SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info),
832 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info), 838 SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info),
833 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id), 839 SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id),
840 SNDRV_CTL_IOCTL_TLV_READ = _IOWR('U', 0x1a, struct snd_ctl_tlv),
834 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), 841 SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int),
835 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info), 842 SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info),
836 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), 843 SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int),
diff --git a/include/sound/control.h b/include/sound/control.h
index 2489b1eb0110..a93a58d0e688 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -42,6 +42,7 @@ struct snd_kcontrol_new {
42 snd_kcontrol_info_t *info; 42 snd_kcontrol_info_t *info;
43 snd_kcontrol_get_t *get; 43 snd_kcontrol_get_t *get;
44 snd_kcontrol_put_t *put; 44 snd_kcontrol_put_t *put;
45 unsigned int *tlv;
45 unsigned long private_value; 46 unsigned long private_value;
46}; 47};
47 48
@@ -58,6 +59,7 @@ struct snd_kcontrol {
58 snd_kcontrol_info_t *info; 59 snd_kcontrol_info_t *info;
59 snd_kcontrol_get_t *get; 60 snd_kcontrol_get_t *get;
60 snd_kcontrol_put_t *put; 61 snd_kcontrol_put_t *put;
62 unsigned int *tlv;
61 unsigned long private_value; 63 unsigned long private_value;
62 void *private_data; 64 void *private_data;
63 void (*private_free)(struct snd_kcontrol *kcontrol); 65 void (*private_free)(struct snd_kcontrol *kcontrol);
diff --git a/include/sound/tlv.h b/include/sound/tlv.h
new file mode 100644
index 000000000000..b826e1df1da6
--- /dev/null
+++ b/include/sound/tlv.h
@@ -0,0 +1,43 @@
1#ifndef __SOUND_TLV_H
2#define __SOUND_TLV_H
3
4/*
5 * Advanced Linux Sound Architecture - ALSA - Driver
6 * Copyright (c) 2006 by Jaroslav Kysela <perex@suse.cz>
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25/*
26 * TLV structure is right behind the struct snd_ctl_tlv:
27 * unsigned int type - see SNDRV_CTL_TLVT_*
28 * unsigned int length
29 * .... data aligned to sizeof(unsigned int), use
30 * block_length = (length + (sizeof(unsigned int) - 1)) &
31 * ~(sizeof(unsigned int) - 1)) ....
32 */
33
34#define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */
35#define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */
36
37#define DECLARE_TLV_DB_SCALE(name, min, step, mute) \
38unsigned int name[] = { \
39 SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \
40 (min), ((step) & 0xffff) | ((mute) ? 0x10000 : 0) \
41}
42
43#endif /* __SOUND_TLV_H */