[PATCH 5/5] platform/x86: uniwill-laptop: Handle super key lock events

Armin Wolf posted 5 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH 5/5] platform/x86: uniwill-laptop: Handle super key lock events
Posted by Armin Wolf 1 month, 2 weeks ago
On many devices, the user can toggle the super key lock state by
pressing Fn + F9. Forward the associated events to the super_key_lock
sysfs attribute as a poll notification.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/platform/x86/uniwill/uniwill-acpi.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c
index e162af1d9118..26ee21a95a8b 100644
--- a/drivers/platform/x86/uniwill/uniwill-acpi.c
+++ b/drivers/platform/x86/uniwill/uniwill-acpi.c
@@ -378,9 +378,6 @@ static const struct key_entry uniwill_keymap[] = {
 	{ KE_IGNORE,    UNIWILL_OSD_CAPSLOCK,                   { KEY_CAPSLOCK }},
 	{ KE_IGNORE,    UNIWILL_OSD_NUMLOCK,                    { KEY_NUMLOCK }},
 
-	/* Reported when the user locks/unlocks the super key */
-	{ KE_IGNORE,    UNIWILL_OSD_SUPER_KEY_LOCK_ENABLE,      { KEY_UNKNOWN }},
-	{ KE_IGNORE,    UNIWILL_OSD_SUPER_KEY_LOCK_DISABLE,     { KEY_UNKNOWN }},
 	/* Optional, might not be reported by all devices */
 	{ KE_IGNORE,	UNIWILL_OSD_SUPER_KEY_LOCK_CHANGED,	{ KEY_UNKNOWN }},
 
@@ -1353,6 +1350,14 @@ static int uniwill_notifier_call(struct notifier_block *nb, unsigned long action
 	struct uniwill_battery_entry *entry;
 
 	switch (action) {
+	case UNIWILL_OSD_SUPER_KEY_LOCK_ENABLE:
+	case UNIWILL_OSD_SUPER_KEY_LOCK_DISABLE:
+		if (!uniwill_device_supports(data, UNIWILL_FEATURE_SUPER_KEY))
+			return NOTIFY_DONE;
+
+		sysfs_notify(&data->dev->kobj, NULL, "super_key_enable");
+
+		return NOTIFY_OK;
 	case UNIWILL_OSD_BATTERY_ALERT:
 		if (!uniwill_device_supports(data, UNIWILL_FEATURE_BATTERY))
 			return NOTIFY_DONE;
-- 
2.39.5