diff mbox series

[1/3] platform/x86: asus-wmi: Add userspace notification for performance mode change

Message ID 20200828214932.20866-2-rublag-ns@yandex.ru (mailing list archive)
State Accepted, archived
Headers show
Series platform/x86: asus-wmi: Improve TUF laptops support | expand

Commit Message

Vasiliy Kupriakov Aug. 28, 2020, 9:49 p.m. UTC
When user presses Fn-F5, the driver automatically changes throttle
thermal policy (or fan boost mode, depending on laptop model).

It would be convenient for userspace software to be able to poll on
corresponding sysfs variable. For example, to show a notification about
mode change.

Note that there is currently no way to handle Fn-F5 from userspace
directly, driver does not pass it.

Signed-off-by: Vasiliy Kupriakov <rublag-ns@yandex.ru>
---
 drivers/platform/x86/asus-wmi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Hans de Goede Nov. 24, 2020, 1:40 p.m. UTC | #1
Hi,

Quick self intro: I have take over drivers/platform/x86
maintainership from Andy; and I'm working my way through
the backlog of old patches in patchwork:
https://patchwork.kernel.org/project/platform-driver-x86/list/

On 8/28/20 11:49 PM, Vasiliy Kupriakov wrote:
> When user presses Fn-F5, the driver automatically changes throttle
> thermal policy (or fan boost mode, depending on laptop model).
> 
> It would be convenient for userspace software to be able to poll on
> corresponding sysfs variable. For example, to show a notification about
> mode change.
> 
> Note that there is currently no way to handle Fn-F5 from userspace
> directly, driver does not pass it.
> 
> Signed-off-by: Vasiliy Kupriakov <rublag-ns@yandex.ru>

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



> ---
>  drivers/platform/x86/asus-wmi.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 8f4acdc06b13..71559d429ba0 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -1660,6 +1660,10 @@ static int fan_boost_mode_write(struct asus_wmi *asus)
>  	pr_info("Set fan boost mode: %u\n", value);
>  	err = asus_wmi_set_devstate(ASUS_WMI_DEVID_FAN_BOOST_MODE, value,
>  				    &retval);
> +
> +	sysfs_notify(&asus->platform_device->dev.kobj, NULL,
> +			"fan_boost_mode");
> +
>  	if (err) {
>  		pr_warn("Failed to set fan boost mode: %d\n", err);
>  		return err;
> @@ -1771,6 +1775,10 @@ static int throttle_thermal_policy_write(struct asus_wmi *asus)
>  
>  	err = asus_wmi_set_devstate(ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY,
>  				    value, &retval);
> +
> +	sysfs_notify(&asus->platform_device->dev.kobj, NULL,
> +			"throttle_thermal_policy");
> +
>  	if (err) {
>  		pr_warn("Failed to set throttle thermal policy: %d\n", err);
>  		return err;
>
diff mbox series

Patch

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 8f4acdc06b13..71559d429ba0 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1660,6 +1660,10 @@  static int fan_boost_mode_write(struct asus_wmi *asus)
 	pr_info("Set fan boost mode: %u\n", value);
 	err = asus_wmi_set_devstate(ASUS_WMI_DEVID_FAN_BOOST_MODE, value,
 				    &retval);
+
+	sysfs_notify(&asus->platform_device->dev.kobj, NULL,
+			"fan_boost_mode");
+
 	if (err) {
 		pr_warn("Failed to set fan boost mode: %d\n", err);
 		return err;
@@ -1771,6 +1775,10 @@  static int throttle_thermal_policy_write(struct asus_wmi *asus)
 
 	err = asus_wmi_set_devstate(ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY,
 				    value, &retval);
+
+	sysfs_notify(&asus->platform_device->dev.kobj, NULL,
+			"throttle_thermal_policy");
+
 	if (err) {
 		pr_warn("Failed to set throttle thermal policy: %d\n", err);
 		return err;