All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: freescale: add gpio-fan/thermal support for Google i.MX 8MQ Phanbell
@ 2020-02-29 10:43 ` Vitor Massaru Iha
  0 siblings, 0 replies; 6+ messages in thread
From: Vitor Massaru Iha @ 2020-02-29 10:43 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel
  Cc: robh+dt, mark.rutland, shawnguo, s.hauer, festevam,
	marco.franchi, linux-imx, lkcamp

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

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
---
 .../boot/dts/freescale/imx8mq-phanbell.dts    | 78 +++++++++++++++++++
 arch/arm64/boot/dts/freescale/imx8mq.dtsi     |  2 +-
 2 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts b/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
index 3f2a489a4ad8..fb9f208d1e41 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
@@ -35,6 +35,14 @@
 		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>;
+		status = "okay";
+	};
 };
 
 &A53_0 {
@@ -374,3 +382,73 @@
 		>;
 	};
 };
+
+&tmu {
+	throttle-cfgs {
+		throttle_devfreq: devfreq {
+			throttle,max_state = <2>;
+			#cooling-cells = <2>;
+		};
+	};
+};
+
+&cpu_thermal {
+	trips {
+		cpu_alert0: trip0 {
+			temperature = <75000>;
+			hysteresis = <2000>;
+			type = "passive";
+		};
+
+		cpu_alert1: trip1 {
+			temperature = <80000>;
+			hysteresis = <2000>;
+			type = "passive";
+		};
+
+		cpu_alert2: trip2 {
+			temperature = <85000>;
+			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 =
+			<&throttle_devfreq 0 1>, /* 1/2 GPU Clock */
+			<&A53_0 0 1>; /* Exclude highest OPP */
+		};
+
+		map1 {
+			trip = <&cpu_alert1>;
+			cooling-device =
+			<&A53_0 0 2>; /* Exclude two highest OPPs */
+		};
+
+		map2 {
+			trip = <&cpu_alert2>;
+			cooling-device =
+			<&throttle_devfreq 0 2>; /* Min GPU Clock, disable CPU2/3 */
+		};
+
+		map4 {
+			trip = <&fan_toggle0>;
+			cooling-device = <&fan 0 1>;
+		};
+	};
+};
+
diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
index 6a1e83922c71..a3bb17a6b9df 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
@@ -198,7 +198,7 @@
 	};
 
 	thermal-zones {
-		cpu-thermal {
+		cpu_thermal: cpu-thermal {
 			polling-delay-passive = <250>;
 			polling-delay = <2000>;
 			thermal-sensors = <&tmu 0>;
-- 
2.21.1


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

* [PATCH] arm64: dts: freescale: add gpio-fan/thermal support for Google i.MX 8MQ Phanbell
@ 2020-02-29 10:43 ` Vitor Massaru Iha
  0 siblings, 0 replies; 6+ messages in thread
From: Vitor Massaru Iha @ 2020-02-29 10:43 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel
  Cc: mark.rutland, lkcamp, shawnguo, s.hauer, robh+dt, linux-imx,
	marco.franchi, festevam

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

Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
---
 .../boot/dts/freescale/imx8mq-phanbell.dts    | 78 +++++++++++++++++++
 arch/arm64/boot/dts/freescale/imx8mq.dtsi     |  2 +-
 2 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts b/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
index 3f2a489a4ad8..fb9f208d1e41 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
@@ -35,6 +35,14 @@
 		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>;
+		status = "okay";
+	};
 };
 
 &A53_0 {
@@ -374,3 +382,73 @@
 		>;
 	};
 };
+
+&tmu {
+	throttle-cfgs {
+		throttle_devfreq: devfreq {
+			throttle,max_state = <2>;
+			#cooling-cells = <2>;
+		};
+	};
+};
+
+&cpu_thermal {
+	trips {
+		cpu_alert0: trip0 {
+			temperature = <75000>;
+			hysteresis = <2000>;
+			type = "passive";
+		};
+
+		cpu_alert1: trip1 {
+			temperature = <80000>;
+			hysteresis = <2000>;
+			type = "passive";
+		};
+
+		cpu_alert2: trip2 {
+			temperature = <85000>;
+			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 =
+			<&throttle_devfreq 0 1>, /* 1/2 GPU Clock */
+			<&A53_0 0 1>; /* Exclude highest OPP */
+		};
+
+		map1 {
+			trip = <&cpu_alert1>;
+			cooling-device =
+			<&A53_0 0 2>; /* Exclude two highest OPPs */
+		};
+
+		map2 {
+			trip = <&cpu_alert2>;
+			cooling-device =
+			<&throttle_devfreq 0 2>; /* Min GPU Clock, disable CPU2/3 */
+		};
+
+		map4 {
+			trip = <&fan_toggle0>;
+			cooling-device = <&fan 0 1>;
+		};
+	};
+};
+
diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
index 6a1e83922c71..a3bb17a6b9df 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
@@ -198,7 +198,7 @@
 	};
 
 	thermal-zones {
-		cpu-thermal {
+		cpu_thermal: cpu-thermal {
 			polling-delay-passive = <250>;
 			polling-delay = <2000>;
 			thermal-sensors = <&tmu 0>;
-- 
2.21.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: dts: freescale: add gpio-fan/thermal support for Google i.MX 8MQ Phanbell
  2020-02-29 10:43 ` Vitor Massaru Iha
@ 2020-02-29 13:07   ` Fabio Estevam
  -1 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2020-02-29 13:07 UTC (permalink / raw)
  To: Vitor Massaru Iha
  Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Rob Herring, Mark Rutland, Shawn Guo, Sascha Hauer,
	Marco Franchi, NXP Linux Team, lkcamp

Hi Vitor,

Thanks for your patch.

On Sat, Feb 29, 2020 at 7:43 AM Vitor Massaru Iha <vitor@massaru.org> wrote:
>
> 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
>
> Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
> ---
>  .../boot/dts/freescale/imx8mq-phanbell.dts    | 78 +++++++++++++++++++
>  arch/arm64/boot/dts/freescale/imx8mq.dtsi     |  2 +-
>  2 files changed, 79 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts b/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
> index 3f2a489a4ad8..fb9f208d1e41 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
> @@ -35,6 +35,14 @@
>                 gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
>                 enable-active-high;
>         };
> +
> +       fan: gpio_fan {

Underscores are not recommended in property names. Please use
"gpio-fan" instead.

> +               compatible = "gpio-fan";
> +               gpio-fan,speed-map = <0 0 8600 1>;
> +               gpios = <&gpio3 5 GPIO_ACTIVE_HIGH>;

Please add an entry for the pinctrl description of this GPIO.
It worked because GPIO is the default functionality of the pin after
POR, but we should better not rely on it (bootloaders may change it)
and explicitly it in the device tree.

> +               #cooling-cells = <2>;
> +               status = "okay";
> +       };
>  };
>
>  &A53_0 {
> @@ -374,3 +382,73 @@
>                 >;
>         };
>  };
> +
> +&tmu {

Please keep the nodes in alphabetical order.


> +       throttle-cfgs {
> +               throttle_devfreq: devfreq {
> +                       throttle,max_state = <2>;

I don't see this property documented anywhere. Should it be removed?

Thanks

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

* Re: [PATCH] arm64: dts: freescale: add gpio-fan/thermal support for Google i.MX 8MQ Phanbell
@ 2020-02-29 13:07   ` Fabio Estevam
  0 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2020-02-29 13:07 UTC (permalink / raw)
  To: Vitor Massaru Iha
  Cc: Mark Rutland,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	lkcamp, Sascha Hauer, Rob Herring, NXP Linux Team, Marco Franchi,
	Shawn Guo,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

Hi Vitor,

Thanks for your patch.

On Sat, Feb 29, 2020 at 7:43 AM Vitor Massaru Iha <vitor@massaru.org> wrote:
>
> 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
>
> Signed-off-by: Vitor Massaru Iha <vitor@massaru.org>
> ---
>  .../boot/dts/freescale/imx8mq-phanbell.dts    | 78 +++++++++++++++++++
>  arch/arm64/boot/dts/freescale/imx8mq.dtsi     |  2 +-
>  2 files changed, 79 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts b/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
> index 3f2a489a4ad8..fb9f208d1e41 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8mq-phanbell.dts
> @@ -35,6 +35,14 @@
>                 gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>;
>                 enable-active-high;
>         };
> +
> +       fan: gpio_fan {

Underscores are not recommended in property names. Please use
"gpio-fan" instead.

> +               compatible = "gpio-fan";
> +               gpio-fan,speed-map = <0 0 8600 1>;
> +               gpios = <&gpio3 5 GPIO_ACTIVE_HIGH>;

Please add an entry for the pinctrl description of this GPIO.
It worked because GPIO is the default functionality of the pin after
POR, but we should better not rely on it (bootloaders may change it)
and explicitly it in the device tree.

> +               #cooling-cells = <2>;
> +               status = "okay";
> +       };
>  };
>
>  &A53_0 {
> @@ -374,3 +382,73 @@
>                 >;
>         };
>  };
> +
> +&tmu {

Please keep the nodes in alphabetical order.


> +       throttle-cfgs {
> +               throttle_devfreq: devfreq {
> +                       throttle,max_state = <2>;

I don't see this property documented anywhere. Should it be removed?

Thanks

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: dts: freescale: add gpio-fan/thermal support for Google i.MX 8MQ Phanbell
  2020-02-29 13:07   ` Fabio Estevam
@ 2020-02-29 20:14     ` Vitor Massaru Iha
  -1 siblings, 0 replies; 6+ messages in thread
From: Vitor Massaru Iha @ 2020-02-29 20:14 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Rob Herring, Mark Rutland, Shawn Guo, Sascha Hauer,
	Marco Franchi, NXP Linux Team, lkcamp

Hi Fabio,

On Sat, 2020-02-29 at 10:07 -0300, Fabio Estevam wrote:
> > +       fan: gpio_fan {
> 
> Underscores are not recommended in property names. Please use
> "gpio-fan" instead.

Sure. I'll fix it.

> > +               compatible = "gpio-fan";
> > +               gpio-fan,speed-map = <0 0 8600 1>;
> > +               gpios = <&gpio3 5 GPIO_ACTIVE_HIGH>;
> 
> Please add an entry for the pinctrl description of this GPIO.
> It worked because GPIO is the default functionality of the pin after
> POR, but we should better not rely on it (bootloaders may change it)
> and explicitly it in the device tree.

Thanks. I'll do that.

> > +
> > +&tmu {
> 
> Please keep the nodes in alphabetical order.
> 
> 
> > +       throttle-cfgs {
> > +               throttle_devfreq: devfreq {
> > +                       throttle,max_state = <2>;
> 
> I don't see this property documented anywhere. Should it be removed?

Yes, I'll remove it.

BR,
Vitor


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

* Re: [PATCH] arm64: dts: freescale: add gpio-fan/thermal support for Google i.MX 8MQ Phanbell
@ 2020-02-29 20:14     ` Vitor Massaru Iha
  0 siblings, 0 replies; 6+ messages in thread
From: Vitor Massaru Iha @ 2020-02-29 20:14 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Mark Rutland,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	lkcamp, Sascha Hauer, Rob Herring, NXP Linux Team, Marco Franchi,
	Shawn Guo,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE

Hi Fabio,

On Sat, 2020-02-29 at 10:07 -0300, Fabio Estevam wrote:
> > +       fan: gpio_fan {
> 
> Underscores are not recommended in property names. Please use
> "gpio-fan" instead.

Sure. I'll fix it.

> > +               compatible = "gpio-fan";
> > +               gpio-fan,speed-map = <0 0 8600 1>;
> > +               gpios = <&gpio3 5 GPIO_ACTIVE_HIGH>;
> 
> Please add an entry for the pinctrl description of this GPIO.
> It worked because GPIO is the default functionality of the pin after
> POR, but we should better not rely on it (bootloaders may change it)
> and explicitly it in the device tree.

Thanks. I'll do that.

> > +
> > +&tmu {
> 
> Please keep the nodes in alphabetical order.
> 
> 
> > +       throttle-cfgs {
> > +               throttle_devfreq: devfreq {
> > +                       throttle,max_state = <2>;
> 
> I don't see this property documented anywhere. Should it be removed?

Yes, I'll remove it.

BR,
Vitor


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-02-29 20:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-29 10:43 [PATCH] arm64: dts: freescale: add gpio-fan/thermal support for Google i.MX 8MQ Phanbell Vitor Massaru Iha
2020-02-29 10:43 ` Vitor Massaru Iha
2020-02-29 13:07 ` Fabio Estevam
2020-02-29 13:07   ` Fabio Estevam
2020-02-29 20:14   ` Vitor Massaru Iha
2020-02-29 20:14     ` Vitor Massaru Iha

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.