diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-01-16 18:15:22 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-03-09 14:56:19 +0100 |
commit | f5b1db634280ecaf3147ee996f26aad0ed4828c4 (patch) | |
tree | ce7ba0940e5dd3f106276d9119f7e7e3a3b0c7e6 /include/sound | |
parent | fec6c6fec3e20637bee5d276fb61dd8b49a3f9cc (diff) | |
download | linux-3.10-f5b1db634280ecaf3147ee996f26aad0ed4828c4.tar.gz linux-3.10-f5b1db634280ecaf3147ee996f26aad0ed4828c4.tar.bz2 linux-3.10-f5b1db634280ecaf3147ee996f26aad0ed4828c4.zip |
ALSA: add snd_ctl_add_slave_uncached()
Added snd_ctl_add_slave_uncached() function to add a slave element
with volatile controls. The values of normal slave elements are
supposed to be cachable, i.e. they are changed only via the put
callbacks. OTOH, when a slave element is volatile and its values may
be changed by other reason (e.g. hardware status change), the values
will get inconsistent.
The new function allows the slave elements with volatile changes.
When the slave is tied with this call, the native get callback is
issued at each time so that the values are always updated.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/control.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/include/sound/control.h b/include/sound/control.h index 4721b4bba05..4cf8f7aaa13 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -171,6 +171,22 @@ int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol, */ struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, const unsigned int *tlv); -int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave); - +int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave, + unsigned int flags); +/* optional flags for slave */ +#define SND_CTL_SLAVE_NEED_UPDATE (1 << 0) + +static inline int +snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) +{ + return _snd_ctl_add_slave(master, slave, 0); +} + +static inline int +snd_ctl_add_slave_uncached(struct snd_kcontrol *master, + struct snd_kcontrol *slave) +{ + return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE); +} + #endif /* __SOUND_CONTROL_H */ |