Skip to content

Commit cee84c0

Browse files
committed
Merge tag 'thermal-6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull thermal control fixes from Rafael Wysocki: "These fix three issues introduced recently, two related to defects in ACPI tables supplied by the platform firmware and one cause by a thermal core change that went too far: - Prevent the thermal core from failing the registration of a cooling device if its .get_cur_state() reports an incorrect state to start with which may happen for fans handled through firmware-supplied AML in ACPI tables (Rafael Wysocki) - Make the ACPI thermal zone driver initialize all trip points with temperature of 0 centigrade and below as invalid because such trip point temperatures do not make sense on systems with ACPI thermal control and they cause performance regressions due to permanent thermal mitigations to occur (Rafael Wysocki) - Restore passive polling management in the Step-Wise thermal governor that uses it to ensure that all cooling devices used for thermal mitigation will go back to their initial states eventually (Rafael Wysocki)" * tag 'thermal-6.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: thermal: gov_step_wise: Restore passive polling management thermal: ACPI: Invalidate trip points with temperature of 0 or below thermal: core: Do not fail cdev registration because of invalid initial state
2 parents d20f6b3 + b684682 commit cee84c0

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

drivers/acpi/thermal.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,17 @@ static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz)
168168

169169
static int acpi_thermal_temp(struct acpi_thermal *tz, int temp_deci_k)
170170
{
171+
int temp;
172+
171173
if (temp_deci_k == THERMAL_TEMP_INVALID)
172174
return THERMAL_TEMP_INVALID;
173175

174-
return deci_kelvin_to_millicelsius_with_offset(temp_deci_k,
176+
temp = deci_kelvin_to_millicelsius_with_offset(temp_deci_k,
175177
tz->kelvin_offset);
178+
if (temp <= 0)
179+
return THERMAL_TEMP_INVALID;
180+
181+
return temp;
176182
}
177183

178184
static bool acpi_thermal_trip_valid(struct acpi_thermal_trip *acpi_trip)

drivers/thermal/gov_step_wise.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,23 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz,
9393
if (instance->initialized && old_target == instance->target)
9494
continue;
9595

96+
if (trip->type == THERMAL_TRIP_PASSIVE) {
97+
/*
98+
* If the target state for this thermal instance
99+
* changes from THERMAL_NO_TARGET to something else,
100+
* ensure that the zone temperature will be updated
101+
* (assuming enabled passive cooling) until it becomes
102+
* THERMAL_NO_TARGET again, or the cooling device may
103+
* not be reset to its initial state.
104+
*/
105+
if (old_target == THERMAL_NO_TARGET &&
106+
instance->target != THERMAL_NO_TARGET)
107+
tz->passive++;
108+
else if (old_target != THERMAL_NO_TARGET &&
109+
instance->target == THERMAL_NO_TARGET)
110+
tz->passive--;
111+
}
112+
96113
instance->initialized = true;
97114

98115
mutex_lock(&instance->cdev->lock);

drivers/thermal/thermal_core.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -999,9 +999,17 @@ __thermal_cooling_device_register(struct device_node *np,
999999
if (ret)
10001000
goto out_cdev_type;
10011001

1002+
/*
1003+
* The cooling device's current state is only needed for debug
1004+
* initialization below, so a failure to get it does not cause
1005+
* the entire cooling device initialization to fail. However,
1006+
* the debug will not work for the device if its initial state
1007+
* cannot be determined and drivers are responsible for ensuring
1008+
* that this will not happen.
1009+
*/
10021010
ret = cdev->ops->get_cur_state(cdev, &current_state);
10031011
if (ret)
1004-
goto out_cdev_type;
1012+
current_state = ULONG_MAX;
10051013

10061014
thermal_cooling_device_setup_sysfs(cdev);
10071015

@@ -1016,7 +1024,8 @@ __thermal_cooling_device_register(struct device_node *np,
10161024
return ERR_PTR(ret);
10171025
}
10181026

1019-
thermal_debug_cdev_add(cdev, current_state);
1027+
if (current_state <= cdev->max_state)
1028+
thermal_debug_cdev_add(cdev, current_state);
10201029

10211030
/* Add 'this' new cdev to the global cdev list */
10221031
mutex_lock(&thermal_list_lock);

0 commit comments

Comments
 (0)