Skip to contentSkip to conversation

Support headset on Tegra boards that use WM8903

PATCH In review Dmitry Osipenko 4 participants 11 messages Mar 30, 2020 – Apr 14, 2020

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

cover Support headset on Tegra boards that use WM8903

Hello,

Some devices have a 4-pin jack instead of a 3-pin and currently the WM8903 configuration is hardcoded to the case of 3-pin jack in the Tegra's ASoC driver. A new device-tree property is required in order to convey that hardware has a 4-pin jack, and thus, microphone's detection needs to be done in a different way.

In particular this is needed for Acer A500 tablet device that has a 4-pin headset jack, otherwise userspace sees headset instead of headphones and internal microphone isn't enabled by ALSA UCM rule when it should be. Please review and apply, thanks in advance.

Dmitry Osipenko (2):
dt-bindings: sound: tegra-wm8903: Document new nvidia,headset property
ASoC: tegra: tegra_wm8903: Support nvidia,headset property

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

PATCH 1/2 dt-bindings: sound: tegra-wm8903: Document new nvidia,headset property

Some devices have a 4-pin headset jack instead of 3-pin microphone jack. The new boolean nvidia,headset property tells that the Mic Jack represents the state of a headset microphone. This additional hardware description is needed because microphone detection procedure differs in a case of a 4-pin jack from a 3-pin 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 a8f2b0c56c79..bbd581a8c5bc 100644
@@ -29,6 +29,7 @@ Optional properties:
 - nvidia,hp-det-gpios : The GPIO that detect headphones are plugged in
 - nvidia,int-mic-en-gpios : The GPIO that enables the internal microphone
 - nvidia,ext-mic-en-gpios : The GPIO that enables the external microphone
+- nvidia,headset : The Mic Jack represents state of the headset microphone pin
 
 Example:
 
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/2
#2 lore raw

Re: [PATCH v1 1/2] dt-bindings: sound: tegra-wm8903: Document new nvidia,headset property

Quoted 11 lines · Dmitry Osipenko

Some devices have a 4-pin headset jack instead of 3-pin microphone jack. The new boolean nvidia,headset property tells that the Mic Jack represents the state of a headset microphone. This additional hardware description is needed because microphone detection procedure differs in a case of a 4-pin jack from a 3-pin jack.

---
 .../devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt      | 1 +
 1 file changed, 1 insertion(+)
maintainer
#3 lore raw

Applied "ASoC: tegra-wm8903: Document new nvidia, headset property" to the asoc tree

In reply to Dmitry Osipenko

The patch

ASoC: tegra-wm8903: Document new nvidia, headset property

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

From 8240fe6c91b884b5f1f861a8c22721d6ea4c53c9 Mon Sep 17 00:00:00 2001
From: Dmitry Osipenko <[email protected]>
Date: Mon, 30 Mar 2020 23:40:10 +0300
Subject: [PATCH] ASoC: tegra-wm8903: Document new nvidia, headset property

Some devices have a 4-pin headset jack instead of 3-pin microphone jack. The new boolean nvidia,headset property tells that the Mic Jack represents the state of a headset microphone. This additional hardware description is needed because microphone detection procedure differs in a case of a 4-pin jack from a 3-pin 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 a8f2b0c56c79..bbd581a8c5bc 100644
@@ -29,6 +29,7 @@ Optional properties:
 - nvidia,hp-det-gpios : The GPIO that detect headphones are plugged in
 - nvidia,int-mic-en-gpios : The GPIO that enables the internal microphone
 - nvidia,ext-mic-en-gpios : The GPIO that enables the external microphone
+- nvidia,headset : The Mic Jack represents state of the headset microphone pin
 
 Example:
 
Signature · 1 line
2.20.1
#4 lore raw

PATCH 2/2 ASoC: tegra: tegra_wm8903: Support nvidia,headset property

In reply to Dmitry Osipenko

The microphone-jack state needs to be masked in a case of a 4-pin jack when microphone and ground pins are shorted. Presence of nvidia,headset tells that WM8903 CODEC driver should mask microphone's status if short circuit is detected, i.e headphones are inserted.

---
 sound/soc/tegra/tegra_wm8903.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/tegra/tegra_wm8903.c +5 -1
index 071c7d2de77c..e756dc8eeca4 100644
@@ -177,6 +177,7 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_component *component = codec_dai->component;
 	struct snd_soc_card *card = rtd->card;
 	struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
+	int shrt = 0;
 
 	if (gpio_is_valid(machine->gpio_hp_det)) {
 		tegra_wm8903_hp_jack_gpio.gpio = machine->gpio_hp_det;
@@ -189,12 +190,15 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
 					&tegra_wm8903_hp_jack_gpio);
 	}
 
+	if (of_property_read_bool(card->dev->of_node, "nvidia,headset"))
+		shrt = SND_JACK_MICROPHONE;
+
 	snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE,
 			      &tegra_wm8903_mic_jack,
 			      tegra_wm8903_mic_jack_pins,
 			      ARRAY_SIZE(tegra_wm8903_mic_jack_pins));
 	wm8903_mic_detect(component, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE,
-				0);
+				shrt);
 
 	snd_soc_dapm_force_enable_pin(&card->dapm, "MICBIAS");
 
Signature · 1 line
2.25.1
maintainer
#5 lore raw

Applied "ASoC: tegra: tegra_wm8903: Support nvidia, headset property" to the asoc tree

The patch

ASoC: tegra: tegra_wm8903: Support nvidia, headset property

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

From 3ef9d5073b552d56bd6daf2af1e89b7e8d4df183 Mon Sep 17 00:00:00 2001
From: Dmitry Osipenko <[email protected]>
Date: Mon, 30 Mar 2020 23:40:11 +0300
Subject: [PATCH] ASoC: tegra: tegra_wm8903: Support nvidia, headset property

The microphone-jack state needs to be masked in a case of a 4-pin jack when microphone and ground pins are shorted. Presence of nvidia,headset tells that WM8903 CODEC driver should mask microphone's status if short circuit is detected, i.e headphones are inserted.

---
 sound/soc/tegra/tegra_wm8903.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/tegra/tegra_wm8903.c +5 -1
index 9b5651502f12..3aca354f9e08 100644
@@ -177,6 +177,7 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_component *component = codec_dai->component;
 	struct snd_soc_card *card = rtd->card;
 	struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
+	int shrt = 0;
 
 	if (gpio_is_valid(machine->gpio_hp_det)) {
 		tegra_wm8903_hp_jack_gpio.gpio = machine->gpio_hp_det;
@@ -189,12 +190,15 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
 					&tegra_wm8903_hp_jack_gpio);
 	}
 
+	if (of_property_read_bool(card->dev->of_node, "nvidia,headset"))
+		shrt = SND_JACK_MICROPHONE;
+
 	snd_soc_card_jack_new(rtd->card, "Mic Jack", SND_JACK_MICROPHONE,
 			      &tegra_wm8903_mic_jack,
 			      tegra_wm8903_mic_jack_pins,
 			      ARRAY_SIZE(tegra_wm8903_mic_jack_pins));
 	wm8903_mic_detect(component, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE,
-				0);
+				shrt);
 
 	snd_soc_dapm_force_enable_pin(&card->dapm, "MICBIAS");
 
Signature · 1 line
2.20.1
#6 lore raw
In reply to Dmitry Osipenko

30.03.2020 23:40, Dmitry Osipenko пишет:

Quoted 13 lines

Hello,

Some devices have a 4-pin jack instead of a 3-pin and currently the WM8903 configuration is hardcoded to the case of 3-pin jack in the Tegra's ASoC driver. A new device-tree property is required in order to convey that hardware has a 4-pin jack, and thus, microphone's detection needs to be done in a different way.

In particular this is needed for Acer A500 tablet device that has a 4-pin headset jack, otherwise userspace sees headset instead of headphones and internal microphone isn't enabled by ALSA UCM rule when it should be. Please review and apply, thanks in advance.

Quoted 8 lines

Dmitry Osipenko (2):
dt-bindings: sound: tegra-wm8903: Document new nvidia,headset property
ASoC: tegra: tegra_wm8903: Support nvidia,headset property

 .../devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt | 1 +
 sound/soc/tegra/tegra_wm8903.c                              | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

Jon / Stephen, are you okay with this patchset? Could you please ack it? Thanks in advance.

#7 lore raw
Quoted 18 lines · Dmitry Osipenko

30.03.2020 23:40, Dmitry Osipenko пишет:

Quoted 17 lines

Hello,

Some devices have a 4-pin jack instead of a 3-pin and currently the WM8903 configuration is hardcoded to the case of 3-pin jack in the Tegra's ASoC driver. A new device-tree property is required in order to convey that hardware has a 4-pin jack, and thus, microphone's detection needs to be done in a different way.

In particular this is needed for Acer A500 tablet device that has a 4-pin headset jack, otherwise userspace sees headset instead of headphones and internal microphone isn't enabled by ALSA UCM rule when it should be. Please review and apply, thanks in advance.

Dmitry Osipenko (2):
dt-bindings: sound: tegra-wm8903: Document new nvidia,headset property
ASoC: tegra: tegra_wm8903: Support nvidia,headset property

Quoted 7 lines
Quoted 4 lines
 .../devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt | 1 +
 sound/soc/tegra/tegra_wm8903.c                              | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

Jon / Stephen, are you okay with this patchset? Could you please ack it? Thanks in advance.

It looks plausible based on commit descriptions, but I don't remember the details of those APIs well enough to actually review the code change.

#8 lore raw

09.04.2020 19:54, Stephen Warren пишет:
...

Quoted 6 lines
Quoted 2 lines

Jon / Stephen, are you okay with this patchset? Could you please ack it? Thanks in advance.

It looks plausible based on commit descriptions, but I don't remember the details of those APIs well enough to actually review the code change.

The code change doesn't affect any of the old users, so it should be safe anyways.

I understand that you don't feel comfortable to give an ACK if you're unsure, but I assume that Jon is in the same position, and thus, I'm not sure how to move forward.

Mark, could you please help with reviewing this series?

maintainer
#9 lore raw
Quoted 8 lines · Dmitry Osipenko

The code change doesn't affect any of the old users, so it should be safe anyways.

I understand that you don't feel comfortable to give an ACK if you're unsure, but I assume that Jon is in the same position, and thus, I'm not sure how to move forward.

Mark, could you please help with reviewing this series?

It is currently the merge window. Nothing other than bug fixes is going to get applied until the merge window is over, probably Sunday or Monday.

#10 lore raw

09.04.2020 20:29, Mark Brown пишет:

Quoted 5 lines · Dmitry Osipenko
Quoted 3 lines

The code change doesn't affect any of the old users, so it should be safe anyways.

Quoted 9 lines
Quoted 5 lines

I understand that you don't feel comfortable to give an ACK if you're unsure, but I assume that Jon is in the same position, and thus, I'm not sure how to move forward.

Mark, could you please help with reviewing this series?

It is currently the merge window. Nothing other than bug fixes is going to get applied until the merge window is over, probably Sunday or Monday.

Will be awesome, thank you :)