Skip to content

Commit 7c7bb2a

Browse files
mchehabbroonie
authored andcommitted
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>
1 parent 6e1ff14 commit 7c7bb2a

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

sound/soc/intel/boards/sof_es8336.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#define SOF_ES8336_ENABLE_DMIC BIT(5)
3232
#define SOF_ES8336_JD_INVERTED BIT(6)
3333
#define SOF_ES8336_HEADPHONE_GPIO BIT(7)
34+
#define SOC_ES8336_HEADSET_MIC1 BIT(8)
3435

3536
static unsigned long quirk;
3637

@@ -90,6 +91,8 @@ static void log_quirks(struct device *dev)
9091
dev_info(dev, "quirk headphone GPIO enabled\n");
9192
if (quirk & SOF_ES8336_JD_INVERTED)
9293
dev_info(dev, "quirk JD inverted enabled\n");
94+
if (quirk & SOC_ES8336_HEADSET_MIC1)
95+
dev_info(dev, "quirk headset at mic1 port enabled\n");
9396
}
9497

9598
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[] = {
147150
{"Speaker", NULL, "Speaker Power"},
148151
};
149152

150-
static const struct snd_soc_dapm_route sof_es8316_intmic_in1_map[] = {
153+
static const struct snd_soc_dapm_route sof_es8316_headset_mic2_map[] = {
151154
{"MIC1", NULL, "Internal Mic"},
152155
{"MIC2", NULL, "Headset Mic"},
153156
};
154157

158+
static const struct snd_soc_dapm_route sof_es8316_headset_mic1_map[] = {
159+
{"MIC2", NULL, "Internal Mic"},
160+
{"MIC1", NULL, "Headset Mic"},
161+
};
162+
155163
static const struct snd_soc_dapm_route dmic_map[] = {
156164
/* digital mics */
157165
{"DMic", NULL, "SoC DMIC"},
@@ -225,8 +233,13 @@ static int sof_es8316_init(struct snd_soc_pcm_runtime *runtime)
225233

226234
card->dapm.idle_bias_off = true;
227235

228-
custom_map = sof_es8316_intmic_in1_map;
229-
num_routes = ARRAY_SIZE(sof_es8316_intmic_in1_map);
236+
if (quirk & SOC_ES8336_HEADSET_MIC1) {
237+
custom_map = sof_es8316_headset_mic1_map;
238+
num_routes = ARRAY_SIZE(sof_es8316_headset_mic1_map);
239+
} else {
240+
custom_map = sof_es8316_headset_mic2_map;
241+
num_routes = ARRAY_SIZE(sof_es8316_headset_mic2_map);
242+
}
230243

231244
ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
232245
if (ret)

0 commit comments

Comments
 (0)