All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Eduardo Valentin <edubezval@gmail.com>,
	Simon <horms@verge.net.au>, Zhang Rui <rui.zhang@intel.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Magnus <magnus.damm@gmail.com>,
	linux-sh@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH 5/8 v6] thermal: rcar: enable to use thermal-zone on DT
Date: Tue, 05 Jan 2016 08:08:45 +0000	[thread overview]
Message-ID: <87lh841mev.wl%kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87wpsctxjv.wl%kuninori.morimoto.gx@renesas.com>


Hi

ping ?

> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> This patch enables to use thermal-zone on DT if it was calles as
> "renesas,rcar-thermal-gen2".
> Previous style (= non thermal-zone) is still supported by
> "renesas,rcar-thermal" to keep compatibility for "git bisect".
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v5 -> v6
> 
>  - "was call" -> "was called"
>  - add reason why it keeps previous style
> 
>  .../devicetree/bindings/thermal/rcar-thermal.txt   | 37 +++++++++++++++++-
>  drivers/thermal/rcar_thermal.c                     | 45 +++++++++++++++++++---
>  2 files changed, 75 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> index 332e625..e5ee3f1 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	= <115000>;
> +				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 30602f2..e92f29b 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>
> @@ -75,8 +76,10 @@ struct rcar_thermal_priv {
>  #define rcar_has_irq_support(priv)	((priv)->common->base)
>  #define rcar_id_to_shift(priv)		((priv)->id * 8)
>  
> +#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);
> @@ -200,9 +203,9 @@ 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;
>  	int ret;
>  
> @@ -226,6 +229,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)
>  {
> @@ -282,6 +299,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,
> @@ -318,14 +339,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);
>  }
> @@ -386,6 +413,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;
> @@ -444,7 +473,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);
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Eduardo Valentin <edubezval@gmail.com>,
	Simon <horms@verge.net.au>, Zhang Rui <rui.zhang@intel.com>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	Magnus <magnus.damm@gmail.com>, <linux-sh@vger.kernel.org>,
	<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH 5/8 v6] thermal: rcar: enable to use thermal-zone on DT
Date: Tue, 5 Jan 2016 08:08:45 +0000	[thread overview]
Message-ID: <87lh841mev.wl%kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87wpsctxjv.wl%kuninori.morimoto.gx@renesas.com>


Hi

ping ?

> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> This patch enables to use thermal-zone on DT if it was calles as
> "renesas,rcar-thermal-gen2".
> Previous style (= non thermal-zone) is still supported by
> "renesas,rcar-thermal" to keep compatibility for "git bisect".
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v5 -> v6
> 
>  - "was call" -> "was called"
>  - add reason why it keeps previous style
> 
>  .../devicetree/bindings/thermal/rcar-thermal.txt   | 37 +++++++++++++++++-
>  drivers/thermal/rcar_thermal.c                     | 45 +++++++++++++++++++---
>  2 files changed, 75 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> index 332e625..e5ee3f1 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	= <115000>;
> +				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 30602f2..e92f29b 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>
> @@ -75,8 +76,10 @@ struct rcar_thermal_priv {
>  #define rcar_has_irq_support(priv)	((priv)->common->base)
>  #define rcar_id_to_shift(priv)		((priv)->id * 8)
>  
> +#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);
> @@ -200,9 +203,9 @@ 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;
>  	int ret;
>  
> @@ -226,6 +229,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)
>  {
> @@ -282,6 +299,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,
> @@ -318,14 +339,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);
>  }
> @@ -386,6 +413,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;
> @@ -444,7 +473,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);
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Eduardo Valentin <edubezval@gmail.com>,
	Simon <horms@verge.net.au>, Zhang Rui <rui.zhang@intel.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Magnus <magnus.damm@gmail.com>,
	linux-sh@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH 5/8 v6] thermal: rcar: enable to use thermal-zone on DT
Date: Tue, 5 Jan 2016 08:08:45 +0000	[thread overview]
Message-ID: <87lh841mev.wl%kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87wpsctxjv.wl%kuninori.morimoto.gx@renesas.com>


Hi

ping ?

> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> This patch enables to use thermal-zone on DT if it was calles as
> "renesas,rcar-thermal-gen2".
> Previous style (= non thermal-zone) is still supported by
> "renesas,rcar-thermal" to keep compatibility for "git bisect".
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v5 -> v6
> 
>  - "was call" -> "was called"
>  - add reason why it keeps previous style
> 
>  .../devicetree/bindings/thermal/rcar-thermal.txt   | 37 +++++++++++++++++-
>  drivers/thermal/rcar_thermal.c                     | 45 +++++++++++++++++++---
>  2 files changed, 75 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> index 332e625..e5ee3f1 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	= <115000>;
> +				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 30602f2..e92f29b 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>
> @@ -75,8 +76,10 @@ struct rcar_thermal_priv {
>  #define rcar_has_irq_support(priv)	((priv)->common->base)
>  #define rcar_id_to_shift(priv)		((priv)->id * 8)
>  
> +#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);
> @@ -200,9 +203,9 @@ 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;
>  	int ret;
>  
> @@ -226,6 +229,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)
>  {
> @@ -282,6 +299,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,
> @@ -318,14 +339,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);
>  }
> @@ -386,6 +413,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;
> @@ -444,7 +473,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);
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-01-05  8:08 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15  1:16 [PATCH 0/8 v5] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto
2015-12-15  1:16 ` Kuninori Morimoto
2015-12-15  1:17 ` [PATCH 1/8 v5] thermal: rcar: move rcar_thermal_dt_ids to upside Kuninori Morimoto
2015-12-15  1:17   ` Kuninori Morimoto
2015-12-15  1:17 ` [PATCH 2/8 v5] thermal: rcar: check every rcar_thermal_update_temp() return value Kuninori Morimoto
2015-12-15  1:17   ` Kuninori Morimoto
2015-12-15  1:17 ` [PATCH 3/8 v5] thermal: rcar: check irq possibility in rcar_thermal_irq_xxx() Kuninori Morimoto
2015-12-15  1:17   ` Kuninori Morimoto
2015-12-15  1:18 ` [PATCH 4/8 v5] thermal: rcar: rcar_thermal_get_temp() return error if strange temp Kuninori Morimoto
2015-12-15  1:18   ` Kuninori Morimoto
2015-12-15  1:18 ` [PATCH 5/8 v5] thermal: rcar: enable to use thermal-zone on DT Kuninori Morimoto
2015-12-15  1:18   ` Kuninori Morimoto
2015-12-15  1:18   ` Kuninori Morimoto
2015-12-17 20:37   ` Eduardo Valentin
2015-12-17 20:37     ` Eduardo Valentin
2015-12-18  0:25     ` [PATCH 5/8 v6] " Kuninori Morimoto
2015-12-18  0:25       ` Kuninori Morimoto
2015-12-18  0:25       ` Kuninori Morimoto
     [not found]       ` <87wpsctxjv.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2015-12-19  4:17         ` Rob Herring
2015-12-19  4:17           ` Rob Herring
2015-12-19  4:17           ` Rob Herring
2015-12-21  0:56           ` Kuninori Morimoto
2015-12-21  0:56             ` Kuninori Morimoto
2016-01-05  8:08       ` Kuninori Morimoto [this message]
2016-01-05  8:08         ` Kuninori Morimoto
2016-01-05  8:08         ` Kuninori Morimoto
2015-12-15  1:18 ` [PATCH 6/8 v5] ARM: shmobile: r8a7790: enable to use thermal-zone Kuninori Morimoto
2015-12-15  1:18   ` Kuninori Morimoto
2015-12-15  1:19 ` [PATCH 7/8 v5] ARM: shmobile: r8a7791: " Kuninori Morimoto
2015-12-15  1:19   ` Kuninori Morimoto
2015-12-15  1:19 ` [PATCH 8/8 v5] thermal: trip_point_temp_store() calls thermal_zone_device_update() Kuninori Morimoto
2015-12-15  1:19   ` Kuninori Morimoto
2015-12-15  4:49 ` [PATCH 0/8 v5] enable to use thermal-zone on r8a7790/1 Simon Horman
2015-12-15  4:49   ` Simon Horman
     [not found] ` <87d1u8qzsy.wl%kuninori.morimoto.gx-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2015-12-17 21:08   ` Eduardo Valentin
2015-12-17 21:08     ` Eduardo Valentin
2015-12-17 21:08     ` Eduardo Valentin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lh841mev.wl%kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=devicetree@vger.kernel.org \
    --cc=edubezval@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=horms@verge.net.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.