All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 15:03 ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 15:03 UTC (permalink / raw)
  To: Mark Brown
  Cc: Alifer Willians de Moraes, linux-kernel, alsa-devel, devicetree,
	Eran Matityahu, festevam, lgirdwood, linuxppc-dev, nicoleotsuka,
	patches, perex, robh+dt, shengjiu.wang, tiwai, Xiubo.Lee

> > > > +static const char *cin_text[] = {
> > > > +     "ADC", "DMIC"
> > > > +};

> > > > +static SOC_ENUM_SINGLE_DECL(cin_enum,
> > > > +                         WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);

> > > Why would this be runtime selectable?  I'd expect the decision to use
> > > an analogue or digital microphone to be made in the hardware design.

> > I agree that dedicated HW is required, but currently SW side there's no support at all.
> > This patch is aiming to provide a way to enable DMIC on boards using it.
> > Is this supposed to be managed in a different way ?

> Via firmware description.

Can you please provide any reference approach in the kernel code ?

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 15:03 ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 15:03 UTC (permalink / raw)
  To: Mark Brown
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, festevam

> > > > +static const char *cin_text[] = {
> > > > +     "ADC", "DMIC"
> > > > +};

> > > > +static SOC_ENUM_SINGLE_DECL(cin_enum,
> > > > +                         WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);

> > > Why would this be runtime selectable?  I'd expect the decision to use
> > > an analogue or digital microphone to be made in the hardware design.

> > I agree that dedicated HW is required, but currently SW side there's no support at all.
> > This patch is aiming to provide a way to enable DMIC on boards using it.
> > Is this supposed to be managed in a different way ?

> Via firmware description.

Can you please provide any reference approach in the kernel code ?

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 15:03 ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 15:03 UTC (permalink / raw)
  To: Mark Brown
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, perex, festevam

> > > > +static const char *cin_text[] = {
> > > > +     "ADC", "DMIC"
> > > > +};

> > > > +static SOC_ENUM_SINGLE_DECL(cin_enum,
> > > > +                         WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);

> > > Why would this be runtime selectable?  I'd expect the decision to use
> > > an analogue or digital microphone to be made in the hardware design.

> > I agree that dedicated HW is required, but currently SW side there's no support at all.
> > This patch is aiming to provide a way to enable DMIC on boards using it.
> > Is this supposed to be managed in a different way ?

> Via firmware description.

Can you please provide any reference approach in the kernel code ?

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
  2022-06-20 15:03 ` Pierluigi Passaro
  (?)
@ 2022-06-20 15:09   ` Mark Brown
  -1 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-20 15:09 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, perex, festevam

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

On Mon, Jun 20, 2022 at 03:03:50PM +0000, Pierluigi Passaro wrote:

> > Via firmware description.

> Can you please provide any reference approach in the kernel code ?

git grep of_
git grep fwnode_

and I don't immediately remember what the prefix is for ACPI functions.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 15:09   ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-20 15:09 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: Alifer Willians de Moraes, linux-kernel, alsa-devel, devicetree,
	Eran Matityahu, festevam, lgirdwood, linuxppc-dev, nicoleotsuka,
	patches, perex, robh+dt, shengjiu.wang, tiwai, Xiubo.Lee

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

On Mon, Jun 20, 2022 at 03:03:50PM +0000, Pierluigi Passaro wrote:

> > Via firmware description.

> Can you please provide any reference approach in the kernel code ?

git grep of_
git grep fwnode_

and I don't immediately remember what the prefix is for ACPI functions.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 15:09   ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-20 15:09 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, festevam

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

On Mon, Jun 20, 2022 at 03:03:50PM +0000, Pierluigi Passaro wrote:

> > Via firmware description.

> Can you please provide any reference approach in the kernel code ?

git grep of_
git grep fwnode_

and I don't immediately remember what the prefix is for ACPI functions.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
  2022-06-20 19:53     ` Pierluigi Passaro
  (?)
@ 2022-06-21 13:11       ` Mark Brown
  -1 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-21 13:11 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: Alifer Willians de Moraes, linux-kernel, alsa-devel, devicetree,
	Eran Matityahu, festevam, lgirdwood, linuxppc-dev, nicoleotsuka,
	patches, perex, robh+dt, shengjiu.wang, tiwai, Xiubo.Lee

[-- Attachment #1: Type: text/plain, Size: 829 bytes --]

On Mon, Jun 20, 2022 at 07:53:56PM +0000, Pierluigi Passaro wrote:

> > This means that DMICDAT2 is not usefully selectable at runtime, you've
> > got IN1 as digital and IN2 as analogue, so while the DMIC/ADC switch is
> > useful the DMIC1/2 switch is not.

> A customer could have the following working configuration
> - pin 1: DMIC_CLK
> - pin 24: LINEIN2R
> - pin 25: DMICDAT2
> - pin 26: LINEIN2L
> - pin 27: DMICDAT1

> with no shared pins: here there's the chance to select DMIC1, DMIC2 and
> LINEIN2 at runtime: I can't find a reason for a fixed behavior.
> Can you please elaborate ?

So in that case the driver should offer the DMIC1/2 selection.  The
driver should be looking at which pins are wired up as DMICs and only
registering controls that can actually be used in the system based on
the pins that are wired up.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-21 13:11       ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-21 13:11 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, festevam

[-- Attachment #1: Type: text/plain, Size: 829 bytes --]

On Mon, Jun 20, 2022 at 07:53:56PM +0000, Pierluigi Passaro wrote:

> > This means that DMICDAT2 is not usefully selectable at runtime, you've
> > got IN1 as digital and IN2 as analogue, so while the DMIC/ADC switch is
> > useful the DMIC1/2 switch is not.

> A customer could have the following working configuration
> - pin 1: DMIC_CLK
> - pin 24: LINEIN2R
> - pin 25: DMICDAT2
> - pin 26: LINEIN2L
> - pin 27: DMICDAT1

> with no shared pins: here there's the chance to select DMIC1, DMIC2 and
> LINEIN2 at runtime: I can't find a reason for a fixed behavior.
> Can you please elaborate ?

So in that case the driver should offer the DMIC1/2 selection.  The
driver should be looking at which pins are wired up as DMICs and only
registering controls that can actually be used in the system based on
the pins that are wired up.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-21 13:11       ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-21 13:11 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, perex, festevam

[-- Attachment #1: Type: text/plain, Size: 829 bytes --]

On Mon, Jun 20, 2022 at 07:53:56PM +0000, Pierluigi Passaro wrote:

> > This means that DMICDAT2 is not usefully selectable at runtime, you've
> > got IN1 as digital and IN2 as analogue, so while the DMIC/ADC switch is
> > useful the DMIC1/2 switch is not.

> A customer could have the following working configuration
> - pin 1: DMIC_CLK
> - pin 24: LINEIN2R
> - pin 25: DMICDAT2
> - pin 26: LINEIN2L
> - pin 27: DMICDAT1

> with no shared pins: here there's the chance to select DMIC1, DMIC2 and
> LINEIN2 at runtime: I can't find a reason for a fixed behavior.
> Can you please elaborate ?

So in that case the driver should offer the DMIC1/2 selection.  The
driver should be looking at which pins are wired up as DMICs and only
registering controls that can actually be used in the system based on
the pins that are wired up.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
  2022-03-07 14:10   ` Alifer Moraes
  (?)
@ 2022-06-20 19:53     ` Pierluigi Passaro
  -1 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 19:53 UTC (permalink / raw)
  To: Alifer Willians de Moraes, linux-kernel
  Cc: alsa-devel, broonie, devicetree, Eran Matityahu, festevam,
	lgirdwood, linuxppc-dev, nicoleotsuka, patches, perex, robh+dt,
	shengjiu.wang, tiwai, Xiubo.Lee

> > > > Just for my understanding, are you suggesting to set a device tree
> > > > property to force a fixed behavior in the driver ?

> > > Yes.

> > Why should we use a fixed behavior ?

> The things that are fixed by the design should be fixed.

> > > The device shares pins between the line inputs and the DMIC inputs so at
> > > least some of the configuration is going to be determinted at system
> > > design time, that will fix the usable values of at least one of the
> > > controls which ought to be reflected in the runtime behaviour.

> > In our design we use:
> > - pin 1: DMIC_CLK
> > - pin 24: LINEIN2R
> > - pin 26: LINEIN2L
> > - pin 27: DMIC_DATA

> > we have no pins shared among DMIC and LINEIN.

> This means that DMICDAT2 is not usefully selectable at runtime, you've
> got IN1 as digital and IN2 as analogue, so while the DMIC/ADC switch is
> useful the DMIC1/2 switch is not.

A customer could have the following working configuration
- pin 1: DMIC_CLK
- pin 24: LINEIN2R
- pin 25: DMICDAT2
- pin 26: LINEIN2L
- pin 27: DMICDAT1
with no shared pins: here there's the chance to select DMIC1, DMIC2 and
LINEIN2 at runtime: I can't find a reason for a fixed behavior.
Can you please elaborate ?

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 19:53     ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 19:53 UTC (permalink / raw)
  To: Alifer Willians de Moraes, linux-kernel
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, lgirdwood, robh+dt, Eran Matityahu,
	broonie, patches, festevam

> > > > Just for my understanding, are you suggesting to set a device tree
> > > > property to force a fixed behavior in the driver ?

> > > Yes.

> > Why should we use a fixed behavior ?

> The things that are fixed by the design should be fixed.

> > > The device shares pins between the line inputs and the DMIC inputs so at
> > > least some of the configuration is going to be determinted at system
> > > design time, that will fix the usable values of at least one of the
> > > controls which ought to be reflected in the runtime behaviour.

> > In our design we use:
> > - pin 1: DMIC_CLK
> > - pin 24: LINEIN2R
> > - pin 26: LINEIN2L
> > - pin 27: DMIC_DATA

> > we have no pins shared among DMIC and LINEIN.

> This means that DMICDAT2 is not usefully selectable at runtime, you've
> got IN1 as digital and IN2 as analogue, so while the DMIC/ADC switch is
> useful the DMIC1/2 switch is not.

A customer could have the following working configuration
- pin 1: DMIC_CLK
- pin 24: LINEIN2R
- pin 25: DMICDAT2
- pin 26: LINEIN2L
- pin 27: DMICDAT1
with no shared pins: here there's the chance to select DMIC1, DMIC2 and
LINEIN2 at runtime: I can't find a reason for a fixed behavior.
Can you please elaborate ?

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 19:53     ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 19:53 UTC (permalink / raw)
  To: Alifer Willians de Moraes, linux-kernel
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, lgirdwood, robh+dt, perex, Eran Matityahu,
	broonie, patches, festevam

> > > > Just for my understanding, are you suggesting to set a device tree
> > > > property to force a fixed behavior in the driver ?

> > > Yes.

> > Why should we use a fixed behavior ?

> The things that are fixed by the design should be fixed.

> > > The device shares pins between the line inputs and the DMIC inputs so at
> > > least some of the configuration is going to be determinted at system
> > > design time, that will fix the usable values of at least one of the
> > > controls which ought to be reflected in the runtime behaviour.

> > In our design we use:
> > - pin 1: DMIC_CLK
> > - pin 24: LINEIN2R
> > - pin 26: LINEIN2L
> > - pin 27: DMIC_DATA

> > we have no pins shared among DMIC and LINEIN.

> This means that DMICDAT2 is not usefully selectable at runtime, you've
> got IN1 as digital and IN2 as analogue, so while the DMIC/ADC switch is
> useful the DMIC1/2 switch is not.

A customer could have the following working configuration
- pin 1: DMIC_CLK
- pin 24: LINEIN2R
- pin 25: DMICDAT2
- pin 26: LINEIN2L
- pin 27: DMICDAT1
with no shared pins: here there's the chance to select DMIC1, DMIC2 and
LINEIN2 at runtime: I can't find a reason for a fixed behavior.
Can you please elaborate ?

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
  2022-06-20 17:52 ` Pierluigi Passaro
  (?)
@ 2022-06-20 18:04   ` Mark Brown
  -1 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-20 18:04 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: Alifer Willians de Moraes, linux-kernel, alsa-devel, devicetree,
	Eran Matityahu, festevam, lgirdwood, linuxppc-dev, nicoleotsuka,
	patches, perex, robh+dt, shengjiu.wang, tiwai, Xiubo.Lee

[-- Attachment #1: Type: text/plain, Size: 931 bytes --]

On Mon, Jun 20, 2022 at 05:52:43PM +0000, Pierluigi Passaro wrote:
> > > Just for my understanding, are you suggesting to set a device tree
> > > property to force a fixed behavior in the driver ?

> > Yes.

> Why should we use a fixed behavior ?

The things that are fixed by the design should be fixed.

> > The device shares pins between the line inputs and the DMIC inputs so at
> > least some of the configuration is going to be determinted at system
> > design time, that will fix the usable values of at least one of the
> > controls which ought to be reflected in the runtime behaviour.

> In our design we use:
> - pin 1: DMIC_CLK
> - pin 24: LINEIN2R
> - pin 26: LINEIN2L
> - pin 27: DMIC_DATA

> we have no pins shared among DMIC and LINEIN.

This means that DMICDAT2 is not usefully selectable at runtime, you've
got IN1 as digital and IN2 as analogue, so while the DMIC/ADC switch is
useful the DMIC1/2 switch is not.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 18:04   ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-20 18:04 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, festevam

[-- Attachment #1: Type: text/plain, Size: 931 bytes --]

On Mon, Jun 20, 2022 at 05:52:43PM +0000, Pierluigi Passaro wrote:
> > > Just for my understanding, are you suggesting to set a device tree
> > > property to force a fixed behavior in the driver ?

> > Yes.

> Why should we use a fixed behavior ?

The things that are fixed by the design should be fixed.

> > The device shares pins between the line inputs and the DMIC inputs so at
> > least some of the configuration is going to be determinted at system
> > design time, that will fix the usable values of at least one of the
> > controls which ought to be reflected in the runtime behaviour.

> In our design we use:
> - pin 1: DMIC_CLK
> - pin 24: LINEIN2R
> - pin 26: LINEIN2L
> - pin 27: DMIC_DATA

> we have no pins shared among DMIC and LINEIN.

This means that DMICDAT2 is not usefully selectable at runtime, you've
got IN1 as digital and IN2 as analogue, so while the DMIC/ADC switch is
useful the DMIC1/2 switch is not.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 18:04   ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-20 18:04 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, perex, festevam

[-- Attachment #1: Type: text/plain, Size: 931 bytes --]

On Mon, Jun 20, 2022 at 05:52:43PM +0000, Pierluigi Passaro wrote:
> > > Just for my understanding, are you suggesting to set a device tree
> > > property to force a fixed behavior in the driver ?

> > Yes.

> Why should we use a fixed behavior ?

The things that are fixed by the design should be fixed.

> > The device shares pins between the line inputs and the DMIC inputs so at
> > least some of the configuration is going to be determinted at system
> > design time, that will fix the usable values of at least one of the
> > controls which ought to be reflected in the runtime behaviour.

> In our design we use:
> - pin 1: DMIC_CLK
> - pin 24: LINEIN2R
> - pin 26: LINEIN2L
> - pin 27: DMIC_DATA

> we have no pins shared among DMIC and LINEIN.

This means that DMICDAT2 is not usefully selectable at runtime, you've
got IN1 as digital and IN2 as analogue, so while the DMIC/ADC switch is
useful the DMIC1/2 switch is not.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 17:52 ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 17:52 UTC (permalink / raw)
  To: Mark Brown
  Cc: Alifer Willians de Moraes, linux-kernel, alsa-devel, devicetree,
	Eran Matityahu, festevam, lgirdwood, linuxppc-dev, nicoleotsuka,
	patches, perex, robh+dt, shengjiu.wang, tiwai, Xiubo.Lee

> > Just for my understanding, are you suggesting to set a device tree
> > property to force a fixed behavior in the driver ?

> Yes.

Why should we use a fixed behavior ?

> > WM8904 allows using both a DMIC and LINEIN, switching between one or
> > the other and this is how we currently use it.
> > Why the user should not be allowed to switch between DMIC and LINEIN ?

> The device shares pins between the line inputs and the DMIC inputs so at
> least some of the configuration is going to be determinted at system
> design time, that will fix the usable values of at least one of the
> controls which ought to be reflected in the runtime behaviour.

In our design we use:
- pin 1: DMIC_CLK
- pin 24: LINEIN2R
- pin 26: LINEIN2L
- pin 27: DMIC_DATA
we have no pins shared among DMIC and LINEIN.
We have several customer switching between DMIC and LINEIN at runtime.

> Please fix your mail client to word wrap within paragraphs at something
> substantially less than 80 columns.  Doing this makes your messages much
> easier to read and reply to.

I beg your pardon: it should be fixed now.

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 17:52 ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 17:52 UTC (permalink / raw)
  To: Mark Brown
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, festevam

> > Just for my understanding, are you suggesting to set a device tree
> > property to force a fixed behavior in the driver ?

> Yes.

Why should we use a fixed behavior ?

> > WM8904 allows using both a DMIC and LINEIN, switching between one or
> > the other and this is how we currently use it.
> > Why the user should not be allowed to switch between DMIC and LINEIN ?

> The device shares pins between the line inputs and the DMIC inputs so at
> least some of the configuration is going to be determinted at system
> design time, that will fix the usable values of at least one of the
> controls which ought to be reflected in the runtime behaviour.

In our design we use:
- pin 1: DMIC_CLK
- pin 24: LINEIN2R
- pin 26: LINEIN2L
- pin 27: DMIC_DATA
we have no pins shared among DMIC and LINEIN.
We have several customer switching between DMIC and LINEIN at runtime.

> Please fix your mail client to word wrap within paragraphs at something
> substantially less than 80 columns.  Doing this makes your messages much
> easier to read and reply to.

I beg your pardon: it should be fixed now.

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 17:52 ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 17:52 UTC (permalink / raw)
  To: Mark Brown
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, perex, festevam

> > Just for my understanding, are you suggesting to set a device tree
> > property to force a fixed behavior in the driver ?

> Yes.

Why should we use a fixed behavior ?

> > WM8904 allows using both a DMIC and LINEIN, switching between one or
> > the other and this is how we currently use it.
> > Why the user should not be allowed to switch between DMIC and LINEIN ?

> The device shares pins between the line inputs and the DMIC inputs so at
> least some of the configuration is going to be determinted at system
> design time, that will fix the usable values of at least one of the
> controls which ought to be reflected in the runtime behaviour.

In our design we use:
- pin 1: DMIC_CLK
- pin 24: LINEIN2R
- pin 26: LINEIN2L
- pin 27: DMIC_DATA
we have no pins shared among DMIC and LINEIN.
We have several customer switching between DMIC and LINEIN at runtime.

> Please fix your mail client to word wrap within paragraphs at something
> substantially less than 80 columns.  Doing this makes your messages much
> easier to read and reply to.

I beg your pardon: it should be fixed now.

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
  2022-06-20 15:30 ` Pierluigi Passaro
  (?)
@ 2022-06-20 17:38   ` Mark Brown
  -1 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-20 17:38 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: Alifer Willians de Moraes, linux-kernel, alsa-devel, devicetree,
	Eran Matityahu, festevam, lgirdwood, linuxppc-dev, nicoleotsuka,
	patches, perex, robh+dt, shengjiu.wang, tiwai, Xiubo.Lee

[-- Attachment #1: Type: text/plain, Size: 835 bytes --]

On Mon, Jun 20, 2022 at 03:30:45PM +0000, Pierluigi Passaro wrote:

> Just for my understanding, are you suggesting to set a device tree property to force a fixed behavior in the driver ?

Yes.

> WM8904 allows using both a DMIC and LINEIN, switching between one or the other and this is how we currently use it.
> Why the user should not be allowed to switch between DMIC and LINEIN ?

The device shares pins between the line inputs and the DMIC inputs so at
least some of the configuration is going to be determinted at system
design time, that will fix the usable values of at least one of the
controls which ought to be reflected in the runtime behaviour.

Please fix your mail client to word wrap within paragraphs at something
substantially less than 80 columns.  Doing this makes your messages much
easier to read and reply to.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 17:38   ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-20 17:38 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, perex, festevam

[-- Attachment #1: Type: text/plain, Size: 835 bytes --]

On Mon, Jun 20, 2022 at 03:30:45PM +0000, Pierluigi Passaro wrote:

> Just for my understanding, are you suggesting to set a device tree property to force a fixed behavior in the driver ?

Yes.

> WM8904 allows using both a DMIC and LINEIN, switching between one or the other and this is how we currently use it.
> Why the user should not be allowed to switch between DMIC and LINEIN ?

The device shares pins between the line inputs and the DMIC inputs so at
least some of the configuration is going to be determinted at system
design time, that will fix the usable values of at least one of the
controls which ought to be reflected in the runtime behaviour.

Please fix your mail client to word wrap within paragraphs at something
substantially less than 80 columns.  Doing this makes your messages much
easier to read and reply to.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 17:38   ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-20 17:38 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, festevam

[-- Attachment #1: Type: text/plain, Size: 835 bytes --]

On Mon, Jun 20, 2022 at 03:30:45PM +0000, Pierluigi Passaro wrote:

> Just for my understanding, are you suggesting to set a device tree property to force a fixed behavior in the driver ?

Yes.

> WM8904 allows using both a DMIC and LINEIN, switching between one or the other and this is how we currently use it.
> Why the user should not be allowed to switch between DMIC and LINEIN ?

The device shares pins between the line inputs and the DMIC inputs so at
least some of the configuration is going to be determinted at system
design time, that will fix the usable values of at least one of the
controls which ought to be reflected in the runtime behaviour.

Please fix your mail client to word wrap within paragraphs at something
substantially less than 80 columns.  Doing this makes your messages much
easier to read and reply to.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 15:30 ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 15:30 UTC (permalink / raw)
  To: Mark Brown
  Cc: Alifer Willians de Moraes, linux-kernel, alsa-devel, devicetree,
	Eran Matityahu, festevam, lgirdwood, linuxppc-dev, nicoleotsuka,
	patches, perex, robh+dt, shengjiu.wang, tiwai, Xiubo.Lee

> > > Via firmware description.

> > Can you please provide any reference approach in the kernel code ?

> git grep of_
> git grep fwnode_

> and I don't immediately remember what the prefix is for ACPI functions.

Just for my understanding, are you suggesting to set a device tree property to force a fixed behavior in the driver ?
WM8904 allows using both a DMIC and LINEIN, switching between one or the other and this is how we currently use it.
Why the user should not be allowed to switch between DMIC and LINEIN ?

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 15:30 ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 15:30 UTC (permalink / raw)
  To: Mark Brown
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, festevam

> > > Via firmware description.

> > Can you please provide any reference approach in the kernel code ?

> git grep of_
> git grep fwnode_

> and I don't immediately remember what the prefix is for ACPI functions.

Just for my understanding, are you suggesting to set a device tree property to force a fixed behavior in the driver ?
WM8904 allows using both a DMIC and LINEIN, switching between one or the other and this is how we currently use it.
Why the user should not be allowed to switch between DMIC and LINEIN ?

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 15:30 ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 15:30 UTC (permalink / raw)
  To: Mark Brown
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, perex, festevam

> > > Via firmware description.

> > Can you please provide any reference approach in the kernel code ?

> git grep of_
> git grep fwnode_

> and I don't immediately remember what the prefix is for ACPI functions.

Just for my understanding, are you suggesting to set a device tree property to force a fixed behavior in the driver ?
WM8904 allows using both a DMIC and LINEIN, switching between one or the other and this is how we currently use it.
Why the user should not be allowed to switch between DMIC and LINEIN ?

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
  2022-06-20 14:49 ` Pierluigi Passaro
  (?)
@ 2022-06-20 14:56   ` Mark Brown
  -1 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-20 14:56 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, festevam

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

On Mon, Jun 20, 2022 at 02:49:51PM +0000, Pierluigi Passaro wrote:

> > > +static const char *cin_text[] = {
> > > +     "ADC", "DMIC"
> > > +};

> > > +static SOC_ENUM_SINGLE_DECL(cin_enum,
> > > +                         WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);

> > Why would this be runtime selectable?  I'd expect the decision to use
> > an analogue or digital microphone to be made in the hardware design.

> I agree that dedicated HW is required, but currently SW side there's no support at all.
> This patch is aiming to provide a way to enable DMIC on boards using it.
> Is this supposed to be managed in a different way ?

Via firmware description.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 14:56   ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-20 14:56 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, Alifer Willians de Moraes, patches, perex, festevam

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

On Mon, Jun 20, 2022 at 02:49:51PM +0000, Pierluigi Passaro wrote:

> > > +static const char *cin_text[] = {
> > > +     "ADC", "DMIC"
> > > +};

> > > +static SOC_ENUM_SINGLE_DECL(cin_enum,
> > > +                         WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);

> > Why would this be runtime selectable?  I'd expect the decision to use
> > an analogue or digital microphone to be made in the hardware design.

> I agree that dedicated HW is required, but currently SW side there's no support at all.
> This patch is aiming to provide a way to enable DMIC on boards using it.
> Is this supposed to be managed in a different way ?

Via firmware description.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 14:56   ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-06-20 14:56 UTC (permalink / raw)
  To: Pierluigi Passaro
  Cc: Alifer Willians de Moraes, linux-kernel, alsa-devel, devicetree,
	Eran Matityahu, festevam, lgirdwood, linuxppc-dev, nicoleotsuka,
	patches, perex, robh+dt, shengjiu.wang, tiwai, Xiubo.Lee

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

On Mon, Jun 20, 2022 at 02:49:51PM +0000, Pierluigi Passaro wrote:

> > > +static const char *cin_text[] = {
> > > +     "ADC", "DMIC"
> > > +};

> > > +static SOC_ENUM_SINGLE_DECL(cin_enum,
> > > +                         WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);

> > Why would this be runtime selectable?  I'd expect the decision to use
> > an analogue or digital microphone to be made in the hardware design.

> I agree that dedicated HW is required, but currently SW side there's no support at all.
> This patch is aiming to provide a way to enable DMIC on boards using it.
> Is this supposed to be managed in a different way ?

Via firmware description.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 14:49 ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 14:49 UTC (permalink / raw)
  To: Mark Brown, Alifer Willians de Moraes
  Cc: linux-kernel, alsa-devel, devicetree, Eran Matityahu, festevam,
	lgirdwood, linuxppc-dev, nicoleotsuka, patches, perex, robh+dt,
	shengjiu.wang, tiwai, Xiubo.Lee

Hi All,

> > +static const char *cin_text[] = {
> > +     "ADC", "DMIC"
> > +};
> > +
> > +static SOC_ENUM_SINGLE_DECL(cin_enum,
> > +                         WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);
> 
> Why would this be runtime selectable?  I'd expect the decision to use
> an analogue or digital microphone to be made in the hardware design.

I agree that dedicated HW is required, but currently SW side there's no support at all.
This patch is aiming to provide a way to enable DMIC on boards using it.
Is this supposed to be managed in a different way ?

Thanks
Best Regards
Pier

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 14:49 ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 14:49 UTC (permalink / raw)
  To: Mark Brown, Alifer Willians de Moraes
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, patches, festevam

Hi All,

> > +static const char *cin_text[] = {
> > +     "ADC", "DMIC"
> > +};
> > +
> > +static SOC_ENUM_SINGLE_DECL(cin_enum,
> > +                         WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);
> 
> Why would this be runtime selectable?  I'd expect the decision to use
> an analogue or digital microphone to be made in the hardware design.

I agree that dedicated HW is required, but currently SW side there's no support at all.
This patch is aiming to provide a way to enable DMIC on boards using it.
Is this supposed to be managed in a different way ?

Thanks
Best Regards
Pier

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-06-20 14:49 ` Pierluigi Passaro
  0 siblings, 0 replies; 36+ messages in thread
From: Pierluigi Passaro @ 2022-06-20 14:49 UTC (permalink / raw)
  To: Mark Brown, Alifer Willians de Moraes
  Cc: devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee, linuxppc-dev,
	shengjiu.wang, tiwai, linux-kernel, lgirdwood, Eran Matityahu,
	robh+dt, patches, perex, festevam

Hi All,

> > +static const char *cin_text[] = {
> > +     "ADC", "DMIC"
> > +};
> > +
> > +static SOC_ENUM_SINGLE_DECL(cin_enum,
> > +                         WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);
> 
> Why would this be runtime selectable?  I'd expect the decision to use
> an analogue or digital microphone to be made in the hardware design.

I agree that dedicated HW is required, but currently SW side there's no support at all.
This patch is aiming to provide a way to enable DMIC on boards using it.
Is this supposed to be managed in a different way ?

Thanks
Best Regards
Pier

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
  2022-03-07 14:10   ` Alifer Moraes
  (?)
@ 2022-03-07 16:25     ` Mark Brown
  -1 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-03-07 16:25 UTC (permalink / raw)
  To: Alifer Moraes
  Cc: linux-kernel, alsa-devel, devicetree, eran.m, festevam,
	lgirdwood, linuxppc-dev, nicoleotsuka, patches, perex,
	pierluigi.p, robh+dt, shengjiu.wang, tiwai, Xiubo.Lee

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

On Mon, Mar 07, 2022 at 11:10:41AM -0300, Alifer Moraes wrote:

> +static const char *cin_text[] = {
> +	"ADC", "DMIC"
> +};
> +
> +static SOC_ENUM_SINGLE_DECL(cin_enum,
> +			    WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);

Why would this be runtime selectable?  I'd expect the decision to use
an analogue or digital microphone to be made in the hardware design.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-03-07 16:25     ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-03-07 16:25 UTC (permalink / raw)
  To: Alifer Moraes
  Cc: pierluigi.p, devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee,
	linuxppc-dev, shengjiu.wang, tiwai, linux-kernel, lgirdwood,
	eran.m, robh+dt, patches, festevam

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

On Mon, Mar 07, 2022 at 11:10:41AM -0300, Alifer Moraes wrote:

> +static const char *cin_text[] = {
> +	"ADC", "DMIC"
> +};
> +
> +static SOC_ENUM_SINGLE_DECL(cin_enum,
> +			    WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);

Why would this be runtime selectable?  I'd expect the decision to use
an analogue or digital microphone to be made in the hardware design.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-03-07 16:25     ` Mark Brown
  0 siblings, 0 replies; 36+ messages in thread
From: Mark Brown @ 2022-03-07 16:25 UTC (permalink / raw)
  To: Alifer Moraes
  Cc: pierluigi.p, devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee,
	linuxppc-dev, shengjiu.wang, tiwai, linux-kernel, lgirdwood,
	eran.m, robh+dt, patches, perex, festevam

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

On Mon, Mar 07, 2022 at 11:10:41AM -0300, Alifer Moraes wrote:

> +static const char *cin_text[] = {
> +	"ADC", "DMIC"
> +};
> +
> +static SOC_ENUM_SINGLE_DECL(cin_enum,
> +			    WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);

Why would this be runtime selectable?  I'd expect the decision to use
an analogue or digital microphone to be made in the hardware design.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [PATCH 4/4] ASoC: wm8904: add DMIC support
  2022-03-07 14:10 [PATCH 1/4] ASoC: fsl-asoc-card: add WM8904 support Alifer Moraes
  2022-03-07 14:10   ` Alifer Moraes
@ 2022-03-07 14:10   ` Alifer Moraes
  0 siblings, 0 replies; 36+ messages in thread
From: Alifer Moraes @ 2022-03-07 14:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: alsa-devel, broonie, devicetree, eran.m, festevam, lgirdwood,
	linuxppc-dev, nicoleotsuka, patches, perex, pierluigi.p, robh+dt,
	shengjiu.wang, tiwai, Xiubo.Lee

From: Pierluigi Passaro <pierluigi.p@variscite.com>

The WM8904 codec supports both ADC and DMIC inputs.
Add dedicated controls to support the additional routing.

Signed-off-by: Pierluigi Passaro <pierluigi.p@variscite.com>
Signed-off by: Alifer Moraes <alifer.m@variscite.com>
---
 sound/soc/codecs/wm8904.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 4121771db104..c7987dc81e4d 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -837,6 +837,26 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
 	return 0;
 }
 
+static const char *dmic_text[] = {
+	"DMIC1", "DMIC2"
+};
+
+static SOC_ENUM_SINGLE_DECL(dmic_enum,
+			    WM8904_DIGITAL_MICROPHONE_0, 11, dmic_text);
+
+static const struct snd_kcontrol_new dmic_mux =
+	SOC_DAPM_ENUM("DMIC Mux", dmic_enum);
+
+static const char *cin_text[] = {
+	"ADC", "DMIC"
+};
+
+static SOC_ENUM_SINGLE_DECL(cin_enum,
+			    WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);
+
+static const struct snd_kcontrol_new cin_mux =
+	SOC_DAPM_ENUM("Capture Input", cin_enum);
+
 static const char *input_mode_text[] = {
 	"Single-Ended", "Differential Line", "Differential Mic"
 };
@@ -930,6 +950,10 @@ SND_SOC_DAPM_INPUT("IN2R"),
 SND_SOC_DAPM_INPUT("IN3L"),
 SND_SOC_DAPM_INPUT("IN3R"),
 
+SND_SOC_DAPM_MUX("DMIC Mux", SND_SOC_NOPM, 0, 0, &dmic_mux),
+SND_SOC_DAPM_MUX("Left Capture Input", SND_SOC_NOPM, 0, 0, &cin_mux),
+SND_SOC_DAPM_MUX("Right Capture Input", SND_SOC_NOPM, 0, 0, &cin_mux),
+
 SND_SOC_DAPM_SUPPLY("MICBIAS", WM8904_MIC_BIAS_CONTROL_0, 0, 0, NULL, 0),
 
 SND_SOC_DAPM_MUX("Left Capture Mux", SND_SOC_NOPM, 0, 0, &lin_mux),
@@ -1093,11 +1117,21 @@ static const struct snd_soc_dapm_route adc_intercon[] = {
 	{ "AIFOUTL", NULL, "AIFOUTL Mux" },
 	{ "AIFOUTR", NULL, "AIFOUTR Mux" },
 
+	{ "DMIC Mux", "DMIC1", "IN1L" },
+	{ "DMIC Mux", "DMIC2", "IN1R" },
+
+	{ "Left Capture Input", "ADC", "Left Capture PGA" },
+	{ "Left Capture Input", "DMIC", "DMIC Mux" },
+	{ "Right Capture Input", "ADC", "Right Capture PGA" },
+	{ "Right Capture Input", "DMIC", "DMIC Mux" },
+
 	{ "ADCL", NULL, "CLK_DSP" },
 	{ "ADCL", NULL, "Left Capture PGA" },
+	{ "ADCL", NULL, "Left Capture Input" },
 
 	{ "ADCR", NULL, "CLK_DSP" },
 	{ "ADCR", NULL, "Right Capture PGA" },
+	{ "ADCR", NULL, "Right Capture Input" },
 };
 
 static const struct snd_soc_dapm_route dac_intercon[] = {
-- 
2.25.1


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

* [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-03-07 14:10   ` Alifer Moraes
  0 siblings, 0 replies; 36+ messages in thread
From: Alifer Moraes @ 2022-03-07 14:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: pierluigi.p, devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee,
	linuxppc-dev, shengjiu.wang, tiwai, lgirdwood, robh+dt, perex,
	eran.m, broonie, patches, festevam

From: Pierluigi Passaro <pierluigi.p@variscite.com>

The WM8904 codec supports both ADC and DMIC inputs.
Add dedicated controls to support the additional routing.

Signed-off-by: Pierluigi Passaro <pierluigi.p@variscite.com>
Signed-off by: Alifer Moraes <alifer.m@variscite.com>
---
 sound/soc/codecs/wm8904.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 4121771db104..c7987dc81e4d 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -837,6 +837,26 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
 	return 0;
 }
 
+static const char *dmic_text[] = {
+	"DMIC1", "DMIC2"
+};
+
+static SOC_ENUM_SINGLE_DECL(dmic_enum,
+			    WM8904_DIGITAL_MICROPHONE_0, 11, dmic_text);
+
+static const struct snd_kcontrol_new dmic_mux =
+	SOC_DAPM_ENUM("DMIC Mux", dmic_enum);
+
+static const char *cin_text[] = {
+	"ADC", "DMIC"
+};
+
+static SOC_ENUM_SINGLE_DECL(cin_enum,
+			    WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);
+
+static const struct snd_kcontrol_new cin_mux =
+	SOC_DAPM_ENUM("Capture Input", cin_enum);
+
 static const char *input_mode_text[] = {
 	"Single-Ended", "Differential Line", "Differential Mic"
 };
@@ -930,6 +950,10 @@ SND_SOC_DAPM_INPUT("IN2R"),
 SND_SOC_DAPM_INPUT("IN3L"),
 SND_SOC_DAPM_INPUT("IN3R"),
 
+SND_SOC_DAPM_MUX("DMIC Mux", SND_SOC_NOPM, 0, 0, &dmic_mux),
+SND_SOC_DAPM_MUX("Left Capture Input", SND_SOC_NOPM, 0, 0, &cin_mux),
+SND_SOC_DAPM_MUX("Right Capture Input", SND_SOC_NOPM, 0, 0, &cin_mux),
+
 SND_SOC_DAPM_SUPPLY("MICBIAS", WM8904_MIC_BIAS_CONTROL_0, 0, 0, NULL, 0),
 
 SND_SOC_DAPM_MUX("Left Capture Mux", SND_SOC_NOPM, 0, 0, &lin_mux),
@@ -1093,11 +1117,21 @@ static const struct snd_soc_dapm_route adc_intercon[] = {
 	{ "AIFOUTL", NULL, "AIFOUTL Mux" },
 	{ "AIFOUTR", NULL, "AIFOUTR Mux" },
 
+	{ "DMIC Mux", "DMIC1", "IN1L" },
+	{ "DMIC Mux", "DMIC2", "IN1R" },
+
+	{ "Left Capture Input", "ADC", "Left Capture PGA" },
+	{ "Left Capture Input", "DMIC", "DMIC Mux" },
+	{ "Right Capture Input", "ADC", "Right Capture PGA" },
+	{ "Right Capture Input", "DMIC", "DMIC Mux" },
+
 	{ "ADCL", NULL, "CLK_DSP" },
 	{ "ADCL", NULL, "Left Capture PGA" },
+	{ "ADCL", NULL, "Left Capture Input" },
 
 	{ "ADCR", NULL, "CLK_DSP" },
 	{ "ADCR", NULL, "Right Capture PGA" },
+	{ "ADCR", NULL, "Right Capture Input" },
 };
 
 static const struct snd_soc_dapm_route dac_intercon[] = {
-- 
2.25.1


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

* [PATCH 4/4] ASoC: wm8904: add DMIC support
@ 2022-03-07 14:10   ` Alifer Moraes
  0 siblings, 0 replies; 36+ messages in thread
From: Alifer Moraes @ 2022-03-07 14:10 UTC (permalink / raw)
  To: linux-kernel
  Cc: pierluigi.p, devicetree, alsa-devel, nicoleotsuka, Xiubo.Lee,
	linuxppc-dev, shengjiu.wang, tiwai, lgirdwood, robh+dt, eran.m,
	broonie, patches, festevam

From: Pierluigi Passaro <pierluigi.p@variscite.com>

The WM8904 codec supports both ADC and DMIC inputs.
Add dedicated controls to support the additional routing.

Signed-off-by: Pierluigi Passaro <pierluigi.p@variscite.com>
Signed-off by: Alifer Moraes <alifer.m@variscite.com>
---
 sound/soc/codecs/wm8904.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 4121771db104..c7987dc81e4d 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -837,6 +837,26 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
 	return 0;
 }
 
+static const char *dmic_text[] = {
+	"DMIC1", "DMIC2"
+};
+
+static SOC_ENUM_SINGLE_DECL(dmic_enum,
+			    WM8904_DIGITAL_MICROPHONE_0, 11, dmic_text);
+
+static const struct snd_kcontrol_new dmic_mux =
+	SOC_DAPM_ENUM("DMIC Mux", dmic_enum);
+
+static const char *cin_text[] = {
+	"ADC", "DMIC"
+};
+
+static SOC_ENUM_SINGLE_DECL(cin_enum,
+			    WM8904_DIGITAL_MICROPHONE_0, 12, cin_text);
+
+static const struct snd_kcontrol_new cin_mux =
+	SOC_DAPM_ENUM("Capture Input", cin_enum);
+
 static const char *input_mode_text[] = {
 	"Single-Ended", "Differential Line", "Differential Mic"
 };
@@ -930,6 +950,10 @@ SND_SOC_DAPM_INPUT("IN2R"),
 SND_SOC_DAPM_INPUT("IN3L"),
 SND_SOC_DAPM_INPUT("IN3R"),
 
+SND_SOC_DAPM_MUX("DMIC Mux", SND_SOC_NOPM, 0, 0, &dmic_mux),
+SND_SOC_DAPM_MUX("Left Capture Input", SND_SOC_NOPM, 0, 0, &cin_mux),
+SND_SOC_DAPM_MUX("Right Capture Input", SND_SOC_NOPM, 0, 0, &cin_mux),
+
 SND_SOC_DAPM_SUPPLY("MICBIAS", WM8904_MIC_BIAS_CONTROL_0, 0, 0, NULL, 0),
 
 SND_SOC_DAPM_MUX("Left Capture Mux", SND_SOC_NOPM, 0, 0, &lin_mux),
@@ -1093,11 +1117,21 @@ static const struct snd_soc_dapm_route adc_intercon[] = {
 	{ "AIFOUTL", NULL, "AIFOUTL Mux" },
 	{ "AIFOUTR", NULL, "AIFOUTR Mux" },
 
+	{ "DMIC Mux", "DMIC1", "IN1L" },
+	{ "DMIC Mux", "DMIC2", "IN1R" },
+
+	{ "Left Capture Input", "ADC", "Left Capture PGA" },
+	{ "Left Capture Input", "DMIC", "DMIC Mux" },
+	{ "Right Capture Input", "ADC", "Right Capture PGA" },
+	{ "Right Capture Input", "DMIC", "DMIC Mux" },
+
 	{ "ADCL", NULL, "CLK_DSP" },
 	{ "ADCL", NULL, "Left Capture PGA" },
+	{ "ADCL", NULL, "Left Capture Input" },
 
 	{ "ADCR", NULL, "CLK_DSP" },
 	{ "ADCR", NULL, "Right Capture PGA" },
+	{ "ADCR", NULL, "Right Capture Input" },
 };
 
 static const struct snd_soc_dapm_route dac_intercon[] = {
-- 
2.25.1


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

end of thread, other threads:[~2022-06-21 13:12 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-20 15:03 [PATCH 4/4] ASoC: wm8904: add DMIC support Pierluigi Passaro
2022-06-20 15:03 ` Pierluigi Passaro
2022-06-20 15:03 ` Pierluigi Passaro
2022-06-20 15:09 ` Mark Brown
2022-06-20 15:09   ` Mark Brown
2022-06-20 15:09   ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2022-06-20 17:52 Pierluigi Passaro
2022-06-20 17:52 ` Pierluigi Passaro
2022-06-20 17:52 ` Pierluigi Passaro
2022-06-20 18:04 ` Mark Brown
2022-06-20 18:04   ` Mark Brown
2022-06-20 18:04   ` Mark Brown
2022-06-20 15:30 Pierluigi Passaro
2022-06-20 15:30 ` Pierluigi Passaro
2022-06-20 15:30 ` Pierluigi Passaro
2022-06-20 17:38 ` Mark Brown
2022-06-20 17:38   ` Mark Brown
2022-06-20 17:38   ` Mark Brown
2022-06-20 14:49 Pierluigi Passaro
2022-06-20 14:49 ` Pierluigi Passaro
2022-06-20 14:49 ` Pierluigi Passaro
2022-06-20 14:56 ` Mark Brown
2022-06-20 14:56   ` Mark Brown
2022-06-20 14:56   ` Mark Brown
2022-03-07 14:10 [PATCH 1/4] ASoC: fsl-asoc-card: add WM8904 support Alifer Moraes
2022-03-07 14:10 ` [PATCH 4/4] ASoC: wm8904: add DMIC support Alifer Moraes
2022-03-07 14:10   ` Alifer Moraes
2022-03-07 14:10   ` Alifer Moraes
2022-03-07 16:25   ` Mark Brown
2022-03-07 16:25     ` Mark Brown
2022-03-07 16:25     ` Mark Brown
2022-06-20 19:53   ` Pierluigi Passaro
2022-06-20 19:53     ` Pierluigi Passaro
2022-06-20 19:53     ` Pierluigi Passaro
2022-06-21 13:11     ` Mark Brown
2022-06-21 13:11       ` Mark Brown
2022-06-21 13:11       ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.