All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] thermal: of: support writable trips via dt
@ 2014-11-27  1:16 ` Navneet Kumar
  0 siblings, 0 replies; 16+ messages in thread
From: Navneet Kumar @ 2014-11-27  1:16 UTC (permalink / raw)
  To: rui.zhang, edubezval
  Cc: linux-pm, linux-kernel, navneet kumar, Diwakar Tundlam

From: navneet kumar <navneetk@nvidia.com>

Support writable trip points configuration from the
device tree. 'OF' reads this configuration and adjusts
the 'trips' mask accordingly to allow the 'set_trip_xxx'
calls to be effective.

Signed-off-by: Diwakar Tundlam <dtundlam@nvidia.com>
---
 drivers/thermal/of-thermal.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index 62143ba31001..cf9ee3e82fee 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -604,7 +604,8 @@ static int thermal_of_get_trip_type(struct device_node *np,
  * Return: 0 on success, proper error code otherwise
  */
 static int thermal_of_populate_trip(struct device_node *np,
-				    struct __thermal_trip *trip)
+				    struct __thermal_trip *trip,
+				    bool *trip_writable)
 {
 	int prop;
 	int ret;
@@ -629,6 +630,8 @@ static int thermal_of_populate_trip(struct device_node *np,
 		return ret;
 	}
 
+	*trip_writable = of_property_read_bool(np, "writable");
+
 	/* Required for cooling map matching */
 	trip->np = np;
 	of_node_get(np);
@@ -657,6 +660,8 @@ thermal_of_build_thermal_zone(struct device_node *np)
 	struct __thermal_zone *tz;
 	int ret, i;
 	u32 prop;
+	bool trip_writable;
+	u64 m = 0;
 
 	if (!np) {
 		pr_err("no thermal zone np\n");
@@ -700,9 +705,14 @@ thermal_of_build_thermal_zone(struct device_node *np)
 
 	i = 0;
 	for_each_child_of_node(child, gchild) {
-		ret = thermal_of_populate_trip(gchild, &tz->trips[i++]);
+		trip_writable = false;
+		ret = thermal_of_populate_trip(gchild, &tz->trips[i],
+					       &trip_writable);
 		if (ret)
 			goto free_trips;
+		if (trip_writable)
+			m |= 1ULL << i;
+		i++;
 	}
 
 	of_node_put(child);
-- 
1.8.1.5


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

end of thread, other threads:[~2014-12-01 22:35 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-27  1:16 [PATCH 1/3] thermal: of: support writable trips via dt Navneet Kumar
2014-11-27  1:16 ` Navneet Kumar
2014-11-27  1:16 ` [PATCH 2/3] thermal: of: consolidate sensor callbacks as ops Navneet Kumar
2014-11-27  1:16   ` Navneet Kumar
2014-11-27 14:28   ` Eduardo Valentin
2014-12-01 19:29     ` navneet kumar
2014-12-01 19:29       ` navneet kumar
2014-11-27  1:16 ` [PATCH 3/3] thermal: of: notify sensor driver on trip updates Navneet Kumar
2014-11-27  1:16   ` Navneet Kumar
2014-11-27 14:32   ` Eduardo Valentin
2014-12-01 20:45     ` navneet kumar
2014-12-01 20:45       ` navneet kumar
2014-12-01 21:23       ` Eduardo Valentin
2014-12-01 22:35         ` navneet kumar
2014-12-01 22:35           ` navneet kumar
2014-11-27 14:21 ` [PATCH 1/3] thermal: of: support writable trips via dt Eduardo Valentin

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.