Skip to contentSkip to conversation

platform/x86: intel-vbtn: Report switch events when event wakes device

PATCH Superseded Mathew King 2 participants 2 messages May 16, 2019 – May 20, 2019 x86 platform drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: intel-vbtn: Report switch events when event wakes device

When a switch event, such as tablet mode/laptop mode or docked/undocked, wakes a device make sure that the value of the swich is reported. Without when a device is put in tablet mode from laptop mode when it is suspended or vice versa the device will wake up but mode will be incorrect.

Tested by suspending a device in laptop mode and putting it in tablet mode, the device resumes and is in tablet mode. When suspending the device in tablet mode and putting it in laptop mode the device resumes and is in laptop mode.

---
 drivers/platform/x86/intel-vbtn.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/platform/x86/intel-vbtn.c +5 -2
index 06cd7e818ed5..990cc8c20872 100644
@@ -76,12 +76,15 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
 	struct platform_device *device = context;
 	struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev);
 	unsigned int val = !(event & 1); /* Even=press, Odd=release */
-	const struct key_entry *ke_rel;
+	const struct key_entry *ke, *ke_rel;
 	bool autorelease;
 
 	if (priv->wakeup_mode) {
-		if (sparse_keymap_entry_from_scancode(priv->input_dev, event)) {
+		ke = sparse_keymap_entry_from_scancode(priv->input_dev, event);
+		if (ke) {
 			pm_wakeup_hard_event(&device->dev);
+			if (ke->type == KE_SW)
+				sparse_keymap_report_event(priv->input_dev, event, val, 0);
 			return;
 		}
 		goto out_unknown;
Signature · 1 line
2.21.0.1020.gf2820cf01a-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines

-----Original Message-----
From: [email protected] <platform-driver-x86- [email protected]> On Behalf Of Mathew King
Sent: Thursday, May 16, 2019 4:56 PM
To: [email protected]
Cc: Mathew King; AceLan Kao; Darren Hart; Andy Shevchenko; platform-driver- [email protected]
Subject: [PATCH] platform/x86: intel-vbtn: Report switch events when event wakes device

[EXTERNAL EMAIL]

When a switch event, such as tablet mode/laptop mode or docked/undocked, wakes a device make sure that the value of the swich is reported. Without when a device is put in tablet mode from laptop mode when it is suspended or vice versa the device will wake up but mode will be incorrect.

Quoted 6 lines

Tested by suspending a device in laptop mode and putting it in tablet mode, the device resumes and is in tablet mode. When suspending the device in tablet mode and putting it in laptop mode the device resumes and is in laptop mode.

Quoted 32 lines
---
 drivers/platform/x86/intel-vbtn.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/platform/x86/intel-vbtn.c +5 -2
index 06cd7e818ed5..990cc8c20872 100644
@@ -76,12 +76,15 @@ static void notify_handler(acpi_handle handle, u32 event,
 void *context)
 	struct platform_device *device = context;
 	struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev);
 	unsigned int val = !(event & 1); /* Even=press, Odd=release */
-	const struct key_entry *ke_rel;
+	const struct key_entry *ke, *ke_rel;
 	bool autorelease;
 
 	if (priv->wakeup_mode) {
-		if (sparse_keymap_entry_from_scancode(priv->input_dev, event))
 {
+		ke = sparse_keymap_entry_from_scancode(priv->input_dev,
 event);
+		if (ke) {
 			pm_wakeup_hard_event(&device->dev);
+			if (ke->type == KE_SW)
+				sparse_keymap_report_event(priv->input_dev,

event, val, 0);

drivers/platform/x86/intel-vbtn.c +0 -1
 			return;
 		}
 		goto out_unknown;
--

2.21.0.1020.gf2820cf01a-goog