From f1d10e3d89d6132c6a69b5874ad754d80755e31b Mon Sep 17 00:00:00 2001
From: Ruslan Bay <67730802+ruslanbay@users.noreply.github.com>
Date: Sun, 6 Aug 2023 17:05:10 +0300
Subject: [PATCH] contrib/thermald: add surface pro 7 thermald configuration
Source:
https://github.com/linux-surface/linux-surface/issues/221
https://github.com/linux-surface/linux-surface/wiki/Surface-Pro-7/62482dd6d41d1450c948bd2f3903bc0e3af4c5f7
---
contrib/thermald/surface_pro_7/README.md | 51 +++++++++++++++++++
.../thermald/surface_pro_7/thermal-conf.xml | 27 ++++++++++
.../surface_pro_7/thermal-cpu-cdev-order.xml | 18 +++++++
3 files changed, 96 insertions(+)
create mode 100644 contrib/thermald/surface_pro_7/README.md
create mode 100644 contrib/thermald/surface_pro_7/thermal-conf.xml
create mode 100644 contrib/thermald/surface_pro_7/thermal-cpu-cdev-order.xml
diff --git a/contrib/thermald/surface_pro_7/README.md b/contrib/thermald/surface_pro_7/README.md
new file mode 100644
index 000000000..19ff3cd63
--- /dev/null
+++ b/contrib/thermald/surface_pro_7/README.md
@@ -0,0 +1,51 @@
+# Using thermald to avoid thermal throttling
+Install `thermald` for your distro, on many distros it might be installed by default.
+
+Create the config file `/etc/thermald/thermal-conf.xml` and add the following content to the file:
+
+```xml
+
+
+
+ Surface Pro 7 Thermal Workaround
+ *
+ QUIET
+
+
+ cpu
+
+
+ x86_pkg_temp
+ 65000
+ passive
+ SEQUENTIAL
+
+ 1
+ rapl_controller
+ 100
+ 10
+
+
+
+
+
+
+
+```
+Depending on your ambient temperature you might want to lower the `` line to make thermald kick in more aggressively. (65000 = 65°C)
+
+Create the file `/etc/thermald/thermal-cpu-cdev-order.xml` with the following content:
+```xml
+
+ rapl_controller
+ intel_pstate
+ intel_powerclamp
+ cpufreq
+ Processor
+
+```
+
+# Making Fedora respect your config files
+Fedora uses the `--adaptive` option by default, thus ignoring your config files. This might also apply to some other distros.
+
+Edit `/usr/lib/systemd/system/thermald.service` and remove `--adaptive` from the `ExecStart=` line. Then do a `systemctl daemon-reload` so systemd realizes the change. thermald should then respect your configuration files.
diff --git a/contrib/thermald/surface_pro_7/thermal-conf.xml b/contrib/thermald/surface_pro_7/thermal-conf.xml
new file mode 100644
index 000000000..4cf0da183
--- /dev/null
+++ b/contrib/thermald/surface_pro_7/thermal-conf.xml
@@ -0,0 +1,27 @@
+
+
+
+ Surface Pro 7 Thermal Workaround
+ *
+ QUIET
+
+
+ cpu
+
+
+ x86_pkg_temp
+ 65000
+ passive
+ SEQUENTIAL
+
+ 1
+ rapl_controller
+ 100
+ 10
+
+
+
+
+
+
+
diff --git a/contrib/thermald/surface_pro_7/thermal-cpu-cdev-order.xml b/contrib/thermald/surface_pro_7/thermal-cpu-cdev-order.xml
new file mode 100644
index 000000000..e690c5a26
--- /dev/null
+++ b/contrib/thermald/surface_pro_7/thermal-cpu-cdev-order.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+ rapl_controller
+ intel_pstate
+ intel_powerclamp
+ cpufreq
+ Processor
+
+