diff options
-rw-r--r-- | Documentation/thermal/sysfs-api.txt | 4 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 9 | ||||
-rw-r--r-- | drivers/platform/x86/acerhdf.c | 3 | ||||
-rw-r--r-- | drivers/thermal/db8500_thermal.c | 2 | ||||
-rw-r--r-- | drivers/thermal/fair_share.c | 2 | ||||
-rw-r--r-- | drivers/thermal/imx_thermal.c | 3 | ||||
-rw-r--r-- | drivers/thermal/of-thermal.c | 5 | ||||
-rw-r--r-- | drivers/thermal/thermal_core.c | 22 | ||||
-rw-r--r-- | drivers/thermal/thermal_core.h | 1 | ||||
-rw-r--r-- | drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 3 | ||||
-rw-r--r-- | include/linux/thermal.h | 6 |
11 files changed, 42 insertions, 18 deletions
diff --git a/Documentation/thermal/sysfs-api.txt b/Documentation/thermal/sysfs-api.txt index 87519cb379ee..7ec632ed9769 100644 --- a/Documentation/thermal/sysfs-api.txt +++ b/Documentation/thermal/sysfs-api.txt | |||
@@ -95,7 +95,7 @@ temperature) and throttle appropriate devices. | |||
95 | 1.3 interface for binding a thermal zone device with a thermal cooling device | 95 | 1.3 interface for binding a thermal zone device with a thermal cooling device |
96 | 1.3.1 int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, | 96 | 1.3.1 int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, |
97 | int trip, struct thermal_cooling_device *cdev, | 97 | int trip, struct thermal_cooling_device *cdev, |
98 | unsigned long upper, unsigned long lower); | 98 | unsigned long upper, unsigned long lower, unsigned int weight); |
99 | 99 | ||
100 | This interface function bind a thermal cooling device to the certain trip | 100 | This interface function bind a thermal cooling device to the certain trip |
101 | point of a thermal zone device. | 101 | point of a thermal zone device. |
@@ -110,6 +110,8 @@ temperature) and throttle appropriate devices. | |||
110 | lower:the Minimum cooling state can be used for this trip point. | 110 | lower:the Minimum cooling state can be used for this trip point. |
111 | THERMAL_NO_LIMIT means no lower limit, | 111 | THERMAL_NO_LIMIT means no lower limit, |
112 | and the cooling device can be in cooling state 0. | 112 | and the cooling device can be in cooling state 0. |
113 | weight: the influence of this cooling device in this thermal | ||
114 | zone. See 1.4.1 below for more information. | ||
113 | 115 | ||
114 | 1.3.2 int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, | 116 | 1.3.2 int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, |
115 | int trip, struct thermal_cooling_device *cdev); | 117 | int trip, struct thermal_cooling_device *cdev); |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index d24fa1964eb8..6d4e44ea74ac 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -800,7 +800,8 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, | |||
800 | result = | 800 | result = |
801 | thermal_zone_bind_cooling_device | 801 | thermal_zone_bind_cooling_device |
802 | (thermal, trip, cdev, | 802 | (thermal, trip, cdev, |
803 | THERMAL_NO_LIMIT, THERMAL_NO_LIMIT); | 803 | THERMAL_NO_LIMIT, THERMAL_NO_LIMIT, |
804 | THERMAL_WEIGHT_DEFAULT); | ||
804 | else | 805 | else |
805 | result = | 806 | result = |
806 | thermal_zone_unbind_cooling_device | 807 | thermal_zone_unbind_cooling_device |
@@ -824,7 +825,8 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, | |||
824 | if (bind) | 825 | if (bind) |
825 | result = thermal_zone_bind_cooling_device | 826 | result = thermal_zone_bind_cooling_device |
826 | (thermal, trip, cdev, | 827 | (thermal, trip, cdev, |
827 | THERMAL_NO_LIMIT, THERMAL_NO_LIMIT); | 828 | THERMAL_NO_LIMIT, THERMAL_NO_LIMIT, |
829 | THERMAL_WEIGHT_DEFAULT); | ||
828 | else | 830 | else |
829 | result = thermal_zone_unbind_cooling_device | 831 | result = thermal_zone_unbind_cooling_device |
830 | (thermal, trip, cdev); | 832 | (thermal, trip, cdev); |
@@ -841,7 +843,8 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, | |||
841 | result = thermal_zone_bind_cooling_device | 843 | result = thermal_zone_bind_cooling_device |
842 | (thermal, THERMAL_TRIPS_NONE, | 844 | (thermal, THERMAL_TRIPS_NONE, |
843 | cdev, THERMAL_NO_LIMIT, | 845 | cdev, THERMAL_NO_LIMIT, |
844 | THERMAL_NO_LIMIT); | 846 | THERMAL_NO_LIMIT, |
847 | THERMAL_WEIGHT_DEFAULT); | ||
845 | else | 848 | else |
846 | result = thermal_zone_unbind_cooling_device | 849 | result = thermal_zone_unbind_cooling_device |
847 | (thermal, THERMAL_TRIPS_NONE, | 850 | (thermal, THERMAL_TRIPS_NONE, |
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 594c918b553d..1ef02daddb60 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c | |||
@@ -372,7 +372,8 @@ static int acerhdf_bind(struct thermal_zone_device *thermal, | |||
372 | return 0; | 372 | return 0; |
373 | 373 | ||
374 | if (thermal_zone_bind_cooling_device(thermal, 0, cdev, | 374 | if (thermal_zone_bind_cooling_device(thermal, 0, cdev, |
375 | THERMAL_NO_LIMIT, THERMAL_NO_LIMIT)) { | 375 | THERMAL_NO_LIMIT, THERMAL_NO_LIMIT, |
376 | THERMAL_WEIGHT_DEFAULT)) { | ||
376 | pr_err("error binding cooling dev\n"); | 377 | pr_err("error binding cooling dev\n"); |
377 | return -EINVAL; | 378 | return -EINVAL; |
378 | } | 379 | } |
diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c index 20adfbe27df1..2fb273c4baa9 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c | |||
@@ -76,7 +76,7 @@ static int db8500_cdev_bind(struct thermal_zone_device *thermal, | |||
76 | upper = lower = i > max_state ? max_state : i; | 76 | upper = lower = i > max_state ? max_state : i; |
77 | 77 | ||
78 | ret = thermal_zone_bind_cooling_device(thermal, i, cdev, | 78 | ret = thermal_zone_bind_cooling_device(thermal, i, cdev, |
79 | upper, lower); | 79 | upper, lower, THERMAL_WEIGHT_DEFAULT); |
80 | 80 | ||
81 | dev_info(&cdev->device, "%s bind to %d: %d-%s\n", cdev->type, | 81 | dev_info(&cdev->device, "%s bind to %d: %d-%s\n", cdev->type, |
82 | i, ret, ret ? "fail" : "succeed"); | 82 | i, ret, ret ? "fail" : "succeed"); |
diff --git a/drivers/thermal/fair_share.c b/drivers/thermal/fair_share.c index 6e0a3fbfae86..c3b25187b467 100644 --- a/drivers/thermal/fair_share.c +++ b/drivers/thermal/fair_share.c | |||
@@ -109,7 +109,7 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip) | |||
109 | continue; | 109 | continue; |
110 | 110 | ||
111 | instance->target = get_target_state(tz, cdev, | 111 | instance->target = get_target_state(tz, cdev, |
112 | tzp->tbp[i].weight, cur_trip_level); | 112 | instance->weight, cur_trip_level); |
113 | 113 | ||
114 | instance->cdev->updated = false; | 114 | instance->cdev->updated = false; |
115 | thermal_cdev_update(cdev); | 115 | thermal_cdev_update(cdev); |
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 2ccbc0788353..fde4c2876d14 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c | |||
@@ -306,7 +306,8 @@ static int imx_bind(struct thermal_zone_device *tz, | |||
306 | 306 | ||
307 | ret = thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev, | 307 | ret = thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev, |
308 | THERMAL_NO_LIMIT, | 308 | THERMAL_NO_LIMIT, |
309 | THERMAL_NO_LIMIT); | 309 | THERMAL_NO_LIMIT, |
310 | THERMAL_WEIGHT_DEFAULT); | ||
310 | if (ret) { | 311 | if (ret) { |
311 | dev_err(&tz->device, | 312 | dev_err(&tz->device, |
312 | "binding zone %s with cdev %s failed:%d\n", | 313 | "binding zone %s with cdev %s failed:%d\n", |
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 668fb1bdea9e..c606b85ea9f4 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c | |||
@@ -227,7 +227,8 @@ static int of_thermal_bind(struct thermal_zone_device *thermal, | |||
227 | ret = thermal_zone_bind_cooling_device(thermal, | 227 | ret = thermal_zone_bind_cooling_device(thermal, |
228 | tbp->trip_id, cdev, | 228 | tbp->trip_id, cdev, |
229 | tbp->max, | 229 | tbp->max, |
230 | tbp->min); | 230 | tbp->min, |
231 | tbp->usage); | ||
231 | if (ret) | 232 | if (ret) |
232 | return ret; | 233 | return ret; |
233 | } | 234 | } |
@@ -581,7 +582,7 @@ static int thermal_of_populate_bind_params(struct device_node *np, | |||
581 | u32 prop; | 582 | u32 prop; |
582 | 583 | ||
583 | /* Default weight. Usage is optional */ | 584 | /* Default weight. Usage is optional */ |
584 | __tbp->usage = 0; | 585 | __tbp->usage = THERMAL_WEIGHT_DEFAULT; |
585 | ret = of_property_read_u32(np, "contribution", &prop); | 586 | ret = of_property_read_u32(np, "contribution", &prop); |
586 | if (ret == 0) | 587 | if (ret == 0) |
587 | __tbp->usage = prop; | 588 | __tbp->usage = prop; |
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 4108db7e10c1..a6cb9b78b629 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c | |||
@@ -218,7 +218,8 @@ static void print_bind_err_msg(struct thermal_zone_device *tz, | |||
218 | 218 | ||
219 | static void __bind(struct thermal_zone_device *tz, int mask, | 219 | static void __bind(struct thermal_zone_device *tz, int mask, |
220 | struct thermal_cooling_device *cdev, | 220 | struct thermal_cooling_device *cdev, |
221 | unsigned long *limits) | 221 | unsigned long *limits, |
222 | unsigned int weight) | ||
222 | { | 223 | { |
223 | int i, ret; | 224 | int i, ret; |
224 | 225 | ||
@@ -233,7 +234,8 @@ static void __bind(struct thermal_zone_device *tz, int mask, | |||
233 | upper = limits[i * 2 + 1]; | 234 | upper = limits[i * 2 + 1]; |
234 | } | 235 | } |
235 | ret = thermal_zone_bind_cooling_device(tz, i, cdev, | 236 | ret = thermal_zone_bind_cooling_device(tz, i, cdev, |
236 | upper, lower); | 237 | upper, lower, |
238 | weight); | ||
237 | if (ret) | 239 | if (ret) |
238 | print_bind_err_msg(tz, cdev, ret); | 240 | print_bind_err_msg(tz, cdev, ret); |
239 | } | 241 | } |
@@ -280,7 +282,8 @@ static void bind_cdev(struct thermal_cooling_device *cdev) | |||
280 | continue; | 282 | continue; |
281 | tzp->tbp[i].cdev = cdev; | 283 | tzp->tbp[i].cdev = cdev; |
282 | __bind(pos, tzp->tbp[i].trip_mask, cdev, | 284 | __bind(pos, tzp->tbp[i].trip_mask, cdev, |
283 | tzp->tbp[i].binding_limits); | 285 | tzp->tbp[i].binding_limits, |
286 | tzp->tbp[i].weight); | ||
284 | } | 287 | } |
285 | } | 288 | } |
286 | 289 | ||
@@ -319,7 +322,8 @@ static void bind_tz(struct thermal_zone_device *tz) | |||
319 | continue; | 322 | continue; |
320 | tzp->tbp[i].cdev = pos; | 323 | tzp->tbp[i].cdev = pos; |
321 | __bind(tz, tzp->tbp[i].trip_mask, pos, | 324 | __bind(tz, tzp->tbp[i].trip_mask, pos, |
322 | tzp->tbp[i].binding_limits); | 325 | tzp->tbp[i].binding_limits, |
326 | tzp->tbp[i].weight); | ||
323 | } | 327 | } |
324 | } | 328 | } |
325 | exit: | 329 | exit: |
@@ -713,7 +717,8 @@ passive_store(struct device *dev, struct device_attribute *attr, | |||
713 | thermal_zone_bind_cooling_device(tz, | 717 | thermal_zone_bind_cooling_device(tz, |
714 | THERMAL_TRIPS_NONE, cdev, | 718 | THERMAL_TRIPS_NONE, cdev, |
715 | THERMAL_NO_LIMIT, | 719 | THERMAL_NO_LIMIT, |
716 | THERMAL_NO_LIMIT); | 720 | THERMAL_NO_LIMIT, |
721 | THERMAL_WEIGHT_DEFAULT); | ||
717 | } | 722 | } |
718 | mutex_unlock(&thermal_list_lock); | 723 | mutex_unlock(&thermal_list_lock); |
719 | if (!tz->passive_delay) | 724 | if (!tz->passive_delay) |
@@ -931,6 +936,9 @@ static const struct attribute_group *cooling_device_attr_groups[] = { | |||
931 | * @lower: the Minimum cooling state can be used for this trip point. | 936 | * @lower: the Minimum cooling state can be used for this trip point. |
932 | * THERMAL_NO_LIMIT means no lower limit, | 937 | * THERMAL_NO_LIMIT means no lower limit, |
933 | * and the cooling device can be in cooling state 0. | 938 | * and the cooling device can be in cooling state 0. |
939 | * @weight: The weight of the cooling device to be bound to the | ||
940 | * thermal zone. Use THERMAL_WEIGHT_DEFAULT for the | ||
941 | * default value | ||
934 | * | 942 | * |
935 | * This interface function bind a thermal cooling device to the certain trip | 943 | * This interface function bind a thermal cooling device to the certain trip |
936 | * point of a thermal zone device. | 944 | * point of a thermal zone device. |
@@ -941,7 +949,8 @@ static const struct attribute_group *cooling_device_attr_groups[] = { | |||
941 | int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, | 949 | int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, |
942 | int trip, | 950 | int trip, |
943 | struct thermal_cooling_device *cdev, | 951 | struct thermal_cooling_device *cdev, |
944 | unsigned long upper, unsigned long lower) | 952 | unsigned long upper, unsigned long lower, |
953 | unsigned int weight) | ||
945 | { | 954 | { |
946 | struct thermal_instance *dev; | 955 | struct thermal_instance *dev; |
947 | struct thermal_instance *pos; | 956 | struct thermal_instance *pos; |
@@ -986,6 +995,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, | |||
986 | dev->upper = upper; | 995 | dev->upper = upper; |
987 | dev->lower = lower; | 996 | dev->lower = lower; |
988 | dev->target = THERMAL_NO_TARGET; | 997 | dev->target = THERMAL_NO_TARGET; |
998 | dev->weight = weight; | ||
989 | 999 | ||
990 | result = get_idr(&tz->idr, &tz->lock, &dev->id); | 1000 | result = get_idr(&tz->idr, &tz->lock, &dev->id); |
991 | if (result) | 1001 | if (result) |
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 0531c752fbbb..7a465e9d456c 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h | |||
@@ -48,6 +48,7 @@ struct thermal_instance { | |||
48 | struct device_attribute attr; | 48 | struct device_attribute attr; |
49 | struct list_head tz_node; /* node in tz->thermal_instances */ | 49 | struct list_head tz_node; /* node in tz->thermal_instances */ |
50 | struct list_head cdev_node; /* node in cdev->thermal_instances */ | 50 | struct list_head cdev_node; /* node in cdev->thermal_instances */ |
51 | unsigned int weight; /* The weight of the cooling device */ | ||
51 | }; | 52 | }; |
52 | 53 | ||
53 | int thermal_register_governor(struct thermal_governor *); | 54 | int thermal_register_governor(struct thermal_governor *); |
diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c index a38c1756442a..cb45e729adb5 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c | |||
@@ -146,7 +146,8 @@ static int ti_thermal_bind(struct thermal_zone_device *thermal, | |||
146 | return thermal_zone_bind_cooling_device(thermal, 0, cdev, | 146 | return thermal_zone_bind_cooling_device(thermal, 0, cdev, |
147 | /* bind with min and max states defined by cpu_cooling */ | 147 | /* bind with min and max states defined by cpu_cooling */ |
148 | THERMAL_NO_LIMIT, | 148 | THERMAL_NO_LIMIT, |
149 | THERMAL_NO_LIMIT); | 149 | THERMAL_NO_LIMIT, |
150 | THERMAL_WEIGHT_DEFAULT); | ||
150 | } | 151 | } |
151 | 152 | ||
152 | /* Unbind callback functions for thermal zone */ | 153 | /* Unbind callback functions for thermal zone */ |
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 5eac316490ea..00dacd4dfdce 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -40,6 +40,9 @@ | |||
40 | /* No upper/lower limit requirement */ | 40 | /* No upper/lower limit requirement */ |
41 | #define THERMAL_NO_LIMIT ((u32)~0) | 41 | #define THERMAL_NO_LIMIT ((u32)~0) |
42 | 42 | ||
43 | /* Default weight of a bound cooling device */ | ||
44 | #define THERMAL_WEIGHT_DEFAULT 0 | ||
45 | |||
43 | /* Unit conversion macros */ | 46 | /* Unit conversion macros */ |
44 | #define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ | 47 | #define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \ |
45 | ((long)t-2732+5)/10 : ((long)t-2732-5)/10) | 48 | ((long)t-2732+5)/10 : ((long)t-2732-5)/10) |
@@ -323,7 +326,8 @@ void thermal_zone_device_unregister(struct thermal_zone_device *); | |||
323 | 326 | ||
324 | int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, | 327 | int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, |
325 | struct thermal_cooling_device *, | 328 | struct thermal_cooling_device *, |
326 | unsigned long, unsigned long); | 329 | unsigned long, unsigned long, |
330 | unsigned int); | ||
327 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, | 331 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, |
328 | struct thermal_cooling_device *); | 332 | struct thermal_cooling_device *); |
329 | void thermal_zone_device_update(struct thermal_zone_device *); | 333 | void thermal_zone_device_update(struct thermal_zone_device *); |