Linux Renesas SOC kernel development
 help / color / mirror / Atom feed
* [PATCH/RFC 0/3] thermal: rcar_gen3_thermal: Apply shared interrupts for thermal sensors
       [not found] <57661211.7010900@rvc.renesas.com>
@ 2016-06-19  4:12 ` Khiem Nguyen
  2016-06-19  4:13   ` [PATCH/RFC 1/3] thermal: rcar_gen3_thermal: Modify the shared irq with initialization Khiem Nguyen
  2016-06-19  4:16   ` [PATCH/RFC 3/3] arm64: dts: r8a7795: Support shared irq for thermal sensors Khiem Nguyen
  2016-06-20  7:40 ` [PATCH 0/4] thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal support Geert Uytterhoeven
  1 sibling, 2 replies; 5+ messages in thread
From: Khiem Nguyen @ 2016-06-19  4:12 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Wolfram Sang, Geert Uytterhoeven, Magnus Damm, Zhang Rui,
	Eduardo Valentin, Rob Herring, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thao Phuong Le. Nguyen, Hien Duy. Dang, Toru Oishi,
	linux-renesas-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Gaku Inami,
	Khiem Trong. Nguyen, Catalin Marinas, Simon Horman

This patchset intents to improve thermal driver operation in interrupt mode,
which has been introduced in [1].

The original idea is using 1 interrupt for each thermal sensor, to detect both up
and down temperature. It caused issue when the temperature is changing rapidly.

The new idea is about using shared interrupt I/F for all three sensors.
Two interrupts will be set to detect temperature up and down. When interrupt occurs,
the temperature will be updated in all 3 sensors, if the temperature value is changed. 

All comments are welcome.

[1]
[PATCH 0/4] thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal support
https://www.spinics.net/lists/kernel/msg2282663.html

--
Gaku Inami (3):
  thermal: rcar_gen3_thermal: Modify the shared irq with initialization
  thermal: rcar_gen3_thermal: Modify the way to detect the interrupts
  arm64: dts: r8a7795: Support shared irq for thermal sensors

 arch/arm64/boot/dts/renesas/r8a7795.dtsi |  9 ++--
 drivers/thermal/rcar_gen3_thermal.c      | 89 ++++++++++++++++++++------------
 2 files changed, 63 insertions(+), 35 deletions(-)

-- 
1.9.1

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

* [PATCH/RFC 1/3] thermal: rcar_gen3_thermal: Modify the shared irq with initialization
  2016-06-19  4:12 ` [PATCH/RFC 0/3] thermal: rcar_gen3_thermal: Apply shared interrupts for thermal sensors Khiem Nguyen
@ 2016-06-19  4:13   ` Khiem Nguyen
  2016-06-19  4:16   ` [PATCH/RFC 3/3] arm64: dts: r8a7795: Support shared irq for thermal sensors Khiem Nguyen
  1 sibling, 0 replies; 5+ messages in thread
From: Khiem Nguyen @ 2016-06-19  4:13 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Wolfram Sang, Geert Uytterhoeven, Magnus Damm, Zhang Rui,
	Eduardo Valentin, Rob Herring, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thao Phuong Le. Nguyen, Hien Duy. Dang, Toru Oishi,
	linux-renesas-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Gaku Inami, Catalin Marinas,
	Simon Horman, Khiem Trong. Nguyen

In R-CAR Gen3 series, it has some thermal sensors. The interrupt I/F
that can be used in thermal sensors is three. So it should be used
the interrupt I/F as shared.

This patch changes the shared settings for the thermal interrupts.

Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Signed-off-by: Khiem Nguyen <khiem.nguyen.xt@rvc.renesas.com>
---
 drivers/thermal/rcar_gen3_thermal.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index a9a372b..e640a14 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -416,6 +416,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
 	int ret = -ENODEV;
 	int idle;
 	struct device_node *tz_nd, *tmp_nd;
+	int i, irq_cnt;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -489,13 +490,18 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
 	rcar_gen3_thermal_irq_enable(priv);
 
 	/* Interrupt */
-	if (irq) {
-		ret = devm_request_irq(dev, irq->start,
-					rcar_gen3_thermal_irq, 0,
-				       dev_name(dev), priv);
-		if (ret) {
-			dev_err(dev, "IRQ request failed\n ");
-			goto error_unregister;
+	if (rcar_has_irq_support(priv)) {
+		irq_cnt = platform_irq_count(pdev);
+		for (i = 0; i < irq_cnt; i++) {
+			irq = platform_get_resource(pdev, IORESOURCE_IRQ, i);
+			ret = devm_request_irq(dev, irq->start,
+					       rcar_gen3_thermal_irq,
+					       IRQF_SHARED,
+					       dev_name(dev), priv);
+			if (ret) {
+				dev_err(dev, "IRQ request failed\n ");
+				goto error_unregister;
+			}
 		}
 	}
 
-- 
1.9.1

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

* [PATCH/RFC 3/3] arm64: dts: r8a7795: Support shared irq for thermal sensors
  2016-06-19  4:12 ` [PATCH/RFC 0/3] thermal: rcar_gen3_thermal: Apply shared interrupts for thermal sensors Khiem Nguyen
  2016-06-19  4:13   ` [PATCH/RFC 1/3] thermal: rcar_gen3_thermal: Modify the shared irq with initialization Khiem Nguyen
@ 2016-06-19  4:16   ` Khiem Nguyen
  2016-06-20  7:53     ` Geert Uytterhoeven
  1 sibling, 1 reply; 5+ messages in thread
From: Khiem Nguyen @ 2016-06-19  4:16 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Wolfram Sang, Geert Uytterhoeven, Magnus Damm, Zhang Rui,
	Eduardo Valentin, Rob Herring, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thao Phuong Le. Nguyen, Hien Duy. Dang, Toru Oishi,
	linux-renesas-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Gaku Inami, Catalin Marinas,
	Simon Horman, Khiem Trong. Nguyen

This patch adds the shared interrupts for thermal sensors
TSC1/TSC2/TSC3.

Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Signed-off-by: Khiem Nguyen <khiem.nguyen.xt@rvc.renesas.com>
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index db203db..761df2b 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -1628,7 +1628,8 @@
 			compatible = "renesas,thermal-r8a7795",
 				"renesas,rcar-gen3-thermal";
 			reg = <0 0xe6198000 0 0x5c>;
-			interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
+			interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&cpg CPG_MOD 522>;
 			power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
 			#thermal-sensor-cells = <0>;
@@ -1639,7 +1640,8 @@
 			compatible = "renesas,thermal-r8a7795",
 				"renesas,rcar-gen3-thermal";
 			reg = <0 0xe61a0000 0 0x5c>;
-			interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
+			interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&cpg CPG_MOD 522>;
 			power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
 			#thermal-sensor-cells = <0>;
@@ -1650,7 +1652,8 @@
 			compatible = "renesas,thermal-r8a7795",
 				"renesas,rcar-gen3-thermal";
 			reg = <0 0xe61a8000 0 0x5c>;
-			interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
+			interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&cpg CPG_MOD 522>;
 			power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
 			#thermal-sensor-cells = <0>;
-- 
1.9.1


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

* Re: [PATCH 0/4] thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal support
       [not found] <57661211.7010900@rvc.renesas.com>
  2016-06-19  4:12 ` [PATCH/RFC 0/3] thermal: rcar_gen3_thermal: Apply shared interrupts for thermal sensors Khiem Nguyen
@ 2016-06-20  7:40 ` Geert Uytterhoeven
  1 sibling, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2016-06-20  7:40 UTC (permalink / raw)
  To: Khiem Nguyen
  Cc: Kuninori Morimoto, Wolfram Sang, Geert Uytterhoeven, Magnus Damm,
	Zhang Rui, Eduardo Valentin, Rob Herring, Mark Rutland,
	linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Thao Phuong Le. Nguyen,
	Hien Duy. Dang, Toru Oishi, Simon Horman,
	open list:MEDIA DRIVERS FOR RENESAS - FCP

Hi Khiem,

On Sun, Jun 19, 2016 at 5:31 AM, Khiem Nguyen
<khiem.nguyen.xt@rvc.renesas.com> wrote:
> This patchset adds new thermal sensor driver to support 3 sensors
> found in R-Car Gen3 series.
>
> It has been decided to create new driver, instead of using the existing
> thermal driver due to many differences in HW setting flows, the method
> to calculate temperatures value and some newly supported features.
>
> The new driver can support both polling mode and interrupt mode.
> It has been tested with R-Car H3.
>
> This driver is developed based on early work of Hien Dang and Thao Nguyen.
> All comments are welcome.

Thanks for your series!

Please CC linux-renesas-soc for drivers related to Renesas SoCs.
Please CC Simon for dts and defconfig updates that should go through his tree.

> Khiem Nguyen (4):
>   thermal: rcar_gen3_thermal: Document the R-Car Gen3 thermal bindings
>   thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver support
>   arm64: dts: r8a7795: Add R-Car Gen3 thermal support
>   arm64: defconfig: Enable R-Car Gen3 thermal support
>
>  .../bindings/thermal/rcar-gen3-thermal.txt         |  79 ++++
>  arch/arm64/boot/dts/renesas/r8a7795.dtsi           |  86 ++++
>  arch/arm64/configs/defconfig                       |   2 +
>  drivers/thermal/Kconfig                            |   9 +
>  drivers/thermal/Makefile                           |   1 +
>  drivers/thermal/rcar_gen3_thermal.c                | 524 +++++++++++++++++++++
>  6 files changed, 701 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/thermal/rcar-gen3-thermal.txt
>  create mode 100644 drivers/thermal/rcar_gen3_thermal.c

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH/RFC 3/3] arm64: dts: r8a7795: Support shared irq for thermal sensors
  2016-06-19  4:16   ` [PATCH/RFC 3/3] arm64: dts: r8a7795: Support shared irq for thermal sensors Khiem Nguyen
@ 2016-06-20  7:53     ` Geert Uytterhoeven
  0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2016-06-20  7:53 UTC (permalink / raw)
  To: Khiem Nguyen
  Cc: Kuninori Morimoto, Wolfram Sang, Geert Uytterhoeven, Magnus Damm,
	Zhang Rui, Eduardo Valentin, Rob Herring,
	linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Thao Phuong Le. Nguyen,
	Hien Duy. Dang, Toru Oishi, linux-renesas-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Gaku Inami, Catalin Marinas,
	Simon Horman

Hi Khiem,

On Sun, Jun 19, 2016 at 6:16 AM, Khiem Nguyen
<khiem.nguyen.xt@rvc.renesas.com> wrote:
> This patch adds the shared interrupts for thermal sensors
> TSC1/TSC2/TSC3.
>
> Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
> Signed-off-by: Khiem Nguyen <khiem.nguyen.xt@rvc.renesas.com>
> ---
>  arch/arm64/boot/dts/renesas/r8a7795.dtsi | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
> index db203db..761df2b 100644
> --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
> @@ -1628,7 +1628,8 @@
>                         compatible = "renesas,thermal-r8a7795",
>                                 "renesas,rcar-gen3-thermal";
>                         reg = <0 0xe6198000 0 0x5c>;
> -                       interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
> +                       interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>,
> +                                    <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;

If you make this change, the DT bindings should be updated first.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2016-06-20  7:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <57661211.7010900@rvc.renesas.com>
2016-06-19  4:12 ` [PATCH/RFC 0/3] thermal: rcar_gen3_thermal: Apply shared interrupts for thermal sensors Khiem Nguyen
2016-06-19  4:13   ` [PATCH/RFC 1/3] thermal: rcar_gen3_thermal: Modify the shared irq with initialization Khiem Nguyen
2016-06-19  4:16   ` [PATCH/RFC 3/3] arm64: dts: r8a7795: Support shared irq for thermal sensors Khiem Nguyen
2016-06-20  7:53     ` Geert Uytterhoeven
2016-06-20  7:40 ` [PATCH 0/4] thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal support Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox