[PATCH v1 0/2] 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(-)
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.
Signed-off-by: Dmitry Osipenko digetx@gmail.com --- .../devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt | 1 + 1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt index a8f2b0c56c79..bbd581a8c5bc 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt @@ -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:
On Mon, 30 Mar 2020 23:40:10 +0300, Dmitry Osipenko wrote:
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.
Signed-off-by: Dmitry Osipenko digetx@gmail.com
.../devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt | 1 + 1 file changed, 1 insertion(+)
Acked-by: Rob Herring robh@kernel.org
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 digetx@gmail.com 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.
Signed-off-by: Dmitry Osipenko digetx@gmail.com Link: https://lore.kernel.org/r/20200330204011.18465-2-digetx@gmail.com Signed-off-by: Mark Brown broonie@kernel.org --- .../devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt | 1 + 1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt index a8f2b0c56c79..bbd581a8c5bc 100644 --- a/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt +++ b/Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8903.txt @@ -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:
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.
Signed-off-by: Dmitry Osipenko digetx@gmail.com --- sound/soc/tegra/tegra_wm8903.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index 071c7d2de77c..e756dc8eeca4 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c @@ -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");
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 digetx@gmail.com 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.
Signed-off-by: Dmitry Osipenko digetx@gmail.com Link: https://lore.kernel.org/r/20200330204011.18465-3-digetx@gmail.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/tegra/tegra_wm8903.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index 9b5651502f12..3aca354f9e08 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c @@ -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");
30.03.2020 23:40, Dmitry Osipenko пишет:
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(-)
Jon / Stephen, are you okay with this patchset? Could you please ack it? Thanks in advance.
On 4/9/20 8:52 AM, Dmitry Osipenko wrote:
30.03.2020 23:40, Dmitry Osipenko пишет:
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(-)
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.
09.04.2020 19:54, Stephen Warren пишет: ...
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?
On Thu, Apr 09, 2020 at 08:13:54PM +0300, Dmitry Osipenko wrote:
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.
09.04.2020 20:29, Mark Brown пишет:
On Thu, Apr 09, 2020 at 08:13:54PM +0300, Dmitry Osipenko wrote:
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.
Will be awesome, thank you :)
participants (4)
-
Dmitry Osipenko
-
Mark Brown
-
Rob Herring
-
Stephen Warren