diff mbox series

[v1,1/1] ASoC: wm8903: implement DMIC support

Message ID 20230325083643.7575-2-clamor95@gmail.com (mailing list archive)
State New, archived
Headers show
Series Implement DMIC support in WM8903 | expand

Commit Message

Svyatoslav Ryhel March 25, 2023, 8:36 a.m. UTC
Add DMIC input and routing.

Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # ASUS TF300T
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 sound/soc/codecs/wm8903.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Svyatoslav Ryhel March 27, 2023, 8:37 a.m. UTC | #1
пн, 27 бер. 2023 р. о 11:32 Charles Keepax <ckeepax@opensource.cirrus.com> пише:
>
> On Sat, Mar 25, 2023 at 10:36:43AM +0200, Svyatoslav Ryhel wrote:
> > Add DMIC input and routing.
> >
> > Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # ASUS TF300T
> > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > ---
> >  sound/soc/codecs/wm8903.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
> > index 41346e5ec5ad..9c2f0aadcff3 100644
> > --- a/sound/soc/codecs/wm8903.c
> > +++ b/sound/soc/codecs/wm8903.c
> > @@ -9,7 +9,6 @@
> >   *
> >   * TODO:
> >   *  - TDM mode configuration.
> > - *  - Digital microphone support.
> >   */
> >
> >  #include <linux/module.h>
> > @@ -816,6 +815,7 @@ SND_SOC_DAPM_INPUT("IN2L"),
> >  SND_SOC_DAPM_INPUT("IN2R"),
> >  SND_SOC_DAPM_INPUT("IN3L"),
> >  SND_SOC_DAPM_INPUT("IN3R"),
> > +SND_SOC_DAPM_INPUT("DMIC"),
> >  SND_SOC_DAPM_INPUT("DMICDAT"),
>
> There is already a datapath for the DMIC here, DMICDAT. Are you
> sure you don't just need to set the "Left/Right ADC Input" muxes
> correctly through the ALSA controls?
>

I will check once more, but so far I was not able to set the mic to
work with DMICDAT. Only with this patch.

Best regards,
Svyatoslav R.

> >
> >  SND_SOC_DAPM_OUTPUT("HPOUTL"),
> > @@ -996,6 +996,9 @@ static const struct snd_soc_dapm_route wm8903_intercon[] = {
> >       { "AIFTXL", NULL, "Left Capture Mux" },
> >       { "AIFTXR", NULL, "Right Capture Mux" },
> >
> > +     { "ADCL", NULL, "DMIC" },
> > +     { "ADCR", NULL, "DMIC" },
> > +
>
> And at any rate these should not be directly connected to the
> ADC you need some muxing to indicate whether the DMIC or AMICs
> are active. Which the DMICDAT path appears to already have.
>
> Thanks,
> Charles
Svyatoslav Ryhel March 27, 2023, 2:48 p.m. UTC | #2
пн, 27 бер. 2023 р. о 13:14 Charles Keepax <ckeepax@opensource.cirrus.com> пише:
>
> On Mon, Mar 27, 2023 at 11:37:05AM +0300, Svyatoslav Ryhel wrote:
> > пн, 27 бер. 2023 р. о 11:32 Charles Keepax <ckeepax@opensource.cirrus.com> пише:
> > >
> > > On Sat, Mar 25, 2023 at 10:36:43AM +0200, Svyatoslav Ryhel wrote:
> > > > Add DMIC input and routing.
> > > >
> > > > Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # ASUS TF300T
> > > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > > > ---
> > > >  sound/soc/codecs/wm8903.c | 5 ++++-
> > > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
> > > > index 41346e5ec5ad..9c2f0aadcff3 100644
> > > > --- a/sound/soc/codecs/wm8903.c
> > > > +++ b/sound/soc/codecs/wm8903.c
> > > > @@ -9,7 +9,6 @@
> > > >   *
> > > >   * TODO:
> > > >   *  - TDM mode configuration.
> > > > - *  - Digital microphone support.
> > > >   */
> > > >
> > > >  #include <linux/module.h>
> > > > @@ -816,6 +815,7 @@ SND_SOC_DAPM_INPUT("IN2L"),
> > > >  SND_SOC_DAPM_INPUT("IN2R"),
> > > >  SND_SOC_DAPM_INPUT("IN3L"),
> > > >  SND_SOC_DAPM_INPUT("IN3R"),
> > > > +SND_SOC_DAPM_INPUT("DMIC"),
> > > >  SND_SOC_DAPM_INPUT("DMICDAT"),
> > >
> > > There is already a datapath for the DMIC here, DMICDAT. Are you
> > > sure you don't just need to set the "Left/Right ADC Input" muxes
> > > correctly through the ALSA controls?
> > >
> >
> > I will check once more, but so far I was not able to set the mic to
> > work with DMICDAT. Only with this patch.
> >
>
> The two should be basically equivalent when the controls are set
> right, your patch has:
>
> DMIC -> ADCL
>
> The current code has
>
> DMIC -> Left ADC Input -> ADCL
>
> The only difference is that Left ADC Input sets the ADC_DIG_MIC
> bit, but the datasheet clearly indicates that should be
> necessary for digital mics to work. Does your system definitely
> have DMICs? Without that bit set the decimator should still be
> connected to the analogue front end.
>

You are correct, this patch is not needed. It appears that the
issue was not in routing but in wm8903 gpio configuration.

DMICDAT works as intended.

> Thanks,
> Charles
diff mbox series

Patch

diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index 41346e5ec5ad..9c2f0aadcff3 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -9,7 +9,6 @@ 
  *
  * TODO:
  *  - TDM mode configuration.
- *  - Digital microphone support.
  */
 
 #include <linux/module.h>
@@ -816,6 +815,7 @@  SND_SOC_DAPM_INPUT("IN2L"),
 SND_SOC_DAPM_INPUT("IN2R"),
 SND_SOC_DAPM_INPUT("IN3L"),
 SND_SOC_DAPM_INPUT("IN3R"),
+SND_SOC_DAPM_INPUT("DMIC"),
 SND_SOC_DAPM_INPUT("DMICDAT"),
 
 SND_SOC_DAPM_OUTPUT("HPOUTL"),
@@ -996,6 +996,9 @@  static const struct snd_soc_dapm_route wm8903_intercon[] = {
 	{ "AIFTXL", NULL, "Left Capture Mux" },
 	{ "AIFTXR", NULL, "Right Capture Mux" },
 
+	{ "ADCL", NULL, "DMIC" },
+	{ "ADCR", NULL, "DMIC" },
+
 	{ "ADCL", NULL, "Left ADC Input" },
 	{ "ADCL", NULL, "CLK_DSP" },
 	{ "ADCR", NULL, "Right ADC Input" },