Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1286247 > unrolled thread

[PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1

Started byKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
First post2015-12-08 06:30 +0100
Last post2015-12-10 06:00 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> - 2015-12-08 06:30 +0100
    Re: [PATCH 5/8 v4] thermal: rcar: enable to use thermal-zone on DT Khiem Nguyen <khiem.nguyen.xt@rvc.renesas.com> - 2015-12-08 07:10 +0100
    Re: [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Simon Horman <horms@verge.net.au> - 2015-12-10 06:00 +0100

#1286247 — [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1

FromKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date2015-12-08 06:30 +0100
Subject[PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1
Message-ID<qDj0B-6vF-1@gated-at.bofh.it>
Hi

These are v4 of thermal-zone support for r8a7790/r8a7791.
Mainly, it cares return value of get_temp()

I think 8) is needed on of-thermal (?)

Kuninori Morimoto (8):
      1) thermal: rcar: move rcar_thermal_dt_ids to upside
      2) thermal: rcar: check every rcar_thermal_update_temp() return value
      3) thermal: rcar: check irq possibility in rcar_thermal_irq_xxx()
      4) thermal: rcar: retern error rcar_thermal_get_temp() if no ctemp update
      5) thermal: rcar: enable to use thermal-zone on DT
      6) ARM: shmobile: r8a7790: enable to use thermal-zone
      7) ARM: shmobile: r8a7791: enable to use thermal-zone
      8) thermal: of-thermal: of_thermal_set_trip_temp() call thermal_zone_device_update()

 Documentation/devicetree/bindings/thermal/rcar-thermal.txt | 37 +++++++++++++++++++++++++++++++++++--
 arch/arm/boot/dts/r8a7790.dtsi                             | 26 ++++++++++++++++++++++++--
 arch/arm/boot/dts/r8a7791.dtsi                             | 26 ++++++++++++++++++++++++--
 drivers/thermal/of-thermal.c                               |  2 ++
 drivers/thermal/rcar_thermal.c                             | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
 5 files changed, 160 insertions(+), 27 deletions(-)

Best regards
---
Kuninori Morimoto
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1286256 — Re: [PATCH 5/8 v4] thermal: rcar: enable to use thermal-zone on DT

FromKhiem Nguyen <khiem.nguyen.xt@rvc.renesas.com>
Date2015-12-08 07:10 +0100
SubjectRe: [PATCH 5/8 v4] thermal: rcar: enable to use thermal-zone on DT
Message-ID<qDjDk-6Yl-15@gated-at.bofh.it>
In reply to#1286247
Hi Morimoto-san,

Sorry for late information in v3.
There's a small mistake in example in DT binding documentation.

Anyway, let's wait for more comments from other developers before fixing it.

On 12/8/2015 12:28 PM, Kuninori Morimoto wrote:
>
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> This patch enables to use thermal-zone on DT if it was call as
> "renesas,rcar-gen2-thermal".
> Previous style is still supported by "renesas,rcar-thermal".
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v3 -> v4
>
>   - no change
>
>   .../devicetree/bindings/thermal/rcar-thermal.txt   | 37 +++++++++++++++++-
>   drivers/thermal/rcar_thermal.c                     | 44 +++++++++++++++++++---
>   2 files changed, 74 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> index 332e625..601a54d 100644
> --- a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> +++ b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> @@ -1,8 +1,9 @@
>   * Renesas R-Car Thermal
>
>   Required properties:
> -- compatible		: "renesas,thermal-<soctype>", "renesas,rcar-thermal"
> -			  as fallback.
> +- compatible		: "renesas,thermal-<soctype>",
> +			   "renesas,rcar-gen2-thermal" (with thermal-zone) or
> +			   "renesas,rcar-thermal" (without thermal-zone) as fallback.
>   			  Examples with soctypes are:
>   			    - "renesas,thermal-r8a73a4" (R-Mobile APE6)
>   			    - "renesas,thermal-r8a7779" (R-Car H1)
> @@ -36,3 +37,35 @@ thermal@e61f0000 {
>   		0xe61f0300 0x38>;
>   	interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
>   };
> +
> +Example (with thermal-zone):
> +
> +thermal-zones {
> +	cpu_thermal: cpu-thermal {
> +		polling-delay-passive	= <1000>;
> +		polling-delay		= <5000>;
> +
> +		thermal-sensors = <&thermal>;
> +
> +		trips {
> +			cpu-crit {
> +				temperature	= <1150000>;

One zero is redundant here. It should be 115000.
Even though this is an example, the value 1150000 millicelcius degree is 
too big for existing R-Car systems :)

> +				hysteresis	= <0>;
> +				type		= "critical";
> +			};
> +		};
> +		cooling-maps {
> +		};
> +	};
> +};
> +
> +thermal: thermal@e61f0000 {
> +	compatible =	"renesas,thermal-r8a7790",
> +			"renesas,rcar-gen2-thermal",
> +			"renesas,rcar-thermal";
> +	reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>;
> +	interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
> +	clocks = <&mstp5_clks R8A7790_CLK_THERMAL>;
> +	power-domains = <&cpg_clocks>;
> +	#thermal-sensor-cells = <0>;
> +};
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index 40c3ba5..d4d2661 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -23,6 +23,7 @@
>   #include <linux/interrupt.h>
>   #include <linux/io.h>
>   #include <linux/module.h>
> +#include <linux/of_device.h>
>   #include <linux/platform_device.h>
>   #include <linux/pm_runtime.h>
>   #include <linux/reboot.h>
> @@ -81,8 +82,10 @@ struct rcar_thermal_priv {
>   # define rcar_force_update_temp(priv)	0
>   #endif
>
> +#define USE_OF_THERMAL	1
>   static const struct of_device_id rcar_thermal_dt_ids[] = {
>   	{ .compatible = "renesas,rcar-thermal", },
> +	{ .compatible = "renesas,rcar-gen2-thermal", .data = (void *)USE_OF_THERMAL },
>   	{},
>   };
>   MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
> @@ -206,9 +209,8 @@ err_out_unlock:
>   	return ret;
>   }
>
> -static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
> +static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv, int *temp)
>   {
> -	struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
>   	int tmp;
>
>   	if (!rcar_has_irq_support(priv) || rcar_force_update_temp(priv)) {
> @@ -234,6 +236,20 @@ static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
>   	return 0;
>   }
>
> +static int rcar_thermal_of_get_temp(void *data, int *temp)
> +{
> +	struct rcar_thermal_priv *priv = data;
> +
> +	return rcar_thermal_get_current_temp(priv, temp);
> +}
> +
> +static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
> +{
> +	struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
> +
> +	return rcar_thermal_get_current_temp(priv, temp);
> +}
> +
>   static int rcar_thermal_get_trip_type(struct thermal_zone_device *zone,
>   				      int trip, enum thermal_trip_type *type)
>   {
> @@ -290,6 +306,10 @@ static int rcar_thermal_notify(struct thermal_zone_device *zone,
>   	return 0;
>   }
>
> +static const struct thermal_zone_of_device_ops rcar_thermal_zone_of_ops = {
> +	.get_temp	= rcar_thermal_of_get_temp,
> +};
> +
>   static struct thermal_zone_device_ops rcar_thermal_zone_ops = {
>   	.get_temp	= rcar_thermal_get_temp,
>   	.get_trip_type	= rcar_thermal_get_trip_type,
> @@ -326,14 +346,20 @@ static void rcar_thermal_work(struct work_struct *work)
>
>   	priv = container_of(work, struct rcar_thermal_priv, work.work);
>
> -	rcar_thermal_get_temp(priv->zone, &cctemp);
> +	ret = rcar_thermal_get_current_temp(priv, &cctemp);
> +	if (ret < 0)
> +		return;
> +
>   	ret = rcar_thermal_update_temp(priv);
>   	if (ret < 0)
>   		return;
>
>   	rcar_thermal_irq_enable(priv);
>
> -	rcar_thermal_get_temp(priv->zone, &nctemp);
> +	ret = rcar_thermal_get_current_temp(priv, &nctemp);
> +	if (ret < 0)
> +		return;
> +
>   	if (nctemp != cctemp)
>   		thermal_zone_device_update(priv->zone);
>   }
> @@ -394,6 +420,8 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>   	struct rcar_thermal_priv *priv;
>   	struct device *dev = &pdev->dev;
>   	struct resource *res, *irq;
> +	const struct of_device_id *of_id = of_match_device(rcar_thermal_dt_ids, dev);
> +	unsigned long of_data = (unsigned long)of_id->data;
>   	int mres = 0;
>   	int i;
>   	int ret = -ENODEV;
> @@ -452,7 +480,13 @@ static int rcar_thermal_probe(struct platform_device *pdev)
>   		if (ret < 0)
>   			goto error_unregister;
>
> -		priv->zone = thermal_zone_device_register("rcar_thermal",
> +		if (of_data == USE_OF_THERMAL)
> +			priv->zone = thermal_zone_of_sensor_register(
> +						dev, i, priv,
> +						&rcar_thermal_zone_of_ops);
> +		else
> +			priv->zone = thermal_zone_device_register(
> +						"rcar_thermal",
>   						1, 0, priv,
>   						&rcar_thermal_zone_ops, NULL, 0,
>   						idle);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1288204

FromSimon Horman <horms@verge.net.au>
Date2015-12-10 06:00 +0100
Message-ID<qE1uF-1j4-3@gated-at.bofh.it>
In reply to#1286247
On Tue, Dec 08, 2015 at 05:26:20AM +0000, Kuninori Morimoto wrote:
> 
> Hi
> 
> These are v4 of thermal-zone support for r8a7790/r8a7791.
> Mainly, it cares return value of get_temp()
> 
> I think 8) is needed on of-thermal (?)
> 
> Kuninori Morimoto (8):
>       1) thermal: rcar: move rcar_thermal_dt_ids to upside
>       2) thermal: rcar: check every rcar_thermal_update_temp() return value
>       3) thermal: rcar: check irq possibility in rcar_thermal_irq_xxx()
>       4) thermal: rcar: retern error rcar_thermal_get_temp() if no ctemp update
>       5) thermal: rcar: enable to use thermal-zone on DT
>       6) ARM: shmobile: r8a7790: enable to use thermal-zone
>       7) ARM: shmobile: r8a7791: enable to use thermal-zone
>       8) thermal: of-thermal: of_thermal_set_trip_temp() call thermal_zone_device_update()
> 

I have marked patches 6 and 7 as deferred pending acceptance of the driver
changes.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web