aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2008-12-01 03:03:46 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2008-12-01 14:58:53 -0500
commitd889a72c5c71161d6f934f9d7fca0e5b7e52bc08 (patch)
treeb6db608138905a81f9030bdc98d8e983b932de34 /sound/soc/codecs
parent381a22b564ff5a7ada09ad9a0831246da1dc5513 (diff)
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: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/twl4030.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 4b7a2d173a4a..1dae73af5273 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -351,14 +351,20 @@ static int snd_soc_put_volsw_r2_twl4030(struct snd_kcontrol *kcontrol,
351 * FGAIN volume control: 351 * FGAIN volume control:
352 * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB) 352 * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB)
353 */ 353 */
354static DECLARE_TLV_DB_SCALE(master_tlv, -6300, 100, 1); 354static DECLARE_TLV_DB_SCALE(digital_fine_tlv, -6300, 100, 1);
355 355
356/* 356/*
357 * CGAIN volume control: 357 * CGAIN volume control:
358 * 0 dB to 12 dB in 6 dB steps 358 * 0 dB to 12 dB in 6 dB steps
359 * value 2 and 3 means 12 dB 359 * value 2 and 3 means 12 dB
360 */ 360 */
361static DECLARE_TLV_DB_SCALE(master_coarse_tlv, 0, 600, 0); 361static DECLARE_TLV_DB_SCALE(digital_coarse_tlv, 0, 600, 0);
362
363/*
364 * Analog playback gain
365 * -24 dB to 12 dB in 2 dB steps
366 */
367static DECLARE_TLV_DB_SCALE(analog_tlv, -2400, 200, 0);
362 368
363/* 369/*
364 * Capture gain after the ADCs 370 * Capture gain after the ADCs
@@ -367,12 +373,27 @@ static DECLARE_TLV_DB_SCALE(master_coarse_tlv, 0, 600, 0);
367static DECLARE_TLV_DB_SCALE(digital_capture_tlv, 0, 100, 0); 373static DECLARE_TLV_DB_SCALE(digital_capture_tlv, 0, 100, 0);
368 374
369static const struct snd_kcontrol_new twl4030_snd_controls[] = { 375static const struct snd_kcontrol_new twl4030_snd_controls[] = {
370 SOC_DOUBLE_R_TLV("Master Playback Volume", 376 /* Common playback gain controls */
371 TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA, 377 SOC_DOUBLE_R_TLV("DAC1 Digital Fine Playback Volume",
372 0, 0x3f, 0, master_tlv), 378 TWL4030_REG_ARXL1PGA, TWL4030_REG_ARXR1PGA,
373 SOC_DOUBLE_R_TLV("Master PCM Playback Volume", 379 0, 0x3f, 0, digital_fine_tlv),
374 TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA, 380 SOC_DOUBLE_R_TLV("DAC2 Digital Fine Playback Volume",
375 6, 0x2, 0, master_coarse_tlv), 381 TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA,
382 0, 0x3f, 0, digital_fine_tlv),
383
384 SOC_DOUBLE_R_TLV("DAC1 Digital Coarse Playback Volume",
385 TWL4030_REG_ARXL1PGA, TWL4030_REG_ARXR1PGA,
386 6, 0x2, 0, digital_coarse_tlv),
387 SOC_DOUBLE_R_TLV("DAC2 Digital Coarse Playback Volume",
388 TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA,
389 6, 0x2, 0, digital_coarse_tlv),
390
391 SOC_DOUBLE_R_TLV("DAC1 Analog Playback Volume",
392 TWL4030_REG_ARXL1_APGA_CTL, TWL4030_REG_ARXR1_APGA_CTL,
393 3, 0x12, 1, analog_tlv),
394 SOC_DOUBLE_R_TLV("DAC2 Analog Playback Volume",
395 TWL4030_REG_ARXL2_APGA_CTL, TWL4030_REG_ARXR2_APGA_CTL,
396 3, 0x12, 1, analog_tlv),
376 397
377 /* Common capture gain controls */ 398 /* Common capture gain controls */
378 SOC_DOUBLE_R_TLV("Capture Volume", 399 SOC_DOUBLE_R_TLV("Capture Volume",