Skip to contentSkip to conversation

ASoC: cs4265: Add a MIC pre. switch

PATCH In review Matt Flax 2 participants 5 messages Sep 7, 2018

Subsystems (3)
lore
Share & tools
lore

Matt Flax

author
#0 lore raw

PATCH 1/1 ASoC: cs4265: Add a MIC pre. switch

This patch adds a MIC preamp enable switch as a SOC_SINGLE.

---
 sound/soc/codecs/cs4265.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/cs4265.c +1 -0
index d9eebf6a..03476f93 100644
@@ -161,6 +161,7 @@ static const struct snd_kcontrol_new cs4265_snd_controls[] = {
 	SOC_SINGLE("MMTLR Data Switch", CS4265_SPDIF_CTL2, 0, 1, 0),
 	SOC_ENUM("Mono Channel Select", spdif_mono_select_enum),
 	SND_SOC_BYTES("C Data Buffer", CS4265_C_DATA_BUFF, 24),
+	SOC_SINGLE("MIC Preamp", CS4265_PWRCTL, 3, 1, 1),
 };
 
 static const struct snd_soc_dapm_widget cs4265_dapm_widgets[] = {
Signature · 1 line
2.17.1
#1 lore raw
Quoted 12 lines · Matt Flax

This patch adds a MIC preamp enable switch as a SOC_SINGLE.

---
 sound/soc/codecs/cs4265.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/cs4265.c +0 -0
index d9eebf6a..03476f93 100644

sound/soc/codecs/cs4265.c static const struct snd_kcontrol_new cs4265_snd_controls[] = { · line 165

Quoted 5 lines
sound/soc/codecs/cs4265.c +1 -0
@@ -161,6 +161,7 @@ static const struct snd_kcontrol_new cs4265_snd_controls[] = {
 	SOC_SINGLE("MMTLR Data Switch", CS4265_SPDIF_CTL2, 0, 1, 0),
 	SOC_ENUM("Mono Channel Select", spdif_mono_select_enum),
 	SND_SOC_BYTES("C Data Buffer", CS4265_C_DATA_BUFF, 24),
+	SOC_SINGLE("MIC Preamp", CS4265_PWRCTL, 3, 1, 1),
 };

Is this the correct way to control this bit? There is already a SND_SOC_DAPM_PGA widget called "Pre-amp MIC" that controls the bit, it looks like this widget is not connected to the rest of the DAPM graph. Should we just be hooking that widget up instead? The datasheet isn't abundantly clear but it looks like the bit needs to be set whenever the mic is in use:

"The microphone preamplifier block will enter a low-power state whenever this bit is set."

Which would really make DAPM a better fit, unless there are valid use-cases for using the mic with the preamp powered down?

Thanks,
Charles

author
#2 lore raw
Quoted 25 lines · Charles Keepax
Quoted 12 lines · Matt Flax

This patch adds a MIC preamp enable switch as a SOC_SINGLE.

---
  sound/soc/codecs/cs4265.c | 1 +
  1 file changed, 1 insertion(+)
sound/soc/codecs/cs4265.c +0 -0
index d9eebf6a..03476f93 100644

sound/soc/codecs/cs4265.c static const struct snd_kcontrol_new cs4265_snd_controls[] = { · line 165

Quoted 5 lines
sound/soc/codecs/cs4265.c +1 -0
@@ -161,6 +161,7 @@ static const struct snd_kcontrol_new cs4265_snd_controls[] = {
  	SOC_SINGLE("MMTLR Data Switch", CS4265_SPDIF_CTL2, 0, 1, 0),
  	SOC_ENUM("Mono Channel Select", spdif_mono_select_enum),
  	SND_SOC_BYTES("C Data Buffer", CS4265_C_DATA_BUFF, 24),
+	SOC_SINGLE("MIC Preamp", CS4265_PWRCTL, 3, 1, 1),
  };

Is this the correct way to control this bit? There is already a SND_SOC_DAPM_PGA widget called "Pre-amp MIC" that controls the bit, it looks like this widget is not connected to the rest of the DAPM graph. Should we just be hooking that widget up instead? The datasheet isn't abundantly clear but it looks like the bit needs to be set whenever the mic is in use:

Quoted 7 lines

"The microphone preamplifier block will enter a low-power state whenever this bit is set."

Which would really make DAPM a better fit, unless there are valid use-cases for using the mic with the preamp powered down?

Agreed, when you switch to the MIC rather then LINEIN it should be turned on.

This is the DAPM_MUX :
https://github.com/torvalds/linux/blob/master/sound/soc/codecs/cs4265.c#L178
This is the ENUM_SINGLE :
https://github.com/torvalds/linux/blob/master/sound/soc/codecs/cs4265.c#L98

What is the best way to do this ?

Matt

#3 lore raw
Quoted 8 lines · Matt Flax
Quoted 3 lines · Charles Keepax

On Fri, Sep 07, 2018 at 01:27:29PM +1000, Matt Flax wrote:
Which would really make DAPM a better fit, unless there are valid use-cases for using the mic with the preamp powered down?

Agreed, when you switch to the MIC rather then LINEIN it should be turned on.

Quoted 6 lines

This is the DAPM_MUX :
https://github.com/torvalds/linux/blob/master/sound/soc/codecs/cs4265.c#L178
This is the ENUM_SINGLE :
https://github.com/torvalds/linux/blob/master/sound/soc/codecs/cs4265.c#L98

What is the best way to do this ?

Apologies not sure I entirely follow, don't you just want to update the routes such that the existing "Pre-amp MIC" widget is between the MICL,R and the ADC Mux. Something like:

{ "Pre-amp MIC", NULL, "MICL" },
{ "Pre-amp MIC", NULL, "MICR" },
{ "ADC Mux", "MIC", "Pre-amp MIC" },

Thanks,
Charles

author
#4 lore raw
Quoted 13 lines · Charles Keepax
Quoted 12 lines · Matt Flax
Quoted 3 lines · Charles Keepax

On Fri, Sep 07, 2018 at 01:27:29PM +1000, Matt Flax wrote:
Which would really make DAPM a better fit, unless there are valid use-cases for using the mic with the preamp powered down?

Agreed, when you switch to the MIC rather then LINEIN it should be turned on.

This is the DAPM_MUX :
https://github.com/torvalds/linux/blob/master/sound/soc/codecs/cs4265.c#L178
This is the ENUM_SINGLE :
https://github.com/torvalds/linux/blob/master/sound/soc/codecs/cs4265.c#L98

Quoted 10 lines
Quoted 1 line

What is the best way to do this ?

Apologies not sure I entirely follow, don't you just want to update the routes such that the existing "Pre-amp MIC" widget is between the MICL,R and the ADC Mux. Something like:

{ "Pre-amp MIC", NULL, "MICL" },
{ "Pre-amp MIC", NULL, "MICR" },
{ "ADC Mux", "MIC", "Pre-amp MIC" },

ok - will do.

Matt