Add GPIO fan support for ODROID-N2 (#1117) (#1166)

This commit is contained in:
Stefan Agner 2021-01-11 22:50:30 +01:00 committed by GitHub
parent d7c09e15b9
commit 038f1b4bd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 119 additions and 0 deletions

View File

@ -1,4 +1,7 @@
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
CONFIG_THERMAL_GOV_BANG_BANG=y
CONFIG_SENSORS_GPIO_FAN=y
CONFIG_KEYBOARD_GPIO=y
CONFIG_KEYBOARD_GPIO_POLLED=y

View File

@ -0,0 +1,42 @@
From beb4dcdf3cd73f243563228528bc62e3caa881e8 Mon Sep 17 00:00:00 2001
Message-Id: <beb4dcdf3cd73f243563228528bc62e3caa881e8.1610380198.git.stefan@agner.ch>
In-Reply-To: <9d2a2b44e67b0ef49e534c097e8b5e3e1173b033.1610380198.git.stefan@agner.ch>
References: <9d2a2b44e67b0ef49e534c097e8b5e3e1173b033.1610380198.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Mon, 11 Jan 2021 11:38:54 +0100
Subject: [PATCH 09/10] arm64: dts: meson: g12b: add GPIO fan support
Add simple GPIO fan node to support a fan on GPIO J8. Unfortunately the
pad used to control the fan does not support real PWM, hence the RPM
cannot be modulated.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
index ddc7ad9a7d8d..4d96732d0613 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
@@ -39,6 +39,17 @@ emmc_pwrseq: emmc-pwrseq {
reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
};
+ /*
+ * 5V 80x80x10.8mm cooling fan from Hardkernel shop.
+ */
+ fan0: gpio-fan {
+ #cooling-cells = <2>;
+ compatible = "gpio-fan";
+ gpio-fan,speed-map = <0 0 1600 1>;
+ gpios = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>;
+ status = "okay";
+ };
+
gpio-keys-polled {
compatible = "gpio-keys-polled";
poll-interval = <100>;
--
2.30.0

View File

@ -0,0 +1,74 @@
From 8ff3ba007f500ec4f21361fcac4ec7a5b67bcf7e Mon Sep 17 00:00:00 2001
Message-Id: <8ff3ba007f500ec4f21361fcac4ec7a5b67bcf7e.1610382778.git.stefan@agner.ch>
In-Reply-To: <9d2a2b44e67b0ef49e534c097e8b5e3e1173b033.1610382778.git.stefan@agner.ch>
References: <9d2a2b44e67b0ef49e534c097e8b5e3e1173b033.1610382778.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Mon, 11 Jan 2021 15:53:55 +0100
Subject: [PATCH 10/10] arm64: dts: meson: g12b: odroid-n2: add fan as cooling
device
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add the GPIO fan as a cooling device for the CPU thermal zone. Since we
have only full fan speed available with this, set the tripping point to
65°C which is the highest tripping point which Hardkernel used in their
downstream kernel.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
.../dts/amlogic/meson-g12b-odroid-n2.dtsi | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
index 4d96732d0613..30d79175fa3e 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
@@ -388,6 +388,44 @@ &clkc_audio {
status = "okay";
};
+&cpu_thermal {
+ trips {
+ cpu_warm: cpu_warm {
+ hysteresis = <5000>;
+ temperature = <65000>;
+ type = "active";
+ };
+ };
+
+ cooling-maps {
+ map0 {
+ cooling-device =
+ <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+ trip = <&cpu_warm>;
+ };
+ map1 {
+ trip = <&cpu_passive>;
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+ };
+ map2 {
+ trip = <&cpu_hot>;
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu100 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu101 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu102 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&cpu103 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+ <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+ };
+ };
+};
+
&cpu0 {
cpu-supply = <&vddcpu_b>;
operating-points-v2 = <&cpu_opp_table_0>;
--
2.30.0