Skip to contentSkip to conversation

platform/x86: asus_wmi: Support of ASUS TUF laptops on Ryzen CPUs

PATCH New Leonid Maksymchuk 1 participant 3 messages Dec 15, 2019

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

v6 cover platform/x86: asus_wmi: Support of ASUS TUF laptops on Ryzen CPUs

Hi,

this patch series adds support of Throttle themal policy ACPI device to existing asus_wmi platform driver. Support of this device is required for ASUS TUF laptops on Ryzen CPUs to properly work on Linux.

v2: fixed indentation.
v3: patches 2/3 and 3/3 are refactored.
v4: patch 2/3 are simplified.
v5: add new device instead of merging with fan boost mode.
v6: document new ABI, simplify code.

Leonid Maksymchuk (2):
platform/x86: asus_wmi: Support throttle thermal policy platform/x86: asus_wmi: Set throttle thermal policy to default

 .../ABI/testing/sysfs-platform-asus-wmi       |  10 ++
 drivers/platform/x86/asus-wmi.c               | 124 ++++++++++++++++++
 include/linux/platform_data/x86/asus-wmi.h    |   1 +
 3 files changed, 135 insertions(+)
Signature · 1 line
2.24.0
#1 lore raw

PATCH v6 1/2 platform/x86: asus_wmi: Support throttle thermal policy

Throttle thermal policy ACPI device is used to control CPU cooling and throttling. This patch adds sysfs entry for setting current mode and Fn+F5 hotkey that switches to next.

Policy modes:
* 0x00 - default
* 0x01 - overboost
* 0x02 - silent

---
 .../ABI/testing/sysfs-platform-asus-wmi       |  10 ++
 drivers/platform/x86/asus-wmi.c               | 113 ++++++++++++++++++
 include/linux/platform_data/x86/asus-wmi.h    |   1 +
 3 files changed, 124 insertions(+)
Documentation/ABI/testing/sysfs-platform-asus-wmi +10 -0
index 9e99f2909612..1efac0ddb417 100644
@@ -46,3 +46,13 @@ Description:
 			* 0 - normal,
 			* 1 - overboost,
 			* 2 - silent
+
+What:		/sys/devices/platform/<platform>/throttle_thermal_policy
+Date:		Dec 2019
+KernelVersion:	5.6
+Contact:	"Leonid Maksymchuk" <[email protected]>
+Description:
+		Throttle thermal policy mode:
+			* 0 - default,
+			* 1 - overboost,
+			* 2 - silent
drivers/platform/x86/asus-wmi.c +113 -0

167 lines not on this page · raw message

include/linux/platform_data/x86/asus-wmi.h +1 -0
index 60249e22e844..d39fc658c320 100644
@@ -58,6 +58,7 @@
 #define ASUS_WMI_DEVID_LIGHT_SENSOR	0x00050022 /* ?? */
 #define ASUS_WMI_DEVID_LIGHTBAR		0x00050025
 #define ASUS_WMI_DEVID_FAN_BOOST_MODE	0x00110018
+#define ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY 0x00120075
 
 /* Misc */
 #define ASUS_WMI_DEVID_CAMERA		0x00060013
Signature · 1 line
2.24.0
#2 lore raw

PATCH v6 2/2 platform/x86: asus_wmi: Set throttle thermal policy to default

In reply to Leonid Maksymchuk

ASUS TUF FX705DY/FX505DY starts in silent mode and under heavy CPU load it overheats and drops CPU frequency to 399MHz and stays at it until reboot [1]. Set throttle thermal policy to default to avoid overheating and throttlig.

[1] Link: https://bugzilla.kernel.org/show_bug.cgi?id=203733

---
 drivers/platform/x86/asus-wmi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/platform/x86/asus-wmi.c +11 -0
index f10ec9d745e5..469f1a852719 100644
@@ -1780,6 +1780,15 @@ static int throttle_thermal_policy_write(struct asus_wmi *asus)
 	return 0;
 }
 
+static int throttle_thermal_policy_set_default(struct asus_wmi *asus)
+{
+	if (!asus->throttle_thermal_policy_available)
+		return 0;
+
+	asus->throttle_thermal_policy_mode = ASUS_THROTTLE_THERMAL_POLICY_DEFAULT;
+	return throttle_thermal_policy_write(asus);
+}
+
 static int throttle_thermal_policy_switch_next(struct asus_wmi *asus)
 {
 	u8 new_mode = asus->throttle_thermal_policy_mode + 1;
@@ -2548,6 +2557,8 @@ static int asus_wmi_add(struct platform_device *pdev)
 	err = throttle_thermal_policy_check_present(asus);
 	if (err)
 		goto fail_throttle_thermal_policy;
+	else
+		throttle_thermal_policy_set_default(asus);
 
 	err = asus_wmi_sysfs_init(asus->platform_device);
 	if (err)
Signature · 1 line
2.24.0