linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH] ARM64: dts: rockchip: add thermal zone node for rk3399 SoCs
@ 2016-05-25  7:39 Caesar Wang
  2016-06-07 14:33 ` Heiko Stübner
  0 siblings, 1 reply; 2+ messages in thread
From: Caesar Wang @ 2016-05-25  7:39 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: edubezval, dianders, briannorris, smbarber, linux-rockchip,
	Caesar Wang, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala, Catalin Marinas, Will Deacon, Jianqun Xu, devicetree,
	linux-arm-kernel, linux-kernel

This adds thermal zone node to rk3399 dtsi, rk3399 thermal data is
including the cpu and gpu sensor zone node.

The thermal zone node is the node containing all the required info
for describing a thermal zone, including its cooling device bindings.
The thermal zone node must contain, apart from its own properties, one
sub-node containing trip nodes and one sub-node containing all the zone
cooling maps.

The following is the parameter is introduced:
* polling-delay:
The maximum number of milliseconds to wait between polls

* polling-delay-passive:
The maximum number of milliseconds to wait between polls when performing
passive cooling.

* trips:
A sub-node which is a container of only trip point nodes required to
describe the thermal zone.

* cooling-maps:
A sub-node which is a container of only cooling device map nodes, used to
describe the relation between trips and cooling devices.

* cooling-device:
A phandle of a cooling device with its specifier, referring to which
cooling device is used in this cooling specifier binding. In the cooling
specifier, the first cell is the minimum cooling state and the second cell
is the maximum cooling state used in this map.

Signed-off-by: Caesar Wang <wxt@rock-chips.com>
---

 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 100 +++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index 46f325a..f8a80c2 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -45,6 +45,7 @@
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/pinctrl/rockchip.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
 	compatible = "rockchip,rk3399";
@@ -389,6 +390,95 @@
 		status = "disabled";
 	};
 
+	thermal-zones {
+		cpu_thermal: cpu {
+			polling-delay-passive = <100>; /* milliseconds */
+			polling-delay = <1000>; /* milliseconds */
+
+			thermal-sensors = <&tsadc 0>;
+
+			trips {
+				cpu_alert0: cpu_alert0 {
+					temperature = <70000>; /* millicelsius */
+					hysteresis = <2000>; /* millicelsius */
+					type = "passive";
+				};
+				cpu_alert1: cpu_alert1 {
+					temperature = <75000>; /* millicelsius */
+					hysteresis = <2000>; /* millicelsius */
+					type = "passive";
+				};
+				cpu_crit: cpu_crit {
+					temperature = <95000>; /* millicelsius */
+					hysteresis = <2000>; /* millicelsius */
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map0 {
+					trip = <&cpu_alert0>;
+					cooling-device =
+						<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+				map1 {
+					trip = <&cpu_alert1>;
+					cooling-device =
+						<&cpu_l0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+						<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+
+		gpu_thermal: gpu {
+			polling-delay-passive = <100>; /* milliseconds */
+			polling-delay = <1000>; /* milliseconds */
+
+			thermal-sensors = <&tsadc 1>;
+
+			trips {
+				gpu_alert0: gpu_alert0 {
+					temperature = <75000>; /* millicelsius */
+					hysteresis = <2000>; /* millicelsius */
+					type = "passive";
+				};
+				gpu_crit: gpu_crit {
+					temperature = <95000>; /* millicelsius */
+					hysteresis = <2000>; /* millicelsius */
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map0 {
+					trip = <&gpu_alert0>;
+					cooling-device =
+						<&cpu_b0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+	};
+
+	tsadc: tsadc@ff260000 {
+		compatible = "rockchip,rk3399-tsadc";
+		reg = <0x0 0xff260000 0x0 0x100>;
+		interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
+		rockchip,grf = <&grf>;
+		clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>;
+		clock-names = "tsadc", "apb_pclk";
+		assigned-clocks = <&cru SCLK_TSADC>;
+		assigned-clock-rates = <750000>;
+		resets = <&cru SRST_TSADC>;
+		reset-names = "tsadc-apb";
+		pinctrl-names = "init", "default", "sleep";
+		pinctrl-0 = <&otp_gpio>;
+		pinctrl-1 = <&otp_out>;
+		pinctrl-2 = <&otp_gpio>;
+		#thermal-sensor-cells = <1>;
+		rockchip,hw-tshut-temp = <95000>;
+		status = "disabled";
+	};
+
 	pmugrf: syscon@ff320000 {
 		compatible = "rockchip,rk3399-pmugrf", "syscon";
 		reg = <0x0 0xff320000 0x0 0x1000>;
@@ -881,6 +971,16 @@
 			};
 		};
 
+		tsadc {
+			otp_gpio: otp-gpio {
+				rockchip,pins = <1 6 RK_FUNC_GPIO &pcfg_pull_none>;
+			};
+
+			otp_out: otp-out {
+				rockchip,pins = <1 6 RK_FUNC_1 &pcfg_pull_none>;
+			};
+		};
+
 		uart0 {
 			uart0_xfer: uart0-xfer {
 				rockchip,pins =
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESEND PATCH] ARM64: dts: rockchip: add thermal zone node for rk3399 SoCs
  2016-05-25  7:39 [RESEND PATCH] ARM64: dts: rockchip: add thermal zone node for rk3399 SoCs Caesar Wang
@ 2016-06-07 14:33 ` Heiko Stübner
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Stübner @ 2016-06-07 14:33 UTC (permalink / raw)
  To: Caesar Wang
  Cc: edubezval, dianders, briannorris, smbarber, linux-rockchip,
	Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Catalin Marinas, Will Deacon, Jianqun Xu, devicetree,
	linux-arm-kernel, linux-kernel

Am Mittwoch, 25. Mai 2016, 15:39:35 schrieb Caesar Wang:
> This adds thermal zone node to rk3399 dtsi, rk3399 thermal data is
> including the cpu and gpu sensor zone node.
> 
> The thermal zone node is the node containing all the required info
> for describing a thermal zone, including its cooling device bindings.
> The thermal zone node must contain, apart from its own properties, one
> sub-node containing trip nodes and one sub-node containing all the zone
> cooling maps.
> 
> The following is the parameter is introduced:
> * polling-delay:
> The maximum number of milliseconds to wait between polls
> 
> * polling-delay-passive:
> The maximum number of milliseconds to wait between polls when performing
> passive cooling.
> 
> * trips:
> A sub-node which is a container of only trip point nodes required to
> describe the thermal zone.
> 
> * cooling-maps:
> A sub-node which is a container of only cooling device map nodes, used to
> describe the relation between trips and cooling devices.
> 
> * cooling-device:
> A phandle of a cooling device with its specifier, referring to which
> cooling device is used in this cooling specifier binding. In the cooling
> specifier, the first cell is the minimum cooling state and the second cell
> is the maximum cooling state used in this map.
> 
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>

applied to my dts64 branch for 4.8.
I've dropped all the milliseconds etc comments though. They're part of the 
binding, so no need to document the unit in the dts all the time :-)


Thanks
Heiko

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-07 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-25  7:39 [RESEND PATCH] ARM64: dts: rockchip: add thermal zone node for rk3399 SoCs Caesar Wang
2016-06-07 14:33 ` Heiko Stübner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).