Commit 0a61bcbb authored by Hans de Goede's avatar Hans de Goede Committed by Mark Brown

ASoC: Intel: bytct_rt5640: Add a separate "Headset Mic 2" DAPM pin for the mic on the 2nd jack

In order to be able to do jack-detection reporting for the
mic contact on the 2nd jack found on some devices, the
DAPM topology needs to have a separate DAPM pin/input for that
microphone, instead of re-using the "Internal Mic" pin which is
normally used together with the IN1P input of the codec.

Using the "Internal Mic" dapm-pin-switch for this in a snd_soc_jack_pin to
report hotplug events causes the "Internal Mic" pin to get deactivated
when unplugging a headset from the 2nd jack, thus turning off the actual
Internal Mic (typically a pair of digital mics on devices with 2 jacks).

Fixes: 79c1123b ("ASoC: Intel: bytcr_rt5640: Add support for a second headset mic input")
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210819190543.784415-6-hdegoede@redhat.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent e3f2a660
...@@ -324,6 +324,7 @@ static int byt_rt5640_event_lineout(struct snd_soc_dapm_widget *w, ...@@ -324,6 +324,7 @@ static int byt_rt5640_event_lineout(struct snd_soc_dapm_widget *w,
static const struct snd_soc_dapm_widget byt_rt5640_widgets[] = { static const struct snd_soc_dapm_widget byt_rt5640_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL),
SND_SOC_DAPM_MIC("Headset Mic 2", NULL),
SND_SOC_DAPM_MIC("Internal Mic", NULL), SND_SOC_DAPM_MIC("Internal Mic", NULL),
SND_SOC_DAPM_SPK("Speaker", NULL), SND_SOC_DAPM_SPK("Speaker", NULL),
SND_SOC_DAPM_LINE("Line Out", byt_rt5640_event_lineout), SND_SOC_DAPM_LINE("Line Out", byt_rt5640_event_lineout),
...@@ -363,6 +364,12 @@ static const struct snd_soc_dapm_route byt_rt5640_intmic_in3_map[] = { ...@@ -363,6 +364,12 @@ static const struct snd_soc_dapm_route byt_rt5640_intmic_in3_map[] = {
{"IN3P", NULL, "Internal Mic"}, {"IN3P", NULL, "Internal Mic"},
}; };
static const struct snd_soc_dapm_route byt_rt5640_hsmic2_in1_map[] = {
{"Headset Mic 2", NULL, "Platform Clock"},
{"Headset Mic 2", NULL, "MICBIAS1"},
{"IN1P", NULL, "Headset Mic 2"},
};
static const struct snd_soc_dapm_route byt_rt5640_ssp2_aif1_map[] = { static const struct snd_soc_dapm_route byt_rt5640_ssp2_aif1_map[] = {
{"ssp2 Tx", NULL, "codec_out0"}, {"ssp2 Tx", NULL, "codec_out0"},
{"ssp2 Tx", NULL, "codec_out1"}, {"ssp2 Tx", NULL, "codec_out1"},
...@@ -422,6 +429,7 @@ static const struct snd_soc_dapm_route byt_rt5640_lineout_map[] = { ...@@ -422,6 +429,7 @@ static const struct snd_soc_dapm_route byt_rt5640_lineout_map[] = {
static const struct snd_kcontrol_new byt_rt5640_controls[] = { static const struct snd_kcontrol_new byt_rt5640_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphone"), SOC_DAPM_PIN_SWITCH("Headphone"),
SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Headset Mic"),
SOC_DAPM_PIN_SWITCH("Headset Mic 2"),
SOC_DAPM_PIN_SWITCH("Internal Mic"), SOC_DAPM_PIN_SWITCH("Internal Mic"),
SOC_DAPM_PIN_SWITCH("Speaker"), SOC_DAPM_PIN_SWITCH("Speaker"),
SOC_DAPM_PIN_SWITCH("Line Out"), SOC_DAPM_PIN_SWITCH("Line Out"),
...@@ -1086,8 +1094,8 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime) ...@@ -1086,8 +1094,8 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
if (byt_rt5640_quirk & BYT_RT5640_HSMIC2_ON_IN1) { if (byt_rt5640_quirk & BYT_RT5640_HSMIC2_ON_IN1) {
ret = snd_soc_dapm_add_routes(&card->dapm, ret = snd_soc_dapm_add_routes(&card->dapm,
byt_rt5640_intmic_in1_map, byt_rt5640_hsmic2_in1_map,
ARRAY_SIZE(byt_rt5640_intmic_in1_map)); ARRAY_SIZE(byt_rt5640_hsmic2_in1_map));
if (ret) if (ret)
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment