diff options
author | Eduardo Valentin <eduardo.valentin@ti.com> | 2013-07-16 15:26:28 -0400 |
---|---|---|
committer | Eduardo Valentin <eduardo.valentin@ti.com> | 2013-09-03 09:10:24 -0400 |
commit | a8892d83894bcbd2717846cfa85955152b73453f (patch) | |
tree | ae71fac048786708759736daba4ca56dc3b0f73b /drivers/thermal | |
parent | ccba4ffd9eff6120a20cc7656458ac554aec4b0c (diff) |
thermal: thermal_core: allow binding with limits on bind_params
When registering a thermal zone device using platform information
via bind_params, the thermal framework will always perform the
cdev binding using the lowest and highest limits (THERMAL_NO_LIMIT).
This patch changes the data structures so that it is possible
to inform what are the desired limits for each trip point
inside a bind_param. The way the binding is performed is also
changed so that it uses the new data structure.
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/thermal_core.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 51648bfb248d..4962a6aaf295 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c | |||
@@ -202,14 +202,23 @@ static void print_bind_err_msg(struct thermal_zone_device *tz, | |||
202 | } | 202 | } |
203 | 203 | ||
204 | static void __bind(struct thermal_zone_device *tz, int mask, | 204 | static void __bind(struct thermal_zone_device *tz, int mask, |
205 | struct thermal_cooling_device *cdev) | 205 | struct thermal_cooling_device *cdev, |
206 | unsigned long *limits) | ||
206 | { | 207 | { |
207 | int i, ret; | 208 | int i, ret; |
208 | 209 | ||
209 | for (i = 0; i < tz->trips; i++) { | 210 | for (i = 0; i < tz->trips; i++) { |
210 | if (mask & (1 << i)) { | 211 | if (mask & (1 << i)) { |
212 | unsigned long upper, lower; | ||
213 | |||
214 | upper = THERMAL_NO_LIMIT; | ||
215 | lower = THERMAL_NO_LIMIT; | ||
216 | if (limits) { | ||
217 | lower = limits[i * 2]; | ||
218 | upper = limits[i * 2 + 1]; | ||
219 | } | ||
211 | ret = thermal_zone_bind_cooling_device(tz, i, cdev, | 220 | ret = thermal_zone_bind_cooling_device(tz, i, cdev, |
212 | THERMAL_NO_LIMIT, THERMAL_NO_LIMIT); | 221 | upper, lower); |
213 | if (ret) | 222 | if (ret) |
214 | print_bind_err_msg(tz, cdev, ret); | 223 | print_bind_err_msg(tz, cdev, ret); |
215 | } | 224 | } |
@@ -254,7 +263,8 @@ static void bind_cdev(struct thermal_cooling_device *cdev) | |||
254 | if (tzp->tbp[i].match(pos, cdev)) | 263 | if (tzp->tbp[i].match(pos, cdev)) |
255 | continue; | 264 | continue; |
256 | tzp->tbp[i].cdev = cdev; | 265 | tzp->tbp[i].cdev = cdev; |
257 | __bind(pos, tzp->tbp[i].trip_mask, cdev); | 266 | __bind(pos, tzp->tbp[i].trip_mask, cdev, |
267 | tzp->tbp[i].binding_limits); | ||
258 | } | 268 | } |
259 | } | 269 | } |
260 | 270 | ||
@@ -292,7 +302,8 @@ static void bind_tz(struct thermal_zone_device *tz) | |||
292 | if (tzp->tbp[i].match(tz, pos)) | 302 | if (tzp->tbp[i].match(tz, pos)) |
293 | continue; | 303 | continue; |
294 | tzp->tbp[i].cdev = pos; | 304 | tzp->tbp[i].cdev = pos; |
295 | __bind(tz, tzp->tbp[i].trip_mask, pos); | 305 | __bind(tz, tzp->tbp[i].trip_mask, pos, |
306 | tzp->tbp[i].binding_limits); | ||
296 | } | 307 | } |
297 | } | 308 | } |
298 | exit: | 309 | exit: |