Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: core: add SOC_DOUBLE_RANGE_TLV() helper macro

No macro currently allows handling a stereo control that has left and right
in the same register and whose minimum register value is not zero. Add one
that does that.

Note that even though the snd_soc_*_volsw_range() look more appropriate
given the _range suffix, they are not suitable because they don't honor the
two shift values. The snd_soc_*_volsw() look more generic and are suitable
for the task.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://msgid.link/r/20240305-rk3308-audio-codec-v4-3-312acdbe628f@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Luca Ceresoli and committed by
Mark Brown
d75a2161 cce4cbb1

+12
+12
include/sound/soc.h
··· 149 149 {.reg = xreg, .rreg = xreg, \ 150 150 .shift = shift_left, .rshift = shift_right, \ 151 151 .max = xmax, .min = xmin} } 152 + #define SOC_DOUBLE_RANGE_TLV(xname, xreg, xshift_left, xshift_right, xmin, xmax, \ 153 + xinvert, tlv_array) \ 154 + { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 155 + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 156 + SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 157 + .tlv.p = (tlv_array), \ 158 + .info = snd_soc_info_volsw, \ 159 + .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ 160 + .private_value = (unsigned long)&(struct soc_mixer_control) \ 161 + {.reg = xreg, .rreg = xreg, \ 162 + .shift = xshift_left, .rshift = xshift_right, \ 163 + .min = xmin, .max = xmax, .invert = xinvert} } 152 164 #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \ 153 165 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 154 166 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\