]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ASoC: tegra: tegra_wm8903: Support nvidia, headset property
authorDmitry Osipenko <digetx@gmail.com>
Mon, 30 Mar 2020 20:40:11 +0000 (23:40 +0300)
committerMark Brown <broonie@kernel.org>
Tue, 14 Apr 2020 13:51:13 +0000 (14:51 +0100)
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

index 9b5651502f12747a1662137a622ee7dc4e03247a..3aca354f9e08b9d928786be2c3d031998e5a76ba 100644 (file)
@@ -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");