public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Svyatoslav Ryhel <clamor95@gmail.com>,
	Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>,
	lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com,
	thierry.reding@gmail.com, jonathanh@nvidia.com,
	jiapeng.chong@linux.alibaba.com, ion@agorria.com,
	robh@kernel.org, alsa-devel@alsa-project.org,
	linux-tegra@vger.kernel.org
Subject: [PATCH AUTOSEL 6.1 05/19] ASoC: tegra: Support coupled mic-hp detection
Date: Sat,  6 May 2023 20:34:03 -0400	[thread overview]
Message-ID: <20230507003417.4077259-5-sashal@kernel.org> (raw)
In-Reply-To: <20230507003417.4077259-1-sashal@kernel.org>

From: Svyatoslav Ryhel <clamor95@gmail.com>

[ Upstream commit eb0b8481c2e03a5ae01f6bea60b42109bd12b6fe ]

This quirk is used for cases when there is GPIO which detects
any type of 3.5 Jack insertion and actual type of jack is defined
by other GPIO. 3.5 Jack GPIO generates interrupt and MIC GPIO
indicates type of Jack only if 3.5 Jack GPIO is active.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Link: https://lore.kernel.org/r/20230308073502.5421-3-clamor95@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/tegra/tegra_asoc_machine.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/sound/soc/tegra/tegra_asoc_machine.c b/sound/soc/tegra/tegra_asoc_machine.c
index 78faa8bcae274..7b6d5d90c3a2d 100644
--- a/sound/soc/tegra/tegra_asoc_machine.c
+++ b/sound/soc/tegra/tegra_asoc_machine.c
@@ -51,6 +51,17 @@ static struct snd_soc_jack_gpio tegra_machine_headset_jack_gpio = {
 };
 
 /* Mic Jack */
+static int coupled_mic_hp_check(void *data)
+{
+	struct tegra_machine *machine = (struct tegra_machine *)data;
+
+	/* Detect mic insertion only if 3.5 jack is in */
+	if (gpiod_get_value_cansleep(machine->gpiod_hp_det) &&
+	    gpiod_get_value_cansleep(machine->gpiod_mic_det))
+		return SND_JACK_MICROPHONE;
+
+	return 0;
+}
 
 static struct snd_soc_jack tegra_machine_mic_jack;
 
@@ -183,8 +194,15 @@ int tegra_asoc_machine_init(struct snd_soc_pcm_runtime *rtd)
 			return err;
 		}
 
+		tegra_machine_mic_jack_gpio.data = machine;
 		tegra_machine_mic_jack_gpio.desc = machine->gpiod_mic_det;
 
+		if (of_property_read_bool(card->dev->of_node,
+					  "nvidia,coupled-mic-hp-det")) {
+			tegra_machine_mic_jack_gpio.desc = machine->gpiod_hp_det;
+			tegra_machine_mic_jack_gpio.jack_status_check = coupled_mic_hp_check;
+		};
+
 		err = snd_soc_jack_add_gpios(&tegra_machine_mic_jack, 1,
 					     &tegra_machine_mic_jack_gpio);
 		if (err)
-- 
2.39.2


  parent reply	other threads:[~2023-05-07  0:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-07  0:33 [PATCH AUTOSEL 6.1 01/19] ASoC: jack: allow multiple interrupt per gpio Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 02/19] staging: rtl8192e: Replace macro RTL_PCI_DEVICE with PCI_DEVICE Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 03/19] HID: apple: Set the tilde quirk flag on the Geyser 4 and later Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 04/19] staging: axis-fifo: initialize timeouts in init only Sasha Levin
2023-05-07  0:34 ` Sasha Levin [this message]
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 06/19] ASoC: amd: yc: Add DMI entries to support HP OMEN 16-n0xxx (8A42) Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 07/19] HID: logitech-hidpp: Don't use the USB serial for USB devices Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 08/19] HID: logitech-hidpp: Reconcile USB and Unifying serials Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 09/19] spi: spi-imx: fix MX51_ECSPI_* macros when cs > 3 Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 10/19] usb: typec: ucsi: acpi: add quirk for ASUS Zenbook UM325 Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 11/19] ALSA: hda: LNL: add HD Audio PCI ID Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 12/19] ASoC: amd: Add Dell G15 5525 to quirks list Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 13/19] ASoC: amd: yc: Add ThinkBook 14 G5+ ARP to quirks list for acp6x Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 14/19] HID: apple: Set the tilde quirk flag on the Geyser 3 Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 15/19] HID: Ignore battery for ELAN touchscreen on ROG Flow X13 GV301RA Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 16/19] HID: wacom: generic: Set battery quirk only when we see battery data Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 17/19] usb: typec: tcpm: fix multiple times discover svids error Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 18/19] serial: 8250: Reinit port->pm on port specific driver unbind Sasha Levin
2023-05-07  0:34 ` [PATCH AUTOSEL 6.1 19/19] mcb-pci: Reallocate memory region to avoid memory overlapping Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230507003417.4077259-5-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=ion@agorria.com \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=jonathanh@nvidia.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox