From 6d3e2ce6f10107c2e5870e9dce7c2e1d03a6be72 Mon Sep 17 00:00:00 2001 From: Srinivas Pandruvada Date: Mon, 23 Feb 2026 11:04:20 -0800 Subject: thermal: intel: int340x: Read DDR data rate for Nova Lake Add support for reading DDR data rate from PCI config offset. The register details are: CFG Offset : 0xE0 Bits : 11:2 DDR Data rate is in 33.33 MTPS units. Signed-off-by: Srinivas Pandruvada [ rjw: Rearrange code to avoid using goto and make declarations consistent ] Link: https://patch.msgid.link/20260223190420.874853-1-srinivas.pandruvada@linux.intel.com Signed-off-by: Rafael J. Wysocki --- .../intel/int340x_thermal/processor_thermal_rfim.c | 25 +++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c index 314fbc1f490f..1a7e134dfcf8 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c @@ -402,17 +402,31 @@ static ssize_t rfi_restriction_show(struct device *dev, return sysfs_emit(buf, "%llu\n", resp); } + /* ddr_data_rate */ +static const struct mmio_reg nvl_ddr_data_rate_reg = { 1, 0xE0, 10, 0x3FF, 2}; + +static const struct mmio_reg *ddr_data_rate_reg; + static ssize_t ddr_data_rate_show(struct device *dev, struct device_attribute *attr, char *buf) { - u16 id = 0x0107; u64 resp; - int ret; - ret = processor_thermal_send_mbox_read_cmd(to_pci_dev(dev), id, &resp); - if (ret) - return ret; + if (ddr_data_rate_reg) { + u16 reg_val; + + pci_read_config_word(to_pci_dev(dev), ddr_data_rate_reg->offset, ®_val); + resp = (reg_val >> ddr_data_rate_reg->shift) & ddr_data_rate_reg->mask; + resp = (resp * 3333) / 100; + } else { + const u16 id = 0x0107; + int ret; + + ret = processor_thermal_send_mbox_read_cmd(to_pci_dev(dev), id, &resp); + if (ret) + return ret; + } return sysfs_emit(buf, "%llu\n", resp); } @@ -461,6 +475,7 @@ int proc_thermal_rfim_add(struct pci_dev *pdev, struct proc_thermal_device *proc case PCI_DEVICE_ID_INTEL_NVL_H_THERMAL: case PCI_DEVICE_ID_INTEL_NVL_S_THERMAL: dlvr_mmio_regs_table = nvl_dlvr_mmio_regs; + ddr_data_rate_reg = &nvl_ddr_data_rate_reg; break; default: dlvr_mmio_regs_table = dlvr_mmio_regs; -- cgit v1.2.3 From 5ddd020b8bd0fb2fdcdc1f8c40513c656a690f80 Mon Sep 17 00:00:00 2001 From: Thorsten Blum Date: Mon, 23 Feb 2026 08:32:45 +0100 Subject: thermal: core: Replace sprintf() in thermal_bind_cdev_to_trip() Replace unbounded sprintf() with the safer snprintf(). While the current code works correctly, snprintf() is safer and follows secure coding best practices. No functional changes. Signed-off-by: Thorsten Blum Reviewed-by: Lukasz Luba [ rjw: Subject tweaks ] Link: https://patch.msgid.link/20260223073245.321298-2-thorsten.blum@linux.dev Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index b7d706ed7ed9..479916b67f48 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -861,7 +861,7 @@ static int thermal_bind_cdev_to_trip(struct thermal_zone_device *tz, goto free_mem; dev->id = result; - sprintf(dev->name, "cdev%d", dev->id); + snprintf(dev->name, sizeof(dev->name), "cdev%d", dev->id); result = sysfs_create_link(&tz->device.kobj, &cdev->device.kobj, dev->name); if (result) -- cgit v1.2.3 From d161cbd68531eeb4f7cf339d75ee2c761fd8a1aa Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Thu, 5 Mar 2026 17:35:07 +0100 Subject: thermal/of: Add OF node address to output message Temperature sensors are supposed to have the DT node name temperature-sensors. Having multiple ones the node name alone isn't very helpful. Add the node address to make them more distinguishable. Signed-off-by: Alexander Stein Reviewed-by: Lukasz Luba Link: https://patch.msgid.link/20260305163508.2643106-1-alexander.stein@ew.tq-group.com Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_of.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 6ebb83cb70b2..99085c806a1f 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -144,7 +144,7 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int count = of_count_phandle_with_args(child, "thermal-sensors", "#thermal-sensor-cells"); if (count <= 0) { - pr_err("%pOFn: missing thermal sensor\n", child); + pr_err("%pOFP: missing thermal sensor\n", child); return ERR_PTR(-EINVAL); } @@ -156,14 +156,14 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int "#thermal-sensor-cells", i, &sensor_specs); if (ret < 0) { - pr_err("%pOFn: Failed to read thermal-sensors cells: %d\n", child, ret); + pr_err("%pOFP: Failed to read thermal-sensors cells: %d\n", child, ret); return ERR_PTR(ret); } of_node_put(sensor_specs.np); if ((sensor == sensor_specs.np) && id == (sensor_specs.args_count ? sensor_specs.args[0] : 0)) { - pr_debug("sensor %pOFn id=%d belongs to %pOFn\n", sensor, id, child); + pr_debug("sensor %pOFP id=%d belongs to %pOFP\n", sensor, id, child); return no_free_ptr(child); } } @@ -180,7 +180,7 @@ static int thermal_of_monitor_init(struct device_node *np, int *delay, int *pdel if (ret == -EINVAL) { *pdelay = 0; } else if (ret < 0) { - pr_err("%pOFn: Couldn't get polling-delay-passive: %d\n", np, ret); + pr_err("%pOFP: Couldn't get polling-delay-passive: %d\n", np, ret); return ret; } @@ -188,7 +188,7 @@ static int thermal_of_monitor_init(struct device_node *np, int *delay, int *pdel if (ret == -EINVAL) { *delay = 0; } else if (ret < 0) { - pr_err("%pOFn: Couldn't get polling-delay: %d\n", np, ret); + pr_err("%pOFP: Couldn't get polling-delay: %d\n", np, ret); return ret; } @@ -380,23 +380,23 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node * np = of_thermal_zone_find(sensor, id); if (IS_ERR(np)) { if (PTR_ERR(np) != -ENODEV) - pr_err("Failed to find thermal zone for %pOFn id=%d\n", sensor, id); + pr_err("Failed to find thermal zone for %pOFP id=%d\n", sensor, id); return ERR_CAST(np); } trips = thermal_of_trips_init(np, &ntrips); if (IS_ERR(trips)) { - pr_err("Failed to parse trip points for %pOFn id=%d\n", sensor, id); + pr_err("Failed to parse trip points for %pOFP id=%d\n", sensor, id); ret = PTR_ERR(trips); goto out_of_node_put; } if (!trips) - pr_info("No trip points found for %pOFn id=%d\n", sensor, id); + pr_info("No trip points found for %pOFP id=%d\n", sensor, id); ret = thermal_of_monitor_init(np, &delay, &pdelay); if (ret) { - pr_err("Failed to initialize monitoring delays from %pOFn\n", np); + pr_err("Failed to initialize monitoring delays from %pOFP\n", np); goto out_kfree_trips; } @@ -417,7 +417,7 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node * pdelay, delay); if (IS_ERR(tz)) { ret = PTR_ERR(tz); - pr_err("Failed to register thermal zone %pOFn: %d\n", np, ret); + pr_err("Failed to register thermal zone %pOFP: %d\n", np, ret); goto out_kfree_trips; } -- cgit v1.2.3 From a3618f3ca6a6dc5cb185d70626c28836b86e8256 Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Fri, 6 Mar 2026 14:30:16 +0100 Subject: thermal/drivers/imx91: Add hwmon support Expose thermal readings as a HWMON device, so that it could be accessed using lm-sensors. Signed-off-by: Alexander Stein Link: https://patch.msgid.link/20260306133017.3189979-1-alexander.stein@ew.tq-group.com Signed-off-by: Daniel Lezcano --- drivers/thermal/imx91_thermal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/thermal/imx91_thermal.c b/drivers/thermal/imx91_thermal.c index 9b20be03d6de..25915bb702be 100644 --- a/drivers/thermal/imx91_thermal.c +++ b/drivers/thermal/imx91_thermal.c @@ -17,6 +17,8 @@ #include #include +#include "thermal_hwmon.h" + #define REG_SET 0x4 #define REG_CLR 0x8 #define REG_TOG 0xc @@ -318,6 +320,8 @@ static int imx91_tmu_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(tmu->tzd), "failed to register thermal zone sensor\n"); + devm_thermal_add_hwmon_sysfs(dev, tmu->tzd); + irq = platform_get_irq(pdev, 0); if (irq < 0) return irq; -- cgit v1.2.3 From 83c0f9a5d679a6f8d84fc49b2f62ea434ccab4b6 Mon Sep 17 00:00:00 2001 From: Thorsten Blum Date: Sat, 7 Mar 2026 11:24:20 +0100 Subject: thermal/drivers/sprd: Fix temperature clamping in sprd_thm_temp_to_rawdata The temperature was never clamped to SPRD_THM_TEMP_LOW or SPRD_THM_TEMP_HIGH because the return value of clamp() was not used. Fix this by assigning the clamped value to 'temp'. Casting SPRD_THM_TEMP_LOW and SPRD_THM_TEMP_HIGH to int is also redundant and can be removed. Fixes: 554fdbaf19b1 ("thermal: sprd: Add Spreadtrum thermal driver support") Signed-off-by: Thorsten Blum Signed-off-by: Daniel Lezcano Reviewed-by: Baolin Wang Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260307102422.306055-1-thorsten.blum@linux.dev --- drivers/thermal/sprd_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index e546067c9621..70c879e75d85 100644 --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -192,7 +192,7 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sprd_thermal_sensor *sen) { u32 val; - clamp(temp, (int)SPRD_THM_TEMP_LOW, (int)SPRD_THM_TEMP_HIGH); + temp = clamp(temp, SPRD_THM_TEMP_LOW, SPRD_THM_TEMP_HIGH); /* * According to the thermal datasheet, the formula of converting -- cgit v1.2.3 From b3414148bbc1f9cd56217e58a558c6ac4fd1b4a6 Mon Sep 17 00:00:00 2001 From: Thorsten Blum Date: Sat, 7 Mar 2026 11:24:21 +0100 Subject: thermal/drivers/sprd: Fix raw temperature clamping in sprd_thm_rawdata_to_temp The raw temperature data was never clamped to SPRD_THM_RAW_DATA_LOW or SPRD_THM_RAW_DATA_HIGH because the return value of clamp() was not used. Fix this by assigning the clamped value to 'rawdata'. Casting SPRD_THM_RAW_DATA_LOW and SPRD_THM_RAW_DATA_HIGH to u32 is also redundant and can be removed. Fixes: 554fdbaf19b1 ("thermal: sprd: Add Spreadtrum thermal driver support") Signed-off-by: Thorsten Blum Signed-off-by: Daniel Lezcano Reviewed-by: Baolin Wang Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260307102422.306055-2-thorsten.blum@linux.dev --- drivers/thermal/sprd_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index 70c879e75d85..44fa45f74da7 100644 --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -178,7 +178,7 @@ static int sprd_thm_sensor_calibration(struct device_node *np, static int sprd_thm_rawdata_to_temp(struct sprd_thermal_sensor *sen, u32 rawdata) { - clamp(rawdata, (u32)SPRD_THM_RAW_DATA_LOW, (u32)SPRD_THM_RAW_DATA_HIGH); + rawdata = clamp(rawdata, SPRD_THM_RAW_DATA_LOW, SPRD_THM_RAW_DATA_HIGH); /* * According to the thermal datasheet, the formula of converting -- cgit v1.2.3 From 015c4506c356e3bf23b31fd68b913a53f32d4924 Mon Sep 17 00:00:00 2001 From: Richard Acayan Date: Mon, 9 Mar 2026 20:20:35 -0400 Subject: dt-bindings: thermal: tsens: add SDM670 compatible Add the compatible for the thermal sensors on the SDM670. Signed-off-by: Richard Acayan Reviewed-by: Krzysztof Kozlowski Link: https://patch.msgid.link/20260310002037.1863-2-mailingradian@gmail.com Signed-off-by: Daniel Lezcano --- Documentation/devicetree/bindings/thermal/qcom-tsens.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml index 3c5256b0cd9f..6c84f22ae322 100644 --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml @@ -71,6 +71,7 @@ properties: - qcom,sc8180x-tsens - qcom,sc8280xp-tsens - qcom,sdm630-tsens + - qcom,sdm670-tsens - qcom,sdm845-tsens - qcom,sm6115-tsens - qcom,sm6350-tsens -- cgit v1.2.3 From a53a67b1fe94e4a4a3b05edb6bf52e74676e8de2 Mon Sep 17 00:00:00 2001 From: Richard Acayan Date: Mon, 9 Mar 2026 20:20:36 -0400 Subject: dt-bindings: thermal: lmh: Add SDM670 compatible Document the SDM670 LMh. Signed-off-by: Richard Acayan Reviewed-by: Krzysztof Kozlowski Link: https://patch.msgid.link/20260310002037.1863-3-mailingradian@gmail.com Signed-off-by: Daniel Lezcano --- Documentation/devicetree/bindings/thermal/qcom-lmh.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/thermal/qcom-lmh.yaml b/Documentation/devicetree/bindings/thermal/qcom-lmh.yaml index 1175bb358382..ce72347e29d1 100644 --- a/Documentation/devicetree/bindings/thermal/qcom-lmh.yaml +++ b/Documentation/devicetree/bindings/thermal/qcom-lmh.yaml @@ -22,6 +22,9 @@ properties: - qcom,sc8180x-lmh - qcom,sdm845-lmh - qcom,sm8150-lmh + - items: + - const: qcom,sdm670-lmh + - const: qcom,sdm845-lmh - items: - const: qcom,qcm2290-lmh - const: qcom,sm8150-lmh -- cgit v1.2.3 From 94ff50f41472391f7a5b98fd9801dfc361db8957 Mon Sep 17 00:00:00 2001 From: Thorsten Blum Date: Tue, 10 Mar 2026 11:25:25 +0100 Subject: thermal/drivers/sprd: Use min instead of clamp in sprd_thm_temp_to_rawdata Clamping 'val' to itself is unnecessary and the expression can be simplified by using min() instead. Casting SPRD_THM_RAW_DATA_HIGH to u32 is also redundant and can be removed. Reviewed-by: Baolin Wang Reviewed-by: Lukasz Luba Signed-off-by: Thorsten Blum Link: https://patch.msgid.link/20260310102523.201722-3-thorsten.blum@linux.dev Signed-off-by: Daniel Lezcano --- drivers/thermal/sprd_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/sprd_thermal.c b/drivers/thermal/sprd_thermal.c index 44fa45f74da7..d683fcb0f8ab 100644 --- a/drivers/thermal/sprd_thermal.c +++ b/drivers/thermal/sprd_thermal.c @@ -201,7 +201,7 @@ static int sprd_thm_temp_to_rawdata(int temp, struct sprd_thermal_sensor *sen) */ val = (temp + sen->cal_offset) / sen->cal_slope; - return clamp(val, val, (u32)(SPRD_THM_RAW_DATA_HIGH - 1)); + return min(val, SPRD_THM_RAW_DATA_HIGH - 1); } static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp) -- cgit v1.2.3 From 9124e0e8f3fa39b32feb5cb756de10a265e9d8f0 Mon Sep 17 00:00:00 2001 From: Manaf Meethalavalappu Pallikunhi Date: Fri, 13 Mar 2026 16:04:17 +0530 Subject: dt-bindings: thermal: qcom-tsens: Document the SM8750 Temperature Sensor Document the Temperature Sensor (TSENS) on the SM8750 SoC. Signed-off-by: Manaf Meethalavalappu Pallikunhi Signed-off-by: Gaurav Kohli Reviewed-by: Krzysztof Kozlowski Link: https://patch.msgid.link/20260313-sm8750_tsens-v1-1-250fcc3794a2@oss.qualcomm.com Signed-off-by: Daniel Lezcano --- Documentation/devicetree/bindings/thermal/qcom-tsens.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml index 6c84f22ae322..928243cd2883 100644 --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml @@ -82,6 +82,7 @@ properties: - qcom,sm8450-tsens - qcom,sm8550-tsens - qcom,sm8650-tsens + - qcom,sm8750-tsens - qcom,x1e80100-tsens - const: qcom,tsens-v2 -- cgit v1.2.3 From 2dc1b0dd4bbfa2a27e5432300d1c18eb51c7efed Mon Sep 17 00:00:00 2001 From: Thorsten Blum Date: Wed, 11 Mar 2026 17:42:14 +0100 Subject: thermal: sysfs: Use str_enabled_disabled() helper in mode_show() Replace hard-coded strings with the str_enabled_disabled() helper. This unifies the output and helps the linker with deduplication, which may result in a smaller binary. Signed-off-by: Thorsten Blum [ rjw: Subject and changelog tweaks ] Link: https://patch.msgid.link/20260311164212.405981-3-thorsten.blum@linux.dev Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_sysfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index 46b3b2df935c..5eecae13f07d 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "thermal_core.h" @@ -56,10 +57,8 @@ mode_show(struct device *dev, struct device_attribute *attr, char *buf) guard(thermal_zone)(tz); - if (tz->mode == THERMAL_DEVICE_ENABLED) - return sysfs_emit(buf, "enabled\n"); - - return sysfs_emit(buf, "disabled\n"); + return sysfs_emit(buf, "%s\n", + str_enabled_disabled(tz->mode == THERMAL_DEVICE_ENABLED)); } static ssize_t -- cgit v1.2.3 From 40927abf2fed04cd242b269720ce0192604e2027 Mon Sep 17 00:00:00 2001 From: Yury Norov Date: Sat, 14 Mar 2026 15:10:15 -0400 Subject: thermal: intel: hfi: use cpumask_empty() in intel_hfi_offline() cpumask_empty() is more efficient as it may return earlier. Switch to using it. Signed-off-by: Yury Norov Link: https://patch.msgid.link/20260314191016.603067-1-ynorov@nvidia.com Signed-off-by: Rafael J. Wysocki --- drivers/thermal/intel/intel_hfi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c index 1a1a95b39405..8c4ae75231f8 100644 --- a/drivers/thermal/intel/intel_hfi.c +++ b/drivers/thermal/intel/intel_hfi.c @@ -526,7 +526,7 @@ void intel_hfi_offline(unsigned int cpu) mutex_lock(&hfi_instance_lock); cpumask_clear_cpu(cpu, hfi_instance->cpus); - if (!cpumask_weight(hfi_instance->cpus)) + if (cpumask_empty(hfi_instance->cpus)) hfi_disable(); mutex_unlock(&hfi_instance_lock); -- cgit v1.2.3 From 945471425a374e15a0d1a85b35913e1acdcd4a99 Mon Sep 17 00:00:00 2001 From: Anas Iqbal Date: Mon, 23 Mar 2026 09:40:18 +0000 Subject: thermal: devfreq_cooling: avoid unnecessary kfree of freq_table dfc->freq_table is only allocated in the non-EM path via devfreq_cooling_gen_tables(). In the EM path, it remains NULL. Avoid calling kfree() unnecessarily when freq_table was never allocated. This resolves a Smatch warning: calling kfree() when 'dfc->freq_table' is always NULL. Signed-off-by: Anas Iqbal Reviewed-by: Lukasz Luba Link: https://patch.msgid.link/20260323094018.2264-1-mohd.abd.6602@gmail.com Signed-off-by: Rafael J. Wysocki --- drivers/thermal/devfreq_cooling.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c index 597e86d16a4e..1c7dffc8d45f 100644 --- a/drivers/thermal/devfreq_cooling.c +++ b/drivers/thermal/devfreq_cooling.c @@ -472,7 +472,8 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df, remove_qos_req: dev_pm_qos_remove_request(&dfc->req_max_freq); free_table: - kfree(dfc->freq_table); + if (!dfc->em_pd) + kfree(dfc->freq_table); free_dfc: kfree(dfc); -- cgit v1.2.3 From 85f18eddf0761c8f9d9af93251febf4b8813d659 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Fri, 27 Mar 2026 11:07:34 +0100 Subject: dt-bindings: thermal: qcom-tsens: Add Eliza SoC TSENS Document the compatible for Qualcomm Eliza SoC TSENS module, fully compatible with TSENS v2 generation (e.g. SM8650). Acked-by: Rob Herring (Arm) Reviewed-by: Konrad Dybcio Signed-off-by: Krzysztof Kozlowski Link: https://patch.msgid.link/20260327100733.365573-2-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Daniel Lezcano --- Documentation/devicetree/bindings/thermal/qcom-tsens.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml index 928243cd2883..7d34ba00e684 100644 --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.yaml @@ -54,6 +54,7 @@ properties: - description: v2 of TSENS items: - enum: + - qcom,eliza-tsens - qcom,glymur-tsens - qcom,kaanapali-tsens - qcom,milos-tsens -- cgit v1.2.3 From da2c4f332a0504d9c284e7626a561d343c8d6f57 Mon Sep 17 00:00:00 2001 From: Gopi Krishna Menon Date: Fri, 27 Mar 2026 14:35:24 +0530 Subject: thermal/drivers/spear: Fix error condition for reading st,thermal-flags of_property_read_u32 returns 0 on success. The current check returns -EINVAL if the property is read successfully. Fix the check by removing ! from of_property_read_u32 Fixes: b9c7aff481f1 ("drivers/thermal/spear_thermal.c: add Device Tree probing capability") Signed-off-by: Gopi Krishna Menon Signed-off-by: Daniel Lezcano Suggested-by: Daniel Baluta Reviewed-by: Lukasz Luba Link: https://patch.msgid.link/20260327090526.59330-1-krishnagopi487@gmail.com --- drivers/thermal/spear_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c index 603dadcd3df5..5e3e9c1f32f8 100644 --- a/drivers/thermal/spear_thermal.c +++ b/drivers/thermal/spear_thermal.c @@ -93,7 +93,7 @@ static int spear_thermal_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; int ret = 0, val; - if (!np || !of_property_read_u32(np, "st,thermal-flags", &val)) { + if (!np || of_property_read_u32(np, "st,thermal-flags", &val)) { dev_err(&pdev->dev, "Failed: DT Pdata not passed\n"); return -EINVAL; } -- cgit v1.2.3 From 8f271fe15eaef9eeed6229a78adf6565cc554b63 Mon Sep 17 00:00:00 2001 From: Gopi Krishna Menon Date: Sun, 29 Mar 2026 18:04:43 +0530 Subject: dt-bindings: thermal: st,thermal-spear1340: convert to dtschema Convert the SPEAr Thermal Sensor bindings to DT schema. Signed-off-by: Gopi Krishna Menon Signed-off-by: Daniel Lezcano Reviewed-by: Krzysztof Kozlowski Acked-by: Viresh Kumar Link: https://patch.msgid.link/20260329123449.309814-2-krishnagopi487@gmail.com --- .../devicetree/bindings/thermal/spear-thermal.txt | 14 --------- .../bindings/thermal/st,thermal-spear1340.yaml | 36 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 14 deletions(-) delete mode 100644 Documentation/devicetree/bindings/thermal/spear-thermal.txt create mode 100644 Documentation/devicetree/bindings/thermal/st,thermal-spear1340.yaml diff --git a/Documentation/devicetree/bindings/thermal/spear-thermal.txt b/Documentation/devicetree/bindings/thermal/spear-thermal.txt deleted file mode 100644 index 93e3b67c102d..000000000000 --- a/Documentation/devicetree/bindings/thermal/spear-thermal.txt +++ /dev/null @@ -1,14 +0,0 @@ -* SPEAr Thermal - -Required properties: -- compatible : "st,thermal-spear1340" -- reg : Address range of the thermal registers -- st,thermal-flags: flags used to enable thermal sensor - -Example: - - thermal@fc000000 { - compatible = "st,thermal-spear1340"; - reg = <0xfc000000 0x1000>; - st,thermal-flags = <0x7000>; - }; diff --git a/Documentation/devicetree/bindings/thermal/st,thermal-spear1340.yaml b/Documentation/devicetree/bindings/thermal/st,thermal-spear1340.yaml new file mode 100644 index 000000000000..e3462a974691 --- /dev/null +++ b/Documentation/devicetree/bindings/thermal/st,thermal-spear1340.yaml @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/thermal/st,thermal-spear1340.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: SPEAr Thermal Sensor + +maintainers: + - Viresh Kumar + +properties: + compatible: + const: st,thermal-spear1340 + + reg: + maxItems: 1 + + st,thermal-flags: + description: flags used to enable thermal sensor + $ref: /schemas/types.yaml#/definitions/uint32 + +required: + - compatible + - reg + - st,thermal-flags + +additionalProperties: false + +examples: + - | + thermal@fc000000 { + compatible = "st,thermal-spear1340"; + reg = <0xfc000000 0x1000>; + st,thermal-flags = <0x7000>; + }; -- cgit v1.2.3 From 29cbf826d5674a0ea1b101c13861416c7f217304 Mon Sep 17 00:00:00 2001 From: Thorsten Blum Date: Thu, 2 Apr 2026 18:56:18 +0200 Subject: thermal/drivers/brcmstb_thermal: Use max to simplify brcmstb_get_temp Use max() to simplify brcmstb_get_temp() and improve its readability. Since avs_tmon_code_to_temp() returns an int, change the data type of the local variable 't' from long to int. No functional changes. Signed-off-by: Thorsten Blum Signed-off-by: Daniel Lezcano Reviewed-by: Florian Fainelli Link: https://patch.msgid.link/20260402165616.895305-3-thorsten.blum@linux.dev --- drivers/thermal/broadcom/brcmstb_thermal.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c index f46f2ddc174e..a9ffa596f7c0 100644 --- a/drivers/thermal/broadcom/brcmstb_thermal.c +++ b/drivers/thermal/broadcom/brcmstb_thermal.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -154,7 +155,7 @@ static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp) { struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz); u32 val; - long t; + int t; val = __raw_readl(priv->tmon_base + AVS_TMON_STATUS); @@ -164,10 +165,7 @@ static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp) val = (val & AVS_TMON_STATUS_data_msk) >> AVS_TMON_STATUS_data_shift; t = avs_tmon_code_to_temp(priv, val); - if (t < 0) - *temp = 0; - else - *temp = t; + *temp = max(0, t); return 0; } -- cgit v1.2.3 From 761fdf4c8c1c0bd8427f8226be3a3eb5cf896386 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Thu, 2 Apr 2026 10:44:25 +0200 Subject: thermal/core: Remove pointless variable when registering a cooling device The 'id' variable is set to store the ida_alloc() value which is already stored into cdev->id. It is pointless to use it because cdev->id can be used instead. Signed-off-by: Daniel Lezcano Signed-off-by: Daniel Lezcano Reviewed-by: Lukasz Luba Link: https://patch.msgid.link/20260402084426.1360086-1-daniel.lezcano@kernel.org Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 267594b96832..b6b651cb2331 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1063,7 +1063,7 @@ __thermal_cooling_device_register(struct device_node *np, { struct thermal_cooling_device *cdev; unsigned long current_state; - int id, ret; + int ret; if (!ops || !ops->get_max_state || !ops->get_cur_state || !ops->set_cur_state) @@ -1080,7 +1080,6 @@ __thermal_cooling_device_register(struct device_node *np, if (ret < 0) goto out_kfree_cdev; cdev->id = ret; - id = ret; cdev->type = kstrdup_const(type ? type : "", GFP_KERNEL); if (!cdev->type) { @@ -1137,7 +1136,7 @@ out_cooling_dev: out_cdev_type: kfree_const(cdev->type); out_ida_remove: - ida_free(&thermal_cdev_ida, id); + ida_free(&thermal_cdev_ida, cdev->id); out_kfree_cdev: kfree(cdev); return ERR_PTR(ret); -- cgit v1.2.3 From 41ff66baf81c6541f4f985dd7eac4494d03d9440 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Tue, 7 Apr 2026 15:55:19 +0200 Subject: thermal: core: Fix thermal zone governor cleanup issues If thermal_zone_device_register_with_trips() fails after adding a thermal governor to the thermal zone being registered, the governor is not removed from it as appropriate which may lead to a memory leak. In turn, thermal_zone_device_unregister() calls thermal_set_governor() without acquiring the thermal zone lock beforehand which may race with a governor update via sysfs and may lead to a use-after-free in that case. Address these issues by adding two thermal_set_governor() calls, one to thermal_release() to remove the governor from the given thermal zone, and one to the thermal zone registration error path to cover failures preceding the thermal zone device registration. Fixes: e33df1d2f3a0 ("thermal: let governors have private data for each thermal zone") Cc: All applicable Signed-off-by: Rafael J. Wysocki Link: https://patch.msgid.link/5092923.31r3eYUQgx@rafael.j.wysocki --- drivers/thermal/thermal_core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index b6b651cb2331..6e10b2fe2972 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -964,6 +964,7 @@ static void thermal_release(struct device *dev) sizeof("thermal_zone") - 1)) { tz = to_thermal_zone(dev); thermal_zone_destroy_device_groups(tz); + thermal_set_governor(tz, NULL); mutex_destroy(&tz->lock); complete(&tz->removal); } else if (!strncmp(dev_name(dev), "cooling_device", @@ -1610,8 +1611,10 @@ thermal_zone_device_register_with_trips(const char *type, /* sys I/F */ /* Add nodes that are always present via .groups */ result = thermal_zone_create_device_groups(tz); - if (result) + if (result) { + thermal_set_governor(tz, NULL); goto remove_id; + } result = device_register(&tz->device); if (result) @@ -1724,8 +1727,6 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) cancel_delayed_work_sync(&tz->poll_queue); - thermal_set_governor(tz, NULL); - thermal_thresholds_exit(tz); thermal_remove_hwmon_sysfs(tz); ida_free(&thermal_tz_ida, tz->id); -- cgit v1.2.3 From daae9c18feec74566e023fc88cfb0ce26e39d868 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Tue, 7 Apr 2026 15:58:34 +0200 Subject: thermal: core: Free thermal zone ID later during removal The thermal zone removal ordering is different from the thermal zone registration rollback path ordering and the former is arguably problematic because freeing a thermal zone ID prematurely may cause it to be used during the registration of another thermal zone which may fail as a result. Prevent that from occurring by changing the thermal zone removal ordering to reflect the thermal zone registration rollback path ordering. Also more the ida_destroy() call from thermal_zone_device_unregister() to thermal_release() for consistency. Fixes: b31ef8285b19 ("thermal core: convert ID allocation to IDA") Cc: All applicable Signed-off-by: Rafael J. Wysocki Link: https://patch.msgid.link/5063934.GXAFRqVoOG@rafael.j.wysocki --- drivers/thermal/thermal_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 6e10b2fe2972..c1ec98591703 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -965,6 +965,7 @@ static void thermal_release(struct device *dev) tz = to_thermal_zone(dev); thermal_zone_destroy_device_groups(tz); thermal_set_governor(tz, NULL); + ida_destroy(&tz->ida); mutex_destroy(&tz->lock); complete(&tz->removal); } else if (!strncmp(dev_name(dev), "cooling_device", @@ -1729,8 +1730,6 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) thermal_thresholds_exit(tz); thermal_remove_hwmon_sysfs(tz); - ida_free(&thermal_tz_ida, tz->id); - ida_destroy(&tz->ida); device_del(&tz->device); put_device(&tz->device); @@ -1738,6 +1737,9 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) thermal_notify_tz_delete(tz); wait_for_completion(&tz->removal); + + ida_free(&thermal_tz_ida, tz->id); + kfree(tz->tzp); kfree(tz); } -- cgit v1.2.3 From 323803ac63209f9709c988011caa62b014993219 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Tue, 7 Apr 2026 16:06:23 +0200 Subject: thermal: core: Drop redundant check from thermal_zone_device_update() Since __thermal_zone_device_update() checks if tz->state is TZ_STATE_READY and bails out immediately otherwise, it is not necessary to check the thermal_zone_is_present() return value in thermal_zone_device_update(). Namely, tz->state is equal to TZ_STATE_FLAG_INIT initially and that flag is only cleared in thermal_zone_init_complete() after adding tz to the list of thermal zones, and thermal_zone_exit() sets TZ_STATE_FLAG_EXIT in tz->state while removing tz from that list. Thus tz->state is not TZ_STATE_READY when tz is not in the list and the check mentioned above is redundant. Accordingly, drop the redundant thermal_zone_is_present() check from thermal_zone_device_update() and drop the former altogether because it has no more users. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Link: https://patch.msgid.link/3406806.aeNJFYEL58@rafael.j.wysocki --- drivers/thermal/thermal_core.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index c1ec98591703..1f94667b7514 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -695,18 +695,12 @@ int thermal_zone_device_disable(struct thermal_zone_device *tz) } EXPORT_SYMBOL_GPL(thermal_zone_device_disable); -static bool thermal_zone_is_present(struct thermal_zone_device *tz) -{ - return !list_empty(&tz->node); -} - void thermal_zone_device_update(struct thermal_zone_device *tz, enum thermal_notify_event event) { guard(thermal_zone)(tz); - if (thermal_zone_is_present(tz)) - __thermal_zone_device_update(tz, event); + __thermal_zone_device_update(tz, event); } EXPORT_SYMBOL_GPL(thermal_zone_device_update); -- cgit v1.2.3 From 26fd03effa94cdfbbad550f3aa32cb89ccb016b6 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Tue, 7 Apr 2026 16:06:35 +0200 Subject: thermal: core: Adjust thermal_wq allocation flags The thermal workqueue doesn't need to be freezable or per-CPU, so drop WQ_FREEZABLE and WQ_PERCPU from the flags when allocating it. No intentional functional impact. Signed-off-by: Rafael J. Wysocki [ rjw: Subject rewrite ] Link: https://patch.msgid.link/3413335.44csPzL39Z@rafael.j.wysocki Signed-off-by: Rafael J. Wysocki --- drivers/thermal/thermal_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 1f94667b7514..e3e8331ca24e 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1904,8 +1904,7 @@ static int __init thermal_init(void) if (result) goto error; - thermal_wq = alloc_workqueue("thermal_events", - WQ_FREEZABLE | WQ_POWER_EFFICIENT | WQ_PERCPU, 0); + thermal_wq = alloc_workqueue("thermal_events", WQ_POWER_EFFICIENT, 0); if (!thermal_wq) { result = -ENOMEM; goto unregister_netlink; -- cgit v1.2.3 From c4c6a8646359612db34c76f58799f5206945e365 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Tue, 7 Apr 2026 16:07:51 +0200 Subject: thermal: core: Allocate thermal_class statically Define thermal_class as a static structure to simplify thermal_init() and to simplify thermal class availability checks that will need to be carried out during the suspend and resume of thermal zones after subsequent changes. Signed-off-by: Rafael J. Wysocki Link: https://patch.msgid.link/10831981.nUPlyArG6x@rafael.j.wysocki --- drivers/thermal/thermal_core.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index e3e8331ca24e..f0f3a628c00c 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -972,7 +972,11 @@ static void thermal_release(struct device *dev) } } -static struct class *thermal_class; +static const struct class thermal_class = { + .name = "thermal", + .dev_release = thermal_release, +}; +static bool thermal_class_unavailable __ro_after_init = true; static inline void print_bind_err_msg(struct thermal_zone_device *tz, @@ -1065,7 +1069,7 @@ __thermal_cooling_device_register(struct device_node *np, !ops->set_cur_state) return ERR_PTR(-EINVAL); - if (!thermal_class) + if (thermal_class_unavailable) return ERR_PTR(-ENODEV); cdev = kzalloc_obj(*cdev); @@ -1088,7 +1092,7 @@ __thermal_cooling_device_register(struct device_node *np, cdev->np = np; cdev->ops = ops; cdev->updated = false; - cdev->device.class = thermal_class; + cdev->device.class = &thermal_class; cdev->devdata = devdata; ret = cdev->ops->get_max_state(cdev, &cdev->max_state); @@ -1536,7 +1540,7 @@ thermal_zone_device_register_with_trips(const char *type, if (polling_delay && passive_delay > polling_delay) return ERR_PTR(-EINVAL); - if (!thermal_class) + if (thermal_class_unavailable) return ERR_PTR(-ENODEV); tz = kzalloc_flex(*tz, trips, num_trips); @@ -1572,7 +1576,7 @@ thermal_zone_device_register_with_trips(const char *type, if (!tz->ops.critical) tz->ops.critical = thermal_zone_device_critical; - tz->device.class = thermal_class; + tz->device.class = &thermal_class; tz->devdata = devdata; tz->num_trips = num_trips; for_each_trip_desc(tz, td) { @@ -1914,21 +1918,11 @@ static int __init thermal_init(void) if (result) goto destroy_workqueue; - thermal_class = kzalloc_obj(*thermal_class); - if (!thermal_class) { - result = -ENOMEM; + result = class_register(&thermal_class); + if (result) goto unregister_governors; - } - thermal_class->name = "thermal"; - thermal_class->dev_release = thermal_release; - - result = class_register(thermal_class); - if (result) { - kfree(thermal_class); - thermal_class = NULL; - goto unregister_governors; - } + thermal_class_unavailable = false; result = register_pm_notifier(&thermal_pm_nb); if (result) -- cgit v1.2.3 From d33e89d12295087afd108a42f5e240ff53820461 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Tue, 7 Apr 2026 16:09:21 +0200 Subject: thermal: core: Suspend thermal zones later and resume them earlier To avoid some undesirable interactions between thermal zone suspend and resume with user space that is running when those operations are carried out, move them closer to the suspend and resume of devices, respectively, by updating dpm_prepare() to carry out thermal zone suspend and dpm_complete() to start thermal zone resume (that will continue asynchronously). This also makes the code easier to follow by removing one, arguably redundant, level of indirection represented by the thermal PM notifier. Signed-off-by: Rafael J. Wysocki Reviewed-by: Armin Wolf Link: https://patch.msgid.link/2036875.PYKUYFuaPT@rafael.j.wysocki --- drivers/base/power/main.c | 5 ++++ drivers/thermal/thermal_core.c | 60 +++++++++++++----------------------------- include/linux/thermal.h | 6 +++++ 3 files changed, 29 insertions(+), 42 deletions(-) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 189de5250f25..e1b550664bab 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -1282,6 +1283,8 @@ void dpm_complete(pm_message_t state) list_splice(&list, &dpm_list); mutex_unlock(&dpm_list_mtx); + /* Start resuming thermal control */ + thermal_pm_complete(); /* Allow device probing and trigger re-probing of deferred devices */ device_unblock_probing(); trace_suspend_resume(TPS("dpm_complete"), state.event, false); @@ -2225,6 +2228,8 @@ int dpm_prepare(pm_message_t state) * instead. The normal behavior will be restored in dpm_complete(). */ device_block_probing(); + /* Suspend thermal control. */ + thermal_pm_prepare(); mutex_lock(&dpm_list_mtx); while (!list_empty(&dpm_list) && !error) { diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index f0f3a628c00c..2f4e2dc46b8f 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1823,7 +1823,7 @@ static void thermal_zone_pm_prepare(struct thermal_zone_device *tz) cancel_delayed_work(&tz->poll_queue); } -static void thermal_pm_notify_prepare(void) +static void __thermal_pm_prepare(void) { struct thermal_zone_device *tz; @@ -1835,6 +1835,19 @@ static void thermal_pm_notify_prepare(void) thermal_zone_pm_prepare(tz); } +void thermal_pm_prepare(void) +{ + if (thermal_class_unavailable) + return; + + __thermal_pm_prepare(); + /* + * Allow any leftover thermal work items already on the worqueue to + * complete so they don't get in the way later. + */ + flush_workqueue(thermal_wq); +} + static void thermal_zone_pm_complete(struct thermal_zone_device *tz) { guard(thermal_zone)(tz); @@ -1851,10 +1864,13 @@ static void thermal_zone_pm_complete(struct thermal_zone_device *tz) mod_delayed_work(thermal_wq, &tz->poll_queue, 0); } -static void thermal_pm_notify_complete(void) +void thermal_pm_complete(void) { struct thermal_zone_device *tz; + if (thermal_class_unavailable) + return; + guard(mutex)(&thermal_list_lock); thermal_pm_suspended = false; @@ -1863,41 +1879,6 @@ static void thermal_pm_notify_complete(void) thermal_zone_pm_complete(tz); } -static int thermal_pm_notify(struct notifier_block *nb, - unsigned long mode, void *_unused) -{ - switch (mode) { - case PM_HIBERNATION_PREPARE: - case PM_RESTORE_PREPARE: - case PM_SUSPEND_PREPARE: - thermal_pm_notify_prepare(); - /* - * Allow any leftover thermal work items already on the - * worqueue to complete so they don't get in the way later. - */ - flush_workqueue(thermal_wq); - break; - case PM_POST_HIBERNATION: - case PM_POST_RESTORE: - case PM_POST_SUSPEND: - thermal_pm_notify_complete(); - break; - default: - break; - } - return 0; -} - -static struct notifier_block thermal_pm_nb = { - .notifier_call = thermal_pm_notify, - /* - * Run at the lowest priority to avoid interference between the thermal - * zone resume work items spawned by thermal_pm_notify() and the other - * PM notifiers. - */ - .priority = INT_MIN, -}; - static int __init thermal_init(void) { int result; @@ -1924,11 +1905,6 @@ static int __init thermal_init(void) thermal_class_unavailable = false; - result = register_pm_notifier(&thermal_pm_nb); - if (result) - pr_warn("Thermal: Can not register suspend notifier, return %d\n", - result); - return 0; unregister_governors: diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 0b5ed6821080..0ddc77aeeca2 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -273,6 +273,9 @@ bool thermal_trip_is_bound_to_cdev(struct thermal_zone_device *tz, int thermal_zone_device_enable(struct thermal_zone_device *tz); int thermal_zone_device_disable(struct thermal_zone_device *tz); void thermal_zone_device_critical(struct thermal_zone_device *tz); + +void thermal_pm_prepare(void); +void thermal_pm_complete(void); #else static inline struct thermal_zone_device *thermal_zone_device_register_with_trips( const char *type, @@ -350,6 +353,9 @@ static inline int thermal_zone_device_enable(struct thermal_zone_device *tz) static inline int thermal_zone_device_disable(struct thermal_zone_device *tz) { return -ENODEV; } + +static inline void thermal_pm_prepare(void) {} +static inline void thermal_pm_complete(void) {} #endif /* CONFIG_THERMAL */ #endif /* __THERMAL_H__ */ -- cgit v1.2.3 From bf746e2a41efd98668c97759e06d436ae5af5a82 Mon Sep 17 00:00:00 2001 From: John Madieu Date: Thu, 9 Apr 2026 14:59:16 +0200 Subject: thermal: renesas: rzg3e: Remove stale @trim_offset kernel-doc entry The trim_offset field was removed from struct rzg3e_thermal_priv but its kernel-doc entry was left behind. Remove it to fix the mismatch. Signed-off-by: John Madieu Signed-off-by: Daniel Lezcano Link: https://patch.msgid.link/20260409125916.2244241-1-john.madieu.xa@bp.renesas.com --- drivers/thermal/renesas/rzg3e_thermal.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/thermal/renesas/rzg3e_thermal.c b/drivers/thermal/renesas/rzg3e_thermal.c index dde021e283b7..f0e29fe633db 100644 --- a/drivers/thermal/renesas/rzg3e_thermal.c +++ b/drivers/thermal/renesas/rzg3e_thermal.c @@ -93,7 +93,6 @@ struct rzg3e_thermal_info { * @info: chip type specific information * @trmval0: calibration value 0 (b) * @trmval1: calibration value 1 (c) - * @trim_offset: offset for trim registers in syscon * @lock: protects hardware access during conversions */ struct rzg3e_thermal_priv { -- cgit v1.2.3