Skip to content

Commit 2d53dfa

Browse files
Wer-Wolfij-intel
authored andcommitted
platform/x86: uniwill-laptop: Rename FN lock and super key lock attrs
It turns out that both sysfs attributes actually directly control the FN lock status/super key enable status, rather than the triggering of the associated events. This behavior was first observed on a Tuxedo notebook and was belived to be a hardware quirk. However, it seems that i simply misunderstood the manual of the OEM software for Intel NUC devices. The correct behavior is: - fn_lock_toggle_enable enables/disables FN lock mode - super_key_toggle_enable enables/disables the super key Rename both sysfs attributes to avoid confusing users. Fixes: d050479 ("platform/x86: Add Uniwill laptop driver") Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://patch.msgid.link/20260218005101.73680-2-W_Armin@gmx.de Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent e3aa6fe commit 2d53dfa

4 files changed

Lines changed: 39 additions & 37 deletions

File tree

Documentation/ABI/testing/sysfs-driver-uniwill-laptop

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
What: /sys/bus/platform/devices/INOU0000:XX/fn_lock_toggle_enable
1+
What: /sys/bus/platform/devices/INOU0000:XX/fn_lock
22
Date: November 2025
33
KernelVersion: 6.19
44
Contact: Armin Wolf <W_Armin@gmx.de>
@@ -8,15 +8,15 @@ Description:
88

99
Reading this file returns the current enable status of the FN lock functionality.
1010

11-
What: /sys/bus/platform/devices/INOU0000:XX/super_key_toggle_enable
11+
What: /sys/bus/platform/devices/INOU0000:XX/super_key_enable
1212
Date: November 2025
1313
KernelVersion: 6.19
1414
Contact: Armin Wolf <W_Armin@gmx.de>
1515
Description:
16-
Allows userspace applications to enable/disable the super key functionality
17-
of the integrated keyboard by writing "1"/"0" into this file.
16+
Allows userspace applications to enable/disable the super key of the integrated
17+
keyboard by writing "1"/"0" into this file.
1818

19-
Reading this file returns the current enable status of the super key functionality.
19+
Reading this file returns the current enable status of the super key.
2020

2121
What: /sys/bus/platform/devices/INOU0000:XX/touchpad_toggle_enable
2222
Date: November 2025

Documentation/admin-guide/laptops/uniwill-laptop.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Keyboard settings
2424

2525
The ``uniwill-laptop`` driver allows the user to enable/disable:
2626

27-
- the FN and super key lock functionality of the integrated keyboard
27+
- the FN lock and super key of the integrated keyboard
2828
- the touchpad toggle functionality of the integrated touchpad
2929

3030
See Documentation/ABI/testing/sysfs-driver-uniwill-laptop for details.

drivers/platform/x86/uniwill/uniwill-acpi.c

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@
314314
#define LED_CHANNELS 3
315315
#define LED_MAX_BRIGHTNESS 200
316316

317-
#define UNIWILL_FEATURE_FN_LOCK_TOGGLE BIT(0)
318-
#define UNIWILL_FEATURE_SUPER_KEY_TOGGLE BIT(1)
317+
#define UNIWILL_FEATURE_FN_LOCK BIT(0)
318+
#define UNIWILL_FEATURE_SUPER_KEY BIT(1)
319319
#define UNIWILL_FEATURE_TOUCHPAD_TOGGLE BIT(2)
320320
#define UNIWILL_FEATURE_LIGHTBAR BIT(3)
321321
#define UNIWILL_FEATURE_BATTERY BIT(4)
@@ -377,11 +377,15 @@ static const struct key_entry uniwill_keymap[] = {
377377
{ KE_IGNORE, UNIWILL_OSD_CAPSLOCK, { KEY_CAPSLOCK }},
378378
{ KE_IGNORE, UNIWILL_OSD_NUMLOCK, { KEY_NUMLOCK }},
379379

380-
/* Reported when the user locks/unlocks the super key */
381-
{ KE_IGNORE, UNIWILL_OSD_SUPER_KEY_LOCK_ENABLE, { KEY_UNKNOWN }},
382-
{ KE_IGNORE, UNIWILL_OSD_SUPER_KEY_LOCK_DISABLE, { KEY_UNKNOWN }},
380+
/*
381+
* Reported when the user enables/disables the super key.
382+
* Those events might even be reported when the change was done
383+
* using the sysfs attribute!
384+
*/
385+
{ KE_IGNORE, UNIWILL_OSD_SUPER_KEY_DISABLE, { KEY_UNKNOWN }},
386+
{ KE_IGNORE, UNIWILL_OSD_SUPER_KEY_ENABLE, { KEY_UNKNOWN }},
383387
/* Optional, might not be reported by all devices */
384-
{ KE_IGNORE, UNIWILL_OSD_SUPER_KEY_LOCK_CHANGED, { KEY_UNKNOWN }},
388+
{ KE_IGNORE, UNIWILL_OSD_SUPER_KEY_STATE_CHANGED, { KEY_UNKNOWN }},
385389

386390
/* Reported in manual mode when toggling the airplane mode status */
387391
{ KE_KEY, UNIWILL_OSD_RFKILL, { KEY_RFKILL }},
@@ -600,8 +604,8 @@ static const struct regmap_config uniwill_ec_config = {
600604
.use_single_write = true,
601605
};
602606

603-
static ssize_t fn_lock_toggle_enable_store(struct device *dev, struct device_attribute *attr,
604-
const char *buf, size_t count)
607+
static ssize_t fn_lock_store(struct device *dev, struct device_attribute *attr, const char *buf,
608+
size_t count)
605609
{
606610
struct uniwill_data *data = dev_get_drvdata(dev);
607611
unsigned int value;
@@ -624,8 +628,7 @@ static ssize_t fn_lock_toggle_enable_store(struct device *dev, struct device_att
624628
return count;
625629
}
626630

627-
static ssize_t fn_lock_toggle_enable_show(struct device *dev, struct device_attribute *attr,
628-
char *buf)
631+
static ssize_t fn_lock_show(struct device *dev, struct device_attribute *attr, char *buf)
629632
{
630633
struct uniwill_data *data = dev_get_drvdata(dev);
631634
unsigned int value;
@@ -638,10 +641,10 @@ static ssize_t fn_lock_toggle_enable_show(struct device *dev, struct device_attr
638641
return sysfs_emit(buf, "%d\n", !!(value & FN_LOCK_STATUS));
639642
}
640643

641-
static DEVICE_ATTR_RW(fn_lock_toggle_enable);
644+
static DEVICE_ATTR_RW(fn_lock);
642645

643-
static ssize_t super_key_toggle_enable_store(struct device *dev, struct device_attribute *attr,
644-
const char *buf, size_t count)
646+
static ssize_t super_key_enable_store(struct device *dev, struct device_attribute *attr,
647+
const char *buf, size_t count)
645648
{
646649
struct uniwill_data *data = dev_get_drvdata(dev);
647650
unsigned int value;
@@ -673,8 +676,7 @@ static ssize_t super_key_toggle_enable_store(struct device *dev, struct device_a
673676
return count;
674677
}
675678

676-
static ssize_t super_key_toggle_enable_show(struct device *dev, struct device_attribute *attr,
677-
char *buf)
679+
static ssize_t super_key_enable_show(struct device *dev, struct device_attribute *attr, char *buf)
678680
{
679681
struct uniwill_data *data = dev_get_drvdata(dev);
680682
unsigned int value;
@@ -687,7 +689,7 @@ static ssize_t super_key_toggle_enable_show(struct device *dev, struct device_at
687689
return sysfs_emit(buf, "%d\n", !(value & SUPER_KEY_LOCK_STATUS));
688690
}
689691

690-
static DEVICE_ATTR_RW(super_key_toggle_enable);
692+
static DEVICE_ATTR_RW(super_key_enable);
691693

692694
static ssize_t touchpad_toggle_enable_store(struct device *dev, struct device_attribute *attr,
693695
const char *buf, size_t count)
@@ -881,8 +883,8 @@ static int uniwill_nvidia_ctgp_init(struct uniwill_data *data)
881883

882884
static struct attribute *uniwill_attrs[] = {
883885
/* Keyboard-related */
884-
&dev_attr_fn_lock_toggle_enable.attr,
885-
&dev_attr_super_key_toggle_enable.attr,
886+
&dev_attr_fn_lock.attr,
887+
&dev_attr_super_key_enable.attr,
886888
&dev_attr_touchpad_toggle_enable.attr,
887889
/* Lightbar-related */
888890
&dev_attr_rainbow_animation.attr,
@@ -897,13 +899,13 @@ static umode_t uniwill_attr_is_visible(struct kobject *kobj, struct attribute *a
897899
struct device *dev = kobj_to_dev(kobj);
898900
struct uniwill_data *data = dev_get_drvdata(dev);
899901

900-
if (attr == &dev_attr_fn_lock_toggle_enable.attr) {
901-
if (uniwill_device_supports(data, UNIWILL_FEATURE_FN_LOCK_TOGGLE))
902+
if (attr == &dev_attr_fn_lock.attr) {
903+
if (uniwill_device_supports(data, UNIWILL_FEATURE_FN_LOCK))
902904
return attr->mode;
903905
}
904906

905-
if (attr == &dev_attr_super_key_toggle_enable.attr) {
906-
if (uniwill_device_supports(data, UNIWILL_FEATURE_SUPER_KEY_TOGGLE))
907+
if (attr == &dev_attr_super_key_enable.attr) {
908+
if (uniwill_device_supports(data, UNIWILL_FEATURE_SUPER_KEY))
907909
return attr->mode;
908910
}
909911

@@ -1505,7 +1507,7 @@ static void uniwill_shutdown(struct platform_device *pdev)
15051507

15061508
static int uniwill_suspend_keyboard(struct uniwill_data *data)
15071509
{
1508-
if (!uniwill_device_supports(data, UNIWILL_FEATURE_SUPER_KEY_TOGGLE))
1510+
if (!uniwill_device_supports(data, UNIWILL_FEATURE_SUPER_KEY))
15091511
return 0;
15101512

15111513
/*
@@ -1565,7 +1567,7 @@ static int uniwill_resume_keyboard(struct uniwill_data *data)
15651567
unsigned int value;
15661568
int ret;
15671569

1568-
if (!uniwill_device_supports(data, UNIWILL_FEATURE_SUPER_KEY_TOGGLE))
1570+
if (!uniwill_device_supports(data, UNIWILL_FEATURE_SUPER_KEY))
15691571
return 0;
15701572

15711573
ret = regmap_read(data->regmap, EC_ADDR_SWITCH_STATUS, &value);
@@ -1643,16 +1645,16 @@ static struct platform_driver uniwill_driver = {
16431645
};
16441646

16451647
static struct uniwill_device_descriptor lapac71h_descriptor __initdata = {
1646-
.features = UNIWILL_FEATURE_FN_LOCK_TOGGLE |
1647-
UNIWILL_FEATURE_SUPER_KEY_TOGGLE |
1648+
.features = UNIWILL_FEATURE_FN_LOCK |
1649+
UNIWILL_FEATURE_SUPER_KEY |
16481650
UNIWILL_FEATURE_TOUCHPAD_TOGGLE |
16491651
UNIWILL_FEATURE_BATTERY |
16501652
UNIWILL_FEATURE_HWMON,
16511653
};
16521654

16531655
static struct uniwill_device_descriptor lapkc71f_descriptor __initdata = {
1654-
.features = UNIWILL_FEATURE_FN_LOCK_TOGGLE |
1655-
UNIWILL_FEATURE_SUPER_KEY_TOGGLE |
1656+
.features = UNIWILL_FEATURE_FN_LOCK |
1657+
UNIWILL_FEATURE_SUPER_KEY |
16561658
UNIWILL_FEATURE_TOUCHPAD_TOGGLE |
16571659
UNIWILL_FEATURE_LIGHTBAR |
16581660
UNIWILL_FEATURE_BATTERY |

drivers/platform/x86/uniwill/uniwill-wmi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
#define UNIWILL_OSD_KB_LED_LEVEL3 0x3E
6565
#define UNIWILL_OSD_KB_LED_LEVEL4 0x3F
6666

67-
#define UNIWILL_OSD_SUPER_KEY_LOCK_ENABLE 0x40
68-
#define UNIWILL_OSD_SUPER_KEY_LOCK_DISABLE 0x41
67+
#define UNIWILL_OSD_SUPER_KEY_DISABLE 0x40
68+
#define UNIWILL_OSD_SUPER_KEY_ENABLE 0x41
6969

7070
#define UNIWILL_OSD_MENU_JP 0x42
7171

@@ -74,7 +74,7 @@
7474

7575
#define UNIWILL_OSD_RFKILL 0xA4
7676

77-
#define UNIWILL_OSD_SUPER_KEY_LOCK_CHANGED 0xA5
77+
#define UNIWILL_OSD_SUPER_KEY_STATE_CHANGED 0xA5
7878

7979
#define UNIWILL_OSD_LIGHTBAR_STATE_CHANGED 0xA6
8080

0 commit comments

Comments
 (0)