]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00162649 sgtl5000: reduce the DAC volume
authorGary Zhang <b13634@freescale.com>
Tue, 13 Dec 2011 08:11:18 +0000 (16:11 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:33:37 +0000 (08:33 +0200)
1. if the DAC volume is largest, output is harsh.
so reduce the DAC volume.
2. increase ADC volume

Signed-off-by: Gary Zhang <b13634@freescale.com>
sound/soc/codecs/sgtl5000.c

index 98e9c13a7615db7fd3d7fc60cdeedadc22bc83af..c6d067e95c0c99050efb1c151ee021435ca3f97d 100644 (file)
@@ -347,7 +347,7 @@ static int dac_info_volsw(struct snd_kcontrol *kcontrol,
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
        uinfo->count = 2;
        uinfo->value.integer.min = 0;
-       uinfo->value.integer.max = 0xfc - 0x3c;
+       uinfo->value.integer.max = 0xfc - 0x60;
        return 0;
 }
 
@@ -390,9 +390,9 @@ static int dac_get_volsw(struct snd_kcontrol *kcontrol,
        /* get right channel volume */
        r = (reg & SGTL5000_DAC_VOL_RIGHT_MASK) >> SGTL5000_DAC_VOL_RIGHT_SHIFT;
 
-       /* make sure value fall in (0x3c,0xfc) */
-       l = clamp(l, 0x3c, 0xfc);
-       r = clamp(r, 0x3c, 0xfc);
+       /* make sure value fall in (0x60,0xfc) */
+       l = clamp(l, 0x60, 0xfc);
+       r = clamp(r, 0x60, 0xfc);
 
        /* invert it and map to userspace value */
        l = 0xfc - l;
@@ -438,9 +438,9 @@ static int dac_put_volsw(struct snd_kcontrol *kcontrol,
        l = ucontrol->value.integer.value[0];
        r = ucontrol->value.integer.value[1];
 
-       /* make sure userspace volume fall in (0, 0xfc-0x3c) */
-       l = clamp(l, 0, 0xfc - 0x3c);
-       r = clamp(r, 0, 0xfc - 0x3c);
+       /* make sure userspace volume fall in (0, 0xfc-0x60) */
+       l = clamp(l, 0, 0xfc - 0x60);
+       r = clamp(r, 0, 0xfc - 0x60);
 
        /* invert it, get the value can be set to register */
        l = 0xfc - l;
@@ -1603,6 +1603,11 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
 
        snd_soc_write(codec, SGTL5000_CHIP_MIC_CTRL, 0);
 
+       snd_soc_write(codec, SGTL5000_CHIP_DAC_VOL, 0x6060);
+       snd_soc_write(codec, SGTL5000_CHIP_ANA_ADC_CTRL,
+               (0xf << SGTL5000_ADC_VOL_LEFT_SHIFT) |\
+               (0xf << SGTL5000_ADC_VOL_RIGHT_SHIFT));
+
        /*
         * disable DAP
         * TODO: