All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: WM8903: Implement DMIC support
@ 2011-04-19  2:58 Stephen Warren
  2011-04-20 11:10 ` Liam Girdwood
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stephen Warren @ 2011-04-19  2:58 UTC (permalink / raw)
  To: broonie, lrg; +Cc: alsa-devel, Stephen Warren

In addition to the currently supported analog capture path, the WM8903
also supports digital mics.

The analog and digital capture paths are exclusive; a mux is present to
select the capture source.

Logically, the mux exists to select the decimator's input, from either
the ADC or DMIC block outputs. However, the ADC power domain also
includes the DMIC interface. Consequently, this change represents the
mux as existing immediately before the ADC, and selecting between the
Input PGA and DMIC block outputs.

An alternative might be to represent the mux in its correct location,
and associate the ADC power enable controls with both the real ADC, and
a fake ADC for the DMIC?

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 sound/soc/codecs/wm8903.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index d53f206..f3cab84 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -634,6 +634,13 @@ static const struct soc_enum lsidetone_enum =
 static const struct soc_enum rsidetone_enum =
 	SOC_ENUM_SINGLE(WM8903_DAC_DIGITAL_0, 0, 3, sidetone_text);
 
+static const char *adcinput_text[] = {
+	"ADC", "DMIC"
+};
+
+static const struct soc_enum adcinput_enum =
+	SOC_ENUM_SINGLE(WM8903_CLOCK_RATE_TEST_4, 9, 2, adcinput_text);
+
 static const char *aif_text[] = {
 	"Left", "Right"
 };
@@ -767,6 +774,9 @@ static const struct snd_kcontrol_new lsidetone_mux =
 static const struct snd_kcontrol_new rsidetone_mux =
 	SOC_DAPM_ENUM("DACR Sidetone Mux", rsidetone_enum);
 
+static const struct snd_kcontrol_new adcinput_mux =
+	SOC_DAPM_ENUM("ADC Input", adcinput_enum);
+
 static const struct snd_kcontrol_new lcapture_mux =
 	SOC_DAPM_ENUM("Left Capture Mux", lcapture_enum);
 
@@ -817,6 +827,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("DMICDAT"),
 
 SND_SOC_DAPM_OUTPUT("HPOUTL"),
 SND_SOC_DAPM_OUTPUT("HPOUTR"),
@@ -842,6 +853,9 @@ SND_SOC_DAPM_MUX("Right Input Mode Mux", SND_SOC_NOPM, 0, 0, &rinput_mode_mux),
 SND_SOC_DAPM_PGA("Left Input PGA", WM8903_POWER_MANAGEMENT_0, 1, 0, NULL, 0),
 SND_SOC_DAPM_PGA("Right Input PGA", WM8903_POWER_MANAGEMENT_0, 0, 0, NULL, 0),
 
+SND_SOC_DAPM_MUX("Left ADC Input", SND_SOC_NOPM, 0, 0, &adcinput_mux),
+SND_SOC_DAPM_MUX("Right ADC Input", SND_SOC_NOPM, 0, 0, &adcinput_mux),
+
 SND_SOC_DAPM_ADC("ADCL", NULL, WM8903_POWER_MANAGEMENT_6, 1, 0),
 SND_SOC_DAPM_ADC("ADCR", NULL, WM8903_POWER_MANAGEMENT_6, 0, 0),
 
@@ -979,6 +993,11 @@ static const struct snd_soc_dapm_route wm8903_intercon[] = {
 	{ "Left Input PGA", NULL, "Left Input Mode Mux" },
 	{ "Right Input PGA", NULL, "Right Input Mode Mux" },
 
+	{ "Left ADC Input", "ADC", "Left Input PGA" },
+	{ "Left ADC Input", "DMIC", "DMICDAT" },
+	{ "Right ADC Input", "ADC", "Right Input PGA" },
+	{ "Right ADC Input", "DMIC", "DMICDAT" },
+
 	{ "Left Capture Mux", "Left", "ADCL" },
 	{ "Left Capture Mux", "Right", "ADCR" },
 
@@ -988,9 +1007,9 @@ static const struct snd_soc_dapm_route wm8903_intercon[] = {
 	{ "AIFTXL", NULL, "Left Capture Mux" },
 	{ "AIFTXR", NULL, "Right Capture Mux" },
 
-	{ "ADCL", NULL, "Left Input PGA" },
+	{ "ADCL", NULL, "Left ADC Input" },
 	{ "ADCL", NULL, "CLK_DSP" },
-	{ "ADCR", NULL, "Right Input PGA" },
+	{ "ADCR", NULL, "Right ADC Input" },
 	{ "ADCR", NULL, "CLK_DSP" },
 
 	{ "Left Playback Mux", "Left", "AIFRXL" },
-- 
1.7.1

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

* Re: [PATCH] ASoC: WM8903: Implement DMIC support
  2011-04-19  2:58 [PATCH] ASoC: WM8903: Implement DMIC support Stephen Warren
@ 2011-04-20 11:10 ` Liam Girdwood
  2011-04-20 13:00 ` Mark Brown
  2011-10-14 10:34 ` Julian Scheel
  2 siblings, 0 replies; 5+ messages in thread
From: Liam Girdwood @ 2011-04-20 11:10 UTC (permalink / raw)
  To: Stephen Warren; +Cc: alsa-devel, broonie

On Mon, 2011-04-18 at 20:58 -0600, Stephen Warren wrote:
> In addition to the currently supported analog capture path, the WM8903
> also supports digital mics.
> 
> The analog and digital capture paths are exclusive; a mux is present to
> select the capture source.
> 
> Logically, the mux exists to select the decimator's input, from either
> the ADC or DMIC block outputs. However, the ADC power domain also
> includes the DMIC interface. Consequently, this change represents the
> mux as existing immediately before the ADC, and selecting between the
> Input PGA and DMIC block outputs.
> 
> An alternative might be to represent the mux in its correct location,
> and associate the ADC power enable controls with both the real ADC, and
> a fake ADC for the DMIC?
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Acked-by: Liam Girdwood <lrg@ti.com>

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

* Re: [PATCH] ASoC: WM8903: Implement DMIC support
  2011-04-19  2:58 [PATCH] ASoC: WM8903: Implement DMIC support Stephen Warren
  2011-04-20 11:10 ` Liam Girdwood
@ 2011-04-20 13:00 ` Mark Brown
  2011-10-14 10:34 ` Julian Scheel
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2011-04-20 13:00 UTC (permalink / raw)
  To: Stephen Warren; +Cc: alsa-devel, lrg

On Mon, Apr 18, 2011 at 08:58:11PM -0600, Stephen Warren wrote:
> In addition to the currently supported analog capture path, the WM8903
> also supports digital mics.

Applied, thanks.

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

* Re: [PATCH] ASoC: WM8903: Implement DMIC support
  2011-04-19  2:58 [PATCH] ASoC: WM8903: Implement DMIC support Stephen Warren
  2011-04-20 11:10 ` Liam Girdwood
  2011-04-20 13:00 ` Mark Brown
@ 2011-10-14 10:34 ` Julian Scheel
  2011-10-14 12:16   ` Mark Brown
  2 siblings, 1 reply; 5+ messages in thread
From: Julian Scheel @ 2011-10-14 10:34 UTC (permalink / raw)
  To: Stephen Warren; +Cc: alsa-devel, broonie, lrg

Am Montag, den 18.04.2011, 20:58 -0600 schrieb Stephen Warren:
> In addition to the currently supported analog capture path, the WM8903
> also supports digital mics.
> 
> The analog and digital capture paths are exclusive; a mux is present to
> select the capture source.
> 
> Logically, the mux exists to select the decimator's input, from either
> the ADC or DMIC block outputs. However, the ADC power domain also
> includes the DMIC interface. Consequently, this change represents the
> mux as existing immediately before the ADC, and selecting between the
> Input PGA and DMIC block outputs.
> 
> An alternative might be to represent the mux in its correct location,
> and associate the ADC power enable controls with both the real ADC, and
> a fake ADC for the DMIC?

Hi,

actually the wm8903 codec needs GPIO1 and GPIO2 to be configured
properly to be able to use DMIC actually. I would propose to
automatically configure these to DMIC-mode whenever ADCINPUT is set to
DMIC. Would you agree with this procedure?
I would prepare a patch which changes all relevant registers then.

Regards,
Julian

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

* Re: [PATCH] ASoC: WM8903: Implement DMIC support
  2011-10-14 10:34 ` Julian Scheel
@ 2011-10-14 12:16   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2011-10-14 12:16 UTC (permalink / raw)
  To: Julian Scheel; +Cc: alsa-devel, Stephen Warren, lrg

On Fri, Oct 14, 2011 at 12:34:21PM +0200, Julian Scheel wrote:

> actually the wm8903 codec needs GPIO1 and GPIO2 to be configured
> properly to be able to use DMIC actually. I would propose to
> automatically configure these to DMIC-mode whenever ADCINPUT is set to
> DMIC. Would you agree with this procedure?
> I would prepare a patch which changes all relevant registers then.

I'd go the other way and disable the DMIC support if the GPIOs aren't
configured appropriately in the platform data.  Since the DMIC is
selectable at runtime by random applications in most systems if it
forced the GPIOs into DMIC mode it could break functionality on systems
that don't actually have the DMIC wired up.  We've got code for this in
WM8962 for example.

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

end of thread, other threads:[~2011-10-14 12:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-19  2:58 [PATCH] ASoC: WM8903: Implement DMIC support Stephen Warren
2011-04-20 11:10 ` Liam Girdwood
2011-04-20 13:00 ` Mark Brown
2011-10-14 10:34 ` Julian Scheel
2011-10-14 12:16   ` 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.