Skip to contentSkip to conversation

FAILED: patch "[PATCH] platform/x86: intel-vbtn: Stop reporting SW_DOCK events" failed to apply to 5.12-stable tree

PATCH [email protected] 2 participants 3 messages May 12, 2021

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 2728f39dfc720983e2b69f0f1f0c403aaa7c346f Mon Sep 17 00:00:00 2001
From: Hans de Goede <[email protected]>
Date: Sun, 21 Mar 2021 17:35:13 +0100
Subject: [PATCH] platform/x86: intel-vbtn: Stop reporting SW_DOCK events

Stop reporting SW_DOCK events because this breaks suspend-on-lid-close.

SW_DOCK should only be reported for docking stations, but all the DSDTs in my DSDT collection which use the intel-vbtn code, always seem to use this for 2-in-1s / convertibles and set SW_DOCK=1 when in laptop-mode (in tandem with setting SW_TABLET_MODE=0).

This causes userspace to think the laptop is docked to a port-replicator and to disable suspend-on-lid-close, which is undesirable.

Map the dock events to KEY_IGNORE to avoid this broken SW_DOCK reporting.

Note this may theoretically cause us to stop reporting SW_DOCK on some device where the 0xCA and 0xCB intel-vbtn events are actually used for reporting docking to a classic docking-station / port-replicator but I'm not aware of any such devices.

Also the most important thing is that we only report SW_DOCK when it reliably reports being docked to a classic docking-station without any false positives, which clearly is not the case here. If there is a chance of reporting false positives then it is better to not report SW_DOCK at all.

drivers/platform/x86/intel-vbtn.c +10 -2
index 8a8017f9ca91..3fdf4cbec9ad 100644
@@ -48,8 +48,16 @@ static const struct key_entry intel_vbtn_keymap[] = {
 };
 
 static const struct key_entry intel_vbtn_switchmap[] = {
-	{ KE_SW,     0xCA, { .sw = { SW_DOCK, 1 } } },		/* Docked */
-	{ KE_SW,     0xCB, { .sw = { SW_DOCK, 0 } } },		/* Undocked */
+	/*
+	 * SW_DOCK should only be reported for docking stations, but DSDTs using the
+	 * intel-vbtn code, always seem to use this for 2-in-1s / convertibles and set
+	 * SW_DOCK=1 when in laptop-mode (in tandem with setting SW_TABLET_MODE=0).
+	 * This causes userspace to think the laptop is docked to a port-replicator
+	 * and to disable suspend-on-lid-close, which is undesirable.
+	 * Map the dock events to KEY_IGNORE to avoid this broken SW_DOCK reporting.
+	 */
+	{ KE_IGNORE, 0xCA, { .sw = { SW_DOCK, 1 } } },		/* Docked */
+	{ KE_IGNORE, 0xCB, { .sw = { SW_DOCK, 0 } } },		/* Undocked */
 	{ KE_SW,     0xCC, { .sw = { SW_TABLET_MODE, 1 } } },	/* Tablet */
 	{ KE_SW,     0xCD, { .sw = { SW_TABLET_MODE, 0 } } },	/* Laptop */
 	{ KE_END }
#1 lore raw

Hi Greg,

Quoted 5 lines · On 5/12/21 10:51 AM, [email protected] wrote:

The patch below does not apply to the 5.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

This is already in 5.12, but then as commit 538d2dd0b9920334e6596977a664e9e7bac73703 that is the hash it has on my pdx86/fixes branch, where I cherry picked it from my pdx86/for-next branch.

The 2728f39dfc720983e2b69f0f1f0c403aaa7c346f hash you tried to cherry-pick is from my pdx86/for-next branch and so this same change showed up (again) in 5.13-rc1 under this hash, sorry about the confusion.

Regards,

Hans

Quoted 63 lines

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 2728f39dfc720983e2b69f0f1f0c403aaa7c346f Mon Sep 17 00:00:00 2001
From: Hans de Goede <[email protected]>
Date: Sun, 21 Mar 2021 17:35:13 +0100
Subject: [PATCH] platform/x86: intel-vbtn: Stop reporting SW_DOCK events

Stop reporting SW_DOCK events because this breaks suspend-on-lid-close.

SW_DOCK should only be reported for docking stations, but all the DSDTs in my DSDT collection which use the intel-vbtn code, always seem to use this for 2-in-1s / convertibles and set SW_DOCK=1 when in laptop-mode (in tandem with setting SW_TABLET_MODE=0).

This causes userspace to think the laptop is docked to a port-replicator and to disable suspend-on-lid-close, which is undesirable.

Map the dock events to KEY_IGNORE to avoid this broken SW_DOCK reporting.

Note this may theoretically cause us to stop reporting SW_DOCK on some device where the 0xCA and 0xCB intel-vbtn events are actually used for reporting docking to a classic docking-station / port-replicator but I'm not aware of any such devices.

Also the most important thing is that we only report SW_DOCK when it reliably reports being docked to a classic docking-station without any false positives, which clearly is not the case here. If there is a chance of reporting false positives then it is better to not report SW_DOCK at all.

drivers/platform/x86/intel-vbtn.c +10 -2
index 8a8017f9ca91..3fdf4cbec9ad 100644
@@ -48,8 +48,16 @@ static const struct key_entry intel_vbtn_keymap[] = {
 };
 
 static const struct key_entry intel_vbtn_switchmap[] = {
-	{ KE_SW,     0xCA, { .sw = { SW_DOCK, 1 } } },		/* Docked */
-	{ KE_SW,     0xCB, { .sw = { SW_DOCK, 0 } } },		/* Undocked */
+	/*
+	 * SW_DOCK should only be reported for docking stations, but DSDTs using the
+	 * intel-vbtn code, always seem to use this for 2-in-1s / convertibles and set
+	 * SW_DOCK=1 when in laptop-mode (in tandem with setting SW_TABLET_MODE=0).
+	 * This causes userspace to think the laptop is docked to a port-replicator
+	 * and to disable suspend-on-lid-close, which is undesirable.
+	 * Map the dock events to KEY_IGNORE to avoid this broken SW_DOCK reporting.
+	 */
+	{ KE_IGNORE, 0xCA, { .sw = { SW_DOCK, 1 } } },		/* Docked */
+	{ KE_IGNORE, 0xCB, { .sw = { SW_DOCK, 0 } } },		/* Undocked */
 	{ KE_SW,     0xCC, { .sw = { SW_TABLET_MODE, 1 } } },	/* Tablet */
 	{ KE_SW,     0xCD, { .sw = { SW_TABLET_MODE, 0 } } },	/* Laptop */
 	{ KE_END }
author maintainer
#2 lore raw
Quoted 9 lines · Hans de Goede

Hi Greg,

Quoted 5 lines · On 5/12/21 10:51 AM, [email protected] wrote:

The patch below does not apply to the 5.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Quoted 7 lines

This is already in 5.12, but then as commit 538d2dd0b9920334e6596977a664e9e7bac73703 that is the hash it has on my pdx86/fixes branch, where I cherry picked it from my pdx86/for-next branch.

The 2728f39dfc720983e2b69f0f1f0c403aaa7c346f hash you tried to cherry-pick is from my pdx86/for-next branch and so this same change showed up (again) in 5.13-rc1 under this hash, sorry about the confusion.

Ah, that makes sense, thanks for letting me know.

greg k-h