aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Pargmann <mpa@pengutronix.de>2014-01-27 07:03:07 -0500
committerMark Brown <broonie@linaro.org>2014-02-03 07:47:40 -0500
commitc671e79d6c2d5a525496fbf18103841c68fe3305 (patch)
tree326a5eebd46bbd6b565d9cf626ad624b8ef4e1ca
parent80e9c19c02fd8f1343c9c263d22a08e2371c9f55 (diff)
ASoC: tlv320aic32x4: Use signed int mixer controls
There are a number of mixer controls that support negative values. They use signed values for this with different number of bits for the values. Currently they only support the positive range. This patch replaces the unsigned mixers with signed mixers to support the full range. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/codecs/tlv320aic32x4.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 36a9cb90a585..c541213b1edf 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -68,18 +68,24 @@ struct aic32x4_priv {
68 int rstn_gpio; 68 int rstn_gpio;
69}; 69};
70 70
71/* 0dB min, 1dB steps */
72static DECLARE_TLV_DB_SCALE(tlv_step_1, 0, 100, 0);
73/* 0dB min, 0.5dB steps */ 71/* 0dB min, 0.5dB steps */
74static DECLARE_TLV_DB_SCALE(tlv_step_0_5, 0, 50, 0); 72static DECLARE_TLV_DB_SCALE(tlv_step_0_5, 0, 50, 0);
73/* -63.5dB min, 0.5dB steps */
74static DECLARE_TLV_DB_SCALE(tlv_pcm, -6350, 50, 0);
75/* -6dB min, 1dB steps */
76static DECLARE_TLV_DB_SCALE(tlv_driver_gain, -600, 100, 0);
77/* -12dB min, 0.5dB steps */
78static DECLARE_TLV_DB_SCALE(tlv_adc_vol, -1200, 50, 0);
75 79
76static const struct snd_kcontrol_new aic32x4_snd_controls[] = { 80static const struct snd_kcontrol_new aic32x4_snd_controls[] = {
77 SOC_DOUBLE_R_TLV("PCM Playback Volume", AIC32X4_LDACVOL, 81 SOC_DOUBLE_R_S_TLV("PCM Playback Volume", AIC32X4_LDACVOL,
78 AIC32X4_RDACVOL, 0, 0x30, 0, tlv_step_0_5), 82 AIC32X4_RDACVOL, 0, -0x7f, 0x30, 7, 0, tlv_pcm),
79 SOC_DOUBLE_R_TLV("HP Driver Gain Volume", AIC32X4_HPLGAIN, 83 SOC_DOUBLE_R_S_TLV("HP Driver Gain Volume", AIC32X4_HPLGAIN,
80 AIC32X4_HPRGAIN, 0, 0x1D, 0, tlv_step_1), 84 AIC32X4_HPRGAIN, 0, -0x6, 0x1d, 5, 0,
81 SOC_DOUBLE_R_TLV("LO Driver Gain Volume", AIC32X4_LOLGAIN, 85 tlv_driver_gain),
82 AIC32X4_LORGAIN, 0, 0x1D, 0, tlv_step_1), 86 SOC_DOUBLE_R_S_TLV("LO Driver Gain Volume", AIC32X4_LOLGAIN,
87 AIC32X4_LORGAIN, 0, -0x6, 0x1d, 5, 0,
88 tlv_driver_gain),
83 SOC_DOUBLE_R("HP DAC Playback Switch", AIC32X4_HPLGAIN, 89 SOC_DOUBLE_R("HP DAC Playback Switch", AIC32X4_HPLGAIN,
84 AIC32X4_HPRGAIN, 6, 0x01, 1), 90 AIC32X4_HPRGAIN, 6, 0x01, 1),
85 SOC_DOUBLE_R("LO DAC Playback Switch", AIC32X4_LOLGAIN, 91 SOC_DOUBLE_R("LO DAC Playback Switch", AIC32X4_LOLGAIN,
@@ -90,8 +96,8 @@ static const struct snd_kcontrol_new aic32x4_snd_controls[] = {
90 SOC_SINGLE("ADCFGA Left Mute Switch", AIC32X4_ADCFGA, 7, 1, 0), 96 SOC_SINGLE("ADCFGA Left Mute Switch", AIC32X4_ADCFGA, 7, 1, 0),
91 SOC_SINGLE("ADCFGA Right Mute Switch", AIC32X4_ADCFGA, 3, 1, 0), 97 SOC_SINGLE("ADCFGA Right Mute Switch", AIC32X4_ADCFGA, 3, 1, 0),
92 98
93 SOC_DOUBLE_R_TLV("ADC Level Volume", AIC32X4_LADCVOL, 99 SOC_DOUBLE_R_S_TLV("ADC Level Volume", AIC32X4_LADCVOL,
94 AIC32X4_RADCVOL, 0, 0x28, 0, tlv_step_0_5), 100 AIC32X4_RADCVOL, 0, -0x18, 0x28, 6, 0, tlv_adc_vol),
95 SOC_DOUBLE_R_TLV("PGA Level Volume", AIC32X4_LMICPGAVOL, 101 SOC_DOUBLE_R_TLV("PGA Level Volume", AIC32X4_LMICPGAVOL,
96 AIC32X4_RMICPGAVOL, 0, 0x5f, 0, tlv_step_0_5), 102 AIC32X4_RMICPGAVOL, 0, 0x5f, 0, tlv_step_0_5),
97 103