Rockchip soc thermal driver
Subsystems (3)
v6 cover Rockchip soc thermal driver
Changes in v6:
* address comments from Tomeu Vizoso.
- use thermal's generic framework.
Changes in v5:
* address comments from Eduardo Valentin,rui.zhang and Heiko Stubner:
- with BIT() macro
- manage clocks in suspend/resume.
- license is fixed as GPLv2 .
- #include "thermal_core.h"->#include <linux/thermal.h>
- use the generic trip-points.the hw-shut-temp isn't generic trip-points.
- The method of binding and unbinding be fixed.
- The pin-name tsadc->otp_out
Changes in v4:
* address comments from Jonathan Cameron,huangtao and zhaoyifeng:
- this series thermal driver still be put in driver/thermal/
- modify the thermal driver description.
Changes in v3:(add dts configure)
* address comments from Dmitry Torokhov and Arnd Bergmann:
- fix clock-names in rockchip-thermal.txt
- remove rockchip_thermal_control() in rockchip_set_mode()
- fix some code style.
- add dts configure.
Changes in v2:
* address comments from Heiko Stubner:
- fix dt-bindings in rockchip-thermal.txt
- remove Author mark
- rename TSADC_XXX->TSADCV2_XXX,it eill ready to merge compatible other SoCs.
- fix a identation
- remove clk_set_rate(),it's no necessary.
- fix the SIMPLE_DEV_PM_OPS() function style.
Tested on rk3288 SDK board and pinky-v1 board.
Caesar Wang (3):
thermal: rockchip: add driver for Thermal
dt-bindings: document Rockchip thermal
ARM: dts: add main Thermal info to rk3288
.../bindings/thermal/rockchip-thermal.txt | 32 ++ arch/arm/boot/dts/rk3288.dtsi | 44 ++ drivers/thermal/Kconfig | 10 + drivers/thermal/Makefile | 1 + drivers/thermal/rockchip_thermal.c | 605 +++++++++++++++++++++ 5 files changed, 692 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/rockchip-thermal.txt create mode 100644 drivers/thermal/rockchip_thermal.c
Signature · 1 line
1.9.1
PATCH v6 1/3 thermal: rockchip: add driver for Thermal
Thermal is TS-ADC Controller module supports
user-defined mode and automatic mode.
User-defined mode refers,TSADC all the control signals entirely by software writing to register for direct control.
Automaic mode refers to the module automatically poll TSADC output, and the results were checked.If you find that the temperature High in a period of time,an interrupt is generated to the processor down-measures taken;If the temperature over a period of time High, the resulting TSHUT gave CRU module,let it reset the entire chip, or via GPIO give PMIC.
--- drivers/thermal/Kconfig | 10 + drivers/thermal/Makefile | 1 + drivers/thermal/rockchip_thermal.c | 605 +++++++++++++++++++++++++++++++++++++ 3 files changed, 616 insertions(+) create mode 100644 drivers/thermal/rockchip_thermal.c
drivers/thermal/Kconfig +10 -0
@@ -133,6 +133,16 @@ config SPEAR_THERMAL Enable this to plug the SPEAr thermal sensor driver into the Linux thermal framework. +config ROCKCHIP_THERMAL + tristate "Rockchip thermal driver" + depends on ARCH_ROCKCHIP + help + Rockchip thermal driver provides support for Temperature sensor + ADC (TS-ADC) found on Rockchip SoCs. It supports one critical + trip point and one passive trip point. Cpufreq is used as the + cooling device and will throttle CPUs when the Temperature + crosses the passive trip point. + config RCAR_THERMAL tristate "Renesas R-Car thermal driver" depends on ARCH_SHMOBILE || COMPILE_TEST
drivers/thermal/Makefile +1 -0
@@ -19,6 +19,7 @@ thermal_sys-$(CONFIG_CPU_THERMAL) += cpu_cooling.o # platform thermal drivers obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o +obj-$(CONFIG_ROCKCHIP_THERMAL) += rockchip_thermal.o obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o obj-$(CONFIG_KIRKWOOD_THERMAL) += kirkwood_thermal.o obj-y += samsung/
drivers/thermal/rockchip_thermal.c new file +605 -0
605 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v6 2/3 dt-bindings: document Rockchip thermal
In reply to Caesar WangThis add the necessary binding documentation for the thermal found on Rockchip SoCs
--- .../bindings/thermal/rockchip-thermal.txt | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
Documentation/devicetree/bindings/thermal/rockchip-thermal.txt new file +32 -0
@@ -0,0 +1,32 @@ +* Temperature Sensor ADC (TSADC) on rockchip SoCs + +Required properties: +- compatible: "rockchip,rk3288-tsadc" +- reg: physical base address of the controller and length of memory mapped + region. +- interrupts: The interrupt number to the cpu. The interrupt specifier format + depends on the interrupt controller. +- clocks: Must contain an entry for each entry in clock-names. +- clock-names: Shall be "tsadc" for the converter-clock, and "apb_pclk" for + the peripheral clock. +- #thermal-sensor-cells: Should be 1. See ./thermal.txt for a description. + +Exiample: +tsadc: tsadc at ff280000 { + compatible = "rockchip,rk3288-tsadc"; + reg = <0xff280000 0x100>; + interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>; + clock-names = "tsadc", "apb_pclk"; +}; + +Example: referring to thermal sensors: +thermal-zones { + cpu { + polling-delay-passive = <2000>; + polling-delay = <1000>; + + thermal-sensors = + <&tsadc 0>; + }; +};
Signature · 1 line
1.9.1
PATCH v6 3/3 ARM: dts: add main Thermal info to rk3288
In reply to Caesar Wang--- arch/arm/boot/dts/rk3288.dtsi | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
arch/arm/boot/dts/rk3288.dtsi +44 -0
@@ -15,6 +15,7 @@ #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/pinctrl/rockchip.h> #include <dt-bindings/clock/rk3288-cru.h> +#include <dt-bindings/thermal/thermal.h> #include "skeleton.dtsi" / {
@@ -215,6 +216,43 @@ status = "disabled"; }; + thermal-zones { + cpu { + polling-delay-passive = <2000>; + polling-delay = <1000>; + + thermal-sensors = + <&tsadc 0>; + + trips { + cpu_alert0: cpu_alert { + temperature = <80000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "passive"; + }; + cpu_crit: cpu_crit { + temperature = <120000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "critical"; + }; + }; + }; + }; + + tsadc: tsadc at ff280000 { + compatible = "rockchip,rk3288-tsadc"; + reg = <0xff280000 0x100>; + interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>; + clock-names = "tsadc", "apb_pclk"; + pinctrl-names = "tsadc_int"; + pinctrl-0 = <&otp_out>; + reset-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; + + #thermal-sensor-cells = <1>; + hw-shut-temp = <115000>; + }; + usb_host0_ehci: usb at ff500000 { compatible = "generic-ehci"; reg = <0xff500000 0x100>;
@@ -611,5 +649,11 @@ rockchip,pins = <5 15 3 &pcfg_pull_none>; }; }; + + tsadc { + otp_out: otp-out { + rockchip,pins = <0 10 RK_FUNC_1 &pcfg_pull_none>; + }; + }; }; };
Signature · 1 line
1.9.1