alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Martin Kepplinger <martin.kepplinger@puri.sm>
Cc: alsa-devel@alsa-project.org, kernel@puri.sm,
	patches@opensource.cirrus.com, tiwai@suse.com,
	lgirdwood@gmail.com, broonie@kernel.org, geert@glider.be,
	daniel.baluta@nxp.com
Subject: Re: [PATCH] wm8962: add a simple DMIC enable control
Date: Wed, 2 Feb 2022 10:46:57 +0000	[thread overview]
Message-ID: <20220202104657.GA18506@ediswmail.ad.cirrus.com> (raw)
In-Reply-To: <3542af028b622ec1513810b014c35a94b82a94c0.camel@puri.sm>

On Wed, Feb 02, 2022 at 11:17:34AM +0100, Martin Kepplinger wrote:
> Am Mittwoch, dem 02.02.2022 um 09:53 +0000 schrieb Charles Keepax:
> > On Tue, Feb 01, 2022 at 04:01:13PM +0100, Martin Kepplinger wrote:
> Do you have a code example from a different codec that has roughly what
> is missing here? (the sound subsystem is new to me)

Full disclosure this is complete untested, but it should be
pretty close. Let me know if it does the trick and I will send a
proper patch to the list. I do have a Librem 5 in a draw
somewhere so can pull that out if we get really stuck, but that
might have to wait until the weekend :-).

I don't know if you guys are using the analogue bypass paths
around the digital core on the chip. I think those will still
work with the mics set to digital, so I have left the routes as
is, but that might require some checking at some point.

Thanks,
Charles


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


  parent reply	other threads:[~2022-02-02 10:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220201150113.880330-1-martin.kepplinger@puri.sm>
2022-02-02  9:53 ` [PATCH] wm8962: add a simple DMIC enable control Charles Keepax
     [not found]   ` <3542af028b622ec1513810b014c35a94b82a94c0.camel@puri.sm>
2022-02-02 10:46     ` Charles Keepax [this message]
     [not found]       ` <99b847d17e8ac399dba10842ec20091df926aa06.camel@puri.sm>
2022-02-02 13:35         ` Charles Keepax
2022-02-03  9:57           ` Martin Kepplinger
2022-02-03 11:05             ` Charles Keepax
2022-02-04  9:43               ` Martin Kepplinger
2022-02-04  9:50                 ` Martin Kepplinger
2022-02-04 17:21                 ` Charles Keepax
2022-02-07 10:49                   ` Martin Kepplinger
2022-02-07 14:21                     ` Charles Keepax
2022-03-01 13:44                       ` Charles Keepax
2022-03-01 14:00                         ` Martin Kepplinger
2022-03-02 11:48                           ` Martin Kepplinger
2022-03-02 13:40                             ` Charles Keepax
2022-03-02 14:11                               ` Martin Kepplinger
2022-03-03 11:27                                 ` Charles Keepax

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220202104657.GA18506@ediswmail.ad.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=geert@glider.be \
    --cc=kernel@puri.sm \
    --cc=lgirdwood@gmail.com \
    --cc=martin.kepplinger@puri.sm \
    --cc=patches@opensource.cirrus.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).