Commit d889a72c authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

ASoC: TWL4030: Change the common playback volume controls

Add Playback volume controls for all four DACs.
All four paths has three levels of volume controls:
Digital Fine gain, Digital Coarse gain, Analog gain.

The controls are named to reflect their connection to the DACs.
Per DAC volume can be performed, if needed:
amixer sset 'DAC1 Analog'  5,10
DACL1 analog gain to 5
DACR1 analog gain to 10
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 381a22b5
...@@ -351,14 +351,20 @@ static int snd_soc_put_volsw_r2_twl4030(struct snd_kcontrol *kcontrol, ...@@ -351,14 +351,20 @@ static int snd_soc_put_volsw_r2_twl4030(struct snd_kcontrol *kcontrol,
* FGAIN volume control: * FGAIN volume control:
* from -62 to 0 dB in 1 dB steps (mute instead of -63 dB) * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB)
*/ */
static DECLARE_TLV_DB_SCALE(master_tlv, -6300, 100, 1); static DECLARE_TLV_DB_SCALE(digital_fine_tlv, -6300, 100, 1);
/* /*
* CGAIN volume control: * CGAIN volume control:
* 0 dB to 12 dB in 6 dB steps * 0 dB to 12 dB in 6 dB steps
* value 2 and 3 means 12 dB * value 2 and 3 means 12 dB
*/ */
static DECLARE_TLV_DB_SCALE(master_coarse_tlv, 0, 600, 0); static DECLARE_TLV_DB_SCALE(digital_coarse_tlv, 0, 600, 0);
/*
* Analog playback gain
* -24 dB to 12 dB in 2 dB steps
*/
static DECLARE_TLV_DB_SCALE(analog_tlv, -2400, 200, 0);
/* /*
* Capture gain after the ADCs * Capture gain after the ADCs
...@@ -367,12 +373,27 @@ static DECLARE_TLV_DB_SCALE(master_coarse_tlv, 0, 600, 0); ...@@ -367,12 +373,27 @@ static DECLARE_TLV_DB_SCALE(master_coarse_tlv, 0, 600, 0);
static DECLARE_TLV_DB_SCALE(digital_capture_tlv, 0, 100, 0); static DECLARE_TLV_DB_SCALE(digital_capture_tlv, 0, 100, 0);
static const struct snd_kcontrol_new twl4030_snd_controls[] = { static const struct snd_kcontrol_new twl4030_snd_controls[] = {
SOC_DOUBLE_R_TLV("Master Playback Volume", /* Common playback gain controls */
TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA, SOC_DOUBLE_R_TLV("DAC1 Digital Fine Playback Volume",
0, 0x3f, 0, master_tlv), TWL4030_REG_ARXL1PGA, TWL4030_REG_ARXR1PGA,
SOC_DOUBLE_R_TLV("Master PCM Playback Volume", 0, 0x3f, 0, digital_fine_tlv),
TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA, SOC_DOUBLE_R_TLV("DAC2 Digital Fine Playback Volume",
6, 0x2, 0, master_coarse_tlv), TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA,
0, 0x3f, 0, digital_fine_tlv),
SOC_DOUBLE_R_TLV("DAC1 Digital Coarse Playback Volume",
TWL4030_REG_ARXL1PGA, TWL4030_REG_ARXR1PGA,
6, 0x2, 0, digital_coarse_tlv),
SOC_DOUBLE_R_TLV("DAC2 Digital Coarse Playback Volume",
TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA,
6, 0x2, 0, digital_coarse_tlv),
SOC_DOUBLE_R_TLV("DAC1 Analog Playback Volume",
TWL4030_REG_ARXL1_APGA_CTL, TWL4030_REG_ARXR1_APGA_CTL,
3, 0x12, 1, analog_tlv),
SOC_DOUBLE_R_TLV("DAC2 Analog Playback Volume",
TWL4030_REG_ARXL2_APGA_CTL, TWL4030_REG_ARXR2_APGA_CTL,
3, 0x12, 1, analog_tlv),
/* Common capture gain controls */ /* Common capture gain controls */
SOC_DOUBLE_R_TLV("Capture Volume", SOC_DOUBLE_R_TLV("Capture Volume",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment