All of lore.kernel.org
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@free-electrons.com>
To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de,
	pmeerw@pmeerw.net, robh+dt@kernel.org, mark.rutland@arm.com,
	maxime.ripard@free-electrons.com, wens@csie.org,
	lee.jones@linaro.org, linux@armlinux.org.uk,
	stefan.mavrodiev@gmail.com
Cc: Quentin Schulz <quentin.schulz@free-electrons.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	thomas.petazzoni@free-electrons.com
Subject: [PATCH 7/7] ARM: dtsi: sun8i-a33: add CPU thermal throttling
Date: Tue, 20 Dec 2016 11:27:09 +0100	[thread overview]
Message-ID: <20161220102709.9504-8-quentin.schulz@free-electrons.com> (raw)
In-Reply-To: <20161220102709.9504-1-quentin.schulz@free-electrons.com>

This adds CPU thermal throttling for the Allwinner A33. It uses the
thermal sensor present in the SoC's GPADC.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
---
 arch/arm/boot/dts/sun8i-a33.dtsi | 47 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a33.dtsi b/arch/arm/boot/dts/sun8i-a33.dtsi
index 1fcae81..735ebea 100644
--- a/arch/arm/boot/dts/sun8i-a33.dtsi
+++ b/arch/arm/boot/dts/sun8i-a33.dtsi
@@ -43,6 +43,7 @@
  */
 
 #include "sun8i-a23-a33.dtsi"
+#include <dt-bindings/thermal/thermal.h>
 
 / {
 	cpu0_opp_table: opp_table0 {
@@ -79,6 +80,9 @@
 			clocks = <&ccu CLK_CPUX>;
 			clock-names = "cpu";
 			operating-points-v2 = <&cpu0_opp_table>;
+			cooling-min-level = <0>;
+			cooling-max-level = <3>;
+			#cooling-cells = <2>;
 		};
 
 		cpu@2 {
@@ -100,6 +104,49 @@
 		status = "disabled";
 	};
 
+	thermal-zones {
+		cpu_thermal {
+			/* milliseconds */
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+			thermal-sensors = <&rtp>;
+
+			cooling-maps {
+				map0 {
+					trip = <&cpu_alert0>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+				map1 {
+					trip = <&cpu_alert1>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+
+			trips {
+				cpu_alert0: cpu_alert0 {
+					/* milliCelsius */
+					temperature = <75000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_alert1: cpu_alert1 {
+					/* milliCelsius */
+					temperature = <90000>;
+					hysteresis = <2000>;
+					type = "hot";
+				};
+
+				cpu_crit: cpu_crit {
+					/* milliCelsius */
+					temperature = <110000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	memory {
 		reg = <0x40000000 0x80000000>;
 	};
-- 
2.9.3

WARNING: multiple messages have this Message-ID (diff)
From: quentin.schulz@free-electrons.com (Quentin Schulz)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/7] ARM: dtsi: sun8i-a33: add CPU thermal throttling
Date: Tue, 20 Dec 2016 11:27:09 +0100	[thread overview]
Message-ID: <20161220102709.9504-8-quentin.schulz@free-electrons.com> (raw)
In-Reply-To: <20161220102709.9504-1-quentin.schulz@free-electrons.com>

This adds CPU thermal throttling for the Allwinner A33. It uses the
thermal sensor present in the SoC's GPADC.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
---
 arch/arm/boot/dts/sun8i-a33.dtsi | 47 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a33.dtsi b/arch/arm/boot/dts/sun8i-a33.dtsi
index 1fcae81..735ebea 100644
--- a/arch/arm/boot/dts/sun8i-a33.dtsi
+++ b/arch/arm/boot/dts/sun8i-a33.dtsi
@@ -43,6 +43,7 @@
  */
 
 #include "sun8i-a23-a33.dtsi"
+#include <dt-bindings/thermal/thermal.h>
 
 / {
 	cpu0_opp_table: opp_table0 {
@@ -79,6 +80,9 @@
 			clocks = <&ccu CLK_CPUX>;
 			clock-names = "cpu";
 			operating-points-v2 = <&cpu0_opp_table>;
+			cooling-min-level = <0>;
+			cooling-max-level = <3>;
+			#cooling-cells = <2>;
 		};
 
 		cpu at 2 {
@@ -100,6 +104,49 @@
 		status = "disabled";
 	};
 
+	thermal-zones {
+		cpu_thermal {
+			/* milliseconds */
+			polling-delay-passive = <250>;
+			polling-delay = <1000>;
+			thermal-sensors = <&rtp>;
+
+			cooling-maps {
+				map0 {
+					trip = <&cpu_alert0>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+				map1 {
+					trip = <&cpu_alert1>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+
+			trips {
+				cpu_alert0: cpu_alert0 {
+					/* milliCelsius */
+					temperature = <75000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_alert1: cpu_alert1 {
+					/* milliCelsius */
+					temperature = <90000>;
+					hysteresis = <2000>;
+					type = "hot";
+				};
+
+				cpu_crit: cpu_crit {
+					/* milliCelsius */
+					temperature = <110000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+			};
+		};
+	};
+
 	memory {
 		reg = <0x40000000 0x80000000>;
 	};
-- 
2.9.3

  parent reply	other threads:[~2016-12-20 10:29 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20 10:27 [PATCH 0/7] add CPU thermal throttling to Allwinner A33 SoC Quentin Schulz
2016-12-20 10:27 ` Quentin Schulz
2016-12-20 10:27 ` Quentin Schulz
2016-12-20 10:27 ` [PATCH 1/7] Documentation: DT: bindings: iio: adc: add documentation for Allwinner SoCs' GPADC driver Quentin Schulz
2016-12-20 10:27   ` Quentin Schulz
2016-12-20 10:27   ` Quentin Schulz
2016-12-20 14:25   ` Maxime Ripard
2016-12-20 14:25     ` Maxime Ripard
2016-12-20 14:25     ` Maxime Ripard
2016-12-20 15:43     ` Quentin Schulz
2016-12-20 15:43       ` Quentin Schulz
2016-12-20 15:43       ` Quentin Schulz
2016-12-21 12:20       ` Maxime Ripard
2016-12-21 12:20         ` Maxime Ripard
2016-12-21 12:20         ` Maxime Ripard
2016-12-20 10:27 ` [PATCH 2/7] Documentation: DT: bindings: mfd: add documentation for Allwinner SoCs' GPADC MFD driver Quentin Schulz
2016-12-20 10:27   ` Quentin Schulz
2016-12-20 10:27   ` Quentin Schulz
2016-12-20 14:26   ` Maxime Ripard
2016-12-20 14:26     ` Maxime Ripard
2016-12-20 14:26     ` Maxime Ripard
2016-12-20 10:27 ` [PATCH 3/7] iio: adc: sun4i-gpadc-iio: add support for A33 thermal sensor Quentin Schulz
2016-12-20 10:27   ` Quentin Schulz
2016-12-20 10:27   ` Quentin Schulz
2016-12-20 14:44   ` Maxime Ripard
2016-12-20 14:44     ` Maxime Ripard
2016-12-20 14:44     ` Maxime Ripard
2016-12-20 15:20     ` Quentin Schulz
2016-12-20 15:20       ` Quentin Schulz
2016-12-20 15:20       ` Quentin Schulz
2016-12-21  9:09       ` Maxime Ripard
2016-12-21  9:09         ` Maxime Ripard
2016-12-21  9:09         ` Maxime Ripard
2016-12-20 10:27 ` [PATCH 4/7] ARM: dts: sun8i-a33-sinlinx-sina33: add cpu-supply Quentin Schulz
2016-12-20 10:27   ` Quentin Schulz
2016-12-20 10:27   ` Quentin Schulz
2016-12-20 10:27 ` [PATCH 5/7] ARM: dts: sun8i-a33-olinuxino: " Quentin Schulz
2016-12-20 10:27   ` Quentin Schulz
2016-12-20 10:27 ` [PATCH 6/7] ARM: dtsi: sun8i-a33: add A33 thermal sensor Quentin Schulz
2016-12-20 10:27   ` Quentin Schulz
2016-12-20 10:27 ` Quentin Schulz [this message]
2016-12-20 10:27   ` [PATCH 7/7] ARM: dtsi: sun8i-a33: add CPU thermal throttling Quentin Schulz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161220102709.9504-8-quentin.schulz@free-electrons.com \
    --to=quentin.schulz@free-electrons.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=stefan.mavrodiev@gmail.com \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.