[PATCH v3] platform/x86: asus-wmi: log thermal notification event

Jonathan Grant posted 1 patch 2 weeks, 5 days ago
drivers/platform/x86/asus-wmi.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
[PATCH v3] platform/x86: asus-wmi: log thermal notification event
Posted by Jonathan Grant 2 weeks, 5 days ago
From 4eb1a89ef5b481a8bd85bd68735b879e4ed6cb27 Mon Sep 17 00:00:00 2001
From: Jonathan Grant <jg@jguk.org>
Date: Sat, 14 Mar 2026 02:11:09 +0000
Subject: [PATCH] platform/x86: asus-wmi: log thermal notification event

Print a diagnostic message when the ASUS WMI interface receives event 0x6d.
This event was observed shortly before thermal shutdown on an ASUS N56VB under
heavy system load. The message helps diagnose unexpected thermal power-offs.

Signed-off-by: Jonathan Grant <jg@jguk.org>
---
v3:
 - do not change unrelated whitespace
 - address -Wdangling-else by adding braces

 drivers/platform/x86/asus-wmi.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 7c0915e097ba..3bdd92baac57 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -70,6 +70,7 @@ module_param(fnlock_default, bool, 0444);
 #define NOTIFY_KBD_TTP			0xae
 #define NOTIFY_LID_FLIP			0xfa
 #define NOTIFY_LID_FLIP_ROG		0xbd
+#define NOTIFY_THERMAL			0x6d
 
 #define ASUS_WMI_FNLOCK_BIOS_DISABLED	BIT(0)
 
@@ -4597,8 +4598,14 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
 		return;
 
 	if (!sparse_keymap_report_event(asus->inputdev, code,
-					key_value, autorelease))
-		pr_info("Unknown key code 0x%x\n", code);
+					key_value, autorelease)) {
+		if (code == NOTIFY_THERMAL) {
+			pr_info("Thermal state change\n");
+		}
+		else {
+			pr_info("Unknown key code 0x%x\n", code);
+		}
+	}
 }
 
 static void asus_wmi_notify(union acpi_object *obj, void *context)
-- 
2.43.0
Re: [PATCH v3] platform/x86: asus-wmi: log thermal notification event
Posted by Mario Limonciello 2 weeks, 5 days ago

On 3/17/2026 4:30 PM, Jonathan Grant wrote:
>  From 4eb1a89ef5b481a8bd85bd68735b879e4ed6cb27 Mon Sep 17 00:00:00 2001
> From: Jonathan Grant <jg@jguk.org>
> Date: Sat, 14 Mar 2026 02:11:09 +0000
> Subject: [PATCH] platform/x86: asus-wmi: log thermal notification event
> 
> Print a diagnostic message when the ASUS WMI interface receives event 0x6d.
> This event was observed shortly before thermal shutdown on an ASUS N56VB under
> heavy system load. The message helps diagnose unexpected thermal power-offs.
> 
> Signed-off-by: Jonathan Grant <jg@jguk.org>
> ---
> v3:
>   - do not change unrelated whitespace
>   - address -Wdangling-else by adding braces
> 
>   drivers/platform/x86/asus-wmi.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 7c0915e097ba..3bdd92baac57 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -70,6 +70,7 @@ module_param(fnlock_default, bool, 0444);
>   #define NOTIFY_KBD_TTP			0xae
>   #define NOTIFY_LID_FLIP			0xfa
>   #define NOTIFY_LID_FLIP_ROG		0xbd
> +#define NOTIFY_THERMAL			0x6d
>   
>   #define ASUS_WMI_FNLOCK_BIOS_DISABLED	BIT(0)
>   
> @@ -4597,8 +4598,14 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
>   		return;
>   
>   	if (!sparse_keymap_report_event(asus->inputdev, code,
> -					key_value, autorelease))
> -		pr_info("Unknown key code 0x%x\n", code);
> +					key_value, autorelease)) {
> +		if (code == NOTIFY_THERMAL) {
> +			pr_info("Thermal state change\n");

Why are you still sending NOTIFY_THERMAL to 
sparse_keymap_report_event()?  It will always fail.

Shouldn't you be catching this earlier in the function like how 
NOTIFY_KBD_FBM and NOTIFY_KBD_TTP work?

> +		}
> +		else {
> +			pr_info("Unknown key code 0x%x\n", code);
> +		}
> +	}
>   }
>   
>   static void asus_wmi_notify(union acpi_object *obj, void *context)