summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorNĂ­colas F. R. A. Prado <nfraprado@collabora.com>2022-09-22 19:59:47 -0400
committerMark Brown <broonie@kernel.org>2022-09-23 13:56:05 +0100
commitaa51e3c127a43cf4862db5f0081da281f1aa6429 (patch)
tree606af17a4afbc3bd8bff85a5c7866884d562e69e /sound
parent194ff8db03782d1dae41b7b42ea65da5748884c2 (diff)
downloadlinux-stable-aa51e3c127a43cf4862db5f0081da281f1aa6429.tar.gz
linux-stable-aa51e3c127a43cf4862db5f0081da281f1aa6429.tar.bz2
linux-stable-aa51e3c127a43cf4862db5f0081da281f1aa6429.zip
ASoC: mediatek: mt8195: Expose individual headset jack pins
The rt5682 codec is able to distinguish between two event types: headphone insertion/removal and headset microphone insertion/removal. However, currently, the mt8195 ASoC driver exposes a single kcontrol for the headset jack, so userspace isn't able to differentiate between the two events. Add a definition for the headset jack pins, so that a separate jack kcontrol is created for each one, allowing userspace to track and handle them individually. Signed-off-by: NĂ­colas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20220922235951.252532-3-nfraprado@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/mediatek/mt8195/mt8195-mt6359.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359.c b/sound/soc/mediatek/mt8195/mt8195-mt6359.c
index 961e769602d6..17d4c4108a9d 100644
--- a/sound/soc/mediatek/mt8195/mt8195-mt6359.c
+++ b/sound/soc/mediatek/mt8195/mt8195-mt6359.c
@@ -63,6 +63,18 @@ struct mt8195_mt6359_priv {
struct clk *i2so1_mclk;
};
+/* Headset jack detection DAPM pins */
+static struct snd_soc_jack_pin mt8195_jack_pins[] = {
+ {
+ .pin = "Headphone",
+ .mask = SND_JACK_HEADPHONE,
+ },
+ {
+ .pin = "Headset Mic",
+ .mask = SND_JACK_MICROPHONE,
+ },
+};
+
static const struct snd_soc_dapm_widget mt8195_mt6359_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL),
@@ -563,11 +575,12 @@ static int mt8195_rt5682_init(struct snd_soc_pcm_runtime *rtd)
priv->i2so1_mclk = afe_priv->clk[MT8195_CLK_TOP_APLL12_DIV2];
- ret = snd_soc_card_jack_new(rtd->card, "Headset Jack",
+ ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack",
SND_JACK_HEADSET | SND_JACK_BTN_0 |
SND_JACK_BTN_1 | SND_JACK_BTN_2 |
SND_JACK_BTN_3,
- jack);
+ jack, mt8195_jack_pins,
+ ARRAY_SIZE(mt8195_jack_pins));
if (ret) {
dev_err(rtd->dev, "Headset Jack creation failed: %d\n", ret);
return ret;