mirror of
https://abf.rosa.ru/djam/kernel-5.15.git
synced 2025-02-23 18:42:55 +00:00
82 lines
2.8 KiB
Diff
82 lines
2.8 KiB
Diff
![]() |
From a4ff92b5dd7b0bde469a3cafd2f5559f377c2599 Mon Sep 17 00:00:00 2001
|
||
|
From: Mauro Carvalho Chehab <mchehab@kernel.org>
|
||
|
Date: Thu, 7 Apr 2022 20:49:58 +0200
|
||
|
Subject: [PATCH 415/424] ASoC: Intel: sof_es8336: add a quirk for headset at
|
||
|
mic1 port
|
||
|
|
||
|
The headset/internal mic can either be routed as mic1/mic2
|
||
|
or vice-versa.
|
||
|
|
||
|
By default, the driver assumes that the headset is mapped as
|
||
|
mic2, but not all devices map this way.
|
||
|
|
||
|
So, add a quirk to support changing it to mic1, using mic2
|
||
|
for the internal analog mic (if any).
|
||
|
|
||
|
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
|
||
|
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
|
||
|
Link: https://lore.kernel.org/r/5d88fc29b79be7ab77dae391c8e5ee929fd36c27.1649357263.git.mchehab@kernel.org
|
||
|
Signed-off-by: Mark Brown <broonie@kernel.org>
|
||
|
---
|
||
|
sound/soc/intel/boards/sof_es8336.c | 19 ++++++++++++++++---
|
||
|
1 file changed, 16 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
|
||
|
index d15a58666..c71842be9 100644
|
||
|
--- a/sound/soc/intel/boards/sof_es8336.c
|
||
|
+++ b/sound/soc/intel/boards/sof_es8336.c
|
||
|
@@ -31,6 +31,7 @@
|
||
|
#define SOF_ES8336_ENABLE_DMIC BIT(5)
|
||
|
#define SOF_ES8336_JD_INVERTED BIT(6)
|
||
|
#define SOF_ES8336_HEADPHONE_GPIO BIT(7)
|
||
|
+#define SOC_ES8336_HEADSET_MIC1 BIT(8)
|
||
|
|
||
|
static unsigned long quirk;
|
||
|
|
||
|
@@ -90,6 +91,8 @@ static void log_quirks(struct device *dev)
|
||
|
dev_info(dev, "quirk headphone GPIO enabled\n");
|
||
|
if (quirk & SOF_ES8336_JD_INVERTED)
|
||
|
dev_info(dev, "quirk JD inverted enabled\n");
|
||
|
+ if (quirk & SOC_ES8336_HEADSET_MIC1)
|
||
|
+ dev_info(dev, "quirk headset at mic1 port enabled\n");
|
||
|
}
|
||
|
|
||
|
static int sof_es8316_speaker_power_event(struct snd_soc_dapm_widget *w,
|
||
|
@@ -147,11 +150,16 @@ static const struct snd_soc_dapm_route sof_es8316_audio_map[] = {
|
||
|
{"Speaker", NULL, "Speaker Power"},
|
||
|
};
|
||
|
|
||
|
-static const struct snd_soc_dapm_route sof_es8316_intmic_in1_map[] = {
|
||
|
+static const struct snd_soc_dapm_route sof_es8316_headset_mic2_map[] = {
|
||
|
{"MIC1", NULL, "Internal Mic"},
|
||
|
{"MIC2", NULL, "Headset Mic"},
|
||
|
};
|
||
|
|
||
|
+static const struct snd_soc_dapm_route sof_es8316_headset_mic1_map[] = {
|
||
|
+ {"MIC2", NULL, "Internal Mic"},
|
||
|
+ {"MIC1", NULL, "Headset Mic"},
|
||
|
+};
|
||
|
+
|
||
|
static const struct snd_soc_dapm_route dmic_map[] = {
|
||
|
/* digital mics */
|
||
|
{"DMic", NULL, "SoC DMIC"},
|
||
|
@@ -225,8 +233,13 @@ static int sof_es8316_init(struct snd_soc_pcm_runtime *runtime)
|
||
|
|
||
|
card->dapm.idle_bias_off = true;
|
||
|
|
||
|
- custom_map = sof_es8316_intmic_in1_map;
|
||
|
- num_routes = ARRAY_SIZE(sof_es8316_intmic_in1_map);
|
||
|
+ if (quirk & SOC_ES8336_HEADSET_MIC1) {
|
||
|
+ custom_map = sof_es8316_headset_mic1_map;
|
||
|
+ num_routes = ARRAY_SIZE(sof_es8316_headset_mic1_map);
|
||
|
+ } else {
|
||
|
+ custom_map = sof_es8316_headset_mic2_map;
|
||
|
+ num_routes = ARRAY_SIZE(sof_es8316_headset_mic2_map);
|
||
|
+ }
|
||
|
|
||
|
ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
|
||
|
if (ret)
|
||
|
--
|
||
|
2.35.2
|
||
|
|