Skip to content

Commit

Permalink
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…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
  ...
  • Loading branch information
torvalds committed May 12, 2017
2 parents a34ab10 + cb15c81 commit 6a776e4
Show file tree
Hide file tree
Showing 25 changed files with 1,305 additions and 266 deletions.
32 changes: 28 additions & 4 deletions Documentation/devicetree/bindings/thermal/brcm,bcm2835-thermal.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,39 @@ Binding for Thermal Sensor driver for BCM2835 SoCs.
Required parameters:
-------------------

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

Example:

thermal-zones {
cpu_thermal: cpu-thermal {
polling-delay-passive = <0>;
polling-delay = <1000>;

thermal-sensors = <&thermal>;

trips {
cpu-crit {
temperature = <80000>;
hysteresis = <0>;
type = "critical";
};
};

coefficients = <(-538) 407000>;

cooling-maps {
};
};
};

thermal: thermal@7e212000 {
compatible = "brcm,bcm2835-thermal";
reg = <0x7e212000 0x8>;
clocks = <&clocks BCM2835_CLOCK_TSENS>;
#thermal-sensor-cells = <0>;
};
37 changes: 37 additions & 0 deletions Documentation/devicetree/bindings/thermal/brcm,ns-thermal
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
* Broadcom Northstar Thermal

This binding describes thermal sensor that is part of Northstar's DMU (Device
Management Unit).

Required properties:
- compatible : Must be "brcm,ns-thermal"
- reg : iomem address range of PVTMON registers
- #thermal-sensor-cells : Should be <0>

Example:

thermal: thermal@1800c2c0 {
compatible = "brcm,ns-thermal";
reg = <0x1800c2c0 0x10>;
#thermal-sensor-cells = <0>;
};

thermal-zones {
cpu_thermal: cpu-thermal {
polling-delay-passive = <0>;
polling-delay = <1000>;
coefficients = <(-556) 418000>;
thermal-sensors = <&thermal>;

trips {
cpu-crit {
temperature = <125000>;
hysteresis = <0>;
type = "critical";
};
};

cooling-maps {
};
};
};
36 changes: 36 additions & 0 deletions Documentation/devicetree/bindings/thermal/da9062-thermal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
* Dialog DA9062/61 TJUNC Thermal Module

This module is part of the DA9061/DA9062. For more details about entire
DA9062 and DA9061 chips see Documentation/devicetree/bindings/mfd/da9062.txt

Junction temperature thermal module uses an interrupt signal to identify
high THERMAL_TRIP_HOT temperatures for the PMIC device.

Required properties:

- compatible: should be one of the following valid compatible string lines:
"dlg,da9061-thermal", "dlg,da9062-thermal"
"dlg,da9062-thermal"

Optional properties:

- polling-delay-passive : Specify the polling period, measured in
milliseconds, between thermal zone device update checks.

Example: DA9062

pmic0: da9062@58 {
thermal {
compatible = "dlg,da9062-thermal";
polling-delay-passive = <3000>;
};
};

Example: DA9061 using a fall-back compatible for the DA9062 onkey driver

pmic0: da9061@58 {
thermal {
compatible = "dlg,da9061-thermal", "dlg,da9062-thermal";
polling-delay-passive = <3000>;
};
};
21 changes: 21 additions & 0 deletions Documentation/thermal/sysfs-api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -582,3 +582,24 @@ platform data is provided, this uses the step_wise throttling policy.
This function serves as an arbitrator to set the state of a cooling
device. It sets the cooling device to the deepest cooling state if
possible.

6. thermal_emergency_poweroff:

On an event of critical trip temperature crossing. Thermal framework
allows the system to shutdown gracefully by calling orderly_poweroff().
In the event of a failure of orderly_poweroff() to shut down the system
we are in danger of keeping the system alive at undesirably high
temperatures. To mitigate this high risk scenario we program a work
queue to fire after a pre-determined number of seconds to start
an emergency shutdown of the device using the kernel_power_off()
function. In case kernel_power_off() fails then finally
emergency_restart() is called in the worst case.

The delay should be carefully profiled so as to give adequate time for
orderly_poweroff(). In case of failure of an orderly_poweroff() the
emergency poweroff kicks in after the delay has elapsed and shuts down
the system.

If set to 0 emergency poweroff will not be supported. So a carefully
profiled non-zero positive value is a must for emergerncy poweroff to be
triggered.
32 changes: 32 additions & 0 deletions drivers/thermal/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@ menuconfig THERMAL

if THERMAL

config THERMAL_EMERGENCY_POWEROFF_DELAY_MS
int "Emergency poweroff delay in milli-seconds"
depends on THERMAL
default 0
help
Thermal subsystem will issue a graceful shutdown when
critical temperatures are reached using orderly_poweroff(). In
case of failure of an orderly_poweroff(), the thermal emergency
poweroff kicks in after a delay has elapsed and shuts down the system.
This config is number of milliseconds to delay before emergency
poweroff kicks in. Similarly to the critical trip point,
the delay should be carefully profiled so as to give adequate
time for orderly_poweroff() to finish on regular execution.
If set to 0 emergency poweroff will not be supported.

In doubt, leave as 0.

config THERMAL_HWMON
bool
prompt "Expose thermal sensors as hwmon device"
Expand Down Expand Up @@ -291,6 +308,16 @@ config ARMADA_THERMAL
Enable this option if you want to have support for thermal management
controller present in Armada 370 and Armada XP SoC.

config DA9062_THERMAL
tristate "DA9062/DA9061 Dialog Semiconductor thermal driver"
depends on MFD_DA9062 || COMPILE_TEST
depends on OF
help
Enable this for the Dialog Semiconductor thermal sensor driver.
This will report PMIC junction over-temperature for one thermal trip
zone.
Compatible with the DA9062 and DA9061 PMICs.

config INTEL_POWERCLAMP
tristate "Intel PowerClamp idle injection driver"
depends on THERMAL
Expand Down Expand Up @@ -380,6 +407,11 @@ config MTK_THERMAL
Enable this option if you want to have support for thermal management
controller present in Mediatek SoCs

menu "Broadcom thermal drivers"
depends on ARCH_BCM || COMPILE_TEST
source "drivers/thermal/broadcom/Kconfig"
endmenu

menu "Texas Instruments thermal drivers"
depends on ARCH_HAS_BANDGAP || COMPILE_TEST
depends on HAS_IOMEM
Expand Down
2 changes: 2 additions & 0 deletions drivers/thermal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ thermal_sys-$(CONFIG_CLOCK_THERMAL) += clock_cooling.o
thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o

# platform thermal drivers
obj-y += broadcom/
obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM) += qcom-spmi-temp-alarm.o
obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o
obj-$(CONFIG_ROCKCHIP_THERMAL) += rockchip_thermal.o
Expand All @@ -41,6 +42,7 @@ obj-$(CONFIG_TANGO_THERMAL) += tango_thermal.o
obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o
obj-$(CONFIG_MAX77620_THERMAL) += max77620_thermal.o
obj-$(CONFIG_QORIQ_THERMAL) += qoriq_thermal.o
obj-$(CONFIG_DA9062_THERMAL) += da9062-thermal.o
obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o
obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o
obj-$(CONFIG_INTEL_SOC_DTS_IOSF_CORE) += intel_soc_dts_iosf.o
Expand Down
16 changes: 16 additions & 0 deletions drivers/thermal/broadcom/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
config BCM2835_THERMAL
tristate "Thermal sensors on bcm2835 SoC"
depends on ARCH_BCM2835 || COMPILE_TEST
depends on HAS_IOMEM
depends on THERMAL_OF
help
Support for thermal sensors on Broadcom bcm2835 SoCs.

config BCM_NS_THERMAL
tristate "Northstar thermal driver"
depends on ARCH_BCM_IPROC || COMPILE_TEST
help
Northstar is a family of SoCs that includes e.g. BCM4708, BCM47081,
BCM4709 and BCM47094. It contains DMU (Device Management Unit) block
with a thermal sensor that allows checking CPU temperature. This
driver provides support for it.
2 changes: 2 additions & 0 deletions drivers/thermal/broadcom/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
obj-$(CONFIG_BCM2835_THERMAL) += bcm2835_thermal.o
obj-$(CONFIG_BCM_NS_THERMAL) += ns-thermal.o
Loading

0 comments on commit 6a776e4

Please sign in to comment.