diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-03-24 00:35:47 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-03-24 00:35:47 +0100 |
commit | ec6659c3898798a9cf3010d6c61a8ea6fa123073 (patch) | |
tree | eb1fb4165fe7b897f14bbe9a56a775063e005b90 /include/sound | |
parent | c944a93df0d566a66409628c4524f4fc4f62eaf5 (diff) | |
parent | 79c7cdd5441f5d3900c1632adcc8cd2bee35c8da (diff) | |
download | linux-stable-ec6659c3898798a9cf3010d6c61a8ea6fa123073.tar.gz linux-stable-ec6659c3898798a9cf3010d6c61a8ea6fa123073.tar.bz2 linux-stable-ec6659c3898798a9cf3010d6c61a8ea6fa123073.zip |
Merge branch 'topic/vmaster-update' into for-linus
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/control.h | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/include/sound/control.h b/include/sound/control.h index 4721b4bba053..ef96f07aa03b 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -171,6 +171,54 @@ 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) + +/** + * snd_ctl_add_slave - Add a virtual slave control + * @master: vmaster element + * @slave: slave element to add + * + * Add a virtual slave control to the given master element created via + * snd_ctl_create_virtual_master() beforehand. + * Returns zero if successful or a negative error code. + * + * All slaves must be the same type (returning the same information + * via info callback). The fucntion doesn't check it, so it's your + * responsibility. + * + * Also, some additional limitations: + * at most two channels, + * logarithmic volume control (dB level) thus no linear volume, + * master can only attenuate the volume without gain + */ +static inline int +snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave) +{ + return _snd_ctl_add_slave(master, slave, 0); +} + +/** + * snd_ctl_add_slave_uncached - Add a virtual slave control + * @master: vmaster element + * @slave: slave element to add + * + * Add a virtual slave control to the given master. + * Unlike snd_ctl_add_slave(), the element added via this function + * is supposed to have volatile values, and get callback is called + * at each time quried from the master. + * + * When the control peeks the hardware values directly and the value + * can be changed by other means than the put callback of the element, + * this function should be used to keep the value always up-to-date. + */ +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 */ |