ASoC: sn95032: hardware volume and mute controls for sn95038 codec driver
authorRamesh Babu K V <ramesh.babu@intel.com>
Thu, 6 Oct 2011 15:18:22 +0000 (16:18 +0100)
committermgross <mark.gross@intel.com>
Wed, 9 Nov 2011 21:16:21 +0000 (13:16 -0800)
This patch adds alsa mixer digital volume controls to headphone and spekaer
paths.  Application can control left and right volume individually for each
path.

Change-Id: I514ee1a6f72fde1db53721198a190a17c1150bab
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
sound/soc/codecs/sn95031.c

index 7a602c2..ed49399 100644 (file)
@@ -375,6 +375,8 @@ static const char *sn95031_micmode_text[] = {"Single Ended", "Differential"};
 
 /* 0dB to 30dB in 10dB steps */
 static const DECLARE_TLV_DB_SCALE(mic_tlv, 0, 10, 0);
+/* -62db to 9 db in 1db steps*/
+static const DECLARE_TLV_DB_SCALE(out_tlv, -6200, 100, 0);
 
 static const struct soc_enum sn95031_micmode1_enum =
        SOC_ENUM_SINGLE(SN95031_MICAMP1, 1, 2, sn95031_micmode_text);
@@ -417,6 +419,16 @@ static const struct snd_kcontrol_new sn95031_snd_controls[] = {
                        2, 4, 0, mic_tlv),
        SOC_SINGLE_TLV("Mic2 Capture Volume", SN95031_MICAMP2,
                        2, 4, 0, mic_tlv),
+       /* Add digital volume and mute controls for Headphone/Headset*/
+       SOC_DOUBLE_R_TLV("Headphone Playback Volume", SN95031_HSLVOLCTRL,
+                               SN95031_HSRVOLCTRL, 0, 71, 1, out_tlv),
+       SOC_DOUBLE_R("Headphone Playback Switch", SN95031_HSLVOLCTRL,
+                               SN95031_HSRVOLCTRL, 7, 1, 0),
+       /* Add digital volume and mute controls for Speaker*/
+       SOC_DOUBLE_R_TLV("Speaker Playback Volume", SN95031_IHFLVOLCTRL,
+                               SN95031_IHFRVOLCTRL, 0, 71, 1, out_tlv),
+       SOC_DOUBLE_R("Speaker Playback Switch", SN95031_IHFLVOLCTRL,
+                               SN95031_IHFRVOLCTRL, 7, 1, 0),
 };
 
 /* DAPM widgets */