diff mbox series

[1/3] UBUNTU: SAUCE: thermal: core: Add indication for userspace usage

Message ID 20201129173506.738561-2-kai.heng.feng@canonical.com
State New
Headers show
Series Prevent thermal shutdown during boot process | expand

Commit Message

Kai-Heng Feng Nov. 29, 2020, 5:35 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1906168

We are seeing thermal shutdown on Intel based mobile workstations, the
shutdown happens during the first trip handle in
kernel: thermal thermal_zone15: critical temperature reached (101 C), shutting down

However, we shouldn't do a thermal shutdown here, since
1) We may want to use a dedicated daemon, Intel's thermald in this case,
to handle thermal shutdown.

2) For ACPI based system, _CRT doesn't mean shutdown unless it's inside
ThermalZone. ACPI Spec, 11.4.4 _CRT (Critical Temperature):
"... If this object it present under a device, the device’s driver
evaluates this object to determine the device’s critical cooling
temperature trip point. This value may then be used by the device’s
driver to program an internal device temperature sensor trip point."

So a "critical trip" here merely means we should take a more aggressive
cooling method.

So add an indication to let thermal core know it should leave thermal
device to userspace to handle.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
 drivers/thermal/thermal_core.c | 3 +++
 include/linux/thermal.h        | 2 ++
 2 files changed, 5 insertions(+)
diff mbox series


diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 9a321dc548c8..5eb89dc0ff42 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -474,6 +474,9 @@  void thermal_zone_device_update(struct thermal_zone_device *tz,
 	int count;
+	if (tz->tzp && tz->tzp->userspace)
+		return;
 	if (atomic_read(&in_suspend))
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 126913c6a53b..b4ef84cd18ac 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -276,6 +276,8 @@  struct thermal_zone_params {
 	bool no_hwmon;
+	bool userspace;
 	int num_tbps;	/* Number of tbp entries */
 	struct thermal_bind_params *tbp;