Skip to content

Commit dd47038

Browse files
committed
Merge tag 'thermal-v5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux
Pull thermal updates from Daniel Lezcano: - Add the tegra3 thermal sensor and fix the compilation testing on tegra by adding a dependency on ARCH_TEGRA along with COMPILE_TEST (Dmitry Osipenko) - Fix the error code for the exynos when devm_get_clk() fails (Dan Carpenter) - Add the TCC cooling support for AlderLake platform (Sumeet Pawnikar) - Add support for hardware trip points for the rcar gen3 thermal driver and store TSC id as unsigned int (Niklas Söderlund) - Replace the deprecated CPU-hotplug functions get_online_cpus() and put_online_cpus (Sebastian Andrzej Siewior) - Add the thermal tools directory in the MAINTAINERS file (Daniel Lezcano) - Fix the Makefile and the cross compilation flags for the userspace 'tmon' tool (Rolf Eike Beer) - Allow to use the IMOK independently from the GDDV on Int340x (Sumeet Pawnikar) - Fix the stub thermal_cooling_device_register() function prototype which does not match the real function (Arnd Bergmann) - Make the thermal trip point optional in the DT bindings (Maxime Ripard) - Fix a typo in a comment in the core code (Geert Uytterhoeven) - Reduce the verbosity of the trace in the SoC thermal tegra driver (Dmitry Osipenko) - Add the support for the LMh (Limit Management hardware) driver on the QCom platforms (Thara Gopinath) - Allow processing of HWP interrupt by adding a weak function in the Intel driver (Srinivas Pandruvada) - Prevent an abort of the sensor probe is a channel is not used (Matthias Kaehlcke) * tag 'thermal-v5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux: thermal/drivers/qcom/spmi-adc-tm5: Don't abort probing if a sensor is not used thermal/drivers/intel: Allow processing of HWP interrupt dt-bindings: thermal: Add dt binding for QCOM LMh thermal/drivers/qcom: Add support for LMh driver firmware: qcom_scm: Introduce SCM calls to access LMh thermal/drivers/tegra-soctherm: Silence message about clamped temperature thermal: Spelling s/scallbacks/callbacks/ dt-bindings: thermal: Make trips node optional thermal/core: Fix thermal_cooling_device_register() prototype thermal/drivers/int340x: Use IMOK independently tools/thermal/tmon: Add cross compiling support thermal/tools/tmon: Improve the Makefile MAINTAINERS: Add missing userspace thermal tools to the thermal section thermal/drivers/intel_powerclamp: Replace deprecated CPU-hotplug functions. thermal/drivers/rcar_gen3_thermal: Store TSC id as unsigned int thermal/drivers/rcar_gen3_thermal: Add support for hardware trip points drivers/thermal/intel: Add TCC cooling support for AlderLake platform thermal/drivers/exynos: Fix an error code in exynos_tmu_probe() thermal/drivers/tegra: Correct compile-testing of drivers thermal/drivers/tegra: Add driver for Tegra30 thermal sensor
2 parents 765092e + 70ee251 commit dd47038

File tree

21 files changed

+1221
-24
lines changed

21 files changed

+1221
-24
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
# Copyright 2021 Linaro Ltd.
3+
%YAML 1.2
4+
---
5+
$id: http://devicetree.org/schemas/thermal/qcom-lmh.yaml#
6+
$schema: http://devicetree.org/meta-schemas/core.yaml#
7+
8+
title: Qualcomm Limits Management Hardware(LMh)
9+
10+
maintainers:
11+
- Thara Gopinath <[email protected]>
12+
13+
description:
14+
Limits Management Hardware(LMh) is a hardware infrastructure on some
15+
Qualcomm SoCs that can enforce temperature and current limits as
16+
programmed by software for certain IPs like CPU.
17+
18+
properties:
19+
compatible:
20+
enum:
21+
- qcom,sdm845-lmh
22+
23+
reg:
24+
items:
25+
- description: core registers
26+
27+
interrupts:
28+
maxItems: 1
29+
30+
'#interrupt-cells':
31+
const: 1
32+
33+
interrupt-controller: true
34+
35+
cpus:
36+
description:
37+
phandle of the first cpu in the LMh cluster
38+
$ref: /schemas/types.yaml#/definitions/phandle
39+
40+
qcom,lmh-temp-arm-millicelsius:
41+
description:
42+
An integer expressing temperature threshold at which the LMh thermal
43+
FSM is engaged.
44+
45+
qcom,lmh-temp-low-millicelsius:
46+
description:
47+
An integer expressing temperature threshold at which the state machine
48+
will attempt to remove frequency throttling.
49+
50+
qcom,lmh-temp-high-millicelsius:
51+
description:
52+
An integer expressing temperature threshold at which the state machine
53+
will attempt to throttle the frequency.
54+
55+
required:
56+
- compatible
57+
- reg
58+
- interrupts
59+
- '#interrupt-cells'
60+
- interrupt-controller
61+
- cpus
62+
- qcom,lmh-temp-arm-millicelsius
63+
- qcom,lmh-temp-low-millicelsius
64+
- qcom,lmh-temp-high-millicelsius
65+
66+
additionalProperties: false
67+
68+
examples:
69+
- |
70+
#include <dt-bindings/interrupt-controller/arm-gic.h>
71+
72+
lmh@17d70800 {
73+
compatible = "qcom,sdm845-lmh";
74+
reg = <0x17d70800 0x400>;
75+
interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
76+
cpus = <&CPU4>;
77+
qcom,lmh-temp-arm-millicelsius = <65000>;
78+
qcom,lmh-temp-low-millicelsius = <94500>;
79+
qcom,lmh-temp-high-millicelsius = <95000>;
80+
interrupt-controller;
81+
#interrupt-cells = <1>;
82+
};

Documentation/devicetree/bindings/thermal/thermal-zones.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ patternProperties:
215215
- polling-delay
216216
- polling-delay-passive
217217
- thermal-sensors
218-
- trips
218+
219219
additionalProperties: false
220220

221221
additionalProperties: false

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18566,6 +18566,7 @@ F: drivers/thermal/
1856618566
F: include/linux/cpu_cooling.h
1856718567
F: include/linux/thermal.h
1856818568
F: include/uapi/linux/thermal.h
18569+
F: tools/thermal/
1856918570

1857018571
THERMAL DRIVER FOR AMLOGIC SOCS
1857118572
M: Guillaume La Roque <[email protected]>

drivers/firmware/qcom_scm.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,64 @@ int qcom_scm_qsmmu500_wait_safe_toggle(bool en)
11471147
}
11481148
EXPORT_SYMBOL(qcom_scm_qsmmu500_wait_safe_toggle);
11491149

1150+
bool qcom_scm_lmh_dcvsh_available(void)
1151+
{
1152+
return __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_LMH, QCOM_SCM_LMH_LIMIT_DCVSH);
1153+
}
1154+
EXPORT_SYMBOL(qcom_scm_lmh_dcvsh_available);
1155+
1156+
int qcom_scm_lmh_profile_change(u32 profile_id)
1157+
{
1158+
struct qcom_scm_desc desc = {
1159+
.svc = QCOM_SCM_SVC_LMH,
1160+
.cmd = QCOM_SCM_LMH_LIMIT_PROFILE_CHANGE,
1161+
.arginfo = QCOM_SCM_ARGS(1, QCOM_SCM_VAL),
1162+
.args[0] = profile_id,
1163+
.owner = ARM_SMCCC_OWNER_SIP,
1164+
};
1165+
1166+
return qcom_scm_call(__scm->dev, &desc, NULL);
1167+
}
1168+
EXPORT_SYMBOL(qcom_scm_lmh_profile_change);
1169+
1170+
int qcom_scm_lmh_dcvsh(u32 payload_fn, u32 payload_reg, u32 payload_val,
1171+
u64 limit_node, u32 node_id, u64 version)
1172+
{
1173+
dma_addr_t payload_phys;
1174+
u32 *payload_buf;
1175+
int ret, payload_size = 5 * sizeof(u32);
1176+
1177+
struct qcom_scm_desc desc = {
1178+
.svc = QCOM_SCM_SVC_LMH,
1179+
.cmd = QCOM_SCM_LMH_LIMIT_DCVSH,
1180+
.arginfo = QCOM_SCM_ARGS(5, QCOM_SCM_RO, QCOM_SCM_VAL, QCOM_SCM_VAL,
1181+
QCOM_SCM_VAL, QCOM_SCM_VAL),
1182+
.args[1] = payload_size,
1183+
.args[2] = limit_node,
1184+
.args[3] = node_id,
1185+
.args[4] = version,
1186+
.owner = ARM_SMCCC_OWNER_SIP,
1187+
};
1188+
1189+
payload_buf = dma_alloc_coherent(__scm->dev, payload_size, &payload_phys, GFP_KERNEL);
1190+
if (!payload_buf)
1191+
return -ENOMEM;
1192+
1193+
payload_buf[0] = payload_fn;
1194+
payload_buf[1] = 0;
1195+
payload_buf[2] = payload_reg;
1196+
payload_buf[3] = 1;
1197+
payload_buf[4] = payload_val;
1198+
1199+
desc.args[0] = payload_phys;
1200+
1201+
ret = qcom_scm_call(__scm->dev, &desc, NULL);
1202+
1203+
dma_free_coherent(__scm->dev, payload_size, payload_buf, payload_phys);
1204+
return ret;
1205+
}
1206+
EXPORT_SYMBOL(qcom_scm_lmh_dcvsh);
1207+
11501208
static int qcom_scm_find_dload_address(struct device *dev, u64 *addr)
11511209
{
11521210
struct device_node *tcsr;

drivers/firmware/qcom_scm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ extern int scm_legacy_call(struct device *dev, const struct qcom_scm_desc *desc,
114114
#define QCOM_SCM_SVC_HDCP 0x11
115115
#define QCOM_SCM_HDCP_INVOKE 0x01
116116

117+
#define QCOM_SCM_SVC_LMH 0x13
118+
#define QCOM_SCM_LMH_LIMIT_PROFILE_CHANGE 0x01
119+
#define QCOM_SCM_LMH_LIMIT_DCVSH 0x10
120+
117121
#define QCOM_SCM_SVC_SMMU_PROGRAM 0x15
118122
#define QCOM_SCM_SMMU_CONFIG_ERRATA1 0x03
119123
#define QCOM_SCM_SMMU_CONFIG_ERRATA1_CLIENT_ALL 0x02

drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,12 @@ static struct attribute *imok_attr[] = {
108108
NULL
109109
};
110110

111+
static const struct attribute_group imok_attribute_group = {
112+
.attrs = imok_attr,
113+
};
114+
111115
static const struct attribute_group data_attribute_group = {
112116
.bin_attrs = data_attributes,
113-
.attrs = imok_attr,
114117
};
115118

116119
static ssize_t available_uuids_show(struct device *dev,
@@ -522,6 +525,12 @@ static int int3400_thermal_probe(struct platform_device *pdev)
522525
if (result)
523526
goto free_rel_misc;
524527

528+
if (acpi_has_method(priv->adev->handle, "IMOK")) {
529+
result = sysfs_create_group(&pdev->dev.kobj, &imok_attribute_group);
530+
if (result)
531+
goto free_imok;
532+
}
533+
525534
if (priv->data_vault) {
526535
result = sysfs_create_group(&pdev->dev.kobj,
527536
&data_attribute_group);
@@ -545,6 +554,8 @@ static int int3400_thermal_probe(struct platform_device *pdev)
545554
}
546555
free_uuid:
547556
sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group);
557+
free_imok:
558+
sysfs_remove_group(&pdev->dev.kobj, &imok_attribute_group);
548559
free_rel_misc:
549560
if (!priv->rel_misc_dev_res)
550561
acpi_thermal_rel_misc_device_remove(priv->adev->handle);
@@ -573,6 +584,7 @@ static int int3400_thermal_remove(struct platform_device *pdev)
573584
if (priv->data_vault)
574585
sysfs_remove_group(&pdev->dev.kobj, &data_attribute_group);
575586
sysfs_remove_group(&pdev->dev.kobj, &uuid_attribute_group);
587+
sysfs_remove_group(&pdev->dev.kobj, &imok_attribute_group);
576588
thermal_zone_device_unregister(priv->thermal);
577589
kfree(priv->data_vault);
578590
kfree(priv->trts);

drivers/thermal/intel/intel_powerclamp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ static int start_power_clamp(void)
528528

529529
set_target_ratio = clamp(set_target_ratio, 0U, MAX_TARGET_RATIO - 1);
530530
/* prevent cpu hotplug */
531-
get_online_cpus();
531+
cpus_read_lock();
532532

533533
/* prefer BSP */
534534
control_cpu = 0;
@@ -542,7 +542,7 @@ static int start_power_clamp(void)
542542
for_each_online_cpu(cpu) {
543543
start_power_clamp_worker(cpu);
544544
}
545-
put_online_cpus();
545+
cpus_read_unlock();
546546

547547
return 0;
548548
}

drivers/thermal/intel/intel_tcc_cooling.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ static const struct x86_cpu_id tcc_ids[] __initconst = {
7979
X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE, NULL),
8080
X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L, NULL),
8181
X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE, NULL),
82+
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, NULL),
83+
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, NULL),
8284
{}
8385
};
8486

drivers/thermal/qcom/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,13 @@ config QCOM_SPMI_TEMP_ALARM
3131
trip points. The temperature reported by the thermal sensor reflects the
3232
real time die temperature if an ADC is present or an estimate of the
3333
temperature based upon the over temperature stage value.
34+
35+
config QCOM_LMH
36+
tristate "Qualcomm Limits Management Hardware"
37+
depends on ARCH_QCOM
38+
help
39+
This enables initialization of Qualcomm limits management
40+
hardware(LMh). LMh allows for hardware-enforced mitigation for cpus based on
41+
input from temperature and current sensors. On many newer Qualcomm SoCs
42+
LMh is configured in the firmware and this feature need not be enabled.
43+
However, on certain SoCs like sdm845 LMh has to be configured from kernel.

drivers/thermal/qcom/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ qcom_tsens-y += tsens.o tsens-v2.o tsens-v1.o tsens-v0_1.o \
55
tsens-8960.o
66
obj-$(CONFIG_QCOM_SPMI_ADC_TM5) += qcom-spmi-adc-tm5.o
77
obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM) += qcom-spmi-temp-alarm.o
8+
obj-$(CONFIG_QCOM_LMH) += lmh.o

0 commit comments

Comments
 (0)