linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/3] ARM: sun8i-r40: CPU improve
@ 2022-05-17  1:36 qianfanguijin
  2022-05-17  1:36 ` [PATCH v5 1/3] ARM: dts: sun8i-r40: Add "cpu-supply" node for sun8i-r40 based board qianfanguijin
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: qianfanguijin @ 2022-05-17  1:36 UTC (permalink / raw)
  To: linux-sunxi
  Cc: Rob Herring, Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec,
	Rafael J . Wysocki, Viresh Kumar, devicetree, linux-arm-kernel,
	linux-kernel, linux-pm, qianfan Zhao

From: qianfan Zhao <qianfanguijin@163.com>

Change history:
===============
v5(2022-05-17):
- Move opp tables to sun8i-r40-cpu-opp.dtsi
- cpufreq supports 720M, 912M, 1G, 1.1G, 1.2G
- Add cooling supports

v4(2022-05-16):
- Invert two patches.
- Drop the cpufreqs that exceeds 1G in opp tables.

v3:
- remove "allwinner-r40" compatible from allowlist.
- split dts in two part.

Test:
=====

cpufreq was tested by tools: https://github.com/ssvb/cpuburn-arm

1. cpufreq-ljt-stress-test

- root@ubuntu:~/cpuburn-arm-master# ./cpufreq-ljt-stress-test 
- CPU stress test, which is doing JPEG decoding by libjpeg-turbo
- at different cpufreq operating points.
- 
- Testing CPU 0
-  1200 MHz ............................................................ OK
-  1104 MHz ............................................................ OK
-  1008 MHz ............................................................ OK
-   912 MHz ............................................................ OK
-   720 MHz ............................................................ OK
- 
- Testing CPU 1
-  1200 MHz ............................................................ OK
-  1104 MHz ............................................................ OK
-  1008 MHz ............................................................ OK
-   912 MHz ............................................................ OK
-   720 MHz ............................................................ OK
- 
- Testing CPU 2
-  1200 MHz ............................................................ OK
-  1104 MHz ............................................................ OK
-  1008 MHz ............................................................ OK
-   912 MHz ............................................................ OK
-   720 MHz ............................................................ OK
- 
- Testing CPU 3
-  1200 MHz ............................................................ OK
-  1104 MHz ............................................................ OK
-  1008 MHz ............................................................ OK
-   912 MHz ............................................................ OK
-   720 MHz ............................................................ OK

Overall result : PASSED

2. cpu freq slow down when cpuburn-a7.out running

- temperature: 79213, online: 0-3, freq: 1200000
- temperature: 79213, online: 0-3, freq: 1200000
- temperature: 80230, online: 0-3, freq: 1104000
- temperature: 78874, online: 0-3, freq: 1200000
- temperature: 80004, online: 0-3, freq: 1104000
- temperature: 79213, online: 0-3, freq: 1200000
- temperature: 78196, online: 0-3, freq: 1200000
- temperature: 79891, online: 0-3, freq: 1200000
- temperature: 78422, online: 0-3, freq: 1200000
- temperature: 80343, online: 0-3, freq: 1104000
- temperature: 80343, online: 0-3, freq: 1104000


qianfan Zhao (3):
  ARM: dts: sun8i-r40: Add "cpu-supply" node for sun8i-r40 based board
  ARM: dts: sun8i-r40: add opp table for cpu
  ARM: dts: sun8i-r40: Add thermal trip points/cooling maps

 .../boot/dts/sun8i-r40-bananapi-m2-ultra.dts  |  5 ++
 arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi      | 52 +++++++++++++++++++
 arch/arm/boot/dts/sun8i-r40-feta40i.dtsi      |  5 ++
 arch/arm/boot/dts/sun8i-r40.dtsi              | 36 +++++++++++++
 arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts      |  5 ++
 .../boot/dts/sun8i-v40-bananapi-m2-berry.dts  |  5 ++
 6 files changed, 108 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi

-- 
2.25.1


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

* [PATCH v5 1/3] ARM: dts: sun8i-r40: Add "cpu-supply" node for sun8i-r40 based board
  2022-05-17  1:36 [PATCH v5 0/3] ARM: sun8i-r40: CPU improve qianfanguijin
@ 2022-05-17  1:36 ` qianfanguijin
  2022-07-05  4:45   ` Samuel Holland
  2022-05-17  1:36 ` [PATCH v5 2/3] ARM: dts: sun8i-r40: add opp table for cpu qianfanguijin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: qianfanguijin @ 2022-05-17  1:36 UTC (permalink / raw)
  To: linux-sunxi
  Cc: Rob Herring, Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec,
	Rafael J . Wysocki, Viresh Kumar, devicetree, linux-arm-kernel,
	linux-kernel, linux-pm, qianfan Zhao

From: qianfan Zhao <qianfanguijin@163.com>

The CPU of sun8i-r40 is powered by PMIC, let's add "cpu-supply" node.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
---
 arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 4 ++++
 arch/arm/boot/dts/sun8i-r40-feta40i.dtsi          | 4 ++++
 arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts          | 4 ++++
 arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts | 4 ++++
 4 files changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
index a6a1087a0c9b..4f30018ec4a2 100644
--- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
+++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
@@ -113,6 +113,10 @@ &ahci {
 	status = "okay";
 };
 
+&cpu0 {
+	cpu-supply = <&reg_dcdc2>;
+};
+
 &de {
 	status = "okay";
 };
diff --git a/arch/arm/boot/dts/sun8i-r40-feta40i.dtsi b/arch/arm/boot/dts/sun8i-r40-feta40i.dtsi
index 265e0fa57a32..b872b51a346d 100644
--- a/arch/arm/boot/dts/sun8i-r40-feta40i.dtsi
+++ b/arch/arm/boot/dts/sun8i-r40-feta40i.dtsi
@@ -6,6 +6,10 @@
 
 #include "sun8i-r40.dtsi"
 
+&cpu0 {
+	cpu-supply = <&reg_dcdc2>;
+};
+
 &i2c0 {
 	status = "okay";
 
diff --git a/arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts b/arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts
index 6931aaab2382..0eb1990742ff 100644
--- a/arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts
+++ b/arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts
@@ -88,6 +88,10 @@ &ahci {
 	status = "okay";
 };
 
+&cpu0 {
+	cpu-supply = <&reg_dcdc2>;
+};
+
 &de {
 	status = "okay";
 };
diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
index 47954551f573..fdf8bd12faaa 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -107,6 +107,10 @@ &ahci {
 	status = "okay";
 };
 
+&cpu0 {
+	cpu-supply = <&reg_dcdc2>;
+};
+
 &de {
 	status = "okay";
 };
-- 
2.25.1


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

* [PATCH v5 2/3] ARM: dts: sun8i-r40: add opp table for cpu
  2022-05-17  1:36 [PATCH v5 0/3] ARM: sun8i-r40: CPU improve qianfanguijin
  2022-05-17  1:36 ` [PATCH v5 1/3] ARM: dts: sun8i-r40: Add "cpu-supply" node for sun8i-r40 based board qianfanguijin
@ 2022-05-17  1:36 ` qianfanguijin
  2022-07-05  4:57   ` Samuel Holland
  2022-05-17  1:36 ` [PATCH v5 3/3] ARM: dts: sun8i-r40: Add thermal trip points/cooling maps qianfanguijin
  2022-07-05 19:41 ` [PATCH v5 0/3] ARM: sun8i-r40: CPU improve Jernej Škrabec
  3 siblings, 1 reply; 8+ messages in thread
From: qianfanguijin @ 2022-05-17  1:36 UTC (permalink / raw)
  To: linux-sunxi
  Cc: Rob Herring, Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec,
	Rafael J . Wysocki, Viresh Kumar, devicetree, linux-arm-kernel,
	linux-kernel, linux-pm, qianfan Zhao

From: qianfan Zhao <qianfanguijin@163.com>

OPP table value is get from allwinner lichee linux-3.10 kernel driver

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
---
 .../boot/dts/sun8i-r40-bananapi-m2-ultra.dts  |  1 +
 arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi      | 52 +++++++++++++++++++
 arch/arm/boot/dts/sun8i-r40-feta40i.dtsi      |  1 +
 arch/arm/boot/dts/sun8i-r40.dtsi              |  8 +++
 arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts      |  1 +
 .../boot/dts/sun8i-v40-bananapi-m2-berry.dts  |  1 +
 6 files changed, 64 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi

diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
index 4f30018ec4a2..28197bbcb1d5 100644
--- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
+++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
@@ -43,6 +43,7 @@
 
 /dts-v1/;
 #include "sun8i-r40.dtsi"
+#include "sun8i-r40-cpu-opp.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
 
diff --git a/arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi b/arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi
new file mode 100644
index 000000000000..4faa22d3bac8
--- /dev/null
+++ b/arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi
@@ -0,0 +1,52 @@
+/{
+	cpu0_opp_table: opp_table0 {
+		compatible = "operating-points-v2";
+		opp-shared;
+
+		opp-720000000 {
+			opp-hz = /bits/ 64 <720000000>;
+			opp-microvolt = <1000000 1000000 1300000>;
+			clock-latency-ns = <2000000>;
+		};
+
+		opp-912000000 {
+			opp-hz = /bits/ 64 <912000000>;
+			opp-microvolt = <1100000 1100000 1300000>;
+			clock-latency-ns = <2000000>;
+		};
+
+		opp-1008000000 {
+			opp-hz = /bits/ 64 <1008000000>;
+			opp-microvolt = <1160000 1160000 1300000>;
+			clock-latency-ns = <2000000>;
+		};
+
+		opp-1104000000 {
+			opp-hz = /bits/ 64 <1104000000>;
+			opp-microvolt = <1240000 1240000 1300000>;
+			clock-latency-ns = <2000000>;
+		};
+
+		opp-1200000000 {
+			opp-hz = /bits/ 64 <1200000000>;
+			opp-microvolt = <1300000 1300000 1300000>;
+			clock-latency-ns = <2000000>;
+		};
+	};
+};
+
+&cpu0 {
+	operating-points-v2 = <&cpu0_opp_table>;
+};
+
+&cpu1 {
+	operating-points-v2 = <&cpu0_opp_table>;
+};
+
+&cpu2 {
+	operating-points-v2 = <&cpu0_opp_table>;
+};
+
+&cpu3 {
+	operating-points-v2 = <&cpu0_opp_table>;
+};
diff --git a/arch/arm/boot/dts/sun8i-r40-feta40i.dtsi b/arch/arm/boot/dts/sun8i-r40-feta40i.dtsi
index b872b51a346d..9f39b5a2bb35 100644
--- a/arch/arm/boot/dts/sun8i-r40-feta40i.dtsi
+++ b/arch/arm/boot/dts/sun8i-r40-feta40i.dtsi
@@ -5,6 +5,7 @@
 //  Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
 
 #include "sun8i-r40.dtsi"
+#include "sun8i-r40-cpu-opp.dtsi"
 
 &cpu0 {
 	cpu-supply = <&reg_dcdc2>;
diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
index 291f4784e86c..ae2a5ebd9924 100644
--- a/arch/arm/boot/dts/sun8i-r40.dtsi
+++ b/arch/arm/boot/dts/sun8i-r40.dtsi
@@ -84,24 +84,32 @@ cpu0: cpu@0 {
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
 			reg = <0>;
+			clocks = <&ccu CLK_CPU>;
+			clock-names = "cpu";
 		};
 
 		cpu1: cpu@1 {
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
 			reg = <1>;
+			clocks = <&ccu CLK_CPU>;
+			clock-names = "cpu";
 		};
 
 		cpu2: cpu@2 {
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
 			reg = <2>;
+			clocks = <&ccu CLK_CPU>;
+			clock-names = "cpu";
 		};
 
 		cpu3: cpu@3 {
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
 			reg = <3>;
+			clocks = <&ccu CLK_CPU>;
+			clock-names = "cpu";
 		};
 	};
 
diff --git a/arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts b/arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts
index 0eb1990742ff..9f472521f4a4 100644
--- a/arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts
+++ b/arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts
@@ -45,6 +45,7 @@
 
 /dts-v1/;
 #include "sun8i-r40.dtsi"
+#include "sun8i-r40-cpu-opp.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
 
diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
index fdf8bd12faaa..434871040aca 100644
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
@@ -42,6 +42,7 @@
 
 /dts-v1/;
 #include "sun8i-r40.dtsi"
+#include "sun8i-r40-cpu-opp.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
 
-- 
2.25.1


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

* [PATCH v5 3/3] ARM: dts: sun8i-r40: Add thermal trip points/cooling maps
  2022-05-17  1:36 [PATCH v5 0/3] ARM: sun8i-r40: CPU improve qianfanguijin
  2022-05-17  1:36 ` [PATCH v5 1/3] ARM: dts: sun8i-r40: Add "cpu-supply" node for sun8i-r40 based board qianfanguijin
  2022-05-17  1:36 ` [PATCH v5 2/3] ARM: dts: sun8i-r40: add opp table for cpu qianfanguijin
@ 2022-05-17  1:36 ` qianfanguijin
  2022-07-05  5:07   ` Samuel Holland
  2022-07-05 19:41 ` [PATCH v5 0/3] ARM: sun8i-r40: CPU improve Jernej Škrabec
  3 siblings, 1 reply; 8+ messages in thread
From: qianfanguijin @ 2022-05-17  1:36 UTC (permalink / raw)
  To: linux-sunxi
  Cc: Rob Herring, Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec,
	Rafael J . Wysocki, Viresh Kumar, devicetree, linux-arm-kernel,
	linux-kernel, linux-pm, qianfan Zhao

From: qianfan Zhao <qianfanguijin@163.com>

For the trip points, I used values from the BSP code.

The critical trip point value is 30°C above the maximum recommended
ambient temperature (85°C) for the SoC from the datasheet, so there's
some headroom even at such a high ambient temperature.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
---
 arch/arm/boot/dts/sun8i-r40.dtsi | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
index ae2a5ebd9924..b43f3f72a915 100644
--- a/arch/arm/boot/dts/sun8i-r40.dtsi
+++ b/arch/arm/boot/dts/sun8i-r40.dtsi
@@ -86,6 +86,7 @@ cpu0: cpu@0 {
 			reg = <0>;
 			clocks = <&ccu CLK_CPU>;
 			clock-names = "cpu";
+			#cooling-cells = <2>;
 		};
 
 		cpu1: cpu@1 {
@@ -94,6 +95,7 @@ cpu1: cpu@1 {
 			reg = <1>;
 			clocks = <&ccu CLK_CPU>;
 			clock-names = "cpu";
+			#cooling-cells = <2>;
 		};
 
 		cpu2: cpu@2 {
@@ -102,6 +104,7 @@ cpu2: cpu@2 {
 			reg = <2>;
 			clocks = <&ccu CLK_CPU>;
 			clock-names = "cpu";
+			#cooling-cells = <2>;
 		};
 
 		cpu3: cpu@3 {
@@ -110,6 +113,7 @@ cpu3: cpu@3 {
 			reg = <3>;
 			clocks = <&ccu CLK_CPU>;
 			clock-names = "cpu";
+			#cooling-cells = <2>;
 		};
 	};
 
@@ -125,6 +129,30 @@ cpu_thermal: cpu0-thermal {
 			polling-delay-passive = <0>;
 			polling-delay = <0>;
 			thermal-sensors = <&ths 0>;
+
+			trips {
+				cpu_hot_trip: cpu-hot {
+					temperature = <80000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+
+				cpu_very_hot_trip: cpu-very-hot {
+					temperature = <115000>;
+					hysteresis = <0>;
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				cpu-hot-limit {
+					trip = <&cpu_hot_trip>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
 		};
 
 		gpu_thermal: gpu-thermal {
-- 
2.25.1


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

* Re: [PATCH v5 1/3] ARM: dts: sun8i-r40: Add "cpu-supply" node for sun8i-r40 based board
  2022-05-17  1:36 ` [PATCH v5 1/3] ARM: dts: sun8i-r40: Add "cpu-supply" node for sun8i-r40 based board qianfanguijin
@ 2022-07-05  4:45   ` Samuel Holland
  0 siblings, 0 replies; 8+ messages in thread
From: Samuel Holland @ 2022-07-05  4:45 UTC (permalink / raw)
  To: qianfanguijin
  Cc: linux-sunxi, Rob Herring, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, Rafael J . Wysocki, Viresh Kumar, devicetree,
	linux-arm-kernel, linux-kernel, linux-pm

On 5/16/22 8:36 PM, qianfanguijin@163.com wrote:
> From: qianfan Zhao <qianfanguijin@163.com>
> 
> The CPU of sun8i-r40 is powered by PMIC, let's add "cpu-supply" node.
> 
> Signed-off-by: qianfan Zhao <qianfanguijin@163.com>

Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>

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

* Re: [PATCH v5 2/3] ARM: dts: sun8i-r40: add opp table for cpu
  2022-05-17  1:36 ` [PATCH v5 2/3] ARM: dts: sun8i-r40: add opp table for cpu qianfanguijin
@ 2022-07-05  4:57   ` Samuel Holland
  0 siblings, 0 replies; 8+ messages in thread
From: Samuel Holland @ 2022-07-05  4:57 UTC (permalink / raw)
  To: qianfanguijin
  Cc: linux-sunxi, Rob Herring, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, Rafael J . Wysocki, Viresh Kumar, devicetree,
	linux-arm-kernel, linux-kernel, linux-pm

On 5/16/22 8:36 PM, qianfanguijin@163.com wrote:
> From: qianfan Zhao <qianfanguijin@163.com>
> 
> OPP table value is get from allwinner lichee linux-3.10 kernel driver
> 
> Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
> ---
>  .../boot/dts/sun8i-r40-bananapi-m2-ultra.dts  |  1 +
>  arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi      | 52 +++++++++++++++++++
>  arch/arm/boot/dts/sun8i-r40-feta40i.dtsi      |  1 +
>  arch/arm/boot/dts/sun8i-r40.dtsi              |  8 +++
>  arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts      |  1 +
>  .../boot/dts/sun8i-v40-bananapi-m2-berry.dts  |  1 +
>  6 files changed, 64 insertions(+)
>  create mode 100644 arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi
> 
> diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
> index 4f30018ec4a2..28197bbcb1d5 100644
> --- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
> +++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
> @@ -43,6 +43,7 @@
>  
>  /dts-v1/;
>  #include "sun8i-r40.dtsi"
> +#include "sun8i-r40-cpu-opp.dtsi"
>  
>  #include <dt-bindings/gpio/gpio.h>
>  
> diff --git a/arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi b/arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi
> new file mode 100644
> index 000000000000..4faa22d3bac8
> --- /dev/null
> +++ b/arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi
> @@ -0,0 +1,52 @@
> +/{
> +	cpu0_opp_table: opp_table0 {

The binding requires the node name to match a specific regex. The patch as
written does not validate:

arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dtb: opp_table0: $nodename:0: 'opp_table0'
does not match '^opp-table(-[a-z0-9]+)?$'
        From schema: Documentation/devicetree/bindings/opp/opp-v2.yaml

With the node renamed to "opp-table-cpu" (following H3), the devicetrees pass
validation. So with that one change:

Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>

Regards,
Samuel

> +		compatible = "operating-points-v2";
> +		opp-shared;
> +
> +		opp-720000000 {
> +			opp-hz = /bits/ 64 <720000000>;
> +			opp-microvolt = <1000000 1000000 1300000>;
> +			clock-latency-ns = <2000000>;
> +		};
> +
> +		opp-912000000 {
> +			opp-hz = /bits/ 64 <912000000>;
> +			opp-microvolt = <1100000 1100000 1300000>;
> +			clock-latency-ns = <2000000>;
> +		};
> +
> +		opp-1008000000 {
> +			opp-hz = /bits/ 64 <1008000000>;
> +			opp-microvolt = <1160000 1160000 1300000>;
> +			clock-latency-ns = <2000000>;
> +		};
> +
> +		opp-1104000000 {
> +			opp-hz = /bits/ 64 <1104000000>;
> +			opp-microvolt = <1240000 1240000 1300000>;
> +			clock-latency-ns = <2000000>;
> +		};
> +
> +		opp-1200000000 {
> +			opp-hz = /bits/ 64 <1200000000>;
> +			opp-microvolt = <1300000 1300000 1300000>;
> +			clock-latency-ns = <2000000>;
> +		};
> +	};
> +};
> +
> +&cpu0 {
> +	operating-points-v2 = <&cpu0_opp_table>;
> +};
> +
> +&cpu1 {
> +	operating-points-v2 = <&cpu0_opp_table>;
> +};
> +
> +&cpu2 {
> +	operating-points-v2 = <&cpu0_opp_table>;
> +};
> +
> +&cpu3 {
> +	operating-points-v2 = <&cpu0_opp_table>;
> +};
> diff --git a/arch/arm/boot/dts/sun8i-r40-feta40i.dtsi b/arch/arm/boot/dts/sun8i-r40-feta40i.dtsi
> index b872b51a346d..9f39b5a2bb35 100644
> --- a/arch/arm/boot/dts/sun8i-r40-feta40i.dtsi
> +++ b/arch/arm/boot/dts/sun8i-r40-feta40i.dtsi
> @@ -5,6 +5,7 @@
>  //  Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
>  
>  #include "sun8i-r40.dtsi"
> +#include "sun8i-r40-cpu-opp.dtsi"
>  
>  &cpu0 {
>  	cpu-supply = <&reg_dcdc2>;
> diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
> index 291f4784e86c..ae2a5ebd9924 100644
> --- a/arch/arm/boot/dts/sun8i-r40.dtsi
> +++ b/arch/arm/boot/dts/sun8i-r40.dtsi
> @@ -84,24 +84,32 @@ cpu0: cpu@0 {
>  			compatible = "arm,cortex-a7";
>  			device_type = "cpu";
>  			reg = <0>;
> +			clocks = <&ccu CLK_CPU>;
> +			clock-names = "cpu";
>  		};
>  
>  		cpu1: cpu@1 {
>  			compatible = "arm,cortex-a7";
>  			device_type = "cpu";
>  			reg = <1>;
> +			clocks = <&ccu CLK_CPU>;
> +			clock-names = "cpu";
>  		};
>  
>  		cpu2: cpu@2 {
>  			compatible = "arm,cortex-a7";
>  			device_type = "cpu";
>  			reg = <2>;
> +			clocks = <&ccu CLK_CPU>;
> +			clock-names = "cpu";
>  		};
>  
>  		cpu3: cpu@3 {
>  			compatible = "arm,cortex-a7";
>  			device_type = "cpu";
>  			reg = <3>;
> +			clocks = <&ccu CLK_CPU>;
> +			clock-names = "cpu";
>  		};
>  	};
>  
> diff --git a/arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts b/arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts
> index 0eb1990742ff..9f472521f4a4 100644
> --- a/arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts
> +++ b/arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts
> @@ -45,6 +45,7 @@
>  
>  /dts-v1/;
>  #include "sun8i-r40.dtsi"
> +#include "sun8i-r40-cpu-opp.dtsi"
>  
>  #include <dt-bindings/gpio/gpio.h>
>  
> diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> index fdf8bd12faaa..434871040aca 100644
> --- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> +++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
> @@ -42,6 +42,7 @@
>  
>  /dts-v1/;
>  #include "sun8i-r40.dtsi"
> +#include "sun8i-r40-cpu-opp.dtsi"
>  
>  #include <dt-bindings/gpio/gpio.h>
>  
> 


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

* Re: [PATCH v5 3/3] ARM: dts: sun8i-r40: Add thermal trip points/cooling maps
  2022-05-17  1:36 ` [PATCH v5 3/3] ARM: dts: sun8i-r40: Add thermal trip points/cooling maps qianfanguijin
@ 2022-07-05  5:07   ` Samuel Holland
  0 siblings, 0 replies; 8+ messages in thread
From: Samuel Holland @ 2022-07-05  5:07 UTC (permalink / raw)
  To: qianfanguijin
  Cc: linux-sunxi, Rob Herring, Maxime Ripard, Chen-Yu Tsai,
	Jernej Skrabec, Rafael J . Wysocki, Viresh Kumar, devicetree,
	linux-arm-kernel, linux-kernel, linux-pm

On 5/16/22 8:36 PM, qianfanguijin@163.com wrote:
> From: qianfan Zhao <qianfanguijin@163.com>
> 
> For the trip points, I used values from the BSP code.
> 
> The critical trip point value is 30°C above the maximum recommended
> ambient temperature (85°C) for the SoC from the datasheet, so there's
> some headroom even at such a high ambient temperature.
> 
> Signed-off-by: qianfan Zhao <qianfanguijin@163.com>

Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>

which took quite a while to hit the passive trip point:

# cat /sys/class/thermal/cooling_device0/stats/time_in_state_ms
state0  1374892
state1  1499
state2  0
state3  0
state4  0

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

* Re: [PATCH v5 0/3] ARM: sun8i-r40: CPU improve
  2022-05-17  1:36 [PATCH v5 0/3] ARM: sun8i-r40: CPU improve qianfanguijin
                   ` (2 preceding siblings ...)
  2022-05-17  1:36 ` [PATCH v5 3/3] ARM: dts: sun8i-r40: Add thermal trip points/cooling maps qianfanguijin
@ 2022-07-05 19:41 ` Jernej Škrabec
  3 siblings, 0 replies; 8+ messages in thread
From: Jernej Škrabec @ 2022-07-05 19:41 UTC (permalink / raw)
  To: linux-sunxi, qianfanguijin
  Cc: Rob Herring, Maxime Ripard, Chen-Yu Tsai, Rafael J . Wysocki,
	Viresh Kumar, devicetree, linux-arm-kernel, linux-kernel,
	linux-pm, qianfan Zhao

Dne torek, 17. maj 2022 ob 03:36:04 CEST je qianfanguijin@163.com napisal(a):
> From: qianfan Zhao <qianfanguijin@163.com>
> 
> Change history:
> ===============
> v5(2022-05-17):
> - Move opp tables to sun8i-r40-cpu-opp.dtsi
> - cpufreq supports 720M, 912M, 1G, 1.1G, 1.2G
> - Add cooling supports
> 
> v4(2022-05-16):
> - Invert two patches.
> - Drop the cpufreqs that exceeds 1G in opp tables.
> 
> v3:
> - remove "allwinner-r40" compatible from allowlist.
> - split dts in two part.
> 
> Test:
> =====
> 
> cpufreq was tested by tools: https://github.com/ssvb/cpuburn-arm
> 
> 1. cpufreq-ljt-stress-test
> 
> - root@ubuntu:~/cpuburn-arm-master# ./cpufreq-ljt-stress-test
> - CPU stress test, which is doing JPEG decoding by libjpeg-turbo
> - at different cpufreq operating points.
> -
> - Testing CPU 0
> -  1200 MHz ............................................................ OK
> -  1104 MHz ............................................................ OK
> -  1008 MHz ............................................................ OK
> -   912 MHz ............................................................ OK
> -   720 MHz ............................................................ OK
> -
> - Testing CPU 1
> -  1200 MHz ............................................................ OK
> -  1104 MHz ............................................................ OK
> -  1008 MHz ............................................................ OK
> -   912 MHz ............................................................ OK
> -   720 MHz ............................................................ OK
> -
> - Testing CPU 2
> -  1200 MHz ............................................................ OK
> -  1104 MHz ............................................................ OK
> -  1008 MHz ............................................................ OK
> -   912 MHz ............................................................ OK
> -   720 MHz ............................................................ OK
> -
> - Testing CPU 3
> -  1200 MHz ............................................................ OK
> -  1104 MHz ............................................................ OK
> -  1008 MHz ............................................................ OK
> -   912 MHz ............................................................ OK
> -   720 MHz ............................................................ OK
> 
> Overall result : PASSED
> 
> 2. cpu freq slow down when cpuburn-a7.out running
> 
> - temperature: 79213, online: 0-3, freq: 1200000
> - temperature: 79213, online: 0-3, freq: 1200000
> - temperature: 80230, online: 0-3, freq: 1104000
> - temperature: 78874, online: 0-3, freq: 1200000
> - temperature: 80004, online: 0-3, freq: 1104000
> - temperature: 79213, online: 0-3, freq: 1200000
> - temperature: 78196, online: 0-3, freq: 1200000
> - temperature: 79891, online: 0-3, freq: 1200000
> - temperature: 78422, online: 0-3, freq: 1200000
> - temperature: 80343, online: 0-3, freq: 1104000
> - temperature: 80343, online: 0-3, freq: 1104000
> 
> 
> qianfan Zhao (3):
>   ARM: dts: sun8i-r40: Add "cpu-supply" node for sun8i-r40 based board
>   ARM: dts: sun8i-r40: add opp table for cpu
>   ARM: dts: sun8i-r40: Add thermal trip points/cooling maps

Fixed opp table name and applied. Thanks!

Best regards,
Jernej

> 
>  .../boot/dts/sun8i-r40-bananapi-m2-ultra.dts  |  5 ++
>  arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi      | 52 +++++++++++++++++++
>  arch/arm/boot/dts/sun8i-r40-feta40i.dtsi      |  5 ++
>  arch/arm/boot/dts/sun8i-r40.dtsi              | 36 +++++++++++++
>  arch/arm/boot/dts/sun8i-t3-cqa3t-bv3.dts      |  5 ++
>  .../boot/dts/sun8i-v40-bananapi-m2-berry.dts  |  5 ++
>  6 files changed, 108 insertions(+)
>  create mode 100644 arch/arm/boot/dts/sun8i-r40-cpu-opp.dtsi
> 
> --
> 2.25.1



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

end of thread, other threads:[~2022-07-05 19:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17  1:36 [PATCH v5 0/3] ARM: sun8i-r40: CPU improve qianfanguijin
2022-05-17  1:36 ` [PATCH v5 1/3] ARM: dts: sun8i-r40: Add "cpu-supply" node for sun8i-r40 based board qianfanguijin
2022-07-05  4:45   ` Samuel Holland
2022-05-17  1:36 ` [PATCH v5 2/3] ARM: dts: sun8i-r40: add opp table for cpu qianfanguijin
2022-07-05  4:57   ` Samuel Holland
2022-05-17  1:36 ` [PATCH v5 3/3] ARM: dts: sun8i-r40: Add thermal trip points/cooling maps qianfanguijin
2022-07-05  5:07   ` Samuel Holland
2022-07-05 19:41 ` [PATCH v5 0/3] ARM: sun8i-r40: CPU improve Jernej Škrabec

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).