Skip to content

Commit fbfb6bd

Browse files
committed
Merge tag 'thermal-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull thermal control updates from Rafael Wysocki: "These include thermal core fixes and simplifications, driver fixes and new hardware support (SDM670, Eliza SoC), new driver features (hwmon support in imx91, DDR data rate on Nova Lake in int340x), and a handful of cleanups: - Fix thermal core issues related to thermal zone removal and registration errors that may lead to a use-after-free or a memory leak in some cases (Rafael Wysocki) - Drop a redundant check from thermal_zone_device_update(), adjust thermal workqueue allocation flags, and switch over thermal_class allocation to static (Rafael Wysocki) - Relocate the suspend and resume of thermal zones closer to the suspend and resume of devices, respectively (Rafael Wysocki) - Remove a pointless variable used in the thermal core when registering a cooling device (Daniel Lezcano) - Replace sprintf() in thermal_bind_cdev_to_trip() and use str_enabled_disabled() helper in mode_show() (Thorsten Blum) - Replace cpumask_weight() in intel_hfi_offline() with cpumask_empty() which is generally more efficient (Yury Norov) - Add support for reading DDR data rate from PCI config space on Nova Lake platforms to the int340x thermal driver (Srinivas Pandruvada) - Add an OF node address to output message to make sensor names more distinguishable (Alexander Stein) - Add hwmon support for the i.MX97 thermal sensor (Alexander Stein) - Clamp correctly the results when doing value/temperature conversion in the Spreadtrum driver (Thorsten Blum) - Add SDM670 compatible DT bindings for the Tsens and the lMH thermal drivers (Richard Acayan) - Add SM8750 compatible DT bindings for the Tsens thermal driver (Manaf Meethalavalappu Pallikunhi) - Add Eliza SoC compatible DT bindings for the Tsens driver (Krzysztof Kozlowski) - Fix inverted condition check on error in the Spear thermal control driver (Gopi Krishna Menon) - Convert DT bindings documentation into DT schema (Gopi Krishna Menon) - Use max() macro to increase readability in the Broadcom STB thermal sensor (Thorsten Blum) - Remove a stale @trim_offset kernel-doc entry (John Madieu)" * tag 'thermal-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (25 commits) thermal: renesas: rzg3e: Remove stale @trim_offset kernel-doc entry thermal: core: Suspend thermal zones later and resume them earlier thermal: core: Allocate thermal_class statically thermal: core: Adjust thermal_wq allocation flags thermal: core: Drop redundant check from thermal_zone_device_update() thermal: core: Free thermal zone ID later during removal thermal: core: Fix thermal zone governor cleanup issues thermal/core: Remove pointless variable when registering a cooling device thermal/drivers/brcmstb_thermal: Use max to simplify brcmstb_get_temp dt-bindings: thermal: st,thermal-spear1340: convert to dtschema thermal/drivers/spear: Fix error condition for reading st,thermal-flags dt-bindings: thermal: qcom-tsens: Add Eliza SoC TSENS thermal: devfreq_cooling: avoid unnecessary kfree of freq_table thermal: intel: hfi: use cpumask_empty() in intel_hfi_offline() thermal: sysfs: Use str_enabled_disabled() helper in mode_show() dt-bindings: thermal: qcom-tsens: Document the SM8750 Temperature Sensor thermal/drivers/sprd: Use min instead of clamp in sprd_thm_temp_to_rawdata dt-bindings: thermal: lmh: Add SDM670 compatible dt-bindings: thermal: tsens: add SDM670 compatible thermal/drivers/sprd: Fix raw temperature clamping in sprd_thm_rawdata_to_temp ...
2 parents d7c8087 + cd1a3b2 commit fbfb6bd

17 files changed

Lines changed: 143 additions & 123 deletions

File tree

Documentation/devicetree/bindings/thermal/qcom-lmh.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ properties:
2222
- qcom,sc8180x-lmh
2323
- qcom,sdm845-lmh
2424
- qcom,sm8150-lmh
25+
- items:
26+
- const: qcom,sdm670-lmh
27+
- const: qcom,sdm845-lmh
2528
- items:
2629
- const: qcom,qcm2290-lmh
2730
- const: qcom,sm8150-lmh

Documentation/devicetree/bindings/thermal/qcom-tsens.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ properties:
5454
- description: v2 of TSENS
5555
items:
5656
- enum:
57+
- qcom,eliza-tsens
5758
- qcom,glymur-tsens
5859
- qcom,kaanapali-tsens
5960
- qcom,milos-tsens
@@ -71,6 +72,7 @@ properties:
7172
- qcom,sc8180x-tsens
7273
- qcom,sc8280xp-tsens
7374
- qcom,sdm630-tsens
75+
- qcom,sdm670-tsens
7476
- qcom,sdm845-tsens
7577
- qcom,sm6115-tsens
7678
- qcom,sm6350-tsens
@@ -81,6 +83,7 @@ properties:
8183
- qcom,sm8450-tsens
8284
- qcom,sm8550-tsens
8385
- qcom,sm8650-tsens
86+
- qcom,sm8750-tsens
8487
- qcom,x1e80100-tsens
8588
- const: qcom,tsens-v2
8689

Documentation/devicetree/bindings/thermal/spear-thermal.txt

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/thermal/st,thermal-spear1340.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: SPEAr Thermal Sensor
8+
9+
maintainers:
10+
- Viresh Kumar <vireshk@kernel.org>
11+
12+
properties:
13+
compatible:
14+
const: st,thermal-spear1340
15+
16+
reg:
17+
maxItems: 1
18+
19+
st,thermal-flags:
20+
description: flags used to enable thermal sensor
21+
$ref: /schemas/types.yaml#/definitions/uint32
22+
23+
required:
24+
- compatible
25+
- reg
26+
- st,thermal-flags
27+
28+
additionalProperties: false
29+
30+
examples:
31+
- |
32+
thermal@fc000000 {
33+
compatible = "st,thermal-spear1340";
34+
reg = <0xfc000000 0x1000>;
35+
st,thermal-flags = <0x7000>;
36+
};

drivers/base/power/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <trace/events/power.h>
3434
#include <linux/cpufreq.h>
3535
#include <linux/devfreq.h>
36+
#include <linux/thermal.h>
3637
#include <linux/timer.h>
3738
#include <linux/nmi.h>
3839

@@ -1282,6 +1283,8 @@ void dpm_complete(pm_message_t state)
12821283
list_splice(&list, &dpm_list);
12831284
mutex_unlock(&dpm_list_mtx);
12841285

1286+
/* Start resuming thermal control */
1287+
thermal_pm_complete();
12851288
/* Allow device probing and trigger re-probing of deferred devices */
12861289
device_unblock_probing();
12871290
trace_suspend_resume(TPS("dpm_complete"), state.event, false);
@@ -2225,6 +2228,8 @@ int dpm_prepare(pm_message_t state)
22252228
* instead. The normal behavior will be restored in dpm_complete().
22262229
*/
22272230
device_block_probing();
2231+
/* Suspend thermal control. */
2232+
thermal_pm_prepare();
22282233

22292234
mutex_lock(&dpm_list_mtx);
22302235
while (!list_empty(&dpm_list) && !error) {

drivers/thermal/broadcom/brcmstb_thermal.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/irqreturn.h>
1717
#include <linux/interrupt.h>
1818
#include <linux/kernel.h>
19+
#include <linux/minmax.h>
1920
#include <linux/module.h>
2021
#include <linux/of.h>
2122
#include <linux/platform_device.h>
@@ -154,7 +155,7 @@ static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp)
154155
{
155156
struct brcmstb_thermal_priv *priv = thermal_zone_device_priv(tz);
156157
u32 val;
157-
long t;
158+
int t;
158159

159160
val = __raw_readl(priv->tmon_base + AVS_TMON_STATUS);
160161

@@ -164,10 +165,7 @@ static int brcmstb_get_temp(struct thermal_zone_device *tz, int *temp)
164165
val = (val & AVS_TMON_STATUS_data_msk) >> AVS_TMON_STATUS_data_shift;
165166

166167
t = avs_tmon_code_to_temp(priv, val);
167-
if (t < 0)
168-
*temp = 0;
169-
else
170-
*temp = t;
168+
*temp = max(0, t);
171169

172170
return 0;
173171
}

drivers/thermal/devfreq_cooling.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
472472
remove_qos_req:
473473
dev_pm_qos_remove_request(&dfc->req_max_freq);
474474
free_table:
475-
kfree(dfc->freq_table);
475+
if (!dfc->em_pd)
476+
kfree(dfc->freq_table);
476477
free_dfc:
477478
kfree(dfc);
478479

drivers/thermal/imx91_thermal.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <linux/thermal.h>
1818
#include <linux/units.h>
1919

20+
#include "thermal_hwmon.h"
21+
2022
#define REG_SET 0x4
2123
#define REG_CLR 0x8
2224
#define REG_TOG 0xc
@@ -318,6 +320,8 @@ static int imx91_tmu_probe(struct platform_device *pdev)
318320
return dev_err_probe(dev, PTR_ERR(tmu->tzd),
319321
"failed to register thermal zone sensor\n");
320322

323+
devm_thermal_add_hwmon_sysfs(dev, tmu->tzd);
324+
321325
irq = platform_get_irq(pdev, 0);
322326
if (irq < 0)
323327
return irq;

drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,17 +402,31 @@ static ssize_t rfi_restriction_show(struct device *dev,
402402
return sysfs_emit(buf, "%llu\n", resp);
403403
}
404404

405+
/* ddr_data_rate */
406+
static const struct mmio_reg nvl_ddr_data_rate_reg = { 1, 0xE0, 10, 0x3FF, 2};
407+
408+
static const struct mmio_reg *ddr_data_rate_reg;
409+
405410
static ssize_t ddr_data_rate_show(struct device *dev,
406411
struct device_attribute *attr,
407412
char *buf)
408413
{
409-
u16 id = 0x0107;
410414
u64 resp;
411-
int ret;
412415

413-
ret = processor_thermal_send_mbox_read_cmd(to_pci_dev(dev), id, &resp);
414-
if (ret)
415-
return ret;
416+
if (ddr_data_rate_reg) {
417+
u16 reg_val;
418+
419+
pci_read_config_word(to_pci_dev(dev), ddr_data_rate_reg->offset, &reg_val);
420+
resp = (reg_val >> ddr_data_rate_reg->shift) & ddr_data_rate_reg->mask;
421+
resp = (resp * 3333) / 100;
422+
} else {
423+
const u16 id = 0x0107;
424+
int ret;
425+
426+
ret = processor_thermal_send_mbox_read_cmd(to_pci_dev(dev), id, &resp);
427+
if (ret)
428+
return ret;
429+
}
416430

417431
return sysfs_emit(buf, "%llu\n", resp);
418432
}
@@ -461,6 +475,7 @@ int proc_thermal_rfim_add(struct pci_dev *pdev, struct proc_thermal_device *proc
461475
case PCI_DEVICE_ID_INTEL_NVL_H_THERMAL:
462476
case PCI_DEVICE_ID_INTEL_NVL_S_THERMAL:
463477
dlvr_mmio_regs_table = nvl_dlvr_mmio_regs;
478+
ddr_data_rate_reg = &nvl_ddr_data_rate_reg;
464479
break;
465480
default:
466481
dlvr_mmio_regs_table = dlvr_mmio_regs;

drivers/thermal/intel/intel_hfi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ void intel_hfi_offline(unsigned int cpu)
526526
mutex_lock(&hfi_instance_lock);
527527
cpumask_clear_cpu(cpu, hfi_instance->cpus);
528528

529-
if (!cpumask_weight(hfi_instance->cpus))
529+
if (cpumask_empty(hfi_instance->cpus))
530530
hfi_disable();
531531

532532
mutex_unlock(&hfi_instance_lock);

0 commit comments

Comments
 (0)