summarylogtreecommitdiffstats
path: root/0012-asus-wmi-dgpu-tgp.patch
blob: 6f1d3e10b42887a6f5e4fc0619ca5a2e9c0c1a5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 904b138b305a668adb2920c14b70a46b7c4751ba Mon Sep 17 00:00:00 2001
From: "Luke D. Jones" <luke@ljones.dev>
Date: Sun, 26 May 2024 16:17:17 +1200
Subject: [PATCH 12/12] asus-wmi: dgpu tgp

Signed-off-by: Luke D. Jones <luke@ljones.dev>
---
 drivers/platform/x86/asus-wmi.c            | 11 +++++++++++
 include/linux/platform_data/x86/asus-wmi.h |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 8fef31c6bc6f..d4b679decbbf 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -119,6 +119,7 @@ module_param(fnlock_default, bool, 0444);
 #define PPT_CPU_MIN		5
 #define PPT_CPU_DEFAULT		80
 #define PPT_CPU_MAX_DEFAULT	100
+#define NVIDIA_GPU_POWER_MAX	70
 #define NVIDIA_BOOST_MIN	5
 #define NVIDIA_BOOST_MAX_DEFAULT	25
 #define NVIDIA_TEMP_MIN		75
@@ -783,6 +784,10 @@ ROG_ATTR_RW(nv_dynamic_boost, NVIDIA_BOOST_MIN, nv_dynamic_boost_max, ASUS_WMI_D
 /* Tunable: NVIDIA temperature target ****************************************/
 ROG_ATTR_RW(nv_temp_target, NVIDIA_TEMP_MIN, nv_temp_target_max, ASUS_WMI_DEVID_NV_THERM_TARGET);
 
+/* dGPU TGP setting **********************************************************/
+WMI_ATTR_SIMPLE_RO(dgpu_base_tgp, ASUS_WMI_DEVID_DGPU_BASE_TGP);
+WMI_ATTR_SIMPLE_RW(dgpu_set_tgp, 0, NVIDIA_GPU_POWER_MAX, ASUS_WMI_DEVID_DGPU_SET_TGP);
+
 /* Ally MCU Powersave ********************************************************/
 WMI_ATTR_SIMPLE_RW(mcu_powersave, 0, 1, ASUS_WMI_DEVID_MCU_POWERSAVE)
 
@@ -4212,6 +4217,8 @@ static struct attribute *platform_attributes[] = {
 	&dev_attr_boot_sound.attr,
 	&dev_attr_panel_od.attr,
 	&dev_attr_panel_fhd.attr,
+	&dev_attr_dgpu_base_tgp.attr,
+	&dev_attr_dgpu_set_tgp.attr,
 	&dev_attr_cores_enabled.attr,
 	&dev_attr_cores_max.attr,
 	&dev_attr_apu_mem.attr,
@@ -4288,6 +4295,10 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
 		devid = ASUS_WMI_DEVID_PANEL_OD;
 	else if (attr == &dev_attr_panel_fhd.attr)
 		devid = ASUS_WMI_DEVID_PANEL_FHD;
+	else if (attr == &dev_attr_dgpu_base_tgp.attr)
+		devid = ASUS_WMI_DEVID_DGPU_BASE_TGP;
+	else if (attr == &dev_attr_dgpu_set_tgp.attr)
+		ok = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_DGPU_SET_TGP);
 	else if (attr == &dev_attr_cores_enabled.attr
 		|| attr == &dev_attr_cores_max.attr)
 		ok = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_CORES_SET);
diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
index 30a3a4fdd43e..f9b18934c1ab 100644
--- a/include/linux/platform_data/x86/asus-wmi.h
+++ b/include/linux/platform_data/x86/asus-wmi.h
@@ -135,6 +135,9 @@
 /* dgpu on/off */
 #define ASUS_WMI_DEVID_DGPU		0x00090020
 
+#define ASUS_WMI_DEVID_DGPU_BASE_TGP	0x00120099
+#define ASUS_WMI_DEVID_DGPU_SET_TGP	0x00120098
+
 /* gpu mux switch, 0 = dGPU, 1 = Optimus */
 #define ASUS_WMI_DEVID_GPU_MUX		0x00090016
 #define ASUS_WMI_DEVID_GPU_MUX_VIVO	0x00090026
-- 
2.45.1