ASoC: TWL4030: change DAPMs for analog microphone selection
PATCH 1/1 ASoC: TWL4030: change DAPMs for analog microphone selection
The mixer DAPM is suitable than the mux DAPM for the analog microphone registers(0x05, 0x06) because each bit for path is switchable.
--- sound/soc/codecs/twl4030.c | 52 ++++++++++++++++--------------------------- 1 files changed, 19 insertions(+), 33 deletions(-)
sound/soc/codecs/twl4030.c +19 -33
@@ -397,36 +397,18 @@ static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control =SOC_DAPM_ENUM ("Route" , twl4030_handsfreer_enum);/* Left analog microphone selection */ -static const char *twl4030_analoglmic_texts[] = - {"Off" ,"Main mic" ,"Headset mic" ,"AUXL" ,"Carkit mic" }; - -static const unsigned int twl4030_analoglmic_values[] = - {0x0 ,0x1 ,0x2 ,0x4 ,0x8 }; - -static const struct soc_enum twl4030_analoglmic_enum = -SOC_VALUE_ENUM_SINGLE (TWL4030_REG_ANAMICL ,0 ,0xf , -ARRAY_SIZE (twl4030_analoglmic_texts), - twl4030_analoglmic_texts, - twl4030_analoglmic_values); - -static const struct snd_kcontrol_new twl4030_dapm_analoglmic_control = -SOC_DAPM_VALUE_ENUM ("Route" , twl4030_analoglmic_enum); +static const struct snd_kcontrol_new twl4030_dapm_analoglmic_controls[] = { +SOC_DAPM_SINGLE ("Main mic" ,TWL4030_REG_ANAMICL ,0 ,1 ,0 ), +SOC_DAPM_SINGLE ("Headset mic" ,TWL4030_REG_ANAMICL ,1 ,1 ,0 ), +SOC_DAPM_SINGLE ("AUXL" ,TWL4030_REG_ANAMICL ,2 ,1 ,0 ), +SOC_DAPM_SINGLE ("Carkit mic" ,TWL4030_REG_ANAMICL ,3 ,1 ,0 ), +};/* Right analog microphone selection */ -static const char *twl4030_analogrmic_texts[] = - {"Off" ,"Sub mic" ,"AUXR" }; - -static const unsigned int twl4030_analogrmic_values[] = - {0x0 ,0x1 ,0x4 }; - -static const struct soc_enum twl4030_analogrmic_enum = -SOC_VALUE_ENUM_SINGLE (TWL4030_REG_ANAMICR ,0 ,0x5 , -ARRAY_SIZE (twl4030_analogrmic_texts), - twl4030_analogrmic_texts, - twl4030_analogrmic_values); - -static const struct snd_kcontrol_new twl4030_dapm_analogrmic_control = -SOC_DAPM_VALUE_ENUM ("Route" , twl4030_analogrmic_enum); +static const struct snd_kcontrol_new twl4030_dapm_analogrmic_controls[] = { +SOC_DAPM_SINGLE ("Sub mic" ,TWL4030_REG_ANAMICR ,0 ,1 ,0 ), +SOC_DAPM_SINGLE ("AUXR" ,TWL4030_REG_ANAMICR ,1 ,1 ,0 ), +};/* TX1 L/R Analog/Digital microphone selection */ static const char *twl4030_micpathtx1_texts[] =
@@ -1034,11 +1016,15 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_POST_PMD | SND_SOC_DAPM_POST_REG), -/* Analog input muxes with switch for the capture amplifiers */ -SND_SOC_DAPM_VALUE_MUX ("Analog Left Capture Route" , -TWL4030_REG_ANAMICL ,4 ,0 , &twl4030_dapm_analoglmic_control), -SND_SOC_DAPM_VALUE_MUX ("Analog Right Capture Route" , -TWL4030_REG_ANAMICR ,4 ,0 , &twl4030_dapm_analogrmic_control), +/* Analog input mixers for the capture amplifiers */ +SND_SOC_DAPM_MIXER ("Analog Left Capture Route" , +TWL4030_REG_ANAMICL ,4 ,0 , + &twl4030_dapm_analoglmic_controls[0 ], +ARRAY_SIZE (twl4030_dapm_analoglmic_controls)), +SND_SOC_DAPM_MIXER ("Analog Right Capture Route" , +TWL4030_REG_ANAMICR ,4 ,0 , + &twl4030_dapm_analogrmic_controls[0 ], +ARRAY_SIZE (twl4030_dapm_analogrmic_controls)),SND_SOC_DAPM_PGA ("ADC Physical Left" , TWL4030_REG_AVADC_CTL, 3, 0, NULL, 0),
Signature · 1 line
1.6.0.4
Quoted 2 lines · On Tuesday 28 April 2009 08:59:50 ext Joonyoung Shim wrote:
The mixer DAPM is suitable than the mux DAPM for the analog microphone
registers(0x05, 0x06)because each bit for path is switchable.
I'm not sure about this one.
The TRM has this for the ANAMICL register:
Analog microphone left: Main microphone, headset microphone, carkit microphone, or auxiliary left microphone can be routed to the input of the A/D converters separately (only one enable bit at 1).
It is true, that it does not states explicitly that you can not set more than 1 bit, but it has this: only one enable bit at 1...
Are you sure about this?
---
Péter
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 11 lines · Peter Ujfalusi
Quoted 2 lines · On Tuesday 28 April 2009 08:59:50 ext Joonyoung Shim wrote:
The mixer DAPM is suitable than the mux DAPM for the analog microphone
registers(0x05, 0x06)because each bit for path is switchable.I'm not sure about this one.
The TRM has this for the ANAMICL register:
Analog microphone left: Main microphone, headset microphone, carkit microphone, or auxiliary left microphone can be routed to the input of the A/D converters separately (only one enable bit at 1).
Quoted 4 lines
It is true, that it does not states explicitly that you can not set more than 1 bit, but it has this: only one enable bit at 1...
Are you sure about this?
I read it at TRM too, but cannot believe it such mixer of outputs.
Actually, i setted to 1 both HSMIC_EN bit and MAINMIC_EN bit for the ANAMICL register, and recorded sound from headset mic and main mic. The result is that both sounds are recorded.
So, to be sure this part, can you inquire about it to TI side?
Quoted 7 lines · On Wednesday 29 April 2009 03:19:21 ext Joonyoung Shim wrote:
I read it at TRM too, but cannot believe it such mixer of outputs.
Actually, i setted to 1 both
HSMIC_ENbit andMAINMIC_ENbit for the ANAMICL register, and recorded sound from headset mic and main mic. The result is that both sounds are recorded.So, to be sure this part, can you inquire about it to TI side?
I'll ask Ti about this and also about the output mixer/mux thing, just to be sure that we are not doing anything 'illegal' with those either.
We should wait with this until Ti responds, I'll let you know what is their opinion...
Signature · 1 line
Péter
Quoted 7 lines · Peter Ujfalusi
Quoted 6 lines · On Wednesday 29 April 2009 03:19:21 ext Joonyoung Shim wrote:
I read it at TRM too, but cannot believe it such mixer of outputs.
Actually, i setted to 1 both
HSMIC_ENbit andMAINMIC_ENbit for the ANAMICL register, and recorded sound from headset mic and main mic. The result is that both sounds are recorded.
Quoted 7 lines
Quoted 1 line
So, to be sure this part, can you inquire about it to TI side?
I'll ask Ti about this and also about the output mixer/mux thing, just to be sure that we are not doing anything 'illegal' with those either.
We should wait with this until Ti responds, I'll let you know what is their opinion...
Ok, i see.
Thanks.
Quoted 13 lines · On Thursday 30 April 2009 10:20:16 ext Joonyoung Shim wrote:
Quoted 12 lines · Peter Ujfalusi
Quoted 7 lines · On Wednesday 29 April 2009 03:19:21 ext Joonyoung Shim wrote:
I read it at TRM too, but cannot believe it such mixer of outputs.
Actually, i setted to 1 both
HSMIC_ENbit andMAINMIC_ENbit for the ANAMICL register, and recorded sound from headset mic and main mic. The result is that both sounds are recorded.So, to be sure this part, can you inquire about it to TI side?
I'll ask Ti about this and also about the output mixer/mux thing, just to be sure that we are not doing anything 'illegal' with those either.
Quoted 6 lines
Quoted 2 lines
We should wait with this until Ti responds, I'll let you know what is their opinion...
Ok, i see.
Thanks.
I got the response for this:
On the output side: ear, predive, HS, Carkit is mixable, but the mixing is summing and not averaging, so if the inputs are close to full, it may cause saturation.
On the input side: you are right, the inputs can be mixed, but if we enable more than one input at the same time, the input impedance of the input amplifier will be reduced.
Just in case, can you resend the patch?
Signature · 5 lines
Péter _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 24 lines · Peter Ujfalusi
Quoted 9 lines · On Thursday 30 April 2009 10:20:16 ext Joonyoung Shim wrote:
Quoted 8 lines · Peter Ujfalusi
Quoted 7 lines · On Wednesday 29 April 2009 03:19:21 ext Joonyoung Shim wrote:
I read it at TRM too, but cannot believe it such mixer of outputs.
Actually, i setted to 1 both
HSMIC_ENbit andMAINMIC_ENbit for the ANAMICL register, and recorded sound from headset mic and main mic. The result is that both sounds are recorded.So, to be sure this part, can you inquire about it to TI side?
Quoted 8 lines
Quoted 5 lines
I'll ask Ti about this and also about the output mixer/mux thing, just to be sure that we are not doing anything 'illegal' with those either.
We should wait with this until Ti responds, I'll let you know what is their opinion...
Ok, i see.
Thanks.
I got the response for this:
On the output side: ear, predive, HS, Carkit is mixable, but the mixing is summing and not averaging, so if the inputs are close to full, it may cause saturation.
Quoted 6 lines
On the input side: you are right, the inputs can be mixed, but if we enable more than one input at the same time, the input impedance of the input amplifier will be reduced.
Just in case, can you resend the patch?
Ok, i resend the patch. Thanks.
--
From: Joonyoung Shim <[email protected]>
Date: Mon, 11 May 2009 20:36:08 +0900
Subject: [PATCH] ASoC: TWL4030: change DAPMs for analog microphone selection
The inputs of the twl4030 codec can be mixed, so we will use the mixer DAPM for the analog microphone registers(0x05, 0x06), but if we enable more than one input at the same time, the input impedance of the input amplifier will be reduced.
--- sound/soc/codecs/twl4030.c | 52 ++++++++++++++++--------------------------- 1 files changed, 19 insertions(+), 33 deletions(-)
sound/soc/codecs/twl4030.c +19 -33
@@ -422,36 +422,18 @@ static const struct snd_kcontrol_new twl4030_dapm_vibrapath_control =SOC_DAPM_ENUM ("Route" , twl4030_vibrapath_enum);/* Left analog microphone selection */ -static const char *twl4030_analoglmic_texts[] = - {"Off" ,"Main mic" ,"Headset mic" ,"AUXL" ,"Carkit mic" }; - -static const unsigned int twl4030_analoglmic_values[] = - {0x0 ,0x1 ,0x2 ,0x4 ,0x8 }; - -static const struct soc_enum twl4030_analoglmic_enum = -SOC_VALUE_ENUM_SINGLE (TWL4030_REG_ANAMICL ,0 ,0xf , -ARRAY_SIZE (twl4030_analoglmic_texts), - twl4030_analoglmic_texts, - twl4030_analoglmic_values); - -static const struct snd_kcontrol_new twl4030_dapm_analoglmic_control = -SOC_DAPM_VALUE_ENUM ("Route" , twl4030_analoglmic_enum); +static const struct snd_kcontrol_new twl4030_dapm_analoglmic_controls[] = { +SOC_DAPM_SINGLE ("Main mic" ,TWL4030_REG_ANAMICL ,0 ,1 ,0 ), +SOC_DAPM_SINGLE ("Headset mic" ,TWL4030_REG_ANAMICL ,1 ,1 ,0 ), +SOC_DAPM_SINGLE ("AUXL" ,TWL4030_REG_ANAMICL ,2 ,1 ,0 ), +SOC_DAPM_SINGLE ("Carkit mic" ,TWL4030_REG_ANAMICL ,3 ,1 ,0 ), +};/* Right analog microphone selection */ -static const char *twl4030_analogrmic_texts[] = - {"Off" ,"Sub mic" ,"AUXR" }; - -static const unsigned int twl4030_analogrmic_values[] = - {0x0 ,0x1 ,0x4 }; - -static const struct soc_enum twl4030_analogrmic_enum = -SOC_VALUE_ENUM_SINGLE (TWL4030_REG_ANAMICR ,0 ,0x5 , -ARRAY_SIZE (twl4030_analogrmic_texts), - twl4030_analogrmic_texts, - twl4030_analogrmic_values); - -static const struct snd_kcontrol_new twl4030_dapm_analogrmic_control = -SOC_DAPM_VALUE_ENUM ("Route" , twl4030_analogrmic_enum); +static const struct snd_kcontrol_new twl4030_dapm_analogrmic_controls[] = { +SOC_DAPM_SINGLE ("Sub mic" ,TWL4030_REG_ANAMICR ,0 ,1 ,0 ), +SOC_DAPM_SINGLE ("AUXR" ,TWL4030_REG_ANAMICR ,1 ,1 ,0 ), +};/* TX1 L/R Analog/Digital microphone selection */ static const char *twl4030_micpathtx1_texts[] =
@@ -1138,11 +1120,15 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_POST_PMD | SND_SOC_DAPM_POST_REG), -/* Analog input muxes with switch for the capture amplifiers */ -SND_SOC_DAPM_VALUE_MUX ("Analog Left Capture Route" , -TWL4030_REG_ANAMICL ,4 ,0 , &twl4030_dapm_analoglmic_control), -SND_SOC_DAPM_VALUE_MUX ("Analog Right Capture Route" , -TWL4030_REG_ANAMICR ,4 ,0 , &twl4030_dapm_analogrmic_control), +/* Analog input mixers for the capture amplifiers */ +SND_SOC_DAPM_MIXER ("Analog Left Capture Route" , +TWL4030_REG_ANAMICL ,4 ,0 , + &twl4030_dapm_analoglmic_controls[0 ], +ARRAY_SIZE (twl4030_dapm_analoglmic_controls)), +SND_SOC_DAPM_MIXER ("Analog Right Capture Route" , +TWL4030_REG_ANAMICR ,4 ,0 , + &twl4030_dapm_analogrmic_controls[0 ], +ARRAY_SIZE (twl4030_dapm_analogrmic_controls)),SND_SOC_DAPM_PGA ("ADC Physical Left" , TWL4030_REG_AVADC_CTL, 3, 0, NULL, 0),
Signature · 1 line
1.6.0.4
Quoted 37 lines · Joonyoung Shim
Quoted 36 lines · Peter Ujfalusi
Quoted 15 lines · On Thursday 30 April 2009 10:20:16 ext Joonyoung Shim wrote:
Quoted 14 lines · Peter Ujfalusi
Quoted 9 lines · On Wednesday 29 April 2009 03:19:21 ext Joonyoung Shim wrote:
I read it at TRM too, but cannot believe it such mixer of outputs.
Actually, i setted to 1 both
HSMIC_ENbit andMAINMIC_ENbit for the
ANAMICL register, and recorded sound from headset mic and main mic. The
result is that both sounds are recorded.So, to be sure this part, can you inquire about it to TI side?
I'll ask Ti about this and also about the output mixer/mux thing, just to
be sure that we are not doing anything 'illegal' with those either.Quoted 6 lines
Quoted 3 lines
We should wait with this until Ti responds, I'll let you know what is
their opinion...Ok, i see.
Thanks.
I got the response for this:
On the output side: ear, predive, HS, Carkit is mixable, but the mixing is
summing and not averaging, so if the inputs are close to full, it may cause
saturation.On the input side: you are right, the inputs can be mixed, but if we enable
more than one input at the same time, the input impedance of the input
amplifier will be reduced.
Quoted 4 lines
Quoted 2 lines
Just in case, can you resend the patch?
Ok, i resend the patch. Thanks.
Peter, are you OK with this? You asked for it to be resent so I guess you wanted to re-review it or something?
Quoted 99 lines
--
From: Joonyoung Shim <[email protected]>
Date: Mon, 11 May 2009 20:36:08 +0900
Subject: [PATCH] ASoC: TWL4030: change DAPMs for analog microphone selectionThe inputs of the twl4030 codec can be mixed, so we will use the mixer DAPM for the analog microphone
registers(0x05, 0x06), but if we enable more than one input at the same time, the input impedance of the input amplifier will be reduced.Signed-off-by Joonyoung Shim <[email protected]>---
sound/soc/codecs/twl4030.c| 52 +++++++++++++++
+---------------------------1 files changed, 19 insertions(+), 33 deletions(-)sound/soc/codecs/twl4030.c +0
-0@@ -422,36 +422,18 @@ static const struct snd_kcontrol_new
twl4030_dapm_vibrapath_control=SOC_DAPM_ENUM("Route", twl4030_vibrapath_enum);/* Left analog microphone selection */
sound/soc/codecs/twl4030.c +0
-13-static const char *twl4030_analoglmic_texts[] = - {"Off" ,"Main mic" ,"Headset mic" ,"AUXL" ,"Carkit mic" }; - -static const unsigned int twl4030_analoglmic_values[] = - {0x0 ,0x1 ,0x2 ,0x4 ,0x8 }; - -static const struct soc_enum twl4030_analoglmic_enum = -SOC_VALUE_ENUM_SINGLE (TWL4030_REG_ANAMICL ,0 ,0xf , -ARRAY_SIZE (twl4030_analoglmic_texts), - twl4030_analoglmic_texts, - twl4030_analoglmic_values); - -static const struct snd_kcontrol_new
twl4030_dapm_analoglmic_control=sound/soc/codecs/twl4030.c +1
-1-SOC_DAPM_VALUE_ENUM ("Route" , twl4030_analoglmic_enum); +static const struct snd_kcontrol_newtwl4030_dapm_analoglmic_controls[] = {
sound/soc/codecs/twl4030.c +5
-0+SOC_DAPM_SINGLE ("Main mic" ,TWL4030_REG_ANAMICL ,0 ,1 ,0 ), +SOC_DAPM_SINGLE ("Headset mic" ,TWL4030_REG_ANAMICL ,1 ,1 ,0 ), +SOC_DAPM_SINGLE ("AUXL" ,TWL4030_REG_ANAMICL ,2 ,1 ,0 ), + SOC_DAPM_SINGLE("Carkit mic", TWL4030_REG_ANAMICL, 3, 1, 0), +};/* Right analog microphone selection */
sound/soc/codecs/twl4030.c +0
-13-static const char *twl4030_analogrmic_texts[] = - {"Off" ,"Sub mic" ,"AUXR" }; - -static const unsigned int twl4030_analogrmic_values[] = - {0x0 ,0x1 ,0x4 }; - -static const struct soc_enum twl4030_analogrmic_enum = -SOC_VALUE_ENUM_SINGLE (TWL4030_REG_ANAMICR ,0 ,0x5 , -ARRAY_SIZE (twl4030_analogrmic_texts), - twl4030_analogrmic_texts, - twl4030_analogrmic_values); - -static const struct snd_kcontrol_new
twl4030_dapm_analogrmic_control=sound/soc/codecs/twl4030.c +1
-1-SOC_DAPM_VALUE_ENUM ("Route" , twl4030_analogrmic_enum); +static const struct snd_kcontrol_newtwl4030_dapm_analogrmic_controls[] = {
sound/soc/codecs/twl4030.c +3
-0+SOC_DAPM_SINGLE ("Sub mic" ,TWL4030_REG_ANAMICR ,0 ,1 ,0 ), + SOC_DAPM_SINGLE("AUXR", TWL4030_REG_ANAMICR, 1, 1, 0), +};/* TX1 L/R Analog/Digital microphone selection */
static const char *twl4030_micpathtx1_texts[] =sound/soc/codecs/twl4030.c +9
-5@@ -1138,11 +1120,15 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_POST_PMD | SND_SOC_DAPM_POST_REG), -/* Analog input muxes with switch for the capture amplifiers */ -SND_SOC_DAPM_VALUE_MUX ("Analog Left Capture Route" , -TWL4030_REG_ANAMICL ,4 ,0 , &twl4030_dapm_analoglmic_control), -SND_SOC_DAPM_VALUE_MUX ("Analog Right Capture Route" , -TWL4030_REG_ANAMICR ,4 ,0 , &twl4030_dapm_analogrmic_control), +/* Analog input mixers for the capture amplifiers */ +SND_SOC_DAPM_MIXER ("Analog Left Capture Route" , +TWL4030_REG_ANAMICL ,4 ,0 , + &twl4030_dapm_analoglmic_controls[0 ], +ARRAY_SIZE (twl4030_dapm_analoglmic_controls)), +SND_SOC_DAPM_MIXER ("Analog Right Capture Route" , +TWL4030_REG_ANAMICR ,4 ,0 , + &twl4030_dapm_analogrmic_controls[0 ], +ARRAY_SIZE (twl4030_dapm_analogrmic_controls)), SND_SOC_DAPM_PGA("ADC Physical Left",TWL4030_REG_AVADC_CTL, 3, 0, NULL, 0),Signature · 1 line
1.6.0.4
Peter Ujfalusi
Acked-byQuoted 7 lines · On Tuesday 12 May 2009 09:57:02 ext Mark Brown wrote:
On 11 May 2009, at 12:41, Joonyoung Shim <[email protected]>
Quoted 3 lines
Quoted 1 line
Just in case, can you resend the patch?
Ok, i resend the patch. Thanks.
Peter, are you OK with this? You asked for it to be resent so I guess you wanted to re-review it or something?
If the original patch applies, that there is no need to resend. I just wanted to make your job easier...
The patch was OK otherwise.
Mark Brown
AppliedQuoted 3 lines · Peter Ujfalusi
If the original patch applies, that there is no need to resend. I just wanted to make your job easier...
The patch was OK otherwise.
Applied, thanks.