Kcontrols for ASoC TWL4030 CODEC
Here i submit the patch for the kcontrols for ASoC TWL4030 CODEC.
This patch comes next to my first patch.
There seems some MUA issue so i attached the patch.
Quoted 1 line
From
228b912bef74c4f22f4afaa031ac0ce0fef652f1Mon Sep 17 00:00:00 2001
From: chnaveenkrishna <[email protected]>
Date: Thu, 20 Nov 2008 18:11:45 +0530
Subject: [PATCH] Kcontrols for gain selection and enabling, disabling the ADC, DAC-2
--- sound/soc/codecs/twl4030.c | 61 +++++++++++++++++++++++++++++++++++++++---- 1 files changed, 55 insertions(+), 6 deletions(-)
sound/soc/codecs/twl4030.c +0 -0
@@ -190,12 +190,61 @@ static void twl4030_init_chip(struct snd_soc_codec
*codec)
}
static const struct snd_kcontrol_new twl4030_snd_controls[] = {
- SOC_DOUBLE_R("Master Playback Volume",
- TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA,
- 0, 127, 0),
- SOC_DOUBLE_R("Capture Volume",
- TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA,
- 0, 127, 0),
+
+ /* Master Playback Volume Controls */
+ SOC_DOUBLE_R("Master PLayback Course Gain",
+ TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA,
+ 6, 3, 0),
+
+ SOC_DOUBLE_R("Master Playback Fine Gain",
+ TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA,
+ 0, 63, 0),
+
+ /* Master Capture Gain controls */
+ SOC_DOUBLE_R("Master Capture Gain",
+ TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA,
+ 0, 31, 0),
+
+ /* Headset volume controls */
+ SOC_DOUBLE("Headset Volume",
+ TWL4030_REG_HS_GAIN_SET, 2, 0, 3, 0),
+
+ /* Ear Piece volume controls */
+ SOC_SINGLE("Earpiece Volume",
+ TWL4030_REG_EAR_CTL, 4, 3, 0),
+
+ /* Internal Class D Speaker volume controls */
+ SOC_DOUBLE_R("Internal Speaker Volume",
+ TWL4030_REG_ARXL2_APGA_CTL, TWL4030_REG_ARXR2_APGA_CTL,
+ 3, 17, 0),
+
+ /* External Class D Speaker volume controls */
+ SOC_DOUBLE_R("External Speaker Volume",
+ TWL4030_REG_PREDL_CTL, TWL4030_REG_PREDR_CTL,
+ 4, 3, 0),
+
+ /* Predriver Carkit volume controls */
+ SOC_DOUBLE_R("Pre Car-Kit Volume",
+ TWL4030_REG_PRECKL_CTL, TWL4030_REG_PRECKR_CTL,
+ 4, 3, 0),
+
+ SOC_DOUBLE("Main + Sub Mic Capture Gain",
+ TWL4030_REG_ANAMIC_GAIN, 3 , 0, 5, 0),
+
+ /* Loop gain controls*/
+ SOC_DOUBLE("Loop Gain", TWL4030_REG_ATX2ARXPGA,
+ 3 , 0, 7, 0),
+
+ /* Left and Right ADC Switches */
+ SOC_SINGLE("ADCL", TWL4030_REG_AVADC_CTL, 3, 1, 0),
+
+ SOC_SINGLE("ADCR", TWL4030_REG_AVADC_CTL, 1, 1, 0),
+
+ /* Left and Right DAC-2 Switches */
+ SOC_SINGLE("DACL2", TWL4030_REG_AVDAC_CTL, 3, 1, 0),
+
+ SOC_SINGLE("DACR2", TWL4030_REG_AVDAC_CTL, 2, 1, 0),
+
};
/* add non dapm controls */
Signature · 6 lines
1.5.3.4 -- Thanks, (: Naveen Krishna Ch :)
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Review
Quoted 13 lines · naveen krishna ch
static const struct
snd_kcontrol_newtwl4030_snd_controls[] = {(quoted diff) +6
-6- SOC_DOUBLE_R("Master Playback Volume", - TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA, - 0, 127, 0), - SOC_DOUBLE_R("Capture Volume", - TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA, - 0, 127, 0), + + /* Master Playback Volume Controls */ + SOC_DOUBLE_R("Master PLayback Course Gain", + TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA, + 6, 3, 0), +
Please see the comments I made in response to your original posting - there look to be problems with your indentation here and your control names should conform to the ALSA control naming standard in:
Documentation/sound/alsa/ControlNames.txt
Quoted 11 lines · Mark Brown
Quoted 9 lines · naveen krishna ch
static const struct
snd_kcontrol_newtwl4030_snd_controls[] = {(quoted diff) +2
-6- SOC_DOUBLE_R("Master Playback Volume", - TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA, - 0, 127, 0), - SOC_DOUBLE_R("Capture Volume", - TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA, - 0, 127, 0), + + /* Master Playback Volume Controls */
Quoted 8 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+ SOC_DOUBLE_R("Master PLayback Course Gain", + TWL4030_REG_ARXL2PGA, TWL4030_REG_ARXR2PGA, + 6, 3, 0), +Please see the comments I made in response to your original posting - there look to be problems with your indentation here and your control names should conform to the ALSA control naming standard in:
Sorry i could not solve the issue with the indentation i have attached the patch file.
Quoted 3 lines
Documentation/sound/alsa/ControlNames.txt
The standard names in the documentation does not gives the exact details of the CODEC's feature so i used a part of the CODEC pin name to avoid confusion at later stages.
Course and Fine controls are feature given by the CODEC so distinguish them i named them against the features.
There is an internal and external speaker facility i name d them against that.
However i will re submit the patch with some modifications in names.
Signature · 3 lines
Thanks, (: Naveen Krishna Ch :)
Quoted 7 lines · naveen krishna ch
Quoted 1 line · Mark Brown
Documentation/sound/alsa/ControlNames.txtThe standard names in the documentation does not gives the exact details of the CODEC's feature so i used a part of the CODEC pin name to avoid confusion at later stages.
You'll not be able to get all the control names entirely from the spec but you should still do things like use "Volume" for gain and attenuation controls as I said.