* [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1
@ 2015-12-08 5:26 Kuninori Morimoto
2015-12-08 5:27 ` [PATCH 1/8 v4] thermal: rcar: move rcar_thermal_dt_ids to upside Kuninori Morimoto
` (8 more replies)
0 siblings, 9 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2015-12-08 5:26 UTC (permalink / raw)
To: Simon, Zhang Rui, Eduardo Valentin, Geert Uytterhoeven
Cc: Magnus, linux-sh-u79uwXL29TY76Z2rM5mHXA,
linux-pm-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/8 v4] thermal: rcar: move rcar_thermal_dt_ids to upside
2015-12-08 5:26 [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto
@ 2015-12-08 5:27 ` Kuninori Morimoto
2015-12-08 5:27 ` [PATCH 2/8 v4] thermal: rcar: check every rcar_thermal_update_temp() return value Kuninori Morimoto
` (7 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2015-12-08 5:27 UTC (permalink / raw)
To: Simon, Zhang Rui, Eduardo Valentin
Cc: Geert Uytterhoeven, Magnus, linux-sh, linux-pm, linux-kernel,
devicetree@vger.kernel.org
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>
---
v3 -> v4
- no change
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 5d4ae7d..ac8d1eb 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
*/
@@ -491,12 +497,6 @@ static int rcar_thermal_remove(struct platform_device *pdev)
return 0;
}
-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] 16+ messages in thread
* [PATCH 2/8 v4] thermal: rcar: check every rcar_thermal_update_temp() return value
2015-12-08 5:26 [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto
2015-12-08 5:27 ` [PATCH 1/8 v4] thermal: rcar: move rcar_thermal_dt_ids to upside Kuninori Morimoto
@ 2015-12-08 5:27 ` Kuninori Morimoto
2015-12-08 5:27 ` [PATCH 3/8 v4] thermal: rcar: check irq possibility in rcar_thermal_irq_xxx() Kuninori Morimoto
` (6 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2015-12-08 5:27 UTC (permalink / raw)
To: Simon, Zhang Rui, Eduardo Valentin
Cc: Geert Uytterhoeven, Magnus, linux-sh, linux-pm, linux-kernel,
devicetree@vger.kernel.org
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v3 -> v4
- add 1line between int <-> return
drivers/thermal/rcar_thermal.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index ac8d1eb..a1a93f3 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -210,8 +210,12 @@ static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
{
struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
- if (!rcar_has_irq_support(priv) || rcar_force_update_temp(priv))
- rcar_thermal_update_temp(priv);
+ if (!rcar_has_irq_support(priv) || rcar_force_update_temp(priv)) {
+ int ret = rcar_thermal_update_temp(priv);
+
+ if (ret < 0)
+ return ret;
+ }
mutex_lock(&priv->lock);
*temp = MCELSIUS((priv->ctemp * 5) - 65);
@@ -305,11 +309,15 @@ static void rcar_thermal_work(struct work_struct *work)
{
struct rcar_thermal_priv *priv;
int cctemp, nctemp;
+ int ret;
priv = container_of(work, struct rcar_thermal_priv, work.work);
rcar_thermal_get_temp(priv->zone, &cctemp);
- rcar_thermal_update_temp(priv);
+ ret = rcar_thermal_update_temp(priv);
+ if (ret < 0)
+ return;
+
rcar_thermal_irq_enable(priv);
rcar_thermal_get_temp(priv->zone, &nctemp);
@@ -427,7 +435,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
mutex_init(&priv->lock);
INIT_LIST_HEAD(&priv->list);
INIT_DELAYED_WORK(&priv->work, rcar_thermal_work);
- rcar_thermal_update_temp(priv);
+ ret = rcar_thermal_update_temp(priv);
+ if (ret < 0)
+ goto error_unregister;
priv->zone = thermal_zone_device_register("rcar_thermal",
1, 0, priv,
--
1.9.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/8 v4] thermal: rcar: check irq possibility in rcar_thermal_irq_xxx()
2015-12-08 5:26 [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto
2015-12-08 5:27 ` [PATCH 1/8 v4] thermal: rcar: move rcar_thermal_dt_ids to upside Kuninori Morimoto
2015-12-08 5:27 ` [PATCH 2/8 v4] thermal: rcar: check every rcar_thermal_update_temp() return value Kuninori Morimoto
@ 2015-12-08 5:27 ` Kuninori Morimoto
2015-12-08 5:28 ` [PATCH 4/8 v4] thermal: rcar: retern error rcar_thermal_get_temp() if no ctemp update Kuninori Morimoto
` (5 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2015-12-08 5:27 UTC (permalink / raw)
To: Simon, Zhang Rui, Eduardo Valentin
Cc: Geert Uytterhoeven, Magnus, linux-sh, linux-pm, linux-kernel,
devicetree@vger.kernel.org
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Current rcar thermal driver sometimes checks irq possibility when it
calls rcar_thermal_irq_enable/disable(), but sometimes not.
This patch checks it inside rcar_thermal_irq_enable/disable().
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v3 -> v4
- no change
drivers/thermal/rcar_thermal.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index a1a93f3..67b5216 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -298,6 +298,9 @@ static void _rcar_thermal_irq_ctrl(struct rcar_thermal_priv *priv, int enable)
unsigned long flags;
u32 mask = 0x3 << rcar_id_to_shift(priv); /* enable Rising/Falling */
+ if (!rcar_has_irq_support(priv))
+ return;
+
spin_lock_irqsave(&common->lock, flags);
rcar_thermal_common_bset(common, INTMSK, mask, enable ? 0 : mask);
@@ -449,8 +452,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
goto error_unregister;
}
- if (rcar_has_irq_support(priv))
- rcar_thermal_irq_enable(priv);
+ rcar_thermal_irq_enable(priv);
list_move_tail(&priv->list, &common->head);
@@ -496,8 +498,7 @@ static int rcar_thermal_remove(struct platform_device *pdev)
struct rcar_thermal_priv *priv;
rcar_thermal_for_each_priv(priv, common) {
- if (rcar_has_irq_support(priv))
- rcar_thermal_irq_disable(priv);
+ rcar_thermal_irq_disable(priv);
thermal_zone_device_unregister(priv->zone);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 4/8 v4] thermal: rcar: retern error rcar_thermal_get_temp() if no ctemp update
2015-12-08 5:26 [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto
` (2 preceding siblings ...)
2015-12-08 5:27 ` [PATCH 3/8 v4] thermal: rcar: check irq possibility in rcar_thermal_irq_xxx() Kuninori Morimoto
@ 2015-12-08 5:28 ` Kuninori Morimoto
2015-12-14 21:20 ` Eduardo Valentin
2015-12-08 5:28 ` [PATCH 5/8 v4] thermal: rcar: enable to use thermal-zone on DT Kuninori Morimoto
` (4 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Kuninori Morimoto @ 2015-12-08 5:28 UTC (permalink / raw)
To: Simon, Zhang Rui, Eduardo Valentin
Cc: Geert Uytterhoeven, Magnus, linux-sh, linux-pm, linux-kernel,
devicetree@vger.kernel.org
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Current rcar_thermal_get_temp() returns latest temperature, but it might
not be updated if some HW issue happened. This means user might get
wrong temperature. This patch solved this issue.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v3 -> v4
- "happend" -> "happened"
drivers/thermal/rcar_thermal.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 67b5216..40c3ba5 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -199,9 +199,9 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp);
- priv->ctemp = ctemp;
ret = 0;
err_out_unlock:
+ priv->ctemp = ctemp;
mutex_unlock(&priv->lock);
return ret;
}
@@ -209,6 +209,7 @@ err_out_unlock:
static int rcar_thermal_get_temp(struct thermal_zone_device *zone, 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)) {
int ret = rcar_thermal_update_temp(priv);
@@ -218,9 +219,18 @@ static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
}
mutex_lock(&priv->lock);
- *temp = MCELSIUS((priv->ctemp * 5) - 65);
+ tmp = MCELSIUS((priv->ctemp * 5) - 65);
mutex_unlock(&priv->lock);
+ if ((tmp < MCELSIUS(-45)) || (tmp > MCELSIUS(125))) {
+ struct device *dev = rcar_priv_to_dev(priv);
+
+ dev_err(dev, "it couldn't measure temperature correctly\n");
+ return -EIO;
+ }
+
+ *temp = tmp;
+
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 5/8 v4] thermal: rcar: enable to use thermal-zone on DT
2015-12-08 5:26 [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto
` (3 preceding siblings ...)
2015-12-08 5:28 ` [PATCH 4/8 v4] thermal: rcar: retern error rcar_thermal_get_temp() if no ctemp update Kuninori Morimoto
@ 2015-12-08 5:28 ` Kuninori Morimoto
2015-12-08 6:03 ` Khiem Nguyen
2015-12-08 5:29 ` [PATCH 6/8 v4] ARM: shmobile: r8a7790: enable to use thermal-zone Kuninori Morimoto
` (3 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Kuninori Morimoto @ 2015-12-08 5:28 UTC (permalink / raw)
To: Simon, Zhang Rui, Eduardo Valentin
Cc: Geert Uytterhoeven, Magnus, linux-sh, linux-pm, linux-kernel,
devicetree@vger.kernel.org
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>;
+ 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);
--
1.9.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 6/8 v4] ARM: shmobile: r8a7790: enable to use thermal-zone
2015-12-08 5:26 [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto
` (4 preceding siblings ...)
2015-12-08 5:28 ` [PATCH 5/8 v4] thermal: rcar: enable to use thermal-zone on DT Kuninori Morimoto
@ 2015-12-08 5:29 ` Kuninori Morimoto
2015-12-08 5:29 ` [PATCH 7/8 v4] ARM: shmobile: r8a7791: " Kuninori Morimoto
` (2 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2015-12-08 5:29 UTC (permalink / raw)
To: Simon, Zhang Rui, Eduardo Valentin
Cc: Geert Uytterhoeven, Magnus, linux-sh, linux-pm, linux-kernel,
devicetree@vger.kernel.org
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 modifying 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 reaches to the value.
echo $temp > /sys/class/thermal/thermal_zone0/trip_point_0_temp
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v3 -> v4
- modifing -> modifying
- reached -> reaches
- <1150000> -> <115000>
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 9f3036b..2203b97 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 = <115000>;
+ 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-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>;
};
timer {
--
1.9.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 7/8 v4] ARM: shmobile: r8a7791: enable to use thermal-zone
2015-12-08 5:26 [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto
` (5 preceding siblings ...)
2015-12-08 5:29 ` [PATCH 6/8 v4] ARM: shmobile: r8a7790: enable to use thermal-zone Kuninori Morimoto
@ 2015-12-08 5:29 ` Kuninori Morimoto
2015-12-08 5:30 ` [PATCH 8/8 v4] thermal: of-thermal: of_thermal_set_trip_temp() call thermal_zone_device_update() Kuninori Morimoto
2015-12-10 4:57 ` [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Simon Horman
8 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2015-12-08 5:29 UTC (permalink / raw)
To: Simon, Zhang Rui, Eduardo Valentin
Cc: Geert Uytterhoeven, Magnus, linux-sh, linux-pm, linux-kernel,
devicetree@vger.kernel.org
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 modifying 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 reaches to the value.
echo $temp > /sys/class/thermal/thermal_zone0/trip_point_0_temp
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v3 -> v4
- modifing -> modifying
- reached -> reaches
- <1150000> -> <115000>
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 3776974..9b37c80 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 = <115000>;
+ 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-gen2-thermal",
+ "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] 16+ messages in thread
* [PATCH 8/8 v4] thermal: of-thermal: of_thermal_set_trip_temp() call thermal_zone_device_update()
2015-12-08 5:26 [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto
` (6 preceding siblings ...)
2015-12-08 5:29 ` [PATCH 7/8 v4] ARM: shmobile: r8a7791: " Kuninori Morimoto
@ 2015-12-08 5:30 ` Kuninori Morimoto
2015-12-14 21:11 ` Eduardo Valentin
2015-12-10 4:57 ` [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Simon Horman
8 siblings, 1 reply; 16+ messages in thread
From: Kuninori Morimoto @ 2015-12-08 5:30 UTC (permalink / raw)
To: Simon, Zhang Rui, Eduardo Valentin
Cc: Geert Uytterhoeven, Magnus, linux-sh, linux-pm, linux-kernel,
devicetree@vger.kernel.org
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
of_thermal_set_trip_temp() updates trip temperature. It should call
thermal_zone_device_update() immediately.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v3 -> v4
- no change
drivers/thermal/of-thermal.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index 42b7d42..a1dd7b1 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -334,6 +334,8 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
/* thermal framework should take care of data->mask & (1 << trip) */
data->trips[trip].temperature = temp;
+ thermal_zone_device_update(tz);
+
return 0;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 5/8 v4] thermal: rcar: enable to use thermal-zone on DT
2015-12-08 5:28 ` [PATCH 5/8 v4] thermal: rcar: enable to use thermal-zone on DT Kuninori Morimoto
@ 2015-12-08 6:03 ` Khiem Nguyen
0 siblings, 0 replies; 16+ messages in thread
From: Khiem Nguyen @ 2015-12-08 6:03 UTC (permalink / raw)
To: Kuninori Morimoto
Cc: Simon, Zhang Rui, Eduardo Valentin, Geert Uytterhoeven, Magnus,
linux-sh@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Khiem Nguyen, Toru Oishi, Hien Duy. Dang
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);
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1
2015-12-08 5:26 [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto
` (7 preceding siblings ...)
2015-12-08 5:30 ` [PATCH 8/8 v4] thermal: of-thermal: of_thermal_set_trip_temp() call thermal_zone_device_update() Kuninori Morimoto
@ 2015-12-10 4:57 ` Simon Horman
8 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2015-12-10 4:57 UTC (permalink / raw)
To: Kuninori Morimoto
Cc: Zhang Rui, Eduardo Valentin, Geert Uytterhoeven, Magnus, linux-sh,
linux-pm, linux-kernel, devicetree@vger.kernel.org
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.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 8/8 v4] thermal: of-thermal: of_thermal_set_trip_temp() call thermal_zone_device_update()
2015-12-08 5:30 ` [PATCH 8/8 v4] thermal: of-thermal: of_thermal_set_trip_temp() call thermal_zone_device_update() Kuninori Morimoto
@ 2015-12-14 21:11 ` Eduardo Valentin
2015-12-15 0:20 ` Kuninori Morimoto
0 siblings, 1 reply; 16+ messages in thread
From: Eduardo Valentin @ 2015-12-14 21:11 UTC (permalink / raw)
To: Kuninori Morimoto
Cc: Simon, Zhang Rui, Geert Uytterhoeven, Magnus, linux-sh, linux-pm,
linux-kernel, devicetree@vger.kernel.org
Hey!
On Tue, Dec 08, 2015 at 05:30:00AM +0000, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> of_thermal_set_trip_temp() updates trip temperature. It should call
> thermal_zone_device_update() immediately.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v3 -> v4
>
> - no change
>
> drivers/thermal/of-thermal.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
> index 42b7d42..a1dd7b1 100644
> --- a/drivers/thermal/of-thermal.c
> +++ b/drivers/thermal/of-thermal.c
> @@ -334,6 +334,8 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
> /* thermal framework should take care of data->mask & (1 << trip) */
> data->trips[trip].temperature = temp;
>
> + thermal_zone_device_update(tz);
> +
Although I understand the need for this, I would prefer you move this change
to thermal_core.c. The reasoning is to keep the same behavior for
thermal zones created over of thermal and regular thermal zones.
BR,
> return 0;
> }
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/8 v4] thermal: rcar: retern error rcar_thermal_get_temp() if no ctemp update
2015-12-08 5:28 ` [PATCH 4/8 v4] thermal: rcar: retern error rcar_thermal_get_temp() if no ctemp update Kuninori Morimoto
@ 2015-12-14 21:20 ` Eduardo Valentin
2015-12-14 23:55 ` Kuninori Morimoto
2015-12-15 0:24 ` Kuninori Morimoto
0 siblings, 2 replies; 16+ messages in thread
From: Eduardo Valentin @ 2015-12-14 21:20 UTC (permalink / raw)
To: Kuninori Morimoto
Cc: Simon, Zhang Rui, Geert Uytterhoeven, Magnus, linux-sh, linux-pm,
linux-kernel, devicetree@vger.kernel.org
On Tue, Dec 08, 2015 at 05:28:13AM +0000, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> Current rcar_thermal_get_temp() returns latest temperature, but it might
> not be updated if some HW issue happened. This means user might get
> wrong temperature. This patch solved this issue.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v3 -> v4
>
> - "happend" -> "happened"
>
> drivers/thermal/rcar_thermal.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index 67b5216..40c3ba5 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -199,9 +199,9 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
>
> dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp);
>
> - priv->ctemp = ctemp;
> ret = 0;
> err_out_unlock:
> + priv->ctemp = ctemp;
> mutex_unlock(&priv->lock);
> return ret;
I believe the problem here is actually the lack of error
handling/propagation. Are you sure you want to write to parameter
in the fail path ?
rcar_thermal_update_temp already returns error code when it fails
to read temperature. Don't you think it would make more sense to fix the
places that call rcar_thermal_update_temp to properly handle its return
value and propagate that error code when necessary?
BR,
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/8 v4] thermal: rcar: retern error rcar_thermal_get_temp() if no ctemp update
2015-12-14 21:20 ` Eduardo Valentin
@ 2015-12-14 23:55 ` Kuninori Morimoto
2015-12-15 0:24 ` Kuninori Morimoto
1 sibling, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2015-12-14 23:55 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Simon, Zhang Rui, Geert Uytterhoeven, Magnus, linux-sh, linux-pm,
linux-kernel, devicetree@vger.kernel.org
Hi Eduardo
> > --- a/drivers/thermal/rcar_thermal.c
> > +++ b/drivers/thermal/rcar_thermal.c
> > @@ -199,9 +199,9 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
> >
> > dev_dbg(dev, "thermal%d %d -> %d\n", priv->id, priv->ctemp, ctemp);
> >
> > - priv->ctemp = ctemp;
> > ret = 0;
> > err_out_unlock:
> > + priv->ctemp = ctemp;
> > mutex_unlock(&priv->lock);
> > return ret;
>
> I believe the problem here is actually the lack of error
> handling/propagation. Are you sure you want to write to parameter
> in the fail path ?
>
> rcar_thermal_update_temp already returns error code when it fails
> to read temperature. Don't you think it would make more sense to fix the
> places that call rcar_thermal_update_temp to properly handle its return
> value and propagate that error code when necessary?
Thanks. But the logic is that
priv->ctemp will be 0 in error cases, and it will be reported as
dev_err() in rcar_thermal_get_current_temp()
The problem was that priv->ctemp will not be updated
in error case of rcar_thermal_update_temp().
but user can call get_temp (it doesn't call
rcar_thermal_update_temp() if interrupt was supported).
In such case, user will get old thermal.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 8/8 v4] thermal: of-thermal: of_thermal_set_trip_temp() call thermal_zone_device_update()
2015-12-14 21:11 ` Eduardo Valentin
@ 2015-12-15 0:20 ` Kuninori Morimoto
0 siblings, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2015-12-15 0:20 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Simon, Zhang Rui, Geert Uytterhoeven, Magnus, linux-sh, linux-pm,
linux-kernel, devicetree@vger.kernel.org
Hi Eduardo
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > of_thermal_set_trip_temp() updates trip temperature. It should call
> > thermal_zone_device_update() immediately.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> > v3 -> v4
> >
> > - no change
> >
> > drivers/thermal/of-thermal.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
> > index 42b7d42..a1dd7b1 100644
> > --- a/drivers/thermal/of-thermal.c
> > +++ b/drivers/thermal/of-thermal.c
> > @@ -334,6 +334,8 @@ static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip,
> > /* thermal framework should take care of data->mask & (1 << trip) */
> > data->trips[trip].temperature = temp;
> >
> > + thermal_zone_device_update(tz);
> > +
>
> Although I understand the need for this, I would prefer you move this change
> to thermal_core.c. The reasoning is to keep the same behavior for
> thermal zones created over of thermal and regular thermal zones.
Indeed. will do in v5
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/8 v4] thermal: rcar: retern error rcar_thermal_get_temp() if no ctemp update
2015-12-14 21:20 ` Eduardo Valentin
2015-12-14 23:55 ` Kuninori Morimoto
@ 2015-12-15 0:24 ` Kuninori Morimoto
1 sibling, 0 replies; 16+ messages in thread
From: Kuninori Morimoto @ 2015-12-15 0:24 UTC (permalink / raw)
To: Eduardo Valentin
Cc: Simon, Zhang Rui, Geert Uytterhoeven, Magnus, linux-sh, linux-pm,
linux-kernel, devicetree@vger.kernel.org
Hi Eduardo, again
> I believe the problem here is actually the lack of error
> handling/propagation. Are you sure you want to write to parameter
> in the fail path ?
>
> rcar_thermal_update_temp already returns error code when it fails
> to read temperature. Don't you think it would make more sense to fix the
> places that call rcar_thermal_update_temp to properly handle its return
> value and propagate that error code when necessary?
Will update in v5
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2015-12-15 0:24 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-08 5:26 [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Kuninori Morimoto
2015-12-08 5:27 ` [PATCH 1/8 v4] thermal: rcar: move rcar_thermal_dt_ids to upside Kuninori Morimoto
2015-12-08 5:27 ` [PATCH 2/8 v4] thermal: rcar: check every rcar_thermal_update_temp() return value Kuninori Morimoto
2015-12-08 5:27 ` [PATCH 3/8 v4] thermal: rcar: check irq possibility in rcar_thermal_irq_xxx() Kuninori Morimoto
2015-12-08 5:28 ` [PATCH 4/8 v4] thermal: rcar: retern error rcar_thermal_get_temp() if no ctemp update Kuninori Morimoto
2015-12-14 21:20 ` Eduardo Valentin
2015-12-14 23:55 ` Kuninori Morimoto
2015-12-15 0:24 ` Kuninori Morimoto
2015-12-08 5:28 ` [PATCH 5/8 v4] thermal: rcar: enable to use thermal-zone on DT Kuninori Morimoto
2015-12-08 6:03 ` Khiem Nguyen
2015-12-08 5:29 ` [PATCH 6/8 v4] ARM: shmobile: r8a7790: enable to use thermal-zone Kuninori Morimoto
2015-12-08 5:29 ` [PATCH 7/8 v4] ARM: shmobile: r8a7791: " Kuninori Morimoto
2015-12-08 5:30 ` [PATCH 8/8 v4] thermal: of-thermal: of_thermal_set_trip_temp() call thermal_zone_device_update() Kuninori Morimoto
2015-12-14 21:11 ` Eduardo Valentin
2015-12-15 0:20 ` Kuninori Morimoto
2015-12-10 4:57 ` [PATCH 0/8 v4] enable to use thermal-zone on r8a7790/1 Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).