diff options
author | Jaroslav Kysela <perex@suse.cz> | 2006-07-05 11:34:51 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-09-23 04:37:26 -0400 |
commit | 8aa9b586e42099817163aba01d925c2660c4dbbe (patch) | |
tree | b70172eafcb672074fda1858c7a9c5779a1132f8 /include | |
parent | 6bbe13ecbbce4415a5a7959b3bc35b18313025e0 (diff) |
[ALSA] Control API - more robust TLV implementation
- added callback option
- added READ/WRITE/COMMAND flags to access member
- added WRITE/COMMAND ioctls
- added SNDRV_CTL_EVENT_MASK_TLV for TLV change notifications
- added TLV support to ELEM_ADD ioctl
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'include')
-rw-r--r-- | include/sound/asound.h | 10 | ||||
-rw-r--r-- | include/sound/control.h | 16 |
2 files changed, 23 insertions, 3 deletions
diff --git a/include/sound/asound.h b/include/sound/asound.h index 76a20406bd18..c1621c650a9a 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h | |||
@@ -727,10 +727,15 @@ typedef int __bitwise snd_ctl_elem_iface_t; | |||
727 | #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) | 727 | #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) |
728 | #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) | 728 | #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) |
729 | #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ | 729 | #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ |
730 | #define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<2) /* when was control changed */ | 730 | #define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ |
731 | #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ | ||
732 | #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ | ||
733 | #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) | ||
734 | #define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */ | ||
731 | #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ | 735 | #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ |
732 | #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ | 736 | #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ |
733 | #define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ | 737 | #define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ |
738 | #define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ | ||
734 | #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ | 739 | #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ |
735 | #define SNDRV_CTL_ELEM_ACCESS_DINDIRECT (1<<30) /* indirect access for matrix dimensions in the info structure */ | 740 | #define SNDRV_CTL_ELEM_ACCESS_DINDIRECT (1<<30) /* indirect access for matrix dimensions in the info structure */ |
736 | #define SNDRV_CTL_ELEM_ACCESS_INDIRECT (1<<31) /* indirect access for element value in the value structure */ | 741 | #define SNDRV_CTL_ELEM_ACCESS_INDIRECT (1<<31) /* indirect access for element value in the value structure */ |
@@ -838,6 +843,8 @@ enum { | |||
838 | SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info), | 843 | SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info), |
839 | SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id), | 844 | 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), | 845 | SNDRV_CTL_IOCTL_TLV_READ = _IOWR('U', 0x1a, struct snd_ctl_tlv), |
846 | SNDRV_CTL_IOCTL_TLV_WRITE = _IOWR('U', 0x1b, struct snd_ctl_tlv), | ||
847 | SNDRV_CTL_IOCTL_TLV_COMMAND = _IOWR('U', 0x1c, struct snd_ctl_tlv), | ||
841 | SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), | 848 | SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int), |
842 | SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info), | 849 | SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info), |
843 | SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), | 850 | SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int), |
@@ -862,6 +869,7 @@ enum sndrv_ctl_event_type { | |||
862 | #define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ | 869 | #define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ |
863 | #define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ | 870 | #define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ |
864 | #define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ | 871 | #define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ |
872 | #define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */ | ||
865 | #define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ | 873 | #define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ |
866 | 874 | ||
867 | struct snd_ctl_event { | 875 | struct snd_ctl_event { |
diff --git a/include/sound/control.h b/include/sound/control.h index a93a58d0e688..e3905c5a0950 100644 --- a/include/sound/control.h +++ b/include/sound/control.h | |||
@@ -30,6 +30,11 @@ struct snd_kcontrol; | |||
30 | typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo); | 30 | typedef int (snd_kcontrol_info_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_info * uinfo); |
31 | typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); | 31 | typedef int (snd_kcontrol_get_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); |
32 | typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); | 32 | typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); |
33 | typedef int (snd_kcontrol_tlv_rw_t)(struct snd_kcontrol *kcontrol, | ||
34 | int op_flag, /* 0=read,1=write,-1=command */ | ||
35 | unsigned int size, | ||
36 | unsigned int __user *tlv); | ||
37 | |||
33 | 38 | ||
34 | struct snd_kcontrol_new { | 39 | struct snd_kcontrol_new { |
35 | snd_ctl_elem_iface_t iface; /* interface identifier */ | 40 | snd_ctl_elem_iface_t iface; /* interface identifier */ |
@@ -42,7 +47,10 @@ struct snd_kcontrol_new { | |||
42 | snd_kcontrol_info_t *info; | 47 | snd_kcontrol_info_t *info; |
43 | snd_kcontrol_get_t *get; | 48 | snd_kcontrol_get_t *get; |
44 | snd_kcontrol_put_t *put; | 49 | snd_kcontrol_put_t *put; |
45 | unsigned int *tlv; | 50 | union { |
51 | snd_kcontrol_tlv_rw_t *c; | ||
52 | unsigned int *p; | ||
53 | } tlv; | ||
46 | unsigned long private_value; | 54 | unsigned long private_value; |
47 | }; | 55 | }; |
48 | 56 | ||
@@ -59,7 +67,11 @@ struct snd_kcontrol { | |||
59 | snd_kcontrol_info_t *info; | 67 | snd_kcontrol_info_t *info; |
60 | snd_kcontrol_get_t *get; | 68 | snd_kcontrol_get_t *get; |
61 | snd_kcontrol_put_t *put; | 69 | snd_kcontrol_put_t *put; |
62 | unsigned int *tlv; | 70 | snd_kcontrol_tlv_rw_t *tlv_rw; |
71 | union { | ||
72 | snd_kcontrol_tlv_rw_t *c; | ||
73 | unsigned int *p; | ||
74 | } tlv; | ||
63 | unsigned long private_value; | 75 | unsigned long private_value; |
64 | void *private_data; | 76 | void *private_data; |
65 | void (*private_free)(struct snd_kcontrol *kcontrol); | 77 | void (*private_free)(struct snd_kcontrol *kcontrol); |