Skip to contentSkip to conversation

arm64: dts: freescale: add gpio-fan/thermal support for Google i.MX 8MQ Phanbell

PATCH In review Vitor Massaru Iha 2 participants 5 messages Mar 2, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 arm64: dts: freescale: add gpio-fan/thermal support for Google i.MX 8MQ Phanbell

It was based on Google Source Code for Coral Edge TPU Mendel release:
https://coral.googlesource.com/linux-imx/

It was tested on Coral Dev Board using this command:
sudo stress --cpu 4 --timeout 3600

---
v2:
* Fix underscore in property name;
* Add pinctrl entry for gpio-fan;
* Removes undocumented property.

BR,
Vitor

---
 .../boot/dts/freescale/imx8mq-phanbell.dts    | 64 +++++++++++++++++++
 arch/arm64/boot/dts/freescale/imx8mq.dtsi     |  2 +-
 2 files changed, 65 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts +64 -0
index 3f2a489a4ad8..3302e5c127ca 100644
@@ -35,6 +35,16 @@
 		gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
 		enable-active-high;
 	};
+
+	fan: gpio-fan {
+		compatible = "gpio-fan";
+		gpio-fan,speed-map = <0 0 8600 1>;
+		gpios = <&gpio3 5 GPIO_ACTIVE_HIGH>;
+		#cooling-cells = <2>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_gpio_fan>;
+		status = "okay";
+	};
 };
 
 &A53_0 {
@@ -373,4 +383,58 @@
 			MX8MQ_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B 0xc6
 		>;
 	};
+
+	pinctrl_gpio_fan: gpiofanp {
+		fsl,pins = <
+			MX8MQ_IOMUXC_NAND_CLE_GPIO3_IO5 0x01
+		>;
+	};
 };
+
+&cpu_thermal {
+	trips {
+		cpu_alert0: trip0 {
+			temperature = <75000>;
+			hysteresis = <2000>;
+			type = "passive";
+		};
+
+		cpu_alert1: trip1 {
+			temperature = <80000>;
+			hysteresis = <2000>;
+			type = "passive";
+		};
+
+		cpu_crit0: trip3 {
+			temperature = <90000>;
+			hysteresis = <2000>;
+			type = "critical";
+		};
+
+		fan_toggle0: trip4 {
+			temperature = <65000>;
+			hysteresis = <10000>;
+			type = "active";
+		};
+	};
+
+	cooling-maps {
+		map0 {
+			trip = <&cpu_alert0>;
+			cooling-device =
+			<&A53_0 0 1>; /* Exclude highest OPP */
+		};
+
+		map1 {
+			trip = <&cpu_alert1>;
+			cooling-device =
+			<&A53_0 0 2>; /* Exclude two highest OPPs */
+		};
+
+		map4 {
+			trip = <&fan_toggle0>;
+			cooling-device = <&fan 0 1>;
+		};
+	};
+};
+
arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -1
index 6a1e83922c71..a3bb17a6b9df 100644
@@ -198,7 +198,7 @@
 	};
 
 	thermal-zones {
-		cpu-thermal {
+		cpu_thermal: cpu-thermal {
 			polling-delay-passive = <250>;
 			polling-delay = <2000>;
 			thermal-sensors = <&tmu 0>;
Signature · 1 line
2.21.1
reviewer Reviewed-by on v2 1/1
#1 lore raw

Hi Vitor,

Forgot to say in the previous revision, but the typical Subject pattern is:

arm64: dts: imx8mq-phanbell: Add gpio-fan/thermal support

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts line 387

Quoted 7 lines · Vitor Massaru Iha

&A53_0 {

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts +2 -0
@@ -373,4 +383,58 @@
                        MX8MQ_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B 0xc6
                >;
        };
+
+       pinctrl_gpio_fan: gpiofanp {

Please keep the pinctrl entries in alphabetical order.

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts line 389

Quoted 2 lines
arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts +2 -0
+               fsl,pins = <
+                       MX8MQ_IOMUXC_NAND_CLE_GPIO3_IO5 0x01

This pad comes as 0x16 after POR, so please add it as:

MX8MQ_IOMUXC_NAND_CLE_GPIO3_IO5 0x16

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts line 394

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts +1 -0
+&cpu_thermal {

Please put it prior to the &i2c1 node in order to keep the alphabetical order.

With these changes you can add:

#2 lore raw

Hi Fabio,

Thanks for your review.

Quoted 27 lines · Fabio Estevam

Hi Vitor,

Forgot to say in the previous revision, but the typical Subject pattern is:

arm64: dts: imx8mq-phanbell: Add gpio-fan/thermal support

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts line 387

Quoted 7 lines · Vitor Massaru Iha

&A53_0 {

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts +2 -0
@@ -373,4 +383,58 @@
                        MX8MQ_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B 0xc6
                >;
        };
+
+       pinctrl_gpio_fan: gpiofanp {

Please keep the pinctrl entries in alphabetical order.

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts line 389

Quoted 2 lines
arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts +2 -0
+               fsl,pins = <
+                       MX8MQ_IOMUXC_NAND_CLE_GPIO3_IO5 0x01

This pad comes as 0x16 after POR, so please add it as:

MX8MQ_IOMUXC_NAND_CLE_GPIO3_IO5 0x16

Quoted 8 lines

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts line 394

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts +1 -0
+&cpu_thermal {

Please put it prior to the &i2c1 node in order to keep the alphabetical order.

With these changes you can add:

I'll send the PATCH v3.

BR,
Vitor

#3 lore raw

Hi Fabio,

I fixed the tabs on MX8MQ_IOMUXC_NAND_CLE_GPIO3_IO5 line too.

BR,
Vitor

Quoted 47 lines · Vitor Massaru Iha

Hi Fabio,

Thanks for your review.

Quoted 27 lines · Fabio Estevam

Hi Vitor,

Forgot to say in the previous revision, but the typical Subject pattern is:

arm64: dts: imx8mq-phanbell: Add gpio-fan/thermal support

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts line 387

Quoted 7 lines · Vitor Massaru Iha

&A53_0 {

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts +2 -0
@@ -373,4 +383,58 @@
                        MX8MQ_IOMUXC_GPIO1_IO02_WDOG1_WDOG_B 0xc6
                >;
        };
+
+       pinctrl_gpio_fan: gpiofanp {

Please keep the pinctrl entries in alphabetical order.

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts line 389

Quoted 2 lines
arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts +2 -0
+               fsl,pins = <
+                       MX8MQ_IOMUXC_NAND_CLE_GPIO3_IO5 0x01

This pad comes as 0x16 after POR, so please add it as:

MX8MQ_IOMUXC_NAND_CLE_GPIO3_IO5 0x16

Quoted 8 lines

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts line 394

Quoted 1 line
arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts +1 -0
+&cpu_thermal {

Please put it prior to the &i2c1 node in order to keep the alphabetical order.

With these changes you can add:

I'll send the PATCH v3.

BR,
Vitor

reviewer
#4 lore raw
In reply to Vitor Massaru Iha

Hi Vitor,

One more comment:

arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts line 387

Quoted 2 lines · Vitor Massaru Iha
arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts +2 -0
+
+       pinctrl_gpio_fan: gpiofanp {

This should be:
pinctrl_gpio_fan: gpiofangrp {

Thanks