From: Navneet Kumar <navneetk@nvidia.com>
To: <rui.zhang@intel.com>, <edubezval@gmail.com>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
navneet kumar <navneetk@nvidia.com>,
Diwakar Tundlam <dtundlam@nvidia.com>
Subject: [PATCH 1/3] thermal: of: support writable trips via dt
Date: Wed, 26 Nov 2014 17:16:27 -0800 [thread overview]
Message-ID: <1417050989-25405-1-git-send-email-navneetk@nvidia.com> (raw)
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
next reply other threads:[~2014-11-27 1:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-27 1:16 Navneet Kumar [this message]
2014-11-27 1:16 ` [PATCH 2/3] thermal: of: consolidate sensor callbacks as ops Navneet Kumar
2014-11-27 14:28 ` Eduardo Valentin
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 14:32 ` Eduardo Valentin
2014-12-01 20:45 ` navneet kumar
2014-12-01 21:23 ` Eduardo Valentin
2014-12-01 22:35 ` navneet kumar
2014-11-27 14:21 ` [PATCH 1/3] thermal: of: support writable trips via dt Eduardo Valentin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1417050989-25405-1-git-send-email-navneetk@nvidia.com \
--to=navneetk@nvidia.com \
--cc=dtundlam@nvidia.com \
--cc=edubezval@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is 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).