Skip to contentSkip to conversation

platform/x86: asus-wmi: Add param to turn fn-lock mode on by default

PATCH Superseded Luca Stefani 2 participants 4 messages Mar 23, 2021 – Apr 7, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 platform/x86: asus-wmi: Add param to turn fn-lock mode on by default

* On recent ZenBooks the fn-lock is disabled
by default on boot while running Windows.

* Add a module param ( fnlock_default ) that allows changing the default at probe time

---
 drivers/platform/x86/asus-wmi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +4 -1
index 9ca15f724343..f3ed72f01462 100644
@@ -47,6 +47,9 @@ MODULE_AUTHOR("Corentin Chary <[email protected]>, "
 MODULE_DESCRIPTION("Asus Generic WMI Driver");
 MODULE_LICENSE("GPL");
 
+static bool fnlock_default = false;
+module_param(fnlock_default, bool, 0444);
+
 #define to_asus_wmi_driver(pdrv)					\
 	(container_of((pdrv), struct asus_wmi_driver, platform_driver))
 
@@ -2673,7 +2676,7 @@ static int asus_wmi_add(struct platform_device *pdev)
 		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
 
 	if (asus_wmi_has_fnlock_key(asus)) {
-		asus->fnlock_locked = true;
+		asus->fnlock_locked = fnlock_default;
 		asus_wmi_fnlock_update(asus);
 	}
 
Signature · 1 line
2.31.0
#1 lore raw

Hi,

Quoted 16 lines · Luca Stefani

* On recent ZenBooks the fn-lock is disabled
by default on boot while running Windows.

* Add a module param ( fnlock_default ) that allows changing the default at probe time

---
 drivers/platform/x86/asus-wmi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +0 -0
index 9ca15f724343..f3ed72f01462 100644

drivers/platform/x86/asus-wmi.c MODULE_AUTHOR("Corentin Chary <[email protected]>, " · line 50

Quoted 4 lines
drivers/platform/x86/asus-wmi.c +1 -0
@@ -47,6 +47,9 @@ MODULE_AUTHOR("Corentin Chary <[email protected]>, "
 MODULE_DESCRIPTION("Asus Generic WMI Driver");
 MODULE_LICENSE("GPL");
 
+static bool fnlock_default = false;

The initial value of this needs to be true, so that there is no behavioral change when people upgrade from a kernel without this to one with it.

And then people who want a different behavior can get that by setting the module option.

Regards,

Hans

Quoted 15 lines
drivers/platform/x86/asus-wmi.c +3 -1
+module_param(fnlock_default, bool, 0444);
+
 #define to_asus_wmi_driver(pdrv)					\
 	(container_of((pdrv), struct asus_wmi_driver, platform_driver))
 
@@ -2673,7 +2676,7 @@ static int asus_wmi_add(struct platform_device *pdev)
 		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
 
 	if (asus_wmi_has_fnlock_key(asus)) {
-		asus->fnlock_locked = true;
+		asus->fnlock_locked = fnlock_default;
 		asus_wmi_fnlock_update(asus);
 	}
 
#2 lore raw

PATCH v3 1/1 platform/x86: asus-wmi: Add param to turn fn-lock mode on by default

In reply to Luca Stefani

* On recent ZenBooks the fn-lock is disabled
by default on boot while running Windows.

* Add a module param ( fnlock_default ) that allows changing the default at probe time

---
 drivers/platform/x86/asus-wmi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +4 -1
index 9ca15f724343..ebaeb7bb80f5 100644
@@ -47,6 +47,9 @@ MODULE_AUTHOR("Corentin Chary <[email protected]>, "
 MODULE_DESCRIPTION("Asus Generic WMI Driver");
 MODULE_LICENSE("GPL");
 
+static bool fnlock_default = true;
+module_param(fnlock_default, bool, 0444);
+
 #define to_asus_wmi_driver(pdrv)					\
 	(container_of((pdrv), struct asus_wmi_driver, platform_driver))
 
@@ -2673,7 +2676,7 @@ static int asus_wmi_add(struct platform_device *pdev)
 		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
 
 	if (asus_wmi_has_fnlock_key(asus)) {
-		asus->fnlock_locked = true;
+		asus->fnlock_locked = fnlock_default;
 		asus_wmi_fnlock_update(asus);
 	}
 
Signature · 1 line
2.31.0
#3 lore raw

Hi,

Quoted 6 lines · Luca Stefani

* On recent ZenBooks the fn-lock is disabled
by default on boot while running Windows.

* Add a module param ( fnlock_default ) that allows changing the default at probe time

Quoted 1 line

Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.

Regards,

Hans

Quoted 28 lines
---
 drivers/platform/x86/asus-wmi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +4 -1
index 9ca15f724343..ebaeb7bb80f5 100644
@@ -47,6 +47,9 @@ MODULE_AUTHOR("Corentin Chary <[email protected]>, "
 MODULE_DESCRIPTION("Asus Generic WMI Driver");
 MODULE_LICENSE("GPL");
 
+static bool fnlock_default = true;
+module_param(fnlock_default, bool, 0444);
+
 #define to_asus_wmi_driver(pdrv)					\
 	(container_of((pdrv), struct asus_wmi_driver, platform_driver))
 
@@ -2673,7 +2676,7 @@ static int asus_wmi_add(struct platform_device *pdev)
 		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
 
 	if (asus_wmi_has_fnlock_key(asus)) {
-		asus->fnlock_locked = true;
+		asus->fnlock_locked = fnlock_default;
 		asus_wmi_fnlock_update(asus);
 	}