Skip to contentSkip to conversation

Support built-in Mic on Tegra boards that use WM8903

PATCH In review Dmitry Osipenko 3 participants 7 messages Mar 20, 2020 – Mar 23, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Support built-in Mic on Tegra boards that use WM8903

Hello,

This small series adds audio route for built-in microphone on NVIDIA Tegra boards that use WM8903 CODEC. In particular this is needed in order to unmute internal microphone on Acer A500 tablet device. I'm planning to send out the device tree for the A500 for 5.8, so will be nice to get the microphone sorted out. Please review and apply, thanks in advance.

Dmitry Osipenko (2):
dt-bindings: sound: tegra-wm8903: Document built-in microphone audio
source
ASoC: tegra: tegra_wm8903: Support DAPM events for built-in microphone

 .../sound/nvidia,tegra-audio-wm8903.txt        |  1 +
 sound/soc/tegra/tegra_wm8903.c                 | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 dt-bindings: sound: tegra-wm8903: Document built-in microphone audio source

The internal microphone source is needed in order to be able to describe the hardware audio routing for devices that have the built-in microphone in addition to the external Mic Jack.

---
 .../devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt      | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt +1 -0
index b795d282818d..a8f2b0c56c79 100644
@@ -18,6 +18,7 @@ Required properties:
   * Headphone Jack
   * Int Spk
   * Mic Jack
+  * Int Mic
 
 - nvidia,i2s-controller : The phandle of the Tegra I2S1 controller
 - nvidia,audio-codec : The phandle of the WM8903 audio codec
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/2 ASoC: tegra: tegra_wm8903: Support DAPM events for built-in microphone

In reply to Dmitry Osipenko

The enable-GPIO needs to be toggled on a DAPM event in order to turn microphone ON/OFF, otherwise microphone won't work.

---
 sound/soc/tegra/tegra_wm8903.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
sound/soc/tegra/tegra_wm8903.c +18 -0
index f08d3489c3cf..071c7d2de77c 100644
@@ -143,14 +143,32 @@ static int tegra_wm8903_event_hp(struct snd_soc_dapm_widget *w,
 	return 0;
 }
 
+static int tegra_wm8903_event_int_mic(struct snd_soc_dapm_widget *w,
+				      struct snd_kcontrol *k, int event)
+{
+	struct snd_soc_dapm_context *dapm = w->dapm;
+	struct snd_soc_card *card = dapm->card;
+	struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
+
+	if (!gpio_is_valid(machine->gpio_int_mic_en))
+		return 0;
+
+	gpio_set_value_cansleep(machine->gpio_int_mic_en,
+				SND_SOC_DAPM_EVENT_ON(event));
+
+	return 0;
+}
+
 static const struct snd_soc_dapm_widget tegra_wm8903_dapm_widgets[] = {
 	SND_SOC_DAPM_SPK("Int Spk", tegra_wm8903_event_int_spk),
 	SND_SOC_DAPM_HP("Headphone Jack", tegra_wm8903_event_hp),
 	SND_SOC_DAPM_MIC("Mic Jack", NULL),
+	SND_SOC_DAPM_MIC("Int Mic", tegra_wm8903_event_int_mic),
 };
 
 static const struct snd_kcontrol_new tegra_wm8903_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Int Spk"),
+	SOC_DAPM_PIN_SWITCH("Int Mic"),
 };
 
 static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
Signature · 1 line
2.25.1
Acked-by on the v1 series
#3 lore raw
In reply to Dmitry Osipenko
Quoted 7 lines · Dmitry Osipenko

Hello,

This small series adds audio route for built-in microphone on NVIDIA Tegra boards that use WM8903 CODEC. In particular this is needed in order to unmute internal microphone on Acer A500 tablet device. I'm planning to send out the device tree for the A500 for 5.8, so will be nice to get the microphone sorted out. Please review and apply, thanks in advance.

It's been a long time since I looked at this code, but the series looks plausible,

(I wonder why machine->gpio_int_mic_en was already parse but never used!)

#4 lore raw

21.03.2020 01:30, Stephen Warren пишет:

Quoted 9 lines · Dmitry Osipenko
Quoted 7 lines

Hello,

This small series adds audio route for built-in microphone on NVIDIA Tegra boards that use WM8903 CODEC. In particular this is needed in order to unmute internal microphone on Acer A500 tablet device. I'm planning to send out the device tree for the A500 for 5.8, so will be nice to get the microphone sorted out. Please review and apply, thanks in advance.

Quoted 3 lines

It's been a long time since I looked at this code, but the series looks plausible,

Thank you!

Quoted 1 line

(I wonder why machine->gpio_int_mic_en was already parse but never used!)

Perhaps there were plans to support it later on, but that never materialized.

maintainer Acked-by
#5 lore raw
In reply to Stephen Warren
Quoted 9 lines · Stephen Warren
Quoted 7 lines · Dmitry Osipenko

Hello,

This small series adds audio route for built-in microphone on NVIDIA Tegra boards that use WM8903 CODEC. In particular this is needed in order to unmute internal microphone on Acer A500 tablet device. I'm planning to send out the device tree for the A500 for 5.8, so will be nice to get the microphone sorted out. Please review and apply, thanks in advance.

Quoted 5 lines

It's been a long time since I looked at this code, but the series looks plausible,

(I wonder why machine->gpio_int_mic_en was already parse but never used!)

Looking at the ventana schematics, it appears that the internal-mic signals was connected to a header and not an actual mic, so maybe we never had a proper internal-mic on any board but allowed one to be connected.

Anyway, looks good to me as well.

Cheers
Jon

Signature · 1 line
nvpublic
#6 lore raw

23.03.2020 18:59, Jon Hunter пишет:

Quoted 16 lines · Stephen Warren
Quoted 13 lines · Dmitry Osipenko
Quoted 7 lines

Hello,

This small series adds audio route for built-in microphone on NVIDIA Tegra boards that use WM8903 CODEC. In particular this is needed in order to unmute internal microphone on Acer A500 tablet device. I'm planning to send out the device tree for the A500 for 5.8, so will be nice to get the microphone sorted out. Please review and apply, thanks in advance.

It's been a long time since I looked at this code, but the series looks plausible,

Quoted 6 lines
Quoted 1 line

(I wonder why machine->gpio_int_mic_en was already parse but never used!)

Looking at the ventana schematics, it appears that the internal-mic signals was connected to a header and not an actual mic, so maybe we never had a proper internal-mic on any board but allowed one to be connected.

I guess cardhu may have a mic, judging by downstream kernel sources (I don't have cardhu schematics).

Quoted 3 lines

Anyway, looks good to me as well.

Thanks