[PATCH] ALSA: hda/conexant: Fix missing headphone node after reboot from Windows
Takashi Iwai
tiwai at suse.de
Tue Jun 23 08:25:10 CEST 2020
When Lenovo Thinkpad E495 is rebooted from Windows, the headphone
control is lost. This seems because BIOS doesn't initialize the
headphone node (NID 0x16) properly after the reboot from Windows, as
Windows likely turns off the power at its exit. The node is left
as a vendor-specific unknown node and ignored by the HD-audio parser.
This patch forcibly initializes the node at the probe time, by
overriding the widget caps and the connection list, so that the
headphone control is detected always at probe time.
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207741
Cc: <stable at vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
sound/pci/hda/patch_conexant.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 396b5503038a..37c8add48791 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -215,6 +215,7 @@ enum {
CXT_FIXUP_MUTE_LED_GPIO,
CXT_FIXUP_HEADSET_MIC,
CXT_FIXUP_HP_MIC_NO_PRESENCE,
+ CXT_FIXUP_THINKPAD_E495,
};
/* for hda_fixup_thinkpad_acpi() */
@@ -673,6 +674,22 @@ static void cxt_fixup_mute_led_gpio(struct hda_codec *codec,
spec->gpio_led);
}
+static void cxt_fixup_thinkpad_e495(struct hda_codec *codec,
+ const struct hda_fixup *fix,
+ int action)
+{
+ if (action == HDA_FIXUP_ACT_PRE_PROBE) {
+ static const hda_nid_t conns[] = { 0x10, 0x11 };
+ /* BIOS invalidates the headphone pin NID 0x16 when rebooted
+ * after Windows by some reason;
+ * forcibly restoring the whole setup
+ */
+ snd_hda_override_wcaps(codec, 0x16, 0x400581);
+ snd_hda_codec_set_pincfg(codec, 0x16, 0x03211040);
+ snd_hda_override_conn_list(codec, 0x16, ARRAY_SIZE(conns),
+ conns);
+ }
+}
/* ThinkPad X200 & co with cxt5051 */
static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = {
@@ -846,6 +863,12 @@ static const struct hda_fixup cxt_fixups[] = {
.chained = true,
.chain_id = CXT_FIXUP_HEADSET_MIC,
},
+ [CXT_FIXUP_THINKPAD_E495] = {
+ .type = HDA_FIXUP_FUNC,
+ .v.func = cxt_fixup_thinkpad_e495,
+ .chained = true,
+ .chain_id = CXT_FIXUP_THINKPAD_ACPI,
+ },
};
static const struct snd_pci_quirk cxt5045_fixups[] = {
@@ -932,6 +955,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x17aa, 0x5124, "Lenovo Thinkpad E495", CXT_FIXUP_THINKPAD_E495),
SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI),
SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004),
SND_PCI_QUIRK(0x1c06, 0x2012, "Lemote A1205", CXT_PINCFG_LEMOTE_A1205),
--
2.16.4
More information about the Alsa-devel
mailing list