Skip to contentSkip to conversation

v2 Exynos5422 odroidxu3 pwm-fan control using thermal sensors

PATCH Superseded Anand Moon 1 participant 6 messages Apr 9, 2015

Subsystems (2)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Anand Moon

author
#0 lore raw

This work depeds upon work done by Lukasz Majewski <[email protected]> and Sjoerd Simons <[email protected]> regarding the pwm-fan.

Changes from v1
fixed the registration of thermal sensor to tmu_cpu0
Dropped patches.
0005-pwm-samsung-Fix-output-race-on-disabling.patch 0006-hwmon-pwm-fan-Update-the-duty-cycle-inorder-to-contr.patch

-Anand Moon

author
#1 lore raw

PATCH v2 1/5 ARM: dts :exynos5422-odroidxu3 Add pwm-fan node to the Odroid-XU3 board.

Add pwm-fan node to the OdroidXU3 board.

Tested on OdroidXU3 board.

Changes since v1 : None

---
 arch/arm/boot/dts/exynos5422-odroidxu3.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/boot/dts/exynos5422-odroidxu3.dts +16 -0
index a519c86..04d982b 100644
@@ -278,6 +278,15 @@
 	rtc at 101E0000 {
 		status = "okay";
 	};
+
+	fan0: pwm-fan {
+		compatible = "pwm-fan";
+		pwms = <&pwm 0 20972 0>;
+		cooling-min-state = <0>;
+		cooling-max-state = <3>;
+		#cooling-cells = <2>;
+		cooling-levels = <0 130 170 230>;
+	};
 };
 
 &hdmi {
@@ -369,3 +378,10 @@
 		shunt-resistor = <10000>;
 	};
 };
+
+&pwm {
+	pinctrl-0 = <&pwm0_out>;
+	pinctrl-names = "default";
+	samsung,pwm-outputs = <0>;
+	status = "okay";
+};
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v2 2/5 ARM: dts: OdroidXU3: Enable TMU at Exynos5422 base.

In reply to Anand Moon

This commit enables TMU IP block on the Exynos5422 OdroidXU3 device.

Tested on OdroidXU3 board.

Changes since v1 : None

---
 arch/arm/boot/dts/exynos5422-odroidxu3.dts | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
arch/arm/boot/dts/exynos5422-odroidxu3.dts +25 -0
index 04d982b..6e7ee53 100644
@@ -287,6 +287,31 @@
 		#cooling-cells = <2>;
 		cooling-levels = <0 130 170 230>;
 	};
+
+	tmu at 10060000 {
+		vtmu-supply = <&ldo10_reg>;
+		status = "okay";
+	};
+
+	tmu at 10064000 {
+		vtmu-supply = <&ldo10_reg>;
+		status = "okay";
+	};
+
+	tmu at 10068000 {
+		vtmu-supply = <&ldo10_reg>;
+		status = "okay";
+	};
+
+	tmu at 1006c000 {
+		vtmu-supply = <&ldo10_reg>;
+		status = "okay";
+	};
+
+	tmu at 100a0000 {
+		vtmu-supply = <&ldo10_reg>;
+		status = "okay";
+	};
 };
 
 &hdmi {
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH v2 3/5 ARM: dts: define default thermal-zones for exynos5

In reply to Anand Moon

Trip points corresponding to the one defined in the exynos_tmu_data.c for Exynos5 have been included.
This thermal-zones attribute is afterwards reused for Exynos5422.

Changes since v1 : Fixed the thernal_sensor registration of the sensors tmu_cpu0

---
 arch/arm/boot/dts/exynos5-cpu-thermal.dtsi | 59 ++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 arch/arm/boot/dts/exynos5-cpu-thermal.dtsi
arch/arm/boot/dts/exynos5-cpu-thermal.dtsi new file +59 -0
new file mode 100644
index 0000000..3ce8872
@@ -0,0 +1,59 @@
+/*
+ * Device tree sources for Exynos5 thermal zone
+ *
+ * Copyright (c) 2015 Lukasz Majewski <[email protected]>
+ *			Anand Moon <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <dt-bindings/thermal/thermal.h>
+
+/ {
+	thermal-zones {
+		cpu0_thermal: cpu0-thermal {
+			thermal-sensors = <&tmu_cpu0 0>;
+			polling-delay-passive = <0>;
+			polling-delay = <0>;
+			trips {
+				cpu_alert0: cpu-alert-0 {
+					temperature = <50000>; /* millicelsius */
+					hysteresis = <5000>; /* millicelsius */
+					type = "active";
+				};
+				cpu_alert1: cpu-alert-1 {
+					temperature = <60000>; /* millicelsius */
+					hysteresis = <5000>; /* millicelsius */
+					type = "active";
+				};
+				cpu_alert2: cpu-alert-2 {
+					temperature = <70000>; /* millicelsius */
+					hysteresis = <5000>; /* millicelsius */
+					type = "active";
+				};
+				cpu_crit0: cpu-crit-0 {
+					temperature = <100000>; /* millicelsius */
+					hysteresis = <0>; /* millicelsius */
+					type = "critical";
+				};
+			};
+			cooling-maps {
+				map0 {
+				     trip = <&cpu_alert0>;
+				     cooling-device = <&fan0 0 1>;
+				};
+				map1 {
+				     trip = <&cpu_alert1>;
+				     cooling-device = <&fan0 1 2>;
+				};
+				map2 {
+				     trip = <&cpu_alert2>;
+				     cooling-device = <&fan0 2 3>;
+				};
+			};
+		};
+	};
+};
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH v2 4/5 ARM: dts exynos5420 update the cooling cells for core cpu0

In reply to Anand Moon

update the cooling level for cpu0 to avoid following message.

root at odroidxu3:~# dmesg | grep ther

[    0.241511] /thermal-zones/cpu-thermal/cooling-maps/map0:
                         could not get #cooling-cells for /cpus/cpu at 0

Tested on OdroidXU3

Changes since v1 : None

---
 arch/arm/boot/dts/exynos5420.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/exynos5420.dtsi +4 -0
index c0e98cf..6b49f3c 100644
@@ -61,6 +61,10 @@
 			reg = <0x0>;
 			clock-frequency = <1800000000>;
 			cci-control-port = <&cci_control1>;
+
+			cooling-min-level = <10>;
+			cooling-max-level = <7>;
+			#cooling-cells = <2>; /* min followed by max */
 		};
 
 		cpu1: cpu at 1 {
Signature · 1 line
1.9.1
author
#5 lore raw

PATCH v2 5/5 ARM: dts: Enable thermal_zone for exynos5422.

In reply to Anand Moon

Include exynos5-cpu-thermal.dtsi to enable thermal_zone support.

Changes since v1 : Seperate the include previous patch.

---
 arch/arm/boot/dts/exynos5422-odroidxu3.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/exynos5422-odroidxu3.dts +1 -0
index 6e7ee53..16a5f10 100644
@@ -12,6 +12,7 @@
 
 /dts-v1/;
 #include "exynos5800.dtsi"
+#include "exynos5-cpu-thermal.dtsi"
 
 / {
 	model = "Hardkernel Odroid XU3";
Signature · 1 line
1.9.1