Skip to content

Commit dcc0799

Browse files
Srinivas-Kandagatlabroonie
authored andcommitted
ASoC: Introduce SOC_SINGLE_S8_TLV() macro
This patch introduces SOC_SINGLE_S8_TLV() macro for volume control on chips which supports both negative and positive gains with sign bit on a 8 bit register, Gain ranges from -128 to +127 with a predefined step size. Currently we only have support to DOUBLE_S8_TLV() which does not fit for cases where we just have separate gain control register for each channel. One of the Qualcomm SOC msm8916 has such gain control register whose gain range is from -38.4dB to +38.4dB with step size of 0.3dB. Signed-off-by: Srinivas Kandagatla <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 1a695a9 commit dcc0799

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

include/sound/soc.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,17 @@
179179
.get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
180180
.private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \
181181
xmin, xmax, xsign_bit, xinvert) }
182+
#define SOC_SINGLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
183+
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
184+
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
185+
SNDRV_CTL_ELEM_ACCESS_READWRITE, \
186+
.tlv.p = (tlv_array), \
187+
.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
188+
.put = snd_soc_put_volsw, \
189+
.private_value = (unsigned long)&(struct soc_mixer_control) \
190+
{.reg = xreg, .rreg = xreg, \
191+
.min = xmin, .max = xmax, .platform_max = xmax, \
192+
.sign_bit = 7,} }
182193
#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
183194
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
184195
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \

0 commit comments

Comments
 (0)