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>
This commit is contained in:
parent
cce4cbb157
commit
d75a21611a
@ -149,6 +149,18 @@
|
|||||||
{.reg = xreg, .rreg = xreg, \
|
{.reg = xreg, .rreg = xreg, \
|
||||||
.shift = shift_left, .rshift = shift_right, \
|
.shift = shift_left, .rshift = shift_right, \
|
||||||
.max = xmax, .min = xmin} }
|
.max = xmax, .min = xmin} }
|
||||||
|
#define SOC_DOUBLE_RANGE_TLV(xname, xreg, xshift_left, xshift_right, xmin, xmax, \
|
||||||
|
xinvert, tlv_array) \
|
||||||
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
|
||||||
|
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
|
||||||
|
SNDRV_CTL_ELEM_ACCESS_READWRITE,\
|
||||||
|
.tlv.p = (tlv_array), \
|
||||||
|
.info = snd_soc_info_volsw, \
|
||||||
|
.get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
|
||||||
|
.private_value = (unsigned long)&(struct soc_mixer_control) \
|
||||||
|
{.reg = xreg, .rreg = xreg, \
|
||||||
|
.shift = xshift_left, .rshift = xshift_right, \
|
||||||
|
.min = xmin, .max = xmax, .invert = xinvert} }
|
||||||
#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
|
#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
|
||||||
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
|
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
|
||||||
|
Loading…
Reference in New Issue
Block a user