Merge tag 'thermal-7.2-rc1' of gitolite.kernel.org:pub/scm/linux/kernel/git/rafael/linux-pm

Pull thermal control updates from Rafael Wysocki:
 "These add new hardware support (i.MX93 TMU, Amlogic T7, Intel Arrow
  Lake, QCom Nord, Shikra and Hawi), fix issues in a number of places in
  the thermal control core and drivers, clean up code and refactor it in
  preparation for future changes:

   - Rework the initialization and cleanup of thermal class cooling
     devices to separate DT-based cooling device registration and
     cooling device registration without DT (Daniel Lezcano, Ovidiu
     Panait)

   - Update the cooling device DT bindings to support 3-cell cooling
     device representation, where the additional cell holds an ID to
     select a cooling mechanism for devices that offer multiple cooling
     mechanisms, and adjust the cooling device registration code
     accordingly (Gaurav Kohli, Daniel Lezcano)

   - Remove dead code from two functions in the thermal core and
     simplify the unregistration of thermal governors (Rafael Wysocki)

   - Fix critical temperature attribute removal handling in the generic
     thermal zone hwmon support code and rework that code to register a
     separate hwmon class device for each thermal zone (instead of using
     one hwmon class device for all thermal zones of the same type) to
     address thermal zone removal deadlocks (Rafael Wysocki)

   - Use attribute groups for adding temperature attributes to hwmon
     class devices associated with thermal zones (Rafael Wysocki)

   - Pass WQ_UNBOUND when allocating the thermal workqueue (Marco
     Crivellari)

   - Fix potential shift overflow in ptc_mmio_write() and improve error
     handling in proc_thermal_ptc_add() in the int340x thermal control
     driver (Aravind Anilraj)

   - Use sysfs_emit() for cpumask printing in the Intel powerclamp
     thermal driver (Yury Norov)

   - Add Arrow Lake CPU models to the intel_tcc_cooling driver (Srinivas
     Pandruvada)

   - Add QCom Nord, Shikra and Hawi temperature sensor DT bindings
     (Deepti Jaggi, Gaurav Kohli, Dipa Ramesh Mantre)

   - Use devm_add_action_or_reset() for clock disable on the NVidia
     soctherm and switch it to devm cooling device registration version
     (Daniel Lezcano)

   - Add the Amlogic T7 thermal sensor along with thermal calibration
     data read from SMC calls (Ronald Claveau)

   - Fix atomic temperature read in the QCom tsens driver to comply with
     hardware documentation (Priyansh Jain)

   - Add SpacemiT K1 thermal sensor support (Shuwei Wu)

   - Add i.MX93 temperature sensor support and filter out the invalid
     temperature (Jacky Bai)

   - Enable by default the TMU (Thermal Monitoring Unit) on Exynos
     platform (Krzysztof Kozlowski)

   - Rework interrupt initialization in the Tsens driver and add the
     optional wakeup source (Priyansh Jain)

   - Fix typo in a comment in the TSens QCom driver (Jinseok Kim)

   - Fix trailing whitespace and repeated word in the OF code, remove
     quoted string splitting across lines from the iMX7 driver, and
     remove a stray space from the thermal_trip_of_attr() macro
     definition (Mayur Kumar)

   - Update the thermal testing facility code to avoid NULL pointer
     dereferences by rejecting missing command arguments and replace
     sscanf() with kstrtoint() or kstrtoul() in that code (Ovidiu
     Panait, Samuel Moelius)"

* tag 'thermal-7.2-rc1' of gitolite.kernel.org:pub/scm/linux/kernel/git/rafael/linux-pm: (54 commits)
  thermal: sysfs: Replace sscanf() with kstrtoul()
  thermal: testing: Replace sscanf() with kstrtoint()
  thermal: testing: reject missing command arguments
  thermal: intel: intel_tcc_cooling: Add Arrow Lake CPU models
  thermal/drivers/qcom/tsens: Disable wakeup interrupt setup on automotive targets
  thermal/drivers/qcom/tsens: Switch wake IRQ handling to PM callbacks
  thermal/core: Fix missing stub for devm_thermal_cooling_device_register
  dt-bindings: thermal: cooling-devices: Update support for 3 cells cooling device
  thermal/of: Support cooling device ID in cooling-spec
  thermal/of: Pass cdev_id and introduce devm registration helper
  thermal/of: Add cooling device ID support
  thermal/of: Rename the devm_thermal_of_cooling_device_register() function
  thermal/core: Make cooling device OF node conditional on CONFIG_THERMAL_OF
  thermal/of: Move cooling device OF helpers out of thermal core
  hwmon: Use non-OF thermal cooling device registration API
  thermal/core: Add devm_thermal_cooling_device_register()
  thermal/core: Introduce non-OF thermal_cooling_device_register()
  thermal/drivers/samsung: Enable TMU by default
  thermal/driver/qoriq: Workaround unexpected temperature readings from tmu
  thermal/drivers/qoriq: Add i.MX93 tmu support
  ...
This commit is contained in:
Linus Torvalds
2026-06-15 11:35:11 +05:30
54 changed files with 1282 additions and 570 deletions
@@ -63,7 +63,8 @@ properties:
description: The PWM that is used to control the fan.
maxItems: 1
"#cooling-cells": true
"#cooling-cells":
const: 2
required:
- compatible
@@ -21,7 +21,9 @@ properties:
- amlogic,g12a-cpu-thermal
- amlogic,g12a-ddr-thermal
- const: amlogic,g12a-thermal
- const: amlogic,a1-cpu-thermal
- enum:
- amlogic,a1-cpu-thermal
- amlogic,t7-thermal
reg:
maxItems: 1
@@ -42,12 +44,34 @@ properties:
'#thermal-sensor-cells':
const: 0
amlogic,secure-monitor:
description: phandle to the secure monitor
$ref: /schemas/types.yaml#/definitions/phandle-array
items:
- items:
- description: phandle to the secure monitor
- description: sensor index to get specific calibration data
required:
- compatible
- reg
- interrupts
- clocks
- amlogic,ao-secure
allOf:
- if:
properties:
compatible:
contains:
enum:
- amlogic,a1-cpu-thermal
- amlogic,g12a-thermal
then:
required:
- amlogic,ao-secure
else:
required:
- amlogic,secure-monitor
unevaluatedProperties: false
@@ -62,4 +86,13 @@ examples:
#thermal-sensor-cells = <0>;
amlogic,ao-secure = <&sec_AO>;
};
- |
temperature-sensor@20000 {
compatible = "amlogic,t7-thermal";
reg = <0x0 0x20000 0x0 0x50>;
interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clkc_periphs CLKID_TS>;
#thermal-sensor-cells = <0>;
amlogic,secure-monitor = <&sm 1>;
};
...
@@ -56,8 +56,10 @@ properties:
- enum:
- qcom,eliza-tsens
- qcom,glymur-tsens
- qcom,hawi-tsens
- qcom,kaanapali-tsens
- qcom,milos-tsens
- qcom,nord-tsens
- qcom,msm8953-tsens
- qcom,msm8996-tsens
- qcom,msm8998-tsens
@@ -74,6 +76,7 @@ properties:
- qcom,sdm630-tsens
- qcom,sdm670-tsens
- qcom,sdm845-tsens
- qcom,shikra-tsens
- qcom,sm6115-tsens
- qcom,sm6350-tsens
- qcom,sm6375-tsens
@@ -25,6 +25,7 @@ properties:
enum:
- fsl,qoriq-tmu
- fsl,imx8mq-tmu
- fsl,imx93-tmu
reg:
maxItems: 1
@@ -0,0 +1,76 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/thermal/spacemit,k1-tsensor.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: SpacemiT K1 Thermal Sensor
description:
The SpacemiT K1 Thermal Sensor monitors the temperature of the SoC
using multiple internal sensors (e.g., soc, package, gpu, clusters).
maintainers:
- Shuwei Wu <shuwei.wu@mailbox.org>
$ref: thermal-sensor.yaml#
properties:
compatible:
const: spacemit,k1-tsensor
reg:
maxItems: 1
clocks:
items:
- description: Core clock for thermal sensor
- description: Bus clock for thermal sensor
clock-names:
items:
- const: core
- const: bus
interrupts:
maxItems: 1
resets:
items:
- description: Reset for the thermal sensor
"#thermal-sensor-cells":
const: 1
description:
The first cell indicates the sensor ID.
0 = soc
1 = package
2 = gpu
3 = cluster0
4 = cluster1
required:
- compatible
- reg
- clocks
- clock-names
- interrupts
- resets
- "#thermal-sensor-cells"
additionalProperties: false
examples:
- |
#include <dt-bindings/clock/spacemit,k1-syscon.h>
thermal@d4018000 {
compatible = "spacemit,k1-tsensor";
reg = <0xd4018000 0x100>;
clocks = <&syscon_apbc CLK_TSEN>,
<&syscon_apbc CLK_TSEN_BUS>;
clock-names = "core", "bus";
interrupts = <61>;
resets = <&syscon_apbc RESET_TSEN>;
#thermal-sensor-cells = <1>;
};
@@ -44,10 +44,14 @@ select: true
properties:
"#cooling-cells":
description:
Must be 2, in order to specify minimum and maximum cooling state used in
Must be 2 or 3. If 2, specifies minimum and maximum cooling state used in
the cooling-maps reference. The first cell is the minimum cooling state
and the second cell is the maximum cooling state requested.
const: 2
If 3, the first cell specifies the thermal mitigation device specifier
index for devices that support multiple thermal mitigation mechanisms.
The two other cells are respectively the minimum cooling state and the
maximum cooling state.
enum: [2, 3]
additionalProperties: true
@@ -211,7 +211,8 @@ patternProperties:
device. Using the THERMAL_NO_LIMIT (-1UL) constant in the
cooling-device phandle limit specifier lets the framework
use the minimum and maximum cooling state for that cooling
device automatically.
device automatically. If three arguments are specified,
the first argument is the cooling device specifier.
contribution:
$ref: /schemas/types.yaml#/definitions/uint32
+23 -5
View File
@@ -41,12 +41,13 @@ static const struct meson_sm_chip gxbb_chip = {
.cmd_shmem_in_base = 0x82000020,
.cmd_shmem_out_base = 0x82000021,
.cmd = {
CMD(SM_EFUSE_READ, 0x82000030),
CMD(SM_EFUSE_WRITE, 0x82000031),
CMD(SM_EFUSE_READ, 0x82000030),
CMD(SM_EFUSE_WRITE, 0x82000031),
CMD(SM_EFUSE_USER_MAX, 0x82000033),
CMD(SM_GET_CHIP_ID, 0x82000044),
CMD(SM_A1_PWRC_SET, 0x82000093),
CMD(SM_A1_PWRC_GET, 0x82000095),
CMD(SM_GET_CHIP_ID, 0x82000044),
CMD(SM_THERMAL_CALIB_READ, 0x82000047),
CMD(SM_A1_PWRC_SET, 0x82000093),
CMD(SM_A1_PWRC_GET, 0x82000095),
{ /* sentinel */ },
},
};
@@ -245,6 +246,23 @@ struct meson_sm_firmware *meson_sm_get(struct device_node *sm_node)
}
EXPORT_SYMBOL_GPL(meson_sm_get);
/**
* meson_sm_get_thermal_calib - Read thermal sensor calibration data.
* @fw: Pointer to secure-monitor firmware.
* @trim_info: Pointer to store the returned calibration data.
* @tsensor_id: Sensor index to identify which sensor's calibration data
* to retrieve
*
* Return: 0 on success, negative error code on failure.
*/
int meson_sm_get_thermal_calib(struct meson_sm_firmware *fw, u32 *trim_info,
u32 tsensor_id)
{
return meson_sm_call(fw, SM_THERMAL_CALIB_READ, trim_info, tsensor_id,
0, 0, 0, 0);
}
EXPORT_SYMBOL_GPL(meson_sm_get_thermal_calib);
#define SM_CHIP_ID_LENGTH 119
#define SM_CHIP_ID_OFFSET 4
#define SM_CHIP_ID_SIZE 12
+3 -2
View File
@@ -1791,8 +1791,9 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master,
int ret;
if (IS_ENABLED(CONFIG_DRM_ETNAVIV_THERMAL)) {
gpu->cooling = thermal_of_cooling_device_register(dev->of_node,
(char *)dev_name(dev), gpu, &cooling_ops);
gpu->cooling = thermal_of_cooling_device_register(dev->of_node, 0,
dev_name(dev),
gpu, &cooling_ops);
if (IS_ERR(gpu->cooling))
return PTR_ERR(gpu->cooling);
}
+1 -1
View File
@@ -1076,7 +1076,7 @@ static int amc6821_probe(struct i2c_client *client)
"Failed to initialize hwmon\n");
if (IS_ENABLED(CONFIG_THERMAL) && fan_np && data->fan_cooling_levels)
return PTR_ERR_OR_ZERO(devm_thermal_of_cooling_device_register(dev,
return PTR_ERR_OR_ZERO(devm_thermal_of_child_cooling_device_register(dev,
fan_np, client->name, data, &amc6821_cooling_ops));
return 0;
+3 -2
View File
@@ -841,8 +841,9 @@ static int aspeed_create_pwm_cooling(struct device *dev,
}
snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%pOFn%d", child, pwm_port);
cdev->tcdev = devm_thermal_of_cooling_device_register(dev, child,
cdev->name, cdev, &aspeed_pwm_cool_ops);
cdev->tcdev = devm_thermal_of_child_cooling_device_register(dev, child,
cdev->name, cdev,
&aspeed_pwm_cool_ops);
if (IS_ERR(cdev->tcdev))
return PTR_ERR(cdev->tcdev);
+2 -2
View File
@@ -532,8 +532,8 @@ static void cros_ec_hwmon_register_fan_cooling_devices(struct device *dev,
cpriv->hwmon_priv = priv;
cpriv->index = i;
cdev = devm_thermal_of_cooling_device_register(dev, NULL, type, cpriv,
&cros_ec_thermal_cooling_ops);
cdev = devm_thermal_cooling_device_register(dev, type, cpriv,
&cros_ec_thermal_cooling_ops);
if (IS_ERR(cdev)) {
dev_warn(dev, "failed to register fan %zu as a cooling device: %pe\n", i,
cdev);
+2 -2
View File
@@ -1161,8 +1161,8 @@ static int dell_smm_init_cdev(struct device *dev, u8 fan_num)
if (cdata) {
cdata->fan_num = fan_num;
cdata->data = data;
cdev = devm_thermal_of_cooling_device_register(dev, NULL, name, cdata,
&dell_smm_cooling_ops);
cdev = devm_thermal_cooling_device_register(dev, name, cdata,
&dell_smm_cooling_ops);
if (IS_ERR(cdev)) {
devm_kfree(dev, cdata);
ret = PTR_ERR(cdev);
+3 -3
View File
@@ -309,9 +309,9 @@ static int emc2305_set_single_tz(struct device *dev, struct device_node *fan_nod
pwm = data->pwm_min[cdev_idx];
data->cdev_data[cdev_idx].cdev =
devm_thermal_of_cooling_device_register(dev, fan_node,
emc2305_fan_name[idx], data,
&emc2305_cooling_ops);
devm_thermal_of_child_cooling_device_register(dev, fan_node,
emc2305_fan_name[idx], data,
&emc2305_cooling_ops);
if (IS_ERR(data->cdev_data[cdev_idx].cdev)) {
dev_err(dev, "Failed to register cooling device %s\n", emc2305_fan_name[idx]);
+4 -2
View File
@@ -592,8 +592,10 @@ static int gpio_fan_probe(struct platform_device *pdev)
}
/* Optional cooling device register for Device tree platforms */
fan_data->cdev = devm_thermal_of_cooling_device_register(dev, np,
"gpio-fan", fan_data, &gpio_fan_cool_ops);
fan_data->cdev = devm_thermal_of_child_cooling_device_register(dev, np,
"gpio-fan",
fan_data,
&gpio_fan_cool_ops);
dev_info(dev, "GPIO fan initialized\n");
+4 -2
View File
@@ -1082,6 +1082,7 @@ EXPORT_SYMBOL_GPL(hwmon_device_register_with_info);
* @dev: the parent device
* @name: hwmon name attribute
* @drvdata: driver data to attach to created device
* @extra_groups: pointer to list of additional non-standard attribute groups
*
* The use of this function is restricted. It is provided for legacy reasons
* and must only be called from the thermal subsystem.
@@ -1093,12 +1094,13 @@ EXPORT_SYMBOL_GPL(hwmon_device_register_with_info);
*/
struct device *
hwmon_device_register_for_thermal(struct device *dev, const char *name,
void *drvdata)
void *drvdata,
const struct attribute_group **extra_groups)
{
if (!name || !dev)
return ERR_PTR(-EINVAL);
return __hwmon_device_register(dev, name, drvdata, NULL, NULL);
return __hwmon_device_register(dev, name, drvdata, NULL, extra_groups);
}
EXPORT_SYMBOL_NS_GPL(hwmon_device_register_for_thermal, "HWMON_THERMAL");
+3 -3
View File
@@ -794,9 +794,9 @@ static int max6650_probe(struct i2c_client *client)
return err;
if (IS_ENABLED(CONFIG_THERMAL)) {
cooling_dev = devm_thermal_of_cooling_device_register(dev,
dev->of_node, client->name,
data, &max6650_cooling_ops);
cooling_dev = devm_thermal_of_child_cooling_device_register(dev, dev->of_node,
client->name, data,
&max6650_cooling_ops);
if (IS_ERR(cooling_dev)) {
dev_warn(dev, "thermal cooling device register failed: %ld\n",
PTR_ERR(cooling_dev));
+2 -2
View File
@@ -583,8 +583,8 @@ static int mlxreg_fan_cooling_config(struct device *dev, struct mlxreg_fan *fan)
pwm->fan = fan;
/* Set minimal PWM speed. */
pwm->last_hwmon_state = MLXREG_FAN_PWM_DUTY2STATE(MLXREG_FAN_MIN_DUTY);
pwm->cdev = devm_thermal_of_cooling_device_register(dev, NULL, mlxreg_fan_name[i],
pwm, &mlxreg_fan_cooling_ops);
pwm->cdev = devm_thermal_cooling_device_register(dev, mlxreg_fan_name[i],
pwm, &mlxreg_fan_cooling_ops);
if (IS_ERR(pwm->cdev)) {
dev_err(dev, "Failed to register cooling device\n");
return PTR_ERR(pwm->cdev);
+4 -2
View File
@@ -857,8 +857,10 @@ static int npcm7xx_create_pwm_cooling(struct device *dev,
snprintf(cdev->name, THERMAL_NAME_LENGTH, "%pOFn%d", child,
pwm_port);
cdev->tcdev = devm_thermal_of_cooling_device_register(dev, child,
cdev->name, cdev, &npcm7xx_pwm_cool_ops);
cdev->tcdev = devm_thermal_of_child_cooling_device_register(dev, child,
cdev->name,
cdev,
&npcm7xx_pwm_cool_ops);
if (IS_ERR(cdev->tcdev))
return PTR_ERR(cdev->tcdev);
+3 -2
View File
@@ -685,8 +685,9 @@ static int pwm_fan_probe(struct platform_device *pdev)
ctx->pwm_fan_state = ctx->pwm_fan_max_state;
if (IS_ENABLED(CONFIG_THERMAL)) {
cdev = devm_thermal_of_cooling_device_register(dev,
dev->of_node, "pwm-fan", ctx, &pwm_fan_cooling_ops);
cdev = devm_thermal_of_child_cooling_device_register(dev, dev->of_node,
"pwm-fan", ctx,
&pwm_fan_cooling_ops);
if (IS_ERR(cdev)) {
ret = PTR_ERR(cdev);
dev_err(dev,

Some files were not shown because too many files have changed in this diff Show More