All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] enable to use thermal-zone on r8a7790/1
@ 2015-12-04  3:16 ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:16 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


Hi

These are enable to use thermal-zone on r8a7790/r8a7791.
The rcar thermal driver can use of-thermal style zone by this patch,
but it still keeping current style too.

You can select trip temp by DT if you use of-thermal style (this patch).
If not, it will use fixed trip temp.

Kuninori Morimoto (4):
      thermal: rcar: move rcar_thermal_dt_ids to upside
      thermal: rcar: enable to use thermal-zone on DT
      ARM: shmobile: r8a7790: enable to use thermal-zone
      ARM: shmobile: r8a7791: enable to use thermal-zone

 Documentation/devicetree/bindings/thermal/rcar-thermal.txt | 37 +++++++++++++++++++++++++++++++++++--
 arch/arm/boot/dts/r8a7790.dtsi                             | 26 ++++++++++++++++++++++++--
 arch/arm/boot/dts/r8a7791.dtsi                             | 26 ++++++++++++++++++++++++--
 drivers/thermal/rcar_thermal.c                             | 57 +++++++++++++++++++++++++++++++++++++++++++++------------
 4 files changed, 128 insertions(+), 18 deletions(-)



Best regards
---
Kuninori Morimoto

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

* [PATCH 0/4] enable to use thermal-zone on r8a7790/1
@ 2015-12-04  3:16 ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:16 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


Hi

These are enable to use thermal-zone on r8a7790/r8a7791.
The rcar thermal driver can use of-thermal style zone by this patch,
but it still keeping current style too.

You can select trip temp by DT if you use of-thermal style (this patch).
If not, it will use fixed trip temp.

Kuninori Morimoto (4):
      thermal: rcar: move rcar_thermal_dt_ids to upside
      thermal: rcar: enable to use thermal-zone on DT
      ARM: shmobile: r8a7790: enable to use thermal-zone
      ARM: shmobile: r8a7791: enable to use thermal-zone

 Documentation/devicetree/bindings/thermal/rcar-thermal.txt | 37 +++++++++++++++++++++++++++++++++++--
 arch/arm/boot/dts/r8a7790.dtsi                             | 26 ++++++++++++++++++++++++--
 arch/arm/boot/dts/r8a7791.dtsi                             | 26 ++++++++++++++++++++++++--
 drivers/thermal/rcar_thermal.c                             | 57 +++++++++++++++++++++++++++++++++++++++++++++------------
 4 files changed, 128 insertions(+), 18 deletions(-)



Best regards
---
Kuninori Morimoto

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

* [PATCH 0/4] enable to use thermal-zone on r8a7790/1
@ 2015-12-04  3:16 ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:16 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


Hi

These are enable to use thermal-zone on r8a7790/r8a7791.
The rcar thermal driver can use of-thermal style zone by this patch,
but it still keeping current style too.

You can select trip temp by DT if you use of-thermal style (this patch).
If not, it will use fixed trip temp.

Kuninori Morimoto (4):
      thermal: rcar: move rcar_thermal_dt_ids to upside
      thermal: rcar: enable to use thermal-zone on DT
      ARM: shmobile: r8a7790: enable to use thermal-zone
      ARM: shmobile: r8a7791: enable to use thermal-zone

 Documentation/devicetree/bindings/thermal/rcar-thermal.txt | 37 +++++++++++++++++++++++++++++++++++--
 arch/arm/boot/dts/r8a7790.dtsi                             | 26 ++++++++++++++++++++++++--
 arch/arm/boot/dts/r8a7791.dtsi                             | 26 ++++++++++++++++++++++++--
 drivers/thermal/rcar_thermal.c                             | 57 +++++++++++++++++++++++++++++++++++++++++++++------------
 4 files changed, 128 insertions(+), 18 deletions(-)



Best regards
---
Kuninori Morimoto

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

* [PATCH 1/4] thermal: rcar: move rcar_thermal_dt_ids to upside
  2015-12-04  3:16 ` Kuninori Morimoto
  (?)
@ 2015-12-04  3:17   ` Kuninori Morimoto
  -1 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:17 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch is prepare for of-thermal support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/thermal/rcar_thermal.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 13d01ed..96707a6 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -81,6 +81,12 @@ struct rcar_thermal_priv {
 # define rcar_force_update_temp(priv)	0
 #endif
 
+static const struct of_device_id rcar_thermal_dt_ids[] = {
+	{ .compatible = "renesas,rcar-thermal", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
+
 /*
  *		basic functions
  */
@@ -484,12 +490,6 @@ error_unregister:
 	return ret;
 }
 
-static const struct of_device_id rcar_thermal_dt_ids[] = {
-	{ .compatible = "renesas,rcar-thermal", },
-	{},
-};
-MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
-
 static struct platform_driver rcar_thermal_driver = {
 	.driver	= {
 		.name	= "rcar_thermal",
-- 
1.9.1


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

* [PATCH 1/4] thermal: rcar: move rcar_thermal_dt_ids to upside
@ 2015-12-04  3:17   ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:17 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch is prepare for of-thermal support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/thermal/rcar_thermal.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 13d01ed..96707a6 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -81,6 +81,12 @@ struct rcar_thermal_priv {
 # define rcar_force_update_temp(priv)	0
 #endif
 
+static const struct of_device_id rcar_thermal_dt_ids[] = {
+	{ .compatible = "renesas,rcar-thermal", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
+
 /*
  *		basic functions
  */
@@ -484,12 +490,6 @@ error_unregister:
 	return ret;
 }
 
-static const struct of_device_id rcar_thermal_dt_ids[] = {
-	{ .compatible = "renesas,rcar-thermal", },
-	{},
-};
-MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
-
 static struct platform_driver rcar_thermal_driver = {
 	.driver	= {
 		.name	= "rcar_thermal",
-- 
1.9.1


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

* [PATCH 1/4] thermal: rcar: move rcar_thermal_dt_ids to upside
@ 2015-12-04  3:17   ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:17 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch is prepare for of-thermal support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/thermal/rcar_thermal.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 13d01ed..96707a6 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -81,6 +81,12 @@ struct rcar_thermal_priv {
 # define rcar_force_update_temp(priv)	0
 #endif
 
+static const struct of_device_id rcar_thermal_dt_ids[] = {
+	{ .compatible = "renesas,rcar-thermal", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
+
 /*
  *		basic functions
  */
@@ -484,12 +490,6 @@ error_unregister:
 	return ret;
 }
 
-static const struct of_device_id rcar_thermal_dt_ids[] = {
-	{ .compatible = "renesas,rcar-thermal", },
-	{},
-};
-MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
-
 static struct platform_driver rcar_thermal_driver = {
 	.driver	= {
 		.name	= "rcar_thermal",
-- 
1.9.1


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

* [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
  2015-12-04  3:16 ` Kuninori Morimoto
  (?)
@ 2015-12-04  3:17   ` Kuninori Morimoto
  -1 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:17 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch enables to use thermal-zone on DT if it was call as
"renesas,rcar-thermal-gen2".
Previous style is still supported by "renesas,rcar-thermal".

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../devicetree/bindings/thermal/rcar-thermal.txt   | 37 +++++++++++++++++-
 drivers/thermal/rcar_thermal.c                     | 45 +++++++++++++++++++---
 2 files changed, 74 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
index 332e625..904f204 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-thermal-gen2" (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>;
+				hysteresis	= <0>;
+				type		= "critical";
+			};
+		};
+		cooling-maps {
+		};
+	};
+};
+
+thermal: thermal@e61f0000 {
+	compatible =	"renesas,thermal-r8a7790",
+			"renesas,rcar-thermal-gen2",
+			"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 96707a6..9c9e38b 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-thermal-gen2", .data = (void *)USE_OF_THERMAL },
 	{},
 };
 MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
@@ -206,17 +209,35 @@ 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)
 {
-	struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
+	int temp;
 
 	if (!rcar_has_irq_support(priv) || rcar_force_update_temp(priv))
 		rcar_thermal_update_temp(priv);
 
 	mutex_lock(&priv->lock);
-	*temp =  MCELSIUS((priv->ctemp * 5) - 65);
+	temp =  MCELSIUS((priv->ctemp * 5) - 65);
 	mutex_unlock(&priv->lock);
 
+	return temp;
+}
+
+static int rcar_thermal_of_get_temp(void *data, int *temp)
+{
+	struct rcar_thermal_priv *priv = data;
+
+	*temp = rcar_thermal_get_current_temp(priv);
+
+	return 0;
+}
+
+static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
+{
+	struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
+
+	*temp = rcar_thermal_get_current_temp(priv);
+
 	return 0;
 }
 
@@ -276,6 +297,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,
@@ -308,11 +333,11 @@ 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);
+	cctemp = rcar_thermal_get_current_temp(priv);
 	rcar_thermal_update_temp(priv);
 	rcar_thermal_irq_enable(priv);
 
-	rcar_thermal_get_temp(priv->zone, &nctemp);
+	nctemp = rcar_thermal_get_current_temp(priv);
 	if (nctemp != cctemp)
 		thermal_zone_device_update(priv->zone);
 }
@@ -391,6 +416,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;
@@ -449,7 +476,13 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 		INIT_DELAYED_WORK(&priv->work, rcar_thermal_work);
 		rcar_thermal_update_temp(priv);
 
-		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


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

* [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
@ 2015-12-04  3:17   ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:17 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch enables to use thermal-zone on DT if it was call as
"renesas,rcar-thermal-gen2".
Previous style is still supported by "renesas,rcar-thermal".

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../devicetree/bindings/thermal/rcar-thermal.txt   | 37 +++++++++++++++++-
 drivers/thermal/rcar_thermal.c                     | 45 +++++++++++++++++++---
 2 files changed, 74 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
index 332e625..904f204 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-thermal-gen2" (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>;
+				hysteresis	= <0>;
+				type		= "critical";
+			};
+		};
+		cooling-maps {
+		};
+	};
+};
+
+thermal: thermal@e61f0000 {
+	compatible =	"renesas,thermal-r8a7790",
+			"renesas,rcar-thermal-gen2",
+			"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 96707a6..9c9e38b 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-thermal-gen2", .data = (void *)USE_OF_THERMAL },
 	{},
 };
 MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
@@ -206,17 +209,35 @@ 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)
 {
-	struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
+	int temp;
 
 	if (!rcar_has_irq_support(priv) || rcar_force_update_temp(priv))
 		rcar_thermal_update_temp(priv);
 
 	mutex_lock(&priv->lock);
-	*temp =  MCELSIUS((priv->ctemp * 5) - 65);
+	temp =  MCELSIUS((priv->ctemp * 5) - 65);
 	mutex_unlock(&priv->lock);
 
+	return temp;
+}
+
+static int rcar_thermal_of_get_temp(void *data, int *temp)
+{
+	struct rcar_thermal_priv *priv = data;
+
+	*temp = rcar_thermal_get_current_temp(priv);
+
+	return 0;
+}
+
+static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
+{
+	struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
+
+	*temp = rcar_thermal_get_current_temp(priv);
+
 	return 0;
 }
 
@@ -276,6 +297,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,
@@ -308,11 +333,11 @@ 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);
+	cctemp = rcar_thermal_get_current_temp(priv);
 	rcar_thermal_update_temp(priv);
 	rcar_thermal_irq_enable(priv);
 
-	rcar_thermal_get_temp(priv->zone, &nctemp);
+	nctemp = rcar_thermal_get_current_temp(priv);
 	if (nctemp != cctemp)
 		thermal_zone_device_update(priv->zone);
 }
@@ -391,6 +416,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;
@@ -449,7 +476,13 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 		INIT_DELAYED_WORK(&priv->work, rcar_thermal_work);
 		rcar_thermal_update_temp(priv);
 
-		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


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

* [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
@ 2015-12-04  3:17   ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:17 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch enables to use thermal-zone on DT if it was call as
"renesas,rcar-thermal-gen2".
Previous style is still supported by "renesas,rcar-thermal".

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../devicetree/bindings/thermal/rcar-thermal.txt   | 37 +++++++++++++++++-
 drivers/thermal/rcar_thermal.c                     | 45 +++++++++++++++++++---
 2 files changed, 74 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
index 332e625..904f204 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-thermal-gen2" (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>;
+				hysteresis	= <0>;
+				type		= "critical";
+			};
+		};
+		cooling-maps {
+		};
+	};
+};
+
+thermal: thermal@e61f0000 {
+	compatible =	"renesas,thermal-r8a7790",
+			"renesas,rcar-thermal-gen2",
+			"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 96707a6..9c9e38b 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-thermal-gen2", .data = (void *)USE_OF_THERMAL },
 	{},
 };
 MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
@@ -206,17 +209,35 @@ 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)
 {
-	struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
+	int temp;
 
 	if (!rcar_has_irq_support(priv) || rcar_force_update_temp(priv))
 		rcar_thermal_update_temp(priv);
 
 	mutex_lock(&priv->lock);
-	*temp =  MCELSIUS((priv->ctemp * 5) - 65);
+	temp =  MCELSIUS((priv->ctemp * 5) - 65);
 	mutex_unlock(&priv->lock);
 
+	return temp;
+}
+
+static int rcar_thermal_of_get_temp(void *data, int *temp)
+{
+	struct rcar_thermal_priv *priv = data;
+
+	*temp = rcar_thermal_get_current_temp(priv);
+
+	return 0;
+}
+
+static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
+{
+	struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
+
+	*temp = rcar_thermal_get_current_temp(priv);
+
 	return 0;
 }
 
@@ -276,6 +297,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,
@@ -308,11 +333,11 @@ 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);
+	cctemp = rcar_thermal_get_current_temp(priv);
 	rcar_thermal_update_temp(priv);
 	rcar_thermal_irq_enable(priv);
 
-	rcar_thermal_get_temp(priv->zone, &nctemp);
+	nctemp = rcar_thermal_get_current_temp(priv);
 	if (nctemp != cctemp)
 		thermal_zone_device_update(priv->zone);
 }
@@ -391,6 +416,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;
@@ -449,7 +476,13 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 		INIT_DELAYED_WORK(&priv->work, rcar_thermal_work);
 		rcar_thermal_update_temp(priv);
 
-		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


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

* [PATCH 3/4] ARM: shmobile: r8a7790: enable to use thermal-zone
  2015-12-04  3:16 ` Kuninori Morimoto
  (?)
@ 2015-12-04  3:18   ` Kuninori Morimoto
  -1 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:18 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch enables to use thermal-zone on r8a7790.
This thermal sensor can measure temperature from -40000 to 125000,
but over 117000 can be critical on this chip.
Thus, default critical temperature is now set as 115000 (this driver
is using 5000 steps) (Current critical temperature is using it as
90000, but there is no big reason about it)

And it doesn't check thermal zone periodically (same as current
behavior). You can exchange it by modifing polling-delay[-passive]
property.

You can set trip temp if your kernel has CONFIG_THERMAL_WRITABLE_TRIPS,
but you need to take care to use it, since it will call
orderly_poweroff() it it reached to the value.
echo $temp > /sys/class/thermal/thermal_zone0/trip_point_0_temp

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7790.dtsi | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 6cfd0dc..bbbc3cd 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -112,6 +112,25 @@
 		};
 	};
 
+	thermal-zones {
+		cpu_thermal: cpu-thermal {
+			polling-delay-passive	= <0>;
+			polling-delay		= <0>;
+
+			thermal-sensors = <&thermal>;
+
+			trips {
+				cpu-crit {
+					temperature	= <1150000>;
+					hysteresis	= <0>;
+					type		= "critical";
+				};
+			};
+			cooling-maps {
+			};
+		};
+	};
+
 	gic: interrupt-controller@f1001000 {
 		compatible = "arm,gic-400";
 		#interrupt-cells = <3>;
@@ -202,12 +221,15 @@
 		power-domains = <&cpg_clocks>;
 	};
 
-	thermal@e61f0000 {
-		compatible = "renesas,thermal-r8a7790", "renesas,rcar-thermal";
+	thermal: thermal@e61f0000 {
+		compatible =	"renesas,thermal-r8a7790",
+				"renesas,rcar-thermal-gen2",
+				"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>;
 	};
 
 	timer {
-- 
1.9.1


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

* [PATCH 3/4] ARM: shmobile: r8a7790: enable to use thermal-zone
@ 2015-12-04  3:18   ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:18 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch enables to use thermal-zone on r8a7790.
This thermal sensor can measure temperature from -40000 to 125000,
but over 117000 can be critical on this chip.
Thus, default critical temperature is now set as 115000 (this driver
is using 5000 steps) (Current critical temperature is using it as
90000, but there is no big reason about it)

And it doesn't check thermal zone periodically (same as current
behavior). You can exchange it by modifing polling-delay[-passive]
property.

You can set trip temp if your kernel has CONFIG_THERMAL_WRITABLE_TRIPS,
but you need to take care to use it, since it will call
orderly_poweroff() it it reached to the value.
echo $temp > /sys/class/thermal/thermal_zone0/trip_point_0_temp

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7790.dtsi | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 6cfd0dc..bbbc3cd 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -112,6 +112,25 @@
 		};
 	};
 
+	thermal-zones {
+		cpu_thermal: cpu-thermal {
+			polling-delay-passive	= <0>;
+			polling-delay		= <0>;
+
+			thermal-sensors = <&thermal>;
+
+			trips {
+				cpu-crit {
+					temperature	= <1150000>;
+					hysteresis	= <0>;
+					type		= "critical";
+				};
+			};
+			cooling-maps {
+			};
+		};
+	};
+
 	gic: interrupt-controller@f1001000 {
 		compatible = "arm,gic-400";
 		#interrupt-cells = <3>;
@@ -202,12 +221,15 @@
 		power-domains = <&cpg_clocks>;
 	};
 
-	thermal@e61f0000 {
-		compatible = "renesas,thermal-r8a7790", "renesas,rcar-thermal";
+	thermal: thermal@e61f0000 {
+		compatible =	"renesas,thermal-r8a7790",
+				"renesas,rcar-thermal-gen2",
+				"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>;
 	};
 
 	timer {
-- 
1.9.1


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

* [PATCH 3/4] ARM: shmobile: r8a7790: enable to use thermal-zone
@ 2015-12-04  3:18   ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:18 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch enables to use thermal-zone on r8a7790.
This thermal sensor can measure temperature from -40000 to 125000,
but over 117000 can be critical on this chip.
Thus, default critical temperature is now set as 115000 (this driver
is using 5000 steps) (Current critical temperature is using it as
90000, but there is no big reason about it)

And it doesn't check thermal zone periodically (same as current
behavior). You can exchange it by modifing polling-delay[-passive]
property.

You can set trip temp if your kernel has CONFIG_THERMAL_WRITABLE_TRIPS,
but you need to take care to use it, since it will call
orderly_poweroff() it it reached to the value.
echo $temp > /sys/class/thermal/thermal_zone0/trip_point_0_temp

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7790.dtsi | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 6cfd0dc..bbbc3cd 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -112,6 +112,25 @@
 		};
 	};
 
+	thermal-zones {
+		cpu_thermal: cpu-thermal {
+			polling-delay-passive	= <0>;
+			polling-delay		= <0>;
+
+			thermal-sensors = <&thermal>;
+
+			trips {
+				cpu-crit {
+					temperature	= <1150000>;
+					hysteresis	= <0>;
+					type		= "critical";
+				};
+			};
+			cooling-maps {
+			};
+		};
+	};
+
 	gic: interrupt-controller@f1001000 {
 		compatible = "arm,gic-400";
 		#interrupt-cells = <3>;
@@ -202,12 +221,15 @@
 		power-domains = <&cpg_clocks>;
 	};
 
-	thermal@e61f0000 {
-		compatible = "renesas,thermal-r8a7790", "renesas,rcar-thermal";
+	thermal: thermal@e61f0000 {
+		compatible =	"renesas,thermal-r8a7790",
+				"renesas,rcar-thermal-gen2",
+				"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>;
 	};
 
 	timer {
-- 
1.9.1

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

* [PATCH 4/4] ARM: shmobile: r8a7791: enable to use thermal-zone
  2015-12-04  3:16 ` Kuninori Morimoto
  (?)
@ 2015-12-04  3:18   ` Kuninori Morimoto
  -1 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:18 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch enables to use thermal-zone on r8a7791.
This thermal sensor can measure temperature from -40000 to 125000,
but over 117000 can be critical on this chip.
Thus, default critical temperature is now set as 115000 (this driver
is using 5000 steps) (Current critical temperature is using it as
90000, but there is no big reason about it)

And it doesn't check thermal zone periodically (same as current
behavior). You can exchange it by modifing polling-delay[-passive]
property.

You can set trip temp if your kernel has CONFIG_THERMAL_WRITABLE_TRIPS,
but you need to take care to use it, since it will call
orderly_poweroff() it it reached to the value.
echo $temp > /sys/class/thermal/thermal_zone0/trip_point_0_temp

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7791.dtsi | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 1487d92..2fff856 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -69,6 +69,25 @@
 		};
 	};
 
+	thermal-zones {
+		cpu_thermal: cpu-thermal {
+			polling-delay-passive	= <0>;
+			polling-delay		= <0>;
+
+			thermal-sensors = <&thermal>;
+
+			trips {
+				cpu-crit {
+					temperature	= <1150000>;
+					hysteresis	= <0>;
+					type		= "critical";
+				};
+			};
+			cooling-maps {
+			};
+		};
+	};
+
 	gic: interrupt-controller@f1001000 {
 		compatible = "arm,gic-400";
 		#interrupt-cells = <3>;
@@ -185,12 +204,15 @@
 		power-domains = <&cpg_clocks>;
 	};
 
-	thermal@e61f0000 {
-		compatible = "renesas,thermal-r8a7791", "renesas,rcar-thermal";
+	thermal: thermal@e61f0000 {
+		compatible =	"renesas,thermal-r8a7791",
+				"renesas,rcar-thermal-gen2",
+				"renesas,rcar-thermal";
 		reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>;
 		interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp5_clks R8A7791_CLK_THERMAL>;
 		power-domains = <&cpg_clocks>;
+		#thermal-sensor-cells = <0>;
 	};
 
 	timer {
-- 
1.9.1


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

* [PATCH 4/4] ARM: shmobile: r8a7791: enable to use thermal-zone
@ 2015-12-04  3:18   ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:18 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch enables to use thermal-zone on r8a7791.
This thermal sensor can measure temperature from -40000 to 125000,
but over 117000 can be critical on this chip.
Thus, default critical temperature is now set as 115000 (this driver
is using 5000 steps) (Current critical temperature is using it as
90000, but there is no big reason about it)

And it doesn't check thermal zone periodically (same as current
behavior). You can exchange it by modifing polling-delay[-passive]
property.

You can set trip temp if your kernel has CONFIG_THERMAL_WRITABLE_TRIPS,
but you need to take care to use it, since it will call
orderly_poweroff() it it reached to the value.
echo $temp > /sys/class/thermal/thermal_zone0/trip_point_0_temp

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7791.dtsi | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 1487d92..2fff856 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -69,6 +69,25 @@
 		};
 	};
 
+	thermal-zones {
+		cpu_thermal: cpu-thermal {
+			polling-delay-passive	= <0>;
+			polling-delay		= <0>;
+
+			thermal-sensors = <&thermal>;
+
+			trips {
+				cpu-crit {
+					temperature	= <1150000>;
+					hysteresis	= <0>;
+					type		= "critical";
+				};
+			};
+			cooling-maps {
+			};
+		};
+	};
+
 	gic: interrupt-controller@f1001000 {
 		compatible = "arm,gic-400";
 		#interrupt-cells = <3>;
@@ -185,12 +204,15 @@
 		power-domains = <&cpg_clocks>;
 	};
 
-	thermal@e61f0000 {
-		compatible = "renesas,thermal-r8a7791", "renesas,rcar-thermal";
+	thermal: thermal@e61f0000 {
+		compatible =	"renesas,thermal-r8a7791",
+				"renesas,rcar-thermal-gen2",
+				"renesas,rcar-thermal";
 		reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>;
 		interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp5_clks R8A7791_CLK_THERMAL>;
 		power-domains = <&cpg_clocks>;
+		#thermal-sensor-cells = <0>;
 	};
 
 	timer {
-- 
1.9.1


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

* [PATCH 4/4] ARM: shmobile: r8a7791: enable to use thermal-zone
@ 2015-12-04  3:18   ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  3:18 UTC (permalink / raw)
  To: Simon, Zhang Rui, Eduardo Valentin
  Cc: Magnus, linux-sh, linux-pm, linux-kernel


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch enables to use thermal-zone on r8a7791.
This thermal sensor can measure temperature from -40000 to 125000,
but over 117000 can be critical on this chip.
Thus, default critical temperature is now set as 115000 (this driver
is using 5000 steps) (Current critical temperature is using it as
90000, but there is no big reason about it)

And it doesn't check thermal zone periodically (same as current
behavior). You can exchange it by modifing polling-delay[-passive]
property.

You can set trip temp if your kernel has CONFIG_THERMAL_WRITABLE_TRIPS,
but you need to take care to use it, since it will call
orderly_poweroff() it it reached to the value.
echo $temp > /sys/class/thermal/thermal_zone0/trip_point_0_temp

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 arch/arm/boot/dts/r8a7791.dtsi | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 1487d92..2fff856 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -69,6 +69,25 @@
 		};
 	};
 
+	thermal-zones {
+		cpu_thermal: cpu-thermal {
+			polling-delay-passive	= <0>;
+			polling-delay		= <0>;
+
+			thermal-sensors = <&thermal>;
+
+			trips {
+				cpu-crit {
+					temperature	= <1150000>;
+					hysteresis	= <0>;
+					type		= "critical";
+				};
+			};
+			cooling-maps {
+			};
+		};
+	};
+
 	gic: interrupt-controller@f1001000 {
 		compatible = "arm,gic-400";
 		#interrupt-cells = <3>;
@@ -185,12 +204,15 @@
 		power-domains = <&cpg_clocks>;
 	};
 
-	thermal@e61f0000 {
-		compatible = "renesas,thermal-r8a7791", "renesas,rcar-thermal";
+	thermal: thermal@e61f0000 {
+		compatible =	"renesas,thermal-r8a7791",
+				"renesas,rcar-thermal-gen2",
+				"renesas,rcar-thermal";
 		reg = <0 0xe61f0000 0 0x14>, <0 0xe61f0100 0 0x38>;
 		interrupts = <0 69 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp5_clks R8A7791_CLK_THERMAL>;
 		power-domains = <&cpg_clocks>;
+		#thermal-sensor-cells = <0>;
 	};
 
 	timer {
-- 
1.9.1

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

* Re: [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
  2015-12-04  3:17   ` Kuninori Morimoto
@ 2015-12-04  6:33     ` Manish Badarkhe
  -1 siblings, 0 replies; 27+ messages in thread
From: Manish Badarkhe @ 2015-12-04  6:21 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Zhang Rui, Eduardo Valentin, Magnus, linux-sh, linux-pm,
	linux-kernel

Hi


> +static int rcar_thermal_of_get_temp(void *data, int *temp)
> +{
> +       struct rcar_thermal_priv *priv = data;
> +
> +       *temp = rcar_thermal_get_current_temp(priv);
> +
> +       return 0;
> +}
> +
> +static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
> +{
> +       struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
> +
> +       *temp = rcar_thermal_get_current_temp(priv);
> +
>         return 0;
>  }
>

Above two function, always returns 0. Can it possible to handle error
and log some messages.

Regards
Manish Badarkhe

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

* Re: [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
@ 2015-12-04  6:33     ` Manish Badarkhe
  0 siblings, 0 replies; 27+ messages in thread
From: Manish Badarkhe @ 2015-12-04  6:33 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Zhang Rui, Eduardo Valentin, Magnus, linux-sh, linux-pm,
	linux-kernel

Hi


> +static int rcar_thermal_of_get_temp(void *data, int *temp)
> +{
> +       struct rcar_thermal_priv *priv = data;
> +
> +       *temp = rcar_thermal_get_current_temp(priv);
> +
> +       return 0;
> +}
> +
> +static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
> +{
> +       struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
> +
> +       *temp = rcar_thermal_get_current_temp(priv);
> +
>         return 0;
>  }
>

Above two function, always returns 0. Can it possible to handle error
and log some messages.

Regards
Manish Badarkhe

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

* Re: [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
  2015-12-04  6:33     ` Manish Badarkhe
  (?)
@ 2015-12-04  7:07       ` Kuninori Morimoto
  -1 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  7:07 UTC (permalink / raw)
  To: Manish Badarkhe
  Cc: Simon, Zhang Rui, Eduardo Valentin, Magnus, linux-sh, linux-pm,
	linux-kernel


Hi Manish

> > +static int rcar_thermal_of_get_temp(void *data, int *temp)
> > +{
> > +       struct rcar_thermal_priv *priv = data;
> > +
> > +       *temp = rcar_thermal_get_current_temp(priv);
> > +
> > +       return 0;
> > +}
> > +
> > +static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
> > +{
> > +       struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
> > +
> > +       *temp = rcar_thermal_get_current_temp(priv);
> > +
> >         return 0;
> >  }
> >
> 
> Above two function, always returns 0. Can it possible to handle error
> and log some messages.

Thanks. Will try in v2


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

* Re: [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
@ 2015-12-04  7:07       ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  7:07 UTC (permalink / raw)
  To: Manish Badarkhe
  Cc: Simon, Zhang Rui, Eduardo Valentin, Magnus, linux-sh, linux-pm,
	linux-kernel


Hi Manish

> > +static int rcar_thermal_of_get_temp(void *data, int *temp)
> > +{
> > +       struct rcar_thermal_priv *priv = data;
> > +
> > +       *temp = rcar_thermal_get_current_temp(priv);
> > +
> > +       return 0;
> > +}
> > +
> > +static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
> > +{
> > +       struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
> > +
> > +       *temp = rcar_thermal_get_current_temp(priv);
> > +
> >         return 0;
> >  }
> >
> 
> Above two function, always returns 0. Can it possible to handle error
> and log some messages.

Thanks. Will try in v2


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

* Re: [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
@ 2015-12-04  7:07       ` Kuninori Morimoto
  0 siblings, 0 replies; 27+ messages in thread
From: Kuninori Morimoto @ 2015-12-04  7:07 UTC (permalink / raw)
  To: Manish Badarkhe
  Cc: Simon, Zhang Rui, Eduardo Valentin, Magnus, linux-sh, linux-pm,
	linux-kernel


Hi Manish

> > +static int rcar_thermal_of_get_temp(void *data, int *temp)
> > +{
> > +       struct rcar_thermal_priv *priv = data;
> > +
> > +       *temp = rcar_thermal_get_current_temp(priv);
> > +
> > +       return 0;
> > +}
> > +
> > +static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
> > +{
> > +       struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
> > +
> > +       *temp = rcar_thermal_get_current_temp(priv);
> > +
> >         return 0;
> >  }
> >
> 
> Above two function, always returns 0. Can it possible to handle error
> and log some messages.

Thanks. Will try in v2

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

* Re: [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
  2015-12-04  3:17   ` Kuninori Morimoto
@ 2015-12-04  8:32     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 27+ messages in thread
From: Geert Uytterhoeven @ 2015-12-04  8:32 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Zhang Rui, Eduardo Valentin, Magnus, Linux-sh list,
	Linux PM list, linux-kernel, devicetree

Hi Morimoto-san,

CC devicetree

On Fri, Dec 4, 2015 at 4:17 AM, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> 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-thermal-gen2".
> Previous style is still supported by "renesas,rcar-thermal".
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  .../devicetree/bindings/thermal/rcar-thermal.txt   | 37 +++++++++++++++++-
>  drivers/thermal/rcar_thermal.c                     | 45 +++++++++++++++++++---
>  2 files changed, 74 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> index 332e625..904f204 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-thermal-gen2" (with thermal-zone) or

Ugh, another different scheme "<manuf>,<family>-<device>-<familyversion>"...

What about "renesas,rcar-gen2-thermal"?

> +                          "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>;
> +                               hysteresis      = <0>;
> +                               type            = "critical";
> +                       };
> +               };
> +               cooling-maps {
> +               };
> +       };
> +};
> +
> +thermal: thermal@e61f0000 {
> +       compatible =    "renesas,thermal-r8a7790",
> +                       "renesas,rcar-thermal-gen2",
> +                       "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>;
> +};

How are the two nodes above linked?

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] 27+ messages in thread

* Re: [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
@ 2015-12-04  8:32     ` Geert Uytterhoeven
  0 siblings, 0 replies; 27+ messages in thread
From: Geert Uytterhoeven @ 2015-12-04  8:32 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Zhang Rui, Eduardo Valentin, Magnus, Linux-sh list,
	Linux PM list, linux-kernel, devicetree

Hi Morimoto-san,

CC devicetree

On Fri, Dec 4, 2015 at 4:17 AM, Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> 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-thermal-gen2".
> Previous style is still supported by "renesas,rcar-thermal".
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  .../devicetree/bindings/thermal/rcar-thermal.txt   | 37 +++++++++++++++++-
>  drivers/thermal/rcar_thermal.c                     | 45 +++++++++++++++++++---
>  2 files changed, 74 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt
> index 332e625..904f204 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-thermal-gen2" (with thermal-zone) or

Ugh, another different scheme "<manuf>,<family>-<device>-<familyversion>"...

What about "renesas,rcar-gen2-thermal"?

> +                          "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>;
> +                               hysteresis      = <0>;
> +                               type            = "critical";
> +                       };
> +               };
> +               cooling-maps {
> +               };
> +       };
> +};
> +
> +thermal: thermal@e61f0000 {
> +       compatible =    "renesas,thermal-r8a7790",
> +                       "renesas,rcar-thermal-gen2",
> +                       "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>;
> +};

How are the two nodes above linked?

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] 27+ messages in thread

* Re: [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
  2015-12-04  8:32     ` Geert Uytterhoeven
  (?)
@ 2015-12-04  8:34         ` Geert Uytterhoeven
  -1 siblings, 0 replies; 27+ messages in thread
From: Geert Uytterhoeven @ 2015-12-04  8:34 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Zhang Rui, Eduardo Valentin, Magnus, Linux-sh list,
	Linux PM list, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Fri, Dec 4, 2015 at 9:32 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>> +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>;
>> +                               hysteresis      = <0>;
>> +                               type            = "critical";
>> +                       };
>> +               };
>> +               cooling-maps {
>> +               };
>> +       };
>> +};
>> +
>> +thermal: thermal@e61f0000 {
>> +       compatible =    "renesas,thermal-r8a7790",
>> +                       "renesas,rcar-thermal-gen2",
>> +                       "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>;
>> +};
>
> How are the two nodes above linked?

Pleae ignore my comment, I found the "<&thermal>".

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] 27+ messages in thread

* Re: [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
@ 2015-12-04  8:34         ` Geert Uytterhoeven
  0 siblings, 0 replies; 27+ messages in thread
From: Geert Uytterhoeven @ 2015-12-04  8:34 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Zhang Rui, Eduardo Valentin, Magnus, Linux-sh list,
	Linux PM list, linux-kernel, devicetree

On Fri, Dec 4, 2015 at 9:32 AM, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>> +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>;
>> +                               hysteresis      = <0>;
>> +                               type            = "critical";
>> +                       };
>> +               };
>> +               cooling-maps {
>> +               };
>> +       };
>> +};
>> +
>> +thermal: thermal@e61f0000 {
>> +       compatible =    "renesas,thermal-r8a7790",
>> +                       "renesas,rcar-thermal-gen2",
>> +                       "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>;
>> +};
>
> How are the two nodes above linked?

Pleae ignore my comment, I found the "<&thermal>".

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] 27+ messages in thread

* Re: [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT
@ 2015-12-04  8:34         ` Geert Uytterhoeven
  0 siblings, 0 replies; 27+ messages in thread
From: Geert Uytterhoeven @ 2015-12-04  8:34 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Simon, Zhang Rui, Eduardo Valentin, Magnus, Linux-sh list,
	Linux PM list, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Fri, Dec 4, 2015 at 9:32 AM, Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> wrote:
>> +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>;
>> +                               hysteresis      = <0>;
>> +                               type            = "critical";
>> +                       };
>> +               };
>> +               cooling-maps {
>> +               };
>> +       };
>> +};
>> +
>> +thermal: thermal@e61f0000 {
>> +       compatible =    "renesas,thermal-r8a7790",
>> +                       "renesas,rcar-thermal-gen2",
>> +                       "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>;
>> +};
>
> How are the two nodes above linked?

Pleae ignore my comment, I found the "<&thermal>".

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 3/4] ARM: shmobile: r8a7790: enable to use thermal-zone
  2015-12-04  3:18   ` Kuninori Morimoto
@ 2015-12-07  6:34     ` Simon Horman
  -1 siblings, 0 replies; 27+ messages in thread
From: Simon Horman @ 2015-12-07  6:34 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Zhang Rui, Eduardo Valentin, Magnus, linux-sh, linux-pm, linux-kernel

On Fri, Dec 04, 2015 at 03:18:11AM +0000, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> This patch enables to use thermal-zone on r8a7790.
> This thermal sensor can measure temperature from -40000 to 125000,
> but over 117000 can be critical on this chip.
> Thus, default critical temperature is now set as 115000 (this driver
> is using 5000 steps) (Current critical temperature is using it as
> 90000, but there is no big reason about it)
> 
> And it doesn't check thermal zone periodically (same as current
> behavior). You can exchange it by modifing polling-delay[-passive]
> property.
> 
> You can set trip temp if your kernel has CONFIG_THERMAL_WRITABLE_TRIPS,
> but you need to take care to use it, since it will call
> orderly_poweroff() it it reached to the value.
> echo $temp > /sys/class/thermal/thermal_zone0/trip_point_0_temp
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

I have marked this and the following shmobile patch as deffered
pending acceptance of the driver changes (earlier in the patchset).
Please repost the shmobile patches once that has occurred.

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

* Re: [PATCH 3/4] ARM: shmobile: r8a7790: enable to use thermal-zone
@ 2015-12-07  6:34     ` Simon Horman
  0 siblings, 0 replies; 27+ messages in thread
From: Simon Horman @ 2015-12-07  6:34 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Zhang Rui, Eduardo Valentin, Magnus, linux-sh, linux-pm, linux-kernel

On Fri, Dec 04, 2015 at 03:18:11AM +0000, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> This patch enables to use thermal-zone on r8a7790.
> This thermal sensor can measure temperature from -40000 to 125000,
> but over 117000 can be critical on this chip.
> Thus, default critical temperature is now set as 115000 (this driver
> is using 5000 steps) (Current critical temperature is using it as
> 90000, but there is no big reason about it)
> 
> And it doesn't check thermal zone periodically (same as current
> behavior). You can exchange it by modifing polling-delay[-passive]
> property.
> 
> You can set trip temp if your kernel has CONFIG_THERMAL_WRITABLE_TRIPS,
> but you need to take care to use it, since it will call
> orderly_poweroff() it it reached to the value.
> echo $temp > /sys/class/thermal/thermal_zone0/trip_point_0_temp
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

I have marked this and the following shmobile patch as deffered
pending acceptance of the driver changes (earlier in the patchset).
Please repost the shmobile patches once that has occurred.

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

end of thread, other threads:[~2015-12-07  6:34 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-04  3:16 [PATCH 0/4] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto
2015-12-04  3:16 ` Kuninori Morimoto
2015-12-04  3:16 ` Kuninori Morimoto
2015-12-04  3:17 ` [PATCH 1/4] thermal: rcar: move rcar_thermal_dt_ids to upside Kuninori Morimoto
2015-12-04  3:17   ` Kuninori Morimoto
2015-12-04  3:17   ` Kuninori Morimoto
2015-12-04  3:17 ` [PATCH 2/4] thermal: rcar: enable to use thermal-zone on DT Kuninori Morimoto
2015-12-04  3:17   ` Kuninori Morimoto
2015-12-04  3:17   ` Kuninori Morimoto
2015-12-04  6:21   ` Manish Badarkhe
2015-12-04  6:33     ` Manish Badarkhe
2015-12-04  7:07     ` Kuninori Morimoto
2015-12-04  7:07       ` Kuninori Morimoto
2015-12-04  7:07       ` Kuninori Morimoto
2015-12-04  8:32   ` Geert Uytterhoeven
2015-12-04  8:32     ` Geert Uytterhoeven
     [not found]     ` <CAMuHMdUcQFcQuEmQZ4yMGwm=ouH+aQQhG3V95p=Pb56qWberQA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-04  8:34       ` Geert Uytterhoeven
2015-12-04  8:34         ` Geert Uytterhoeven
2015-12-04  8:34         ` Geert Uytterhoeven
2015-12-04  3:18 ` [PATCH 3/4] ARM: shmobile: r8a7790: enable to use thermal-zone Kuninori Morimoto
2015-12-04  3:18   ` Kuninori Morimoto
2015-12-04  3:18   ` Kuninori Morimoto
2015-12-07  6:34   ` Simon Horman
2015-12-07  6:34     ` Simon Horman
2015-12-04  3:18 ` [PATCH 4/4] ARM: shmobile: r8a7791: " Kuninori Morimoto
2015-12-04  3:18   ` Kuninori Morimoto
2015-12-04  3:18   ` Kuninori Morimoto

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.