aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2008-02-07 16:55:08 -0500
committerLen Brown <len.brown@intel.com>2008-02-07 23:48:04 -0500
commit543a956140e1f57331c0e528d2367106057aeca0 (patch)
tree41cbe361027a982dc80c1e952a28152af6d89ce6
parent9f2eef25e044603527e121066284d22f51d853cc (diff)
ACPI: thermal: syntax, spelling, kernel-doc
Reviewed-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--Documentation/thermal/sysfs-api.txt23
-rw-r--r--drivers/thermal/Kconfig4
-rw-r--r--drivers/thermal/thermal.c49
3 files changed, 41 insertions, 35 deletions
diff --git a/Documentation/thermal/sysfs-api.txt b/Documentation/thermal/sysfs-api.txt
index 5776e090359d..ba9c2da5a8c2 100644
--- a/Documentation/thermal/sysfs-api.txt
+++ b/Documentation/thermal/sysfs-api.txt
@@ -14,7 +14,7 @@ The generic thermal sysfs provides a set of interfaces for thermal zone devices
14and thermal cooling devices (fan, processor...) to register with the thermal management 14and thermal cooling devices (fan, processor...) to register with the thermal management
15solution and to be a part of it. 15solution and to be a part of it.
16 16
17This how-to focusses on enabling new thermal zone and cooling devices to participate 17This how-to focuses on enabling new thermal zone and cooling devices to participate
18in thermal management. 18in thermal management.
19This solution is platform independent and any type of thermal zone devices and 19This solution is platform independent and any type of thermal zone devices and
20cooling devices should be able to make use of the infrastructure. 20cooling devices should be able to make use of the infrastructure.
@@ -41,9 +41,9 @@ and throttle appropriate devices.
41 name: the thermal zone name. 41 name: the thermal zone name.
42 trips: the total number of trip points this thermal zone supports. 42 trips: the total number of trip points this thermal zone supports.
43 devdata: device private data 43 devdata: device private data
44 ops: thermal zone device callbacks. 44 ops: thermal zone device call-backs.
45 .bind: bind the thermal zone device with a thermal cooling device. 45 .bind: bind the thermal zone device with a thermal cooling device.
46 .unbind: unbing the thermal zone device with a thermal cooling device. 46 .unbind: unbind the thermal zone device with a thermal cooling device.
47 .get_temp: get the current temperature of the thermal zone. 47 .get_temp: get the current temperature of the thermal zone.
48 .get_mode: get the current mode (user/kernel) of the thermal zone. 48 .get_mode: get the current mode (user/kernel) of the thermal zone.
49 "kernel" means thermal management is done in kernel. 49 "kernel" means thermal management is done in kernel.
@@ -69,7 +69,7 @@ and throttle appropriate devices.
69 It tries to bind itself to all the thermal zone devices register at the same time. 69 It tries to bind itself to all the thermal zone devices register at the same time.
70 name: the cooling device name. 70 name: the cooling device name.
71 devdata: device private data. 71 devdata: device private data.
72 ops: thermal cooling devices callbacks. 72 ops: thermal cooling devices call-backs.
73 .get_max_state: get the Maximum throttle state of the cooling device. 73 .get_max_state: get the Maximum throttle state of the cooling device.
74 .get_cur_state: get the Current throttle state of the cooling device. 74 .get_cur_state: get the Current throttle state of the cooling device.
75 .set_cur_state: set the Current throttle state of the cooling device. 75 .set_cur_state: set the Current throttle state of the cooling device.
@@ -109,7 +109,6 @@ RO read only value
109RW read/write value 109RW read/write value
110 110
111All thermal sysfs attributes will be represented under /sys/class/thermal 111All thermal sysfs attributes will be represented under /sys/class/thermal
112/sys/class/thermal/
113 112
114Thermal zone device sys I/F, created once it's registered: 113Thermal zone device sys I/F, created once it's registered:
115|thermal_zone[0-*]: 114|thermal_zone[0-*]:
@@ -129,7 +128,7 @@ Thermal cooling device sys I/F, created once it's registered:
129These two dynamic attributes are created/removed in pairs. 128These two dynamic attributes are created/removed in pairs.
130They represent the relationship between a thermal zone and its associated cooling device. 129They represent the relationship between a thermal zone and its associated cooling device.
131They are created/removed for each 130They are created/removed for each
132thermal_zone_bind_cooling_device/thermal_zone_unbind_cooling_device successful exection. 131thermal_zone_bind_cooling_device/thermal_zone_unbind_cooling_device successful execution.
133 132
134|thermal_zone[0-*] 133|thermal_zone[0-*]
135 |-----cdev[0-*]: The [0-*]th cooling device in the current thermal zone 134 |-----cdev[0-*]: The [0-*]th cooling device in the current thermal zone
@@ -147,11 +146,11 @@ type Strings which represent the thermal zone type.
147 Optional 146 Optional
148 147
149temp Current temperature as reported by thermal zone (sensor) 148temp Current temperature as reported by thermal zone (sensor)
150 Unit: degree celsius 149 Unit: degree Celsius
151 RO 150 RO
152 Required 151 Required
153 152
154mode One of the predifned values in [kernel, user] 153mode One of the predefined values in [kernel, user]
155 This file gives information about the algorithm 154 This file gives information about the algorithm
156 that is currently managing the thermal zone. 155 that is currently managing the thermal zone.
157 It can be either default kernel based algorithm 156 It can be either default kernel based algorithm
@@ -164,12 +163,12 @@ mode One of the predifned values in [kernel, user]
164 charge of the thermal management. 163 charge of the thermal management.
165 164
166trip_point_[0-*]_temp The temperature above which trip point will be fired 165trip_point_[0-*]_temp The temperature above which trip point will be fired
167 Unit: degree celsius 166 Unit: degree Celsius
168 RO 167 RO
169 Optional 168 Optional
170 169
171trip_point_[0-*]_type Strings which indicate the type of the trip point 170trip_point_[0-*]_type Strings which indicate the type of the trip point
172 Eg. it can be one of critical, hot, passive, 171 E.g. it can be one of critical, hot, passive,
173 active[0-*] for ACPI thermal zone. 172 active[0-*] for ACPI thermal zone.
174 RO 173 RO
175 Optional 174 Optional
@@ -179,7 +178,7 @@ cdev[0-*] Sysfs link to the thermal cooling device node where the sys I/F
179 RO 178 RO
180 Optional 179 Optional
181 180
182cdev[0-*]_trip_point The trip point with which cdev[0-*] is assocated in this thermal zone 181cdev[0-*]_trip_point The trip point with which cdev[0-*] is associated in this thermal zone
183 -1 means the cooling device is not associated with any trip point. 182 -1 means the cooling device is not associated with any trip point.
184 RO 183 RO
185 Optional 184 Optional
@@ -211,7 +210,7 @@ cur_state The current cooling state of this cooling device.
211 210
212ACPI thermal zone may support multiple trip points like critical/hot/passive/active. 211ACPI thermal zone may support multiple trip points like critical/hot/passive/active.
213If an ACPI thermal zone supports critical, passive, active[0] and active[1] at the same time, 212If an ACPI thermal zone supports critical, passive, active[0] and active[1] at the same time,
214it may register itself as a thermale_zone_device (thermal_zone1) with 4 trip points in all. 213it may register itself as a thermal_zone_device (thermal_zone1) with 4 trip points in all.
215It has one processor and one fan, which are both registered as thermal_cooling_device. 214It has one processor and one fan, which are both registered as thermal_cooling_device.
216If the processor is listed in _PSL method, and the fan is listed in _AL0 method, 215If the processor is listed in _PSL method, and the fan is listed in _AL0 method,
217the sys I/F structure will be built like this: 216the sys I/F structure will be built like this:
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 9b3f61200000..69f19f224875 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -9,7 +9,7 @@ menuconfig THERMAL
9 Generic Thermal Sysfs driver offers a generic mechanism for 9 Generic Thermal Sysfs driver offers a generic mechanism for
10 thermal management. Usually it's made up of one or more thermal 10 thermal management. Usually it's made up of one or more thermal
11 zone and cooling device. 11 zone and cooling device.
12 each thermal zone contains its own temperature, trip points, 12 Each thermal zone contains its own temperature, trip points,
13 cooling devices. 13 cooling devices.
14 All platforms with ACPI thermal support can use this driver. 14 All platforms with ACPI thermal support can use this driver.
15 If you want this support, you should say Y here 15 If you want this support, you should say Y here.
diff --git a/drivers/thermal/thermal.c b/drivers/thermal/thermal.c
index 3273e348fd14..e782b3e7fcdb 100644
--- a/drivers/thermal/thermal.c
+++ b/drivers/thermal/thermal.c
@@ -267,7 +267,7 @@ thermal_cooling_device_cur_state_store(struct device *dev,
267} 267}
268 268
269static struct device_attribute dev_attr_cdev_type = 269static struct device_attribute dev_attr_cdev_type =
270 __ATTR(type, 0444, thermal_cooling_device_type_show, NULL); 270__ATTR(type, 0444, thermal_cooling_device_type_show, NULL);
271static DEVICE_ATTR(max_state, 0444, 271static DEVICE_ATTR(max_state, 0444,
272 thermal_cooling_device_max_state_show, NULL); 272 thermal_cooling_device_max_state_show, NULL);
273static DEVICE_ATTR(cur_state, 0644, 273static DEVICE_ATTR(cur_state, 0644,
@@ -276,7 +276,7 @@ static DEVICE_ATTR(cur_state, 0644,
276 276
277static ssize_t 277static ssize_t
278thermal_cooling_device_trip_point_show(struct device *dev, 278thermal_cooling_device_trip_point_show(struct device *dev,
279 struct device_attribute *attr, char *buf) 279 struct device_attribute *attr, char *buf)
280{ 280{
281 struct thermal_cooling_device_instance *instance; 281 struct thermal_cooling_device_instance *instance;
282 282
@@ -293,11 +293,12 @@ thermal_cooling_device_trip_point_show(struct device *dev,
293 293
294/** 294/**
295 * thermal_zone_bind_cooling_device - bind a cooling device to a thermal zone 295 * thermal_zone_bind_cooling_device - bind a cooling device to a thermal zone
296 * this function is usually called in the thermal zone device .bind callback.
297 * @tz: thermal zone device 296 * @tz: thermal zone device
298 * @trip: indicates which trip point the cooling devices is 297 * @trip: indicates which trip point the cooling devices is
299 * associated with in this thermal zone. 298 * associated with in this thermal zone.
300 * @cdev: thermal cooling device 299 * @cdev: thermal cooling device
300 *
301 * This function is usually called in the thermal zone device .bind callback.
301 */ 302 */
302int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, 303int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
303 int trip, 304 int trip,
@@ -307,8 +308,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
307 struct thermal_cooling_device_instance *pos; 308 struct thermal_cooling_device_instance *pos;
308 int result; 309 int result;
309 310
310 if (trip >= tz->trips || 311 if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE))
311 (trip < 0 && trip != THERMAL_TRIPS_NONE))
312 return -EINVAL; 312 return -EINVAL;
313 313
314 if (!tz || !cdev) 314 if (!tz || !cdev)
@@ -361,15 +361,17 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
361 kfree(dev); 361 kfree(dev);
362 return result; 362 return result;
363} 363}
364
364EXPORT_SYMBOL(thermal_zone_bind_cooling_device); 365EXPORT_SYMBOL(thermal_zone_bind_cooling_device);
365 366
366/** 367/**
367 * thermal_zone_unbind_cooling_device - unbind a cooling device from a thermal zone 368 * thermal_zone_unbind_cooling_device - unbind a cooling device from a thermal zone
368 * this function is usually called in the thermal zone device .unbind callback.
369 * @tz: thermal zone device 369 * @tz: thermal zone device
370 * @trip: indicates which trip point the cooling devices is 370 * @trip: indicates which trip point the cooling devices is
371 * associated with in this thermal zone. 371 * associated with in this thermal zone.
372 * @cdev: thermal cooling device 372 * @cdev: thermal cooling device
373 *
374 * This function is usually called in the thermal zone device .unbind callback.
373 */ 375 */
374int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, 376int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
375 int trip, 377 int trip,
@@ -379,8 +381,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
379 381
380 mutex_lock(&tz->lock); 382 mutex_lock(&tz->lock);
381 list_for_each_entry_safe(pos, next, &tz->cooling_devices, node) { 383 list_for_each_entry_safe(pos, next, &tz->cooling_devices, node) {
382 if (pos->tz == tz && pos->trip == trip 384 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) {
383 && pos->cdev == cdev) {
384 list_del(&pos->node); 385 list_del(&pos->node);
385 mutex_unlock(&tz->lock); 386 mutex_unlock(&tz->lock);
386 goto unbind; 387 goto unbind;
@@ -397,6 +398,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
397 kfree(pos); 398 kfree(pos);
398 return 0; 399 return 0;
399} 400}
401
400EXPORT_SYMBOL(thermal_zone_unbind_cooling_device); 402EXPORT_SYMBOL(thermal_zone_unbind_cooling_device);
401 403
402static void thermal_release(struct device *dev) 404static void thermal_release(struct device *dev)
@@ -425,7 +427,10 @@ static struct class thermal_class = {
425 * @ops: standard thermal cooling devices callbacks. 427 * @ops: standard thermal cooling devices callbacks.
426 */ 428 */
427struct thermal_cooling_device *thermal_cooling_device_register(char *type, 429struct thermal_cooling_device *thermal_cooling_device_register(char *type,
428 void *devdata, struct thermal_cooling_device_ops *ops) 430 void *devdata,
431 struct
432 thermal_cooling_device_ops
433 *ops)
429{ 434{
430 struct thermal_cooling_device *cdev; 435 struct thermal_cooling_device *cdev;
431 struct thermal_zone_device *pos; 436 struct thermal_zone_device *pos;
@@ -435,7 +440,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
435 return NULL; 440 return NULL;
436 441
437 if (!ops || !ops->get_max_state || !ops->get_cur_state || 442 if (!ops || !ops->get_max_state || !ops->get_cur_state ||
438 !ops->set_cur_state) 443 !ops->set_cur_state)
439 return NULL; 444 return NULL;
440 445
441 cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL); 446 cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL);
@@ -462,8 +467,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
462 467
463 /* sys I/F */ 468 /* sys I/F */
464 if (type) { 469 if (type) {
465 result = device_create_file(&cdev->device, 470 result = device_create_file(&cdev->device, &dev_attr_cdev_type);
466 &dev_attr_cdev_type);
467 if (result) 471 if (result)
468 goto unregister; 472 goto unregister;
469 } 473 }
@@ -496,11 +500,11 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
496 device_unregister(&cdev->device); 500 device_unregister(&cdev->device);
497 return NULL; 501 return NULL;
498} 502}
503
499EXPORT_SYMBOL(thermal_cooling_device_register); 504EXPORT_SYMBOL(thermal_cooling_device_register);
500 505
501/** 506/**
502 * thermal_cooling_device_unregister - removes the registered thermal cooling device 507 * thermal_cooling_device_unregister - removes the registered thermal cooling device
503 *
504 * @cdev: the thermal cooling device to remove. 508 * @cdev: the thermal cooling device to remove.
505 * 509 *
506 * thermal_cooling_device_unregister() must be called when the device is no 510 * thermal_cooling_device_unregister() must be called when the device is no
@@ -533,8 +537,7 @@ void thermal_cooling_device_unregister(struct
533 } 537 }
534 mutex_unlock(&thermal_list_lock); 538 mutex_unlock(&thermal_list_lock);
535 if (cdev->type[0]) 539 if (cdev->type[0])
536 device_remove_file(&cdev->device, 540 device_remove_file(&cdev->device, &dev_attr_cdev_type);
537 &dev_attr_cdev_type);
538 device_remove_file(&cdev->device, &dev_attr_max_state); 541 device_remove_file(&cdev->device, &dev_attr_max_state);
539 device_remove_file(&cdev->device, &dev_attr_cur_state); 542 device_remove_file(&cdev->device, &dev_attr_cur_state);
540 543
@@ -542,6 +545,7 @@ void thermal_cooling_device_unregister(struct
542 device_unregister(&cdev->device); 545 device_unregister(&cdev->device);
543 return; 546 return;
544} 547}
548
545EXPORT_SYMBOL(thermal_cooling_device_unregister); 549EXPORT_SYMBOL(thermal_cooling_device_unregister);
546 550
547/** 551/**
@@ -555,8 +559,10 @@ EXPORT_SYMBOL(thermal_cooling_device_unregister);
555 * longer needed. 559 * longer needed.
556 */ 560 */
557struct thermal_zone_device *thermal_zone_device_register(char *type, 561struct thermal_zone_device *thermal_zone_device_register(char *type,
558 int trips, void *devdata, 562 int trips,
559 struct thermal_zone_device_ops *ops) 563 void *devdata, struct
564 thermal_zone_device_ops
565 *ops)
560{ 566{
561 struct thermal_zone_device *tz; 567 struct thermal_zone_device *tz;
562 struct thermal_cooling_device *pos; 568 struct thermal_cooling_device *pos;
@@ -625,9 +631,9 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
625 list_add_tail(&tz->node, &thermal_tz_list); 631 list_add_tail(&tz->node, &thermal_tz_list);
626 if (ops->bind) 632 if (ops->bind)
627 list_for_each_entry(pos, &thermal_cdev_list, node) { 633 list_for_each_entry(pos, &thermal_cdev_list, node) {
628 result = ops->bind(tz, pos); 634 result = ops->bind(tz, pos);
629 if (result) 635 if (result)
630 break; 636 break;
631 } 637 }
632 mutex_unlock(&thermal_list_lock); 638 mutex_unlock(&thermal_list_lock);
633 639
@@ -639,11 +645,11 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
639 device_unregister(&tz->device); 645 device_unregister(&tz->device);
640 return NULL; 646 return NULL;
641} 647}
648
642EXPORT_SYMBOL(thermal_zone_device_register); 649EXPORT_SYMBOL(thermal_zone_device_register);
643 650
644/** 651/**
645 * thermal_device_unregister - removes the registered thermal zone device 652 * thermal_device_unregister - removes the registered thermal zone device
646 *
647 * @tz: the thermal zone device to remove 653 * @tz: the thermal zone device to remove
648 */ 654 */
649void thermal_zone_device_unregister(struct thermal_zone_device *tz) 655void thermal_zone_device_unregister(struct thermal_zone_device *tz)
@@ -685,6 +691,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
685 device_unregister(&tz->device); 691 device_unregister(&tz->device);
686 return; 692 return;
687} 693}
694
688EXPORT_SYMBOL(thermal_zone_device_unregister); 695EXPORT_SYMBOL(thermal_zone_device_unregister);
689 696
690static int __init thermal_init(void) 697static int __init thermal_init(void)