aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/twl4030.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index efb371f6f01c..23bae74ebf0a 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -491,6 +491,18 @@ static const struct snd_kcontrol_new twl4030_dapm_dbypassr_control =
491 TWL4030_REG_ATX2ARXPGA, 0, 7, 0, 491 TWL4030_REG_ATX2ARXPGA, 0, 7, 0,
492 twl4030_dapm_dbypass_tlv); 492 twl4030_dapm_dbypass_tlv);
493 493
494/*
495 * Voice Sidetone GAIN volume control:
496 * from -51 to -10 dB in 1 dB steps (mute instead of -51 dB)
497 */
498static DECLARE_TLV_DB_SCALE(twl4030_dapm_dbypassv_tlv, -5100, 100, 1);
499
500/* Digital bypass voice: sidetone (VUL -> VDL)*/
501static const struct snd_kcontrol_new twl4030_dapm_dbypassv_control =
502 SOC_DAPM_SINGLE_TLV("Volume",
503 TWL4030_REG_VSTPGA, 0, 0x29, 0,
504 twl4030_dapm_dbypassv_tlv);
505
494static int micpath_event(struct snd_soc_dapm_widget *w, 506static int micpath_event(struct snd_soc_dapm_widget *w,
495 struct snd_kcontrol *kcontrol, int event) 507 struct snd_kcontrol *kcontrol, int event)
496{ 508{
@@ -607,12 +619,18 @@ static int bypass_event(struct snd_soc_dapm_widget *w,
607 twl4030->bypass_state |= (1 << 4); 619 twl4030->bypass_state |= (1 << 4);
608 else 620 else
609 twl4030->bypass_state &= ~(1 << 4); 621 twl4030->bypass_state &= ~(1 << 4);
622 } else if (m->reg == TWL4030_REG_VSTPGA) {
623 /* Voice digital bypass */
624 if (reg)
625 twl4030->bypass_state |= (1 << 5);
626 else
627 twl4030->bypass_state &= ~(1 << 5);
610 } else { 628 } else {
611 /* Digital bypass */ 629 /* Digital bypass */
612 if (reg & (0x7 << m->shift)) 630 if (reg & (0x7 << m->shift))
613 twl4030->bypass_state |= (1 << (m->shift ? 6 : 5)); 631 twl4030->bypass_state |= (1 << (m->shift ? 7 : 6));
614 else 632 else
615 twl4030->bypass_state &= ~(1 << (m->shift ? 6 : 5)); 633 twl4030->bypass_state &= ~(1 << (m->shift ? 7 : 6));
616 } 634 }
617 635
618 /* Enable master analog loopback mode if any analog switch is enabled*/ 636 /* Enable master analog loopback mode if any analog switch is enabled*/
@@ -991,6 +1009,9 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
991 SND_SOC_DAPM_SWITCH_E("Right Digital Loopback", SND_SOC_NOPM, 0, 0, 1009 SND_SOC_DAPM_SWITCH_E("Right Digital Loopback", SND_SOC_NOPM, 0, 0,
992 &twl4030_dapm_dbypassr_control, bypass_event, 1010 &twl4030_dapm_dbypassr_control, bypass_event,
993 SND_SOC_DAPM_POST_REG), 1011 SND_SOC_DAPM_POST_REG),
1012 SND_SOC_DAPM_SWITCH_E("Voice Digital Loopback", SND_SOC_NOPM, 0, 0,
1013 &twl4030_dapm_dbypassv_control, bypass_event,
1014 SND_SOC_DAPM_POST_REG),
994 1015
995 SND_SOC_DAPM_MIXER("Analog R1 Playback Mixer", TWL4030_REG_AVDAC_CTL, 1016 SND_SOC_DAPM_MIXER("Analog R1 Playback Mixer", TWL4030_REG_AVDAC_CTL,
996 0, 0, NULL, 0), 1017 0, 0, NULL, 0),
@@ -1203,9 +1224,11 @@ static const struct snd_soc_dapm_route intercon[] = {
1203 /* Digital bypass routes */ 1224 /* Digital bypass routes */
1204 {"Right Digital Loopback", "Volume", "TX1 Capture Route"}, 1225 {"Right Digital Loopback", "Volume", "TX1 Capture Route"},
1205 {"Left Digital Loopback", "Volume", "TX1 Capture Route"}, 1226 {"Left Digital Loopback", "Volume", "TX1 Capture Route"},
1227 {"Voice Digital Loopback", "Volume", "TX2 Capture Route"},
1206 1228
1207 {"Analog R2 Playback Mixer", NULL, "Right Digital Loopback"}, 1229 {"Analog R2 Playback Mixer", NULL, "Right Digital Loopback"},
1208 {"Analog L2 Playback Mixer", NULL, "Left Digital Loopback"}, 1230 {"Analog L2 Playback Mixer", NULL, "Left Digital Loopback"},
1231 {"Analog Voice Playback Mixer", NULL, "Voice Digital Loopback"},
1209 1232
1210}; 1233};
1211 1234