alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: wm8962: Allow switching between analog and digital inputs
@ 2022-02-02 16:45 Charles Keepax
  2022-02-03  9:21 ` Martin Kepplinger
  2022-02-03 15:19 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Charles Keepax @ 2022-02-02 16:45 UTC (permalink / raw)
  To: broonie
  Cc: martin.kepplinger, alsa-devel, patches, shengjiu.wang, lgirdwood,
	daniel.baluta

When the DMIC_ENA bit is set the analogue inputs are disconnected from
the digital core of the chip, in favour of the digital microphones.
Currently the driver will always enable DMIC_ENA whilst the GPIOs are
configured for the DMIC function, this means the user can't currently
use both the analog inputs and the digital inputs in one system.

Add an additional DAPM mutex that allows switching between analog and
digital inputs into the digital core.

Reported-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 sound/soc/codecs/wm8962.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index a5584ba962dcf..2c41d31956aa8 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2049,6 +2049,13 @@ static SOC_ENUM_SINGLE_DECL(hpoutl_enum,
 static const struct snd_kcontrol_new hpoutl_mux =
 	SOC_DAPM_ENUM("HPOUTL Mux", hpoutl_enum);
 
+static const char * const input_mode_text[] = { "Analog", "Digital" };
+
+static SOC_ENUM_SINGLE_VIRT_DECL(input_mode_enum, input_mode_text);
+
+static const struct snd_kcontrol_new input_mode_mux =
+	SOC_DAPM_ENUM("Input Mode", input_mode_enum);
+
 static const struct snd_kcontrol_new inpgal[] = {
 SOC_DAPM_SINGLE("IN1L Switch", WM8962_LEFT_INPUT_PGA_CONTROL, 3, 1, 0),
 SOC_DAPM_SINGLE("IN2L Switch", WM8962_LEFT_INPUT_PGA_CONTROL, 2, 1, 0),
@@ -2147,6 +2154,9 @@ SND_SOC_DAPM_MIXER("MIXINR", WM8962_PWR_MGMT_1, 4, 0,
 
 SND_SOC_DAPM_AIF_IN("DMIC_ENA", NULL, 0, WM8962_PWR_MGMT_1, 10, 0),
 
+SND_SOC_DAPM_MUX("Input Mode L", SND_SOC_NOPM, 0, 0, &input_mode_mux),
+SND_SOC_DAPM_MUX("Input Mode R", SND_SOC_NOPM, 0, 0, &input_mode_mux),
+
 SND_SOC_DAPM_ADC("ADCL", "Capture", WM8962_PWR_MGMT_1, 3, 0),
 SND_SOC_DAPM_ADC("ADCR", "Capture", WM8962_PWR_MGMT_1, 2, 0),
 
@@ -2226,16 +2236,19 @@ static const struct snd_soc_dapm_route wm8962_intercon[] = {
 
 	{ "DMIC_ENA", NULL, "DMICDAT" },
 
+	{ "Input Mode L", "Analog", "MIXINL" },
+	{ "Input Mode L", "Digital", "DMIC_ENA" },
+	{ "Input Mode R", "Analog", "MIXINR" },
+	{ "Input Mode R", "Digital", "DMIC_ENA" },
+
 	{ "ADCL", NULL, "SYSCLK" },
 	{ "ADCL", NULL, "TOCLK" },
-	{ "ADCL", NULL, "MIXINL" },
-	{ "ADCL", NULL, "DMIC_ENA" },
+	{ "ADCL", NULL, "Input Mode L" },
 	{ "ADCL", NULL, "DSP2" },
 
 	{ "ADCR", NULL, "SYSCLK" },
 	{ "ADCR", NULL, "TOCLK" },
-	{ "ADCR", NULL, "MIXINR" },
-	{ "ADCR", NULL, "DMIC_ENA" },
+	{ "ADCR", NULL, "Input Mode R" },
 	{ "ADCR", NULL, "DSP2" },
 
 	{ "STL", "Left", "ADCL" },
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: wm8962: Allow switching between analog and digital inputs
  2022-02-02 16:45 [PATCH] ASoC: wm8962: Allow switching between analog and digital inputs Charles Keepax
@ 2022-02-03  9:21 ` Martin Kepplinger
  2022-02-03 15:19 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Kepplinger @ 2022-02-03  9:21 UTC (permalink / raw)
  To: Charles Keepax, broonie
  Cc: patches, shengjiu.wang, daniel.baluta, lgirdwood, alsa-devel

Am Mittwoch, dem 02.02.2022 um 16:45 +0000 schrieb Charles Keepax:
> When the DMIC_ENA bit is set the analogue inputs are disconnected
> from
> the digital core of the chip, in favour of the digital microphones.
> Currently the driver will always enable DMIC_ENA whilst the GPIOs are
> configured for the DMIC function, this means the user can't currently
> use both the analog inputs and the digital inputs in one system.
> 
> Add an additional DAPM mutex that allows switching between analog and
> digital inputs into the digital core.
> 
> Reported-by: Martin Kepplinger <martin.kepplinger@puri.sm>

Hi Charles, thank you again very much for this! You can make this

Reported-and-tested-by: Martin Kepplinger <martin.kepplinger@puri.sm>


> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---
>  sound/soc/codecs/wm8962.c | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
> index a5584ba962dcf..2c41d31956aa8 100644
> --- a/sound/soc/codecs/wm8962.c
> +++ b/sound/soc/codecs/wm8962.c
> @@ -2049,6 +2049,13 @@ static SOC_ENUM_SINGLE_DECL(hpoutl_enum,
>  static const struct snd_kcontrol_new hpoutl_mux =
>         SOC_DAPM_ENUM("HPOUTL Mux", hpoutl_enum);
>  
> +static const char * const input_mode_text[] = { "Analog", "Digital"
> };
> +
> +static SOC_ENUM_SINGLE_VIRT_DECL(input_mode_enum, input_mode_text);
> +
> +static const struct snd_kcontrol_new input_mode_mux =
> +       SOC_DAPM_ENUM("Input Mode", input_mode_enum);
> +
>  static const struct snd_kcontrol_new inpgal[] = {
>  SOC_DAPM_SINGLE("IN1L Switch", WM8962_LEFT_INPUT_PGA_CONTROL, 3, 1,
> 0),
>  SOC_DAPM_SINGLE("IN2L Switch", WM8962_LEFT_INPUT_PGA_CONTROL, 2, 1,
> 0),
> @@ -2147,6 +2154,9 @@ SND_SOC_DAPM_MIXER("MIXINR", WM8962_PWR_MGMT_1,
> 4, 0,
>  
>  SND_SOC_DAPM_AIF_IN("DMIC_ENA", NULL, 0, WM8962_PWR_MGMT_1, 10, 0),
>  
> +SND_SOC_DAPM_MUX("Input Mode L", SND_SOC_NOPM, 0, 0,
> &input_mode_mux),
> +SND_SOC_DAPM_MUX("Input Mode R", SND_SOC_NOPM, 0, 0,
> &input_mode_mux),
> +
>  SND_SOC_DAPM_ADC("ADCL", "Capture", WM8962_PWR_MGMT_1, 3, 0),
>  SND_SOC_DAPM_ADC("ADCR", "Capture", WM8962_PWR_MGMT_1, 2, 0),
>  
> @@ -2226,16 +2236,19 @@ static const struct snd_soc_dapm_route
> wm8962_intercon[] = {
>  
>         { "DMIC_ENA", NULL, "DMICDAT" },
>  
> +       { "Input Mode L", "Analog", "MIXINL" },
> +       { "Input Mode L", "Digital", "DMIC_ENA" },
> +       { "Input Mode R", "Analog", "MIXINR" },
> +       { "Input Mode R", "Digital", "DMIC_ENA" },
> +
>         { "ADCL", NULL, "SYSCLK" },
>         { "ADCL", NULL, "TOCLK" },
> -       { "ADCL", NULL, "MIXINL" },
> -       { "ADCL", NULL, "DMIC_ENA" },
> +       { "ADCL", NULL, "Input Mode L" },
>         { "ADCL", NULL, "DSP2" },
>  
>         { "ADCR", NULL, "SYSCLK" },
>         { "ADCR", NULL, "TOCLK" },
> -       { "ADCR", NULL, "MIXINR" },
> -       { "ADCR", NULL, "DMIC_ENA" },
> +       { "ADCR", NULL, "Input Mode R" },
>         { "ADCR", NULL, "DSP2" },
>  
>         { "STL", "Left", "ADCL" },



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: wm8962: Allow switching between analog and digital inputs
  2022-02-02 16:45 [PATCH] ASoC: wm8962: Allow switching between analog and digital inputs Charles Keepax
  2022-02-03  9:21 ` Martin Kepplinger
@ 2022-02-03 15:19 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2022-02-03 15:19 UTC (permalink / raw)
  To: Charles Keepax
  Cc: martin.kepplinger, alsa-devel, patches, shengjiu.wang, lgirdwood,
	daniel.baluta

On Wed, 2 Feb 2022 16:45:45 +0000, Charles Keepax wrote:
> When the DMIC_ENA bit is set the analogue inputs are disconnected from
> the digital core of the chip, in favour of the digital microphones.
> Currently the driver will always enable DMIC_ENA whilst the GPIOs are
> configured for the DMIC function, this means the user can't currently
> use both the analog inputs and the digital inputs in one system.
> 
> Add an additional DAPM mutex that allows switching between analog and
> digital inputs into the digital core.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: wm8962: Allow switching between analog and digital inputs
      commit: b5083c0c948ac7f52ca700af219cb491735ecd4b

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-07 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 16:45 [PATCH] ASoC: wm8962: Allow switching between analog and digital inputs Charles Keepax
2022-02-03  9:21 ` Martin Kepplinger
2022-02-03 15:19 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).