linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] thermal: sun8i: fix r40 ths number
@ 2020-01-06 17:22 Yangtao Li
  2020-01-06 17:22 ` [PATCH 2/2] ARM: dts: sun8i-r40: Add thermal sensor and thermal zones Yangtao Li
  2020-01-06 17:28 ` [PATCH 1/2] thermal: sun8i: fix r40 ths number Vasily Khoruzhick
  0 siblings, 2 replies; 4+ messages in thread
From: Yangtao Li @ 2020-01-06 17:22 UTC (permalink / raw)
  To: robh+dt, mark.rutland, mripard, wens, anarsoul, tiny.windzz,
	rui.zhang, daniel.lezcano, amit.kucheria, devicetree,
	linux-arm-kernel, linux-kernel, linux-pm

According to the spec, r40 has 2 thermal sensors.
Sensor0 located in the CPU, another in the GPU.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Tested-on: sun8i-r40-bananapi-m2-ultra
---
 drivers/thermal/sun8i_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
index 23a5f4aa4be4..c5661d7c3e20 100644
--- a/drivers/thermal/sun8i_thermal.c
+++ b/drivers/thermal/sun8i_thermal.c
@@ -565,7 +565,7 @@ static const struct ths_thermal_chip sun8i_h3_ths = {
 };
 
 static const struct ths_thermal_chip sun8i_r40_ths = {
-	.sensor_num = 3,
+	.sensor_num = 2,
 	.offset = 251086,
 	.scale = 1130,
 	.has_mod_clk = true,
-- 
2.17.1


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

* [PATCH 2/2] ARM: dts: sun8i-r40: Add thermal sensor and thermal zones
  2020-01-06 17:22 [PATCH 1/2] thermal: sun8i: fix r40 ths number Yangtao Li
@ 2020-01-06 17:22 ` Yangtao Li
  2020-01-06 17:28 ` [PATCH 1/2] thermal: sun8i: fix r40 ths number Vasily Khoruzhick
  1 sibling, 0 replies; 4+ messages in thread
From: Yangtao Li @ 2020-01-06 17:22 UTC (permalink / raw)
  To: robh+dt, mark.rutland, mripard, wens, anarsoul, tiny.windzz,
	rui.zhang, daniel.lezcano, amit.kucheria, devicetree,
	linux-arm-kernel, linux-kernel, linux-pm

There are two sensors, sensor0 for CPU, sensor1 for GPU.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Tested-on: sun8i-r40-bananapi-m2-ultra
---
 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 421dfbbfd7ee..8ccda5cb873f 100644
--- a/arch/arm/boot/dts/sun8i-r40.dtsi
+++ b/arch/arm/boot/dts/sun8i-r40.dtsi
@@ -46,6 +46,7 @@
 #include <dt-bindings/clock/sun8i-r40-ccu.h>
 #include <dt-bindings/reset/sun8i-r40-ccu.h>
 #include <dt-bindings/reset/sun8i-de2.h>
+#include <dt-bindings/thermal/thermal.h>
 
 / {
 	#address-cells = <1>;
@@ -109,6 +110,22 @@
 		status = "disabled";
 	};
 
+	thermal-zones {
+		cpu_thermal: cpu0-thermal {
+			/* milliseconds */
+			polling-delay-passive = <0>;
+			polling-delay = <0>;
+			thermal-sensors = <&ths 0>;
+		};
+
+		gpu_thermal: gpu-thermal {
+			/* milliseconds */
+			polling-delay-passive = <0>;
+			polling-delay = <0>;
+			thermal-sensors = <&ths 1>;
+		};
+	};
+
 	soc {
 		compatible = "simple-bus";
 		#address-cells = <1>;
@@ -421,6 +438,17 @@
 			clocks = <&osc24M>;
 		};
 
+		ths: thermal-sensor@1c24c00 {
+			compatible = "allwinner,sun8i-r40-ths";
+			reg = <0x01c24c00 0x100>;
+			clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_THS>;
+			clock-names = "bus", "mod";
+			interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
+			resets = <&ccu RST_BUS_THS>;
+			/* TODO: add nvmem-cells for calibration */
+			#thermal-sensor-cells = <1>;
+		};
+
 		uart0: serial@1c28000 {
 			compatible = "snps,dw-apb-uart";
 			reg = <0x01c28000 0x400>;
-- 
2.17.1


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

* Re: [PATCH 1/2] thermal: sun8i: fix r40 ths number
  2020-01-06 17:22 [PATCH 1/2] thermal: sun8i: fix r40 ths number Yangtao Li
  2020-01-06 17:22 ` [PATCH 2/2] ARM: dts: sun8i-r40: Add thermal sensor and thermal zones Yangtao Li
@ 2020-01-06 17:28 ` Vasily Khoruzhick
  2020-01-06 17:45   ` Frank Lee
  1 sibling, 1 reply; 4+ messages in thread
From: Vasily Khoruzhick @ 2020-01-06 17:28 UTC (permalink / raw)
  To: Yangtao Li
  Cc: Rob Herring, Mark Rutland, Maxime Ripard, Chen-Yu Tsai,
	Zhang Rui, Daniel Lezcano, Amit Kucheria, devicetree, arm-linux,
	linux-kernel, Linux PM

On Mon, Jan 6, 2020 at 9:23 AM Yangtao Li <tiny.windzz@gmail.com> wrote:
>
> According to the spec, r40 has 2 thermal sensors.
> Sensor0 located in the CPU, another in the GPU.
>
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>

You should also add "Fixes" tag here.

> Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> Tested-on: sun8i-r40-bananapi-m2-ultra
> ---
>  drivers/thermal/sun8i_thermal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> index 23a5f4aa4be4..c5661d7c3e20 100644
> --- a/drivers/thermal/sun8i_thermal.c
> +++ b/drivers/thermal/sun8i_thermal.c
> @@ -565,7 +565,7 @@ static const struct ths_thermal_chip sun8i_h3_ths = {
>  };
>
>  static const struct ths_thermal_chip sun8i_r40_ths = {
> -       .sensor_num = 3,
> +       .sensor_num = 2,
>         .offset = 251086,
>         .scale = 1130,
>         .has_mod_clk = true,
> --
> 2.17.1
>

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

* Re: [PATCH 1/2] thermal: sun8i: fix r40 ths number
  2020-01-06 17:28 ` [PATCH 1/2] thermal: sun8i: fix r40 ths number Vasily Khoruzhick
@ 2020-01-06 17:45   ` Frank Lee
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Lee @ 2020-01-06 17:45 UTC (permalink / raw)
  To: Vasily Khoruzhick
  Cc: Rob Herring, Mark Rutland, Maxime Ripard, Chen-Yu Tsai,
	Zhang Rui, Daniel Lezcano, Amit Kucheria, devicetree, arm-linux,
	linux-kernel, Linux PM

On Tue, Jan 7, 2020 at 1:29 AM Vasily Khoruzhick <anarsoul@gmail.com> wrote:
>
> On Mon, Jan 6, 2020 at 9:23 AM Yangtao Li <tiny.windzz@gmail.com> wrote:
> >
> > According to the spec, r40 has 2 thermal sensors.
> > Sensor0 located in the CPU, another in the GPU.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
>
> You should also add "Fixes" tag here.

Since the driver has not yet entered the merge window......
Thanks for reminding, :D

Yangtao

>
> > Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> > Tested-on: sun8i-r40-bananapi-m2-ultra
> > ---
> >  drivers/thermal/sun8i_thermal.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c
> > index 23a5f4aa4be4..c5661d7c3e20 100644
> > --- a/drivers/thermal/sun8i_thermal.c
> > +++ b/drivers/thermal/sun8i_thermal.c
> > @@ -565,7 +565,7 @@ static const struct ths_thermal_chip sun8i_h3_ths = {
> >  };
> >
> >  static const struct ths_thermal_chip sun8i_r40_ths = {
> > -       .sensor_num = 3,
> > +       .sensor_num = 2,
> >         .offset = 251086,
> >         .scale = 1130,
> >         .has_mod_clk = true,
> > --
> > 2.17.1
> >

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

end of thread, other threads:[~2020-01-06 17:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06 17:22 [PATCH 1/2] thermal: sun8i: fix r40 ths number Yangtao Li
2020-01-06 17:22 ` [PATCH 2/2] ARM: dts: sun8i-r40: Add thermal sensor and thermal zones Yangtao Li
2020-01-06 17:28 ` [PATCH 1/2] thermal: sun8i: fix r40 ths number Vasily Khoruzhick
2020-01-06 17:45   ` Frank Lee

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