ASoC: rt5677: Add sidetone function
authorOder Chiou <oder_chiou@realtek.com>
Thu, 18 Sep 2014 06:45:59 +0000 (14:45 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 23 Sep 2014 00:52:45 +0000 (17:52 -0700)
Add sidetone function

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt5677.c
sound/soc/codecs/rt5677.h

index 1d4719f5fe7579ef48e657832a501d1ea1877e09..4a0f3dfb2a4722ce44f604e9cdf46d88d7450ffb 100644 (file)
@@ -541,6 +541,7 @@ static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0);
 static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0);
 static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0);
 static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);
+static const DECLARE_TLV_DB_SCALE(st_vol_tlv, -4650, 150, 0);
 
 /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */
 static unsigned int bst_tlv[] = {
@@ -605,6 +606,10 @@ static const struct snd_kcontrol_new rt5677_snd_controls[] = {
                RT5677_MONO_ADC_L_VOL_SFT, RT5677_MONO_ADC_R_VOL_SFT, 127, 0,
                adc_vol_tlv),
 
+       /* Sidetone Control */
+       SOC_SINGLE_TLV("Sidetone Volume", RT5677_SIDETONE_CTRL,
+               RT5677_ST_VOL_SFT, 31, 0, st_vol_tlv),
+
        /* ADC Boost Volume Control */
        SOC_DOUBLE_TLV("STO1 ADC Boost Volume", RT5677_STO1_2_ADC_BST,
                RT5677_STO1_ADC_L_BST_SFT, RT5677_STO1_ADC_R_BST_SFT, 3, 0,
@@ -1993,6 +1998,9 @@ static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = {
        /* Sidetone Mux */
        SND_SOC_DAPM_MUX("Sidetone Mux", SND_SOC_NOPM, 0, 0,
                        &rt5677_sidetone_mux),
+       SND_SOC_DAPM_SUPPLY("Sidetone Power", RT5677_SIDETONE_CTRL,
+               RT5677_ST_EN_SFT, 0, NULL, 0),
+
        /* VAD Mux*/
        SND_SOC_DAPM_MUX("VAD ADC Mux", SND_SOC_NOPM, 0, 0,
                        &rt5677_vad_src_mux),
@@ -2704,6 +2712,7 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
        { "Sidetone Mux", "DMIC4 L", "DMIC L4" },
        { "Sidetone Mux", "ADC1", "ADC 1" },
        { "Sidetone Mux", "ADC2", "ADC 2" },
+       { "Sidetone Mux", NULL, "Sidetone Power" },
 
        { "Stereo DAC MIXL", "ST L Switch", "Sidetone Mux" },
        { "Stereo DAC MIXL", "DAC1 L Switch", "DAC1 MIXL" },
index b61b72cfcbd7929f3a1712347a963d362e1d247c..1fe88727a0633629ab01ed4f315bc45027145d9e 100644 (file)
 #define RT5677_ST_SEL_SFT                      9
 #define RT5677_ST_EN                           (0x1 << 6)
 #define RT5677_ST_EN_SFT                       6
+#define RT5677_ST_GAIN                         (0x1 << 5)
+#define RT5677_ST_GAIN_SFT                     5
+#define RT5677_ST_VOL_MASK                     (0x1f << 0)
+#define RT5677_ST_VOL_SFT                      0
 
 /* Analog DAC1/2/3 Source Control (0x15) */
 #define RT5677_ANA_DAC3_SRC_SEL_MASK           (0x3 << 4)