Skip to content

Commit 6a776e4

Browse files
committed
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management updates from Zhang Rui: - Fix a problem where orderly_shutdown() is called for multiple times due to multiple critical overheating events raised in a short period by platform thermal driver. (Keerthy) - Introduce a backup thermal shutdown mechanism, which invokes kernel_power_off()/emergency_restart() directly, after orderly_shutdown() being issued for certain amount of time(specified via Kconfig). This is useful in certain conditions that userspace may be unable to power off the system in a clean manner and leaves the system in a critical state, like in the middle of driver probing phase. (Keerthy) - Introduce a new interface in thermal devfreq_cooling code so that the driver can provide more precise data regarding actual power to the thermal governor every time the power budget is calculated. (Lukasz Luba) - Introduce BCM 2835 soc thermal driver and northstar thermal driver, within a new sub-folder. (Rafał Miłecki) - Introduce DA9062/61 thermal driver. (Steve Twiss) - Remove non-DT booting on TI-SoC driver. Also add support to fetching coefficients from DT. (Keerthy) - Refactorf RCAR Gen3 thermal driver. (Niklas Söderlund) - Small fix on MTK and intel-soc-dts thermal driver. (Dawei Chien, Brian Bian) * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (25 commits) thermal: core: Add a back up thermal shutdown mechanism thermal: core: Allow orderly_poweroff to be called only once Thermal: Intel SoC DTS: Change interrupt request behavior trace: thermal: add another parameter 'power' to the tracing function thermal: devfreq_cooling: add new interface for direct power read thermal: devfreq_cooling: refactor code and add get_voltage function thermal: mt8173: minor mtk_thermal.c cleanups thermal: bcm2835: move to the broadcom subdirectory thermal: broadcom: ns: specify myself as MODULE_AUTHOR thermal: da9062/61: Thermal junction temperature monitoring driver Documentation: devicetree: thermal: da9062/61 TJUNC temperature binding thermal: broadcom: add Northstar thermal driver dt-bindings: thermal: add support for Broadcom's Northstar thermal thermal: bcm2835: add thermal driver for bcm2835 SoC dt-bindings: Add thermal zone to bcm2835-thermal example thermal: rcar_gen3_thermal: add suspend and resume support thermal: rcar_gen3_thermal: store device match data in private structure thermal: rcar_gen3_thermal: enable hardware interrupts for trip points thermal: rcar_gen3_thermal: record and check number of TSCs found thermal: rcar_gen3_thermal: check that TSC exists before memory allocation ...
2 parents a34ab10 + cb15c81 commit 6a776e4

25 files changed

+1305
-266
lines changed

Documentation/devicetree/bindings/thermal/brcm,bcm2835-thermal.txt

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,39 @@ Binding for Thermal Sensor driver for BCM2835 SoCs.
33
Required parameters:
44
-------------------
55

6-
compatible: should be one of: "brcm,bcm2835-thermal",
7-
"brcm,bcm2836-thermal" or "brcm,bcm2837-thermal"
8-
reg: Address range of the thermal registers.
9-
clocks: Phandle of the clock used by the thermal sensor.
6+
compatible: should be one of: "brcm,bcm2835-thermal",
7+
"brcm,bcm2836-thermal" or "brcm,bcm2837-thermal"
8+
reg: Address range of the thermal registers.
9+
clocks: Phandle of the clock used by the thermal sensor.
10+
#thermal-sensor-cells: should be 0 (see thermal.txt)
1011

1112
Example:
1213

14+
thermal-zones {
15+
cpu_thermal: cpu-thermal {
16+
polling-delay-passive = <0>;
17+
polling-delay = <1000>;
18+
19+
thermal-sensors = <&thermal>;
20+
21+
trips {
22+
cpu-crit {
23+
temperature = <80000>;
24+
hysteresis = <0>;
25+
type = "critical";
26+
};
27+
};
28+
29+
coefficients = <(-538) 407000>;
30+
31+
cooling-maps {
32+
};
33+
};
34+
};
35+
1336
thermal: thermal@7e212000 {
1437
compatible = "brcm,bcm2835-thermal";
1538
reg = <0x7e212000 0x8>;
1639
clocks = <&clocks BCM2835_CLOCK_TSENS>;
40+
#thermal-sensor-cells = <0>;
1741
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
* Broadcom Northstar Thermal
2+
3+
This binding describes thermal sensor that is part of Northstar's DMU (Device
4+
Management Unit).
5+
6+
Required properties:
7+
- compatible : Must be "brcm,ns-thermal"
8+
- reg : iomem address range of PVTMON registers
9+
- #thermal-sensor-cells : Should be <0>
10+
11+
Example:
12+
13+
thermal: thermal@1800c2c0 {
14+
compatible = "brcm,ns-thermal";
15+
reg = <0x1800c2c0 0x10>;
16+
#thermal-sensor-cells = <0>;
17+
};
18+
19+
thermal-zones {
20+
cpu_thermal: cpu-thermal {
21+
polling-delay-passive = <0>;
22+
polling-delay = <1000>;
23+
coefficients = <(-556) 418000>;
24+
thermal-sensors = <&thermal>;
25+
26+
trips {
27+
cpu-crit {
28+
temperature = <125000>;
29+
hysteresis = <0>;
30+
type = "critical";
31+
};
32+
};
33+
34+
cooling-maps {
35+
};
36+
};
37+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
* Dialog DA9062/61 TJUNC Thermal Module
2+
3+
This module is part of the DA9061/DA9062. For more details about entire
4+
DA9062 and DA9061 chips see Documentation/devicetree/bindings/mfd/da9062.txt
5+
6+
Junction temperature thermal module uses an interrupt signal to identify
7+
high THERMAL_TRIP_HOT temperatures for the PMIC device.
8+
9+
Required properties:
10+
11+
- compatible: should be one of the following valid compatible string lines:
12+
"dlg,da9061-thermal", "dlg,da9062-thermal"
13+
"dlg,da9062-thermal"
14+
15+
Optional properties:
16+
17+
- polling-delay-passive : Specify the polling period, measured in
18+
milliseconds, between thermal zone device update checks.
19+
20+
Example: DA9062
21+
22+
pmic0: da9062@58 {
23+
thermal {
24+
compatible = "dlg,da9062-thermal";
25+
polling-delay-passive = <3000>;
26+
};
27+
};
28+
29+
Example: DA9061 using a fall-back compatible for the DA9062 onkey driver
30+
31+
pmic0: da9061@58 {
32+
thermal {
33+
compatible = "dlg,da9061-thermal", "dlg,da9062-thermal";
34+
polling-delay-passive = <3000>;
35+
};
36+
};

Documentation/thermal/sysfs-api.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,3 +582,24 @@ platform data is provided, this uses the step_wise throttling policy.
582582
This function serves as an arbitrator to set the state of a cooling
583583
device. It sets the cooling device to the deepest cooling state if
584584
possible.
585+
586+
6. thermal_emergency_poweroff:
587+
588+
On an event of critical trip temperature crossing. Thermal framework
589+
allows the system to shutdown gracefully by calling orderly_poweroff().
590+
In the event of a failure of orderly_poweroff() to shut down the system
591+
we are in danger of keeping the system alive at undesirably high
592+
temperatures. To mitigate this high risk scenario we program a work
593+
queue to fire after a pre-determined number of seconds to start
594+
an emergency shutdown of the device using the kernel_power_off()
595+
function. In case kernel_power_off() fails then finally
596+
emergency_restart() is called in the worst case.
597+
598+
The delay should be carefully profiled so as to give adequate time for
599+
orderly_poweroff(). In case of failure of an orderly_poweroff() the
600+
emergency poweroff kicks in after the delay has elapsed and shuts down
601+
the system.
602+
603+
If set to 0 emergency poweroff will not be supported. So a carefully
604+
profiled non-zero positive value is a must for emergerncy poweroff to be
605+
triggered.

drivers/thermal/Kconfig

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ menuconfig THERMAL
1515

1616
if THERMAL
1717

18+
config THERMAL_EMERGENCY_POWEROFF_DELAY_MS
19+
int "Emergency poweroff delay in milli-seconds"
20+
depends on THERMAL
21+
default 0
22+
help
23+
Thermal subsystem will issue a graceful shutdown when
24+
critical temperatures are reached using orderly_poweroff(). In
25+
case of failure of an orderly_poweroff(), the thermal emergency
26+
poweroff kicks in after a delay has elapsed and shuts down the system.
27+
This config is number of milliseconds to delay before emergency
28+
poweroff kicks in. Similarly to the critical trip point,
29+
the delay should be carefully profiled so as to give adequate
30+
time for orderly_poweroff() to finish on regular execution.
31+
If set to 0 emergency poweroff will not be supported.
32+
33+
In doubt, leave as 0.
34+
1835
config THERMAL_HWMON
1936
bool
2037
prompt "Expose thermal sensors as hwmon device"
@@ -291,6 +308,16 @@ config ARMADA_THERMAL
291308
Enable this option if you want to have support for thermal management
292309
controller present in Armada 370 and Armada XP SoC.
293310

311+
config DA9062_THERMAL
312+
tristate "DA9062/DA9061 Dialog Semiconductor thermal driver"
313+
depends on MFD_DA9062 || COMPILE_TEST
314+
depends on OF
315+
help
316+
Enable this for the Dialog Semiconductor thermal sensor driver.
317+
This will report PMIC junction over-temperature for one thermal trip
318+
zone.
319+
Compatible with the DA9062 and DA9061 PMICs.
320+
294321
config INTEL_POWERCLAMP
295322
tristate "Intel PowerClamp idle injection driver"
296323
depends on THERMAL
@@ -380,6 +407,11 @@ config MTK_THERMAL
380407
Enable this option if you want to have support for thermal management
381408
controller present in Mediatek SoCs
382409

410+
menu "Broadcom thermal drivers"
411+
depends on ARCH_BCM || COMPILE_TEST
412+
source "drivers/thermal/broadcom/Kconfig"
413+
endmenu
414+
383415
menu "Texas Instruments thermal drivers"
384416
depends on ARCH_HAS_BANDGAP || COMPILE_TEST
385417
depends on HAS_IOMEM

drivers/thermal/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ thermal_sys-$(CONFIG_CLOCK_THERMAL) += clock_cooling.o
2727
thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o
2828

2929
# platform thermal drivers
30+
obj-y += broadcom/
3031
obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM) += qcom-spmi-temp-alarm.o
3132
obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o
3233
obj-$(CONFIG_ROCKCHIP_THERMAL) += rockchip_thermal.o
@@ -41,6 +42,7 @@ obj-$(CONFIG_TANGO_THERMAL) += tango_thermal.o
4142
obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o
4243
obj-$(CONFIG_MAX77620_THERMAL) += max77620_thermal.o
4344
obj-$(CONFIG_QORIQ_THERMAL) += qoriq_thermal.o
45+
obj-$(CONFIG_DA9062_THERMAL) += da9062-thermal.o
4446
obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o
4547
obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o
4648
obj-$(CONFIG_INTEL_SOC_DTS_IOSF_CORE) += intel_soc_dts_iosf.o

drivers/thermal/broadcom/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
config BCM2835_THERMAL
2+
tristate "Thermal sensors on bcm2835 SoC"
3+
depends on ARCH_BCM2835 || COMPILE_TEST
4+
depends on HAS_IOMEM
5+
depends on THERMAL_OF
6+
help
7+
Support for thermal sensors on Broadcom bcm2835 SoCs.
8+
9+
config BCM_NS_THERMAL
10+
tristate "Northstar thermal driver"
11+
depends on ARCH_BCM_IPROC || COMPILE_TEST
12+
help
13+
Northstar is a family of SoCs that includes e.g. BCM4708, BCM47081,
14+
BCM4709 and BCM47094. It contains DMU (Device Management Unit) block
15+
with a thermal sensor that allows checking CPU temperature. This
16+
driver provides support for it.

drivers/thermal/broadcom/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
obj-$(CONFIG_BCM2835_THERMAL) += bcm2835_thermal.o
2+
obj-$(CONFIG_BCM_NS_THERMAL) += ns-thermal.o

0 commit comments

Comments
 (0)