Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 41 $) |
| 3 | * |
| 4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
| 5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
| 6 | * |
| 7 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or (at |
| 12 | * your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License along |
| 20 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 21 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
| 22 | * |
| 23 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 24 | * |
| 25 | * This driver fully implements the ACPI thermal policy as described in the |
| 26 | * ACPI 2.0 Specification. |
| 27 | * |
| 28 | * TBD: 1. Implement passive cooling hysteresis. |
| 29 | * 2. Enhance passive cooling (CPU) states/limit interface to support |
| 30 | * concepts of 'multiple limiters', upper/lower limits, etc. |
| 31 | * |
| 32 | */ |
| 33 | |
| 34 | #include <linux/kernel.h> |
| 35 | #include <linux/module.h> |
Len Brown | 0b5bfa1 | 2007-08-12 00:13:02 -0400 | [diff] [blame] | 36 | #include <linux/dmi.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | #include <linux/init.h> |
| 38 | #include <linux/types.h> |
| 39 | #include <linux/proc_fs.h> |
Tim Schmielau | cd354f1 | 2007-02-14 00:33:14 -0800 | [diff] [blame] | 40 | #include <linux/timer.h> |
| 41 | #include <linux/jiffies.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | #include <linux/kmod.h> |
| 43 | #include <linux/seq_file.h> |
Jeremy Fitzhardinge | 10a0a8d | 2007-07-17 18:37:02 -0700 | [diff] [blame] | 44 | #include <linux/reboot.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #include <asm/uaccess.h> |
| 46 | |
| 47 | #include <acpi/acpi_bus.h> |
| 48 | #include <acpi/acpi_drivers.h> |
| 49 | |
| 50 | #define ACPI_THERMAL_COMPONENT 0x04000000 |
| 51 | #define ACPI_THERMAL_CLASS "thermal_zone" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | #define ACPI_THERMAL_DEVICE_NAME "Thermal Zone" |
| 53 | #define ACPI_THERMAL_FILE_STATE "state" |
| 54 | #define ACPI_THERMAL_FILE_TEMPERATURE "temperature" |
| 55 | #define ACPI_THERMAL_FILE_TRIP_POINTS "trip_points" |
| 56 | #define ACPI_THERMAL_FILE_COOLING_MODE "cooling_mode" |
| 57 | #define ACPI_THERMAL_FILE_POLLING_FREQ "polling_frequency" |
| 58 | #define ACPI_THERMAL_NOTIFY_TEMPERATURE 0x80 |
| 59 | #define ACPI_THERMAL_NOTIFY_THRESHOLDS 0x81 |
| 60 | #define ACPI_THERMAL_NOTIFY_DEVICES 0x82 |
| 61 | #define ACPI_THERMAL_NOTIFY_CRITICAL 0xF0 |
| 62 | #define ACPI_THERMAL_NOTIFY_HOT 0xF1 |
| 63 | #define ACPI_THERMAL_MODE_ACTIVE 0x00 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | |
| 65 | #define ACPI_THERMAL_MAX_ACTIVE 10 |
| 66 | #define ACPI_THERMAL_MAX_LIMIT_STR_LEN 65 |
| 67 | |
| 68 | #define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732>=0) ? ((long)t-2732+5)/10 : ((long)t-2732-5)/10) |
| 69 | #define CELSIUS_TO_KELVIN(t) ((t+273)*10) |
| 70 | |
| 71 | #define _COMPONENT ACPI_THERMAL_COMPONENT |
Len Brown | f52fd66 | 2007-02-12 22:42:12 -0500 | [diff] [blame] | 72 | ACPI_MODULE_NAME("thermal"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 74 | MODULE_AUTHOR("Paul Diefenbaugh"); |
Len Brown | 7cda93e | 2007-02-12 23:50:02 -0500 | [diff] [blame] | 75 | MODULE_DESCRIPTION("ACPI Thermal Zone Driver"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | MODULE_LICENSE("GPL"); |
| 77 | |
Len Brown | f8707ec | 2007-08-12 00:12:54 -0400 | [diff] [blame] | 78 | static int act; |
| 79 | module_param(act, int, 0644); |
| 80 | MODULE_PARM_DESC(act, "Disable or override all lowest active trip points.\n"); |
| 81 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | static int tzp; |
Len Brown | 730ff34 | 2007-08-12 00:12:26 -0400 | [diff] [blame] | 83 | module_param(tzp, int, 0444); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n"); |
| 85 | |
Len Brown | f548714 | 2007-08-12 00:12:44 -0400 | [diff] [blame] | 86 | static int nocrt; |
| 87 | module_param(nocrt, int, 0); |
| 88 | MODULE_PARM_DESC(nocrt, "Set to disable action on ACPI thermal zone critical and hot trips.\n"); |
| 89 | |
Len Brown | 72b33ef | 2007-08-12 00:12:17 -0400 | [diff] [blame] | 90 | static int off; |
| 91 | module_param(off, int, 0); |
| 92 | MODULE_PARM_DESC(off, "Set to disable ACPI thermal support.\n"); |
| 93 | |
Len Brown | a70cdc5 | 2007-08-12 00:12:35 -0400 | [diff] [blame] | 94 | static int psv; |
| 95 | module_param(psv, int, 0644); |
| 96 | MODULE_PARM_DESC(psv, "Disable or override all passive trip points.\n"); |
| 97 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 98 | static int acpi_thermal_add(struct acpi_device *device); |
| 99 | static int acpi_thermal_remove(struct acpi_device *device, int type); |
Patrick Mochel | 5d9464a | 2006-12-07 20:56:27 +0800 | [diff] [blame] | 100 | static int acpi_thermal_resume(struct acpi_device *device); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); |
| 102 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); |
| 103 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 105 | static ssize_t acpi_thermal_write_cooling_mode(struct file *, |
| 106 | const char __user *, size_t, |
| 107 | loff_t *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 109 | static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, |
| 110 | size_t, loff_t *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | |
Thomas Renninger | 1ba90e3 | 2007-07-23 14:44:41 +0200 | [diff] [blame] | 112 | static const struct acpi_device_id thermal_device_ids[] = { |
| 113 | {ACPI_THERMAL_HID, 0}, |
| 114 | {"", 0}, |
| 115 | }; |
| 116 | MODULE_DEVICE_TABLE(acpi, thermal_device_ids); |
| 117 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | static struct acpi_driver acpi_thermal_driver = { |
Len Brown | c2b6705 | 2007-02-12 23:33:40 -0500 | [diff] [blame] | 119 | .name = "thermal", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 120 | .class = ACPI_THERMAL_CLASS, |
Thomas Renninger | 1ba90e3 | 2007-07-23 14:44:41 +0200 | [diff] [blame] | 121 | .ids = thermal_device_ids, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 122 | .ops = { |
| 123 | .add = acpi_thermal_add, |
| 124 | .remove = acpi_thermal_remove, |
Konstantin Karasyov | 74ce1468 | 2006-05-08 08:32:00 -0400 | [diff] [blame] | 125 | .resume = acpi_thermal_resume, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 126 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | }; |
| 128 | |
| 129 | struct acpi_thermal_state { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 130 | u8 critical:1; |
| 131 | u8 hot:1; |
| 132 | u8 passive:1; |
| 133 | u8 active:1; |
| 134 | u8 reserved:4; |
| 135 | int active_index; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | }; |
| 137 | |
| 138 | struct acpi_thermal_state_flags { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 139 | u8 valid:1; |
| 140 | u8 enabled:1; |
| 141 | u8 reserved:6; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | }; |
| 143 | |
| 144 | struct acpi_thermal_critical { |
| 145 | struct acpi_thermal_state_flags flags; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 146 | unsigned long temperature; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | }; |
| 148 | |
| 149 | struct acpi_thermal_hot { |
| 150 | struct acpi_thermal_state_flags flags; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 151 | unsigned long temperature; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | }; |
| 153 | |
| 154 | struct acpi_thermal_passive { |
| 155 | struct acpi_thermal_state_flags flags; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 156 | unsigned long temperature; |
| 157 | unsigned long tc1; |
| 158 | unsigned long tc2; |
| 159 | unsigned long tsp; |
| 160 | struct acpi_handle_list devices; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | }; |
| 162 | |
| 163 | struct acpi_thermal_active { |
| 164 | struct acpi_thermal_state_flags flags; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 165 | unsigned long temperature; |
| 166 | struct acpi_handle_list devices; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | }; |
| 168 | |
| 169 | struct acpi_thermal_trips { |
| 170 | struct acpi_thermal_critical critical; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 171 | struct acpi_thermal_hot hot; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | struct acpi_thermal_passive passive; |
| 173 | struct acpi_thermal_active active[ACPI_THERMAL_MAX_ACTIVE]; |
| 174 | }; |
| 175 | |
| 176 | struct acpi_thermal_flags { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 177 | u8 cooling_mode:1; /* _SCP */ |
| 178 | u8 devices:1; /* _TZD */ |
| 179 | u8 reserved:6; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | }; |
| 181 | |
| 182 | struct acpi_thermal { |
Patrick Mochel | 8348e1b | 2006-05-19 16:54:40 -0400 | [diff] [blame] | 183 | struct acpi_device * device; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 184 | acpi_bus_id name; |
| 185 | unsigned long temperature; |
| 186 | unsigned long last_temperature; |
| 187 | unsigned long polling_frequency; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 188 | volatile u8 zombie; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | struct acpi_thermal_flags flags; |
| 190 | struct acpi_thermal_state state; |
| 191 | struct acpi_thermal_trips trips; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 192 | struct acpi_handle_list devices; |
| 193 | struct timer_list timer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | }; |
| 195 | |
Arjan van de Ven | d750803 | 2006-07-04 13:06:00 -0400 | [diff] [blame] | 196 | static const struct file_operations acpi_thermal_state_fops = { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 197 | .open = acpi_thermal_state_open_fs, |
| 198 | .read = seq_read, |
| 199 | .llseek = seq_lseek, |
| 200 | .release = single_release, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | }; |
| 202 | |
Arjan van de Ven | d750803 | 2006-07-04 13:06:00 -0400 | [diff] [blame] | 203 | static const struct file_operations acpi_thermal_temp_fops = { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 204 | .open = acpi_thermal_temp_open_fs, |
| 205 | .read = seq_read, |
| 206 | .llseek = seq_lseek, |
| 207 | .release = single_release, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | }; |
| 209 | |
Arjan van de Ven | d750803 | 2006-07-04 13:06:00 -0400 | [diff] [blame] | 210 | static const struct file_operations acpi_thermal_trip_fops = { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 211 | .open = acpi_thermal_trip_open_fs, |
| 212 | .read = seq_read, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 213 | .llseek = seq_lseek, |
| 214 | .release = single_release, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | }; |
| 216 | |
Arjan van de Ven | d750803 | 2006-07-04 13:06:00 -0400 | [diff] [blame] | 217 | static const struct file_operations acpi_thermal_cooling_fops = { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 218 | .open = acpi_thermal_cooling_open_fs, |
| 219 | .read = seq_read, |
| 220 | .write = acpi_thermal_write_cooling_mode, |
| 221 | .llseek = seq_lseek, |
| 222 | .release = single_release, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | }; |
| 224 | |
Arjan van de Ven | d750803 | 2006-07-04 13:06:00 -0400 | [diff] [blame] | 225 | static const struct file_operations acpi_thermal_polling_fops = { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 226 | .open = acpi_thermal_polling_open_fs, |
| 227 | .read = seq_read, |
| 228 | .write = acpi_thermal_write_polling, |
| 229 | .llseek = seq_lseek, |
| 230 | .release = single_release, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | }; |
| 232 | |
| 233 | /* -------------------------------------------------------------------------- |
| 234 | Thermal Zone Management |
| 235 | -------------------------------------------------------------------------- */ |
| 236 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 237 | static int acpi_thermal_get_temperature(struct acpi_thermal *tz) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 239 | acpi_status status = AE_OK; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | |
| 242 | if (!tz) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 243 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | |
| 245 | tz->last_temperature = tz->temperature; |
| 246 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 247 | status = |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 248 | acpi_evaluate_integer(tz->device->handle, "_TMP", NULL, &tz->temperature); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | if (ACPI_FAILURE(status)) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 250 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 252 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n", |
| 253 | tz->temperature)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 255 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | } |
| 257 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 258 | static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 260 | acpi_status status = AE_OK; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | |
| 263 | if (!tz) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 264 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 266 | status = |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 267 | acpi_evaluate_integer(tz->device->handle, "_TZP", NULL, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 268 | &tz->polling_frequency); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | if (ACPI_FAILURE(status)) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 270 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 272 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n", |
| 273 | tz->polling_frequency)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 275 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | } |
| 277 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 278 | static int acpi_thermal_set_polling(struct acpi_thermal *tz, int seconds) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | |
| 281 | if (!tz) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 282 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | |
| 284 | tz->polling_frequency = seconds * 10; /* Convert value to deci-seconds */ |
| 285 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 286 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 287 | "Polling frequency set to %lu seconds\n", |
Sanjoy Mahajan | 636cedf | 2007-02-16 01:24:43 -0500 | [diff] [blame] | 288 | tz->polling_frequency/10)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 290 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | } |
| 292 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 293 | static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 295 | acpi_status status = AE_OK; |
| 296 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
| 297 | struct acpi_object_list arg_list = { 1, &arg0 }; |
| 298 | acpi_handle handle = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | |
| 301 | if (!tz) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 302 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 304 | status = acpi_get_handle(tz->device->handle, "_SCP", &handle); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | if (ACPI_FAILURE(status)) { |
| 306 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n")); |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 307 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | } |
| 309 | |
| 310 | arg0.integer.value = mode; |
| 311 | |
| 312 | status = acpi_evaluate_object(handle, NULL, &arg_list, NULL); |
| 313 | if (ACPI_FAILURE(status)) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 314 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 316 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | } |
| 318 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 319 | static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 321 | acpi_status status = AE_OK; |
| 322 | int i = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | |
| 325 | if (!tz) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 326 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | |
| 328 | /* Critical Shutdown (required) */ |
| 329 | |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 330 | status = acpi_evaluate_integer(tz->device->handle, "_CRT", NULL, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 331 | &tz->trips.critical.temperature); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | if (ACPI_FAILURE(status)) { |
| 333 | tz->trips.critical.flags.valid = 0; |
Thomas Renninger | a6fc672 | 2006-06-26 23:58:43 -0400 | [diff] [blame] | 334 | ACPI_EXCEPTION((AE_INFO, status, "No critical threshold")); |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 335 | return -ENODEV; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 336 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | tz->trips.critical.flags.valid = 1; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 338 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 339 | "Found critical threshold [%lu]\n", |
| 340 | tz->trips.critical.temperature)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | } |
| 342 | |
| 343 | /* Critical Sleep (optional) */ |
| 344 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 345 | status = |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 346 | acpi_evaluate_integer(tz->device->handle, "_HOT", NULL, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 347 | &tz->trips.hot.temperature); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | if (ACPI_FAILURE(status)) { |
| 349 | tz->trips.hot.flags.valid = 0; |
| 350 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No hot threshold\n")); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 351 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | tz->trips.hot.flags.valid = 1; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 353 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found hot threshold [%lu]\n", |
| 354 | tz->trips.hot.temperature)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | } |
| 356 | |
| 357 | /* Passive: Processors (optional) */ |
| 358 | |
Len Brown | a70cdc5 | 2007-08-12 00:12:35 -0400 | [diff] [blame] | 359 | if (psv == -1) { |
| 360 | status = AE_SUPPORT; |
| 361 | } else if (psv > 0) { |
| 362 | tz->trips.passive.temperature = CELSIUS_TO_KELVIN(psv); |
| 363 | status = AE_OK; |
| 364 | } else { |
| 365 | status = acpi_evaluate_integer(tz->device->handle, |
| 366 | "_PSV", NULL, &tz->trips.passive.temperature); |
| 367 | } |
| 368 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | if (ACPI_FAILURE(status)) { |
| 370 | tz->trips.passive.flags.valid = 0; |
| 371 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No passive threshold\n")); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 372 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | tz->trips.passive.flags.valid = 1; |
| 374 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 375 | status = |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 376 | acpi_evaluate_integer(tz->device->handle, "_TC1", NULL, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 377 | &tz->trips.passive.tc1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | if (ACPI_FAILURE(status)) |
| 379 | tz->trips.passive.flags.valid = 0; |
| 380 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 381 | status = |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 382 | acpi_evaluate_integer(tz->device->handle, "_TC2", NULL, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 383 | &tz->trips.passive.tc2); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | if (ACPI_FAILURE(status)) |
| 385 | tz->trips.passive.flags.valid = 0; |
| 386 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 387 | status = |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 388 | acpi_evaluate_integer(tz->device->handle, "_TSP", NULL, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 389 | &tz->trips.passive.tsp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | if (ACPI_FAILURE(status)) |
| 391 | tz->trips.passive.flags.valid = 0; |
| 392 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 393 | status = |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 394 | acpi_evaluate_reference(tz->device->handle, "_PSL", NULL, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 395 | &tz->trips.passive.devices); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | if (ACPI_FAILURE(status)) |
| 397 | tz->trips.passive.flags.valid = 0; |
| 398 | |
| 399 | if (!tz->trips.passive.flags.valid) |
Len Brown | cece929 | 2006-06-26 23:04:31 -0400 | [diff] [blame] | 400 | printk(KERN_WARNING PREFIX "Invalid passive threshold\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | else |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 402 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 403 | "Found passive threshold [%lu]\n", |
| 404 | tz->trips.passive.temperature)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 405 | } |
| 406 | |
| 407 | /* Active: Fans, etc. (optional) */ |
| 408 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 409 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 411 | char name[5] = { '_', 'A', 'C', ('0' + i), '\0' }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | |
Len Brown | f8707ec | 2007-08-12 00:12:54 -0400 | [diff] [blame] | 413 | if (act == -1) |
| 414 | break; /* disable all active trip points */ |
| 415 | |
| 416 | status = acpi_evaluate_integer(tz->device->handle, |
| 417 | name, NULL, &tz->trips.active[i].temperature); |
| 418 | |
| 419 | if (ACPI_FAILURE(status)) { |
| 420 | if (i == 0) /* no active trip points */ |
| 421 | break; |
| 422 | if (act <= 0) /* no override requested */ |
| 423 | break; |
| 424 | if (i == 1) { /* 1 trip point */ |
| 425 | tz->trips.active[0].temperature = |
| 426 | CELSIUS_TO_KELVIN(act); |
| 427 | } else { /* multiple trips */ |
| 428 | /* |
| 429 | * Don't allow override higher than |
| 430 | * the next higher trip point |
| 431 | */ |
| 432 | tz->trips.active[i - 1].temperature = |
| 433 | (tz->trips.active[i - 2].temperature < |
| 434 | CELSIUS_TO_KELVIN(act) ? |
| 435 | tz->trips.active[i - 2].temperature : |
| 436 | CELSIUS_TO_KELVIN(act)); |
| 437 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | break; |
Len Brown | f8707ec | 2007-08-12 00:12:54 -0400 | [diff] [blame] | 439 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 440 | |
| 441 | name[2] = 'L'; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 442 | status = |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 443 | acpi_evaluate_reference(tz->device->handle, name, NULL, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 444 | &tz->trips.active[i].devices); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | if (ACPI_SUCCESS(status)) { |
| 446 | tz->trips.active[i].flags.valid = 1; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 447 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 448 | "Found active threshold [%d]:[%lu]\n", |
| 449 | i, tz->trips.active[i].temperature)); |
| 450 | } else |
Thomas Renninger | a6fc672 | 2006-06-26 23:58:43 -0400 | [diff] [blame] | 451 | ACPI_EXCEPTION((AE_INFO, status, |
| 452 | "Invalid active threshold [%d]", i)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 453 | } |
| 454 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 455 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | } |
| 457 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 458 | static int acpi_thermal_get_devices(struct acpi_thermal *tz) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 460 | acpi_status status = AE_OK; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 | |
| 463 | if (!tz) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 464 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 466 | status = |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 467 | acpi_evaluate_reference(tz->device->handle, "_TZD", NULL, &tz->devices); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | if (ACPI_FAILURE(status)) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 469 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 471 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | } |
| 473 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 474 | static int acpi_thermal_critical(struct acpi_thermal *tz) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | { |
Len Brown | f548714 | 2007-08-12 00:12:44 -0400 | [diff] [blame] | 476 | if (!tz || !tz->trips.critical.flags.valid || nocrt) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 477 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | |
| 479 | if (tz->temperature >= tz->trips.critical.temperature) { |
Len Brown | cece929 | 2006-06-26 23:04:31 -0400 | [diff] [blame] | 480 | printk(KERN_WARNING PREFIX "Critical trip point\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | tz->trips.critical.flags.enabled = 1; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 482 | } else if (tz->trips.critical.flags.enabled) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 483 | tz->trips.critical.flags.enabled = 0; |
| 484 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 485 | printk(KERN_EMERG |
| 486 | "Critical temperature reached (%ld C), shutting down.\n", |
| 487 | KELVIN_TO_CELSIUS(tz->temperature)); |
Patrick Mochel | 8348e1b | 2006-05-19 16:54:40 -0400 | [diff] [blame] | 488 | acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_CRITICAL, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 489 | tz->trips.critical.flags.enabled); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 490 | |
Jeremy Fitzhardinge | 10a0a8d | 2007-07-17 18:37:02 -0700 | [diff] [blame] | 491 | orderly_poweroff(true); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 493 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | } |
| 495 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 496 | static int acpi_thermal_hot(struct acpi_thermal *tz) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | { |
Len Brown | f548714 | 2007-08-12 00:12:44 -0400 | [diff] [blame] | 498 | if (!tz || !tz->trips.hot.flags.valid || nocrt) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 499 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 500 | |
| 501 | if (tz->temperature >= tz->trips.hot.temperature) { |
Len Brown | cece929 | 2006-06-26 23:04:31 -0400 | [diff] [blame] | 502 | printk(KERN_WARNING PREFIX "Hot trip point\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | tz->trips.hot.flags.enabled = 1; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 504 | } else if (tz->trips.hot.flags.enabled) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | tz->trips.hot.flags.enabled = 0; |
| 506 | |
Patrick Mochel | 8348e1b | 2006-05-19 16:54:40 -0400 | [diff] [blame] | 507 | acpi_bus_generate_event(tz->device, ACPI_THERMAL_NOTIFY_HOT, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 508 | tz->trips.hot.flags.enabled); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | |
| 510 | /* TBD: Call user-mode "sleep(S4)" function */ |
| 511 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 512 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 513 | } |
| 514 | |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 515 | static void acpi_thermal_passive(struct acpi_thermal *tz) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 516 | { |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 517 | int result = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | struct acpi_thermal_passive *passive = NULL; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 519 | int trend = 0; |
| 520 | int i = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 521 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | |
| 523 | if (!tz || !tz->trips.passive.flags.valid) |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 524 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | |
| 526 | passive = &(tz->trips.passive); |
| 527 | |
| 528 | /* |
| 529 | * Above Trip? |
| 530 | * ----------- |
| 531 | * Calculate the thermal trend (using the passive cooling equation) |
| 532 | * and modify the performance limit for all passive cooling devices |
| 533 | * accordingly. Note that we assume symmetry. |
| 534 | */ |
| 535 | if (tz->temperature >= passive->temperature) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 536 | trend = |
| 537 | (passive->tc1 * (tz->temperature - tz->last_temperature)) + |
| 538 | (passive->tc2 * (tz->temperature - passive->temperature)); |
| 539 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 540 | "trend[%d]=(tc1[%lu]*(tmp[%lu]-last[%lu]))+(tc2[%lu]*(tmp[%lu]-psv[%lu]))\n", |
| 541 | trend, passive->tc1, tz->temperature, |
| 542 | tz->last_temperature, passive->tc2, |
| 543 | tz->temperature, passive->temperature)); |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 544 | passive->flags.enabled = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | /* Heating up? */ |
| 546 | if (trend > 0) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 547 | for (i = 0; i < passive->devices.count; i++) |
| 548 | acpi_processor_set_thermal_limit(passive-> |
| 549 | devices. |
| 550 | handles[i], |
| 551 | ACPI_PROCESSOR_LIMIT_INCREMENT); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | /* Cooling off? */ |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 553 | else if (trend < 0) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 554 | for (i = 0; i < passive->devices.count; i++) |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 555 | /* |
| 556 | * assume that we are on highest |
| 557 | * freq/lowest thrott and can leave |
| 558 | * passive mode, even in error case |
| 559 | */ |
| 560 | if (!acpi_processor_set_thermal_limit |
| 561 | (passive->devices.handles[i], |
| 562 | ACPI_PROCESSOR_LIMIT_DECREMENT)) |
| 563 | result = 0; |
| 564 | /* |
| 565 | * Leave cooling mode, even if the temp might |
| 566 | * higher than trip point This is because some |
| 567 | * machines might have long thermal polling |
| 568 | * frequencies (tsp) defined. We will fall back |
| 569 | * into passive mode in next cycle (probably quicker) |
| 570 | */ |
| 571 | if (result) { |
| 572 | passive->flags.enabled = 0; |
| 573 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 574 | "Disabling passive cooling, still above threshold," |
| 575 | " but we are cooling down\n")); |
| 576 | } |
| 577 | } |
| 578 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 579 | } |
| 580 | |
| 581 | /* |
| 582 | * Below Trip? |
| 583 | * ----------- |
| 584 | * Implement passive cooling hysteresis to slowly increase performance |
| 585 | * and avoid thrashing around the passive trip point. Note that we |
| 586 | * assume symmetry. |
| 587 | */ |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 588 | if (!passive->flags.enabled) |
| 589 | return; |
| 590 | for (i = 0; i < passive->devices.count; i++) |
| 591 | if (!acpi_processor_set_thermal_limit |
| 592 | (passive->devices.handles[i], |
| 593 | ACPI_PROCESSOR_LIMIT_DECREMENT)) |
| 594 | result = 0; |
| 595 | if (result) { |
| 596 | passive->flags.enabled = 0; |
| 597 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 598 | "Disabling passive cooling (zone is cool)\n")); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 599 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 600 | } |
| 601 | |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 602 | static void acpi_thermal_active(struct acpi_thermal *tz) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 603 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 604 | int result = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 605 | struct acpi_thermal_active *active = NULL; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 606 | int i = 0; |
| 607 | int j = 0; |
| 608 | unsigned long maxtemp = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 609 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 610 | |
| 611 | if (!tz) |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 612 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 613 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 614 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 615 | active = &(tz->trips.active[i]); |
| 616 | if (!active || !active->flags.valid) |
| 617 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 618 | if (tz->temperature >= active->temperature) { |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 619 | /* |
| 620 | * Above Threshold? |
| 621 | * ---------------- |
| 622 | * If not already enabled, turn ON all cooling devices |
| 623 | * associated with this active threshold. |
| 624 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 625 | if (active->temperature > maxtemp) |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 626 | tz->state.active_index = i; |
| 627 | maxtemp = active->temperature; |
| 628 | if (active->flags.enabled) |
| 629 | continue; |
| 630 | for (j = 0; j < active->devices.count; j++) { |
| 631 | result = |
| 632 | acpi_bus_set_power(active->devices. |
| 633 | handles[j], |
| 634 | ACPI_STATE_D0); |
| 635 | if (result) { |
Len Brown | cece929 | 2006-06-26 23:04:31 -0400 | [diff] [blame] | 636 | printk(KERN_WARNING PREFIX |
| 637 | "Unable to turn cooling device [%p] 'on'\n", |
Thomas Renninger | a6fc672 | 2006-06-26 23:58:43 -0400 | [diff] [blame] | 638 | active->devices. |
Len Brown | cece929 | 2006-06-26 23:04:31 -0400 | [diff] [blame] | 639 | handles[j]); |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 640 | continue; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 641 | } |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 642 | active->flags.enabled = 1; |
| 643 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 644 | "Cooling device [%p] now 'on'\n", |
| 645 | active->devices.handles[j])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 646 | } |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 647 | continue; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 648 | } |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 649 | if (!active->flags.enabled) |
| 650 | continue; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 651 | /* |
| 652 | * Below Threshold? |
| 653 | * ---------------- |
| 654 | * Turn OFF all cooling devices associated with this |
| 655 | * threshold. |
| 656 | */ |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 657 | for (j = 0; j < active->devices.count; j++) { |
| 658 | result = acpi_bus_set_power(active->devices.handles[j], |
| 659 | ACPI_STATE_D3); |
| 660 | if (result) { |
Len Brown | cece929 | 2006-06-26 23:04:31 -0400 | [diff] [blame] | 661 | printk(KERN_WARNING PREFIX |
| 662 | "Unable to turn cooling device [%p] 'off'\n", |
| 663 | active->devices.handles[j]); |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 664 | continue; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 665 | } |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 666 | active->flags.enabled = 0; |
| 667 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 668 | "Cooling device [%p] now 'off'\n", |
| 669 | active->devices.handles[j])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 670 | } |
| 671 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 672 | } |
| 673 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 674 | static void acpi_thermal_check(void *context); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 675 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 676 | static void acpi_thermal_run(unsigned long data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 677 | { |
| 678 | struct acpi_thermal *tz = (struct acpi_thermal *)data; |
| 679 | if (!tz->zombie) |
Alexey Starikovskiy | b8d3519 | 2006-05-05 03:23:00 -0400 | [diff] [blame] | 680 | acpi_os_execute(OSL_GPE_HANDLER, acpi_thermal_check, (void *)data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 681 | } |
| 682 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 683 | static void acpi_thermal_check(void *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 684 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 685 | int result = 0; |
Jan Engelhardt | 50dd096 | 2006-10-01 00:28:50 +0200 | [diff] [blame] | 686 | struct acpi_thermal *tz = data; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 687 | unsigned long sleep_time = 0; |
| 688 | int i = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 689 | struct acpi_thermal_state state; |
| 690 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | |
| 692 | if (!tz) { |
Len Brown | 6468463 | 2006-06-26 23:41:38 -0400 | [diff] [blame] | 693 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 694 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 695 | } |
| 696 | |
| 697 | state = tz->state; |
| 698 | |
| 699 | result = acpi_thermal_get_temperature(tz); |
| 700 | if (result) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 701 | return; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 702 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 703 | memset(&tz->state, 0, sizeof(tz->state)); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 704 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 705 | /* |
| 706 | * Check Trip Points |
| 707 | * ----------------- |
| 708 | * Compare the current temperature to the trip point values to see |
| 709 | * if we've entered one of the thermal policy states. Note that |
| 710 | * this function determines when a state is entered, but the |
| 711 | * individual policy decides when it is exited (e.g. hysteresis). |
| 712 | */ |
| 713 | if (tz->trips.critical.flags.valid) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 714 | state.critical |= |
| 715 | (tz->temperature >= tz->trips.critical.temperature); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 716 | if (tz->trips.hot.flags.valid) |
| 717 | state.hot |= (tz->temperature >= tz->trips.hot.temperature); |
| 718 | if (tz->trips.passive.flags.valid) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 719 | state.passive |= |
| 720 | (tz->temperature >= tz->trips.passive.temperature); |
| 721 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 722 | if (tz->trips.active[i].flags.valid) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 723 | state.active |= |
| 724 | (tz->temperature >= |
| 725 | tz->trips.active[i].temperature); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 726 | |
| 727 | /* |
| 728 | * Invoke Policy |
| 729 | * ------------- |
| 730 | * Separated from the above check to allow individual policy to |
| 731 | * determine when to exit a given state. |
| 732 | */ |
| 733 | if (state.critical) |
| 734 | acpi_thermal_critical(tz); |
| 735 | if (state.hot) |
| 736 | acpi_thermal_hot(tz); |
| 737 | if (state.passive) |
| 738 | acpi_thermal_passive(tz); |
| 739 | if (state.active) |
| 740 | acpi_thermal_active(tz); |
| 741 | |
| 742 | /* |
| 743 | * Calculate State |
| 744 | * --------------- |
| 745 | * Again, separated from the above two to allow independent policy |
| 746 | * decisions. |
| 747 | */ |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 748 | tz->state.critical = tz->trips.critical.flags.enabled; |
| 749 | tz->state.hot = tz->trips.hot.flags.enabled; |
| 750 | tz->state.passive = tz->trips.passive.flags.enabled; |
| 751 | tz->state.active = 0; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 752 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) |
Thomas Renninger | 1cbf4c5 | 2004-09-16 11:07:00 -0400 | [diff] [blame] | 753 | tz->state.active |= tz->trips.active[i].flags.enabled; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 754 | |
| 755 | /* |
| 756 | * Calculate Sleep Time |
| 757 | * -------------------- |
| 758 | * If we're in the passive state, use _TSP's value. Otherwise |
| 759 | * use the default polling frequency (e.g. _TZP). If no polling |
| 760 | * frequency is specified then we'll wait forever (at least until |
| 761 | * a thermal event occurs). Note that _TSP and _TZD values are |
| 762 | * given in 1/10th seconds (we must covert to milliseconds). |
| 763 | */ |
| 764 | if (tz->state.passive) |
| 765 | sleep_time = tz->trips.passive.tsp * 100; |
| 766 | else if (tz->polling_frequency > 0) |
| 767 | sleep_time = tz->polling_frequency * 100; |
| 768 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 769 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n", |
| 770 | tz->name, tz->temperature, sleep_time)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 771 | |
| 772 | /* |
| 773 | * Schedule Next Poll |
| 774 | * ------------------ |
| 775 | */ |
| 776 | if (!sleep_time) { |
| 777 | if (timer_pending(&(tz->timer))) |
| 778 | del_timer(&(tz->timer)); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 779 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 780 | if (timer_pending(&(tz->timer))) |
Andrew Morton | 94e22e1 | 2007-04-23 14:41:13 -0700 | [diff] [blame] | 781 | mod_timer(&(tz->timer), |
| 782 | jiffies + (HZ * sleep_time) / 1000); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 783 | else { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 784 | tz->timer.data = (unsigned long)tz; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 785 | tz->timer.function = acpi_thermal_run; |
| 786 | tz->timer.expires = jiffies + (HZ * sleep_time) / 1000; |
| 787 | add_timer(&(tz->timer)); |
| 788 | } |
| 789 | } |
| 790 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 791 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 792 | } |
| 793 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 794 | /* -------------------------------------------------------------------------- |
| 795 | FS Interface (/proc) |
| 796 | -------------------------------------------------------------------------- */ |
| 797 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 798 | static struct proc_dir_entry *acpi_thermal_dir; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 799 | |
| 800 | static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) |
| 801 | { |
Jan Engelhardt | 50dd096 | 2006-10-01 00:28:50 +0200 | [diff] [blame] | 802 | struct acpi_thermal *tz = seq->private; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 803 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 804 | |
| 805 | if (!tz) |
| 806 | goto end; |
| 807 | |
| 808 | seq_puts(seq, "state: "); |
| 809 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 810 | if (!tz->state.critical && !tz->state.hot && !tz->state.passive |
| 811 | && !tz->state.active) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 812 | seq_puts(seq, "ok\n"); |
| 813 | else { |
| 814 | if (tz->state.critical) |
| 815 | seq_puts(seq, "critical "); |
| 816 | if (tz->state.hot) |
| 817 | seq_puts(seq, "hot "); |
| 818 | if (tz->state.passive) |
| 819 | seq_puts(seq, "passive "); |
| 820 | if (tz->state.active) |
| 821 | seq_printf(seq, "active[%d]", tz->state.active_index); |
| 822 | seq_puts(seq, "\n"); |
| 823 | } |
| 824 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 825 | end: |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 826 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 827 | } |
| 828 | |
| 829 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file) |
| 830 | { |
| 831 | return single_open(file, acpi_thermal_state_seq_show, PDE(inode)->data); |
| 832 | } |
| 833 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 834 | static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) |
| 835 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 836 | int result = 0; |
Jan Engelhardt | 50dd096 | 2006-10-01 00:28:50 +0200 | [diff] [blame] | 837 | struct acpi_thermal *tz = seq->private; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 838 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 839 | |
| 840 | if (!tz) |
| 841 | goto end; |
| 842 | |
| 843 | result = acpi_thermal_get_temperature(tz); |
| 844 | if (result) |
| 845 | goto end; |
| 846 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 847 | seq_printf(seq, "temperature: %ld C\n", |
| 848 | KELVIN_TO_CELSIUS(tz->temperature)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 849 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 850 | end: |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 851 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 852 | } |
| 853 | |
| 854 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file) |
| 855 | { |
| 856 | return single_open(file, acpi_thermal_temp_seq_show, PDE(inode)->data); |
| 857 | } |
| 858 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 859 | static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) |
| 860 | { |
Jan Engelhardt | 50dd096 | 2006-10-01 00:28:50 +0200 | [diff] [blame] | 861 | struct acpi_thermal *tz = seq->private; |
Thomas Renninger | 68ccfaa | 2006-11-19 23:01:40 +0100 | [diff] [blame] | 862 | struct acpi_device *device; |
Thomas Renninger | e7c746e | 2007-06-18 00:40:51 -0400 | [diff] [blame] | 863 | acpi_status status; |
| 864 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 865 | int i = 0; |
| 866 | int j = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 867 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 868 | |
| 869 | if (!tz) |
| 870 | goto end; |
| 871 | |
| 872 | if (tz->trips.critical.flags.valid) |
Len Brown | f548714 | 2007-08-12 00:12:44 -0400 | [diff] [blame] | 873 | seq_printf(seq, "critical (S5): %ld C%s", |
| 874 | KELVIN_TO_CELSIUS(tz->trips.critical.temperature), |
| 875 | nocrt ? " <disabled>\n" : "\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 876 | |
| 877 | if (tz->trips.hot.flags.valid) |
Len Brown | f548714 | 2007-08-12 00:12:44 -0400 | [diff] [blame] | 878 | seq_printf(seq, "hot (S4): %ld C%s", |
| 879 | KELVIN_TO_CELSIUS(tz->trips.hot.temperature), |
| 880 | nocrt ? " <disabled>\n" : "\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 881 | |
| 882 | if (tz->trips.passive.flags.valid) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 883 | seq_printf(seq, |
| 884 | "passive: %ld C: tc1=%lu tc2=%lu tsp=%lu devices=", |
| 885 | KELVIN_TO_CELSIUS(tz->trips.passive.temperature), |
| 886 | tz->trips.passive.tc1, tz->trips.passive.tc2, |
| 887 | tz->trips.passive.tsp); |
| 888 | for (j = 0; j < tz->trips.passive.devices.count; j++) { |
Thomas Renninger | e7c746e | 2007-06-18 00:40:51 -0400 | [diff] [blame] | 889 | status = acpi_bus_get_device(tz->trips.passive.devices. |
| 890 | handles[j], &device); |
| 891 | seq_printf(seq, "%4.4s ", status ? "" : |
| 892 | acpi_device_bid(device)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 893 | } |
| 894 | seq_puts(seq, "\n"); |
| 895 | } |
| 896 | |
| 897 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { |
| 898 | if (!(tz->trips.active[i].flags.valid)) |
| 899 | break; |
| 900 | seq_printf(seq, "active[%d]: %ld C: devices=", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 901 | i, |
| 902 | KELVIN_TO_CELSIUS(tz->trips.active[i].temperature)); |
Thomas Renninger | 68ccfaa | 2006-11-19 23:01:40 +0100 | [diff] [blame] | 903 | for (j = 0; j < tz->trips.active[i].devices.count; j++){ |
Thomas Renninger | e7c746e | 2007-06-18 00:40:51 -0400 | [diff] [blame] | 904 | status = acpi_bus_get_device(tz->trips.active[i]. |
| 905 | devices.handles[j], |
| 906 | &device); |
| 907 | seq_printf(seq, "%4.4s ", status ? "" : |
| 908 | acpi_device_bid(device)); |
Thomas Renninger | 68ccfaa | 2006-11-19 23:01:40 +0100 | [diff] [blame] | 909 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 910 | seq_puts(seq, "\n"); |
| 911 | } |
| 912 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 913 | end: |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 914 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 915 | } |
| 916 | |
| 917 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file) |
| 918 | { |
| 919 | return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data); |
| 920 | } |
| 921 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 922 | static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) |
| 923 | { |
Jan Engelhardt | 50dd096 | 2006-10-01 00:28:50 +0200 | [diff] [blame] | 924 | struct acpi_thermal *tz = seq->private; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 925 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 926 | |
| 927 | if (!tz) |
| 928 | goto end; |
| 929 | |
Len Brown | eaca2d3 | 2007-04-30 23:27:43 -0400 | [diff] [blame] | 930 | if (!tz->flags.cooling_mode) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 931 | seq_puts(seq, "<setting not supported>\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 932 | else |
Len Brown | eaca2d3 | 2007-04-30 23:27:43 -0400 | [diff] [blame] | 933 | seq_puts(seq, "0 - Active; 1 - Passive\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 934 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 935 | end: |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 936 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 937 | } |
| 938 | |
| 939 | static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file) |
| 940 | { |
| 941 | return single_open(file, acpi_thermal_cooling_seq_show, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 942 | PDE(inode)->data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 943 | } |
| 944 | |
| 945 | static ssize_t |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 946 | acpi_thermal_write_cooling_mode(struct file *file, |
| 947 | const char __user * buffer, |
| 948 | size_t count, loff_t * ppos) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 949 | { |
Jan Engelhardt | 50dd096 | 2006-10-01 00:28:50 +0200 | [diff] [blame] | 950 | struct seq_file *m = file->private_data; |
| 951 | struct acpi_thermal *tz = m->private; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 952 | int result = 0; |
| 953 | char mode_string[12] = { '\0' }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 954 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 955 | |
| 956 | if (!tz || (count > sizeof(mode_string) - 1)) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 957 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 958 | |
| 959 | if (!tz->flags.cooling_mode) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 960 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 961 | |
| 962 | if (copy_from_user(mode_string, buffer, count)) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 963 | return -EFAULT; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 964 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 965 | mode_string[count] = '\0'; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 966 | |
| 967 | result = acpi_thermal_set_cooling_mode(tz, |
| 968 | simple_strtoul(mode_string, NULL, |
| 969 | 0)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 970 | if (result) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 971 | return result; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 972 | |
| 973 | acpi_thermal_check(tz); |
| 974 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 975 | return count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 976 | } |
| 977 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 978 | static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) |
| 979 | { |
Jan Engelhardt | 50dd096 | 2006-10-01 00:28:50 +0200 | [diff] [blame] | 980 | struct acpi_thermal *tz = seq->private; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 981 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 982 | |
| 983 | if (!tz) |
| 984 | goto end; |
| 985 | |
| 986 | if (!tz->polling_frequency) { |
| 987 | seq_puts(seq, "<polling disabled>\n"); |
| 988 | goto end; |
| 989 | } |
| 990 | |
| 991 | seq_printf(seq, "polling frequency: %lu seconds\n", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 992 | (tz->polling_frequency / 10)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 993 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 994 | end: |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 995 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 996 | } |
| 997 | |
| 998 | static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file) |
| 999 | { |
| 1000 | return single_open(file, acpi_thermal_polling_seq_show, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1001 | PDE(inode)->data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1002 | } |
| 1003 | |
| 1004 | static ssize_t |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1005 | acpi_thermal_write_polling(struct file *file, |
| 1006 | const char __user * buffer, |
| 1007 | size_t count, loff_t * ppos) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1008 | { |
Jan Engelhardt | 50dd096 | 2006-10-01 00:28:50 +0200 | [diff] [blame] | 1009 | struct seq_file *m = file->private_data; |
| 1010 | struct acpi_thermal *tz = m->private; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1011 | int result = 0; |
| 1012 | char polling_string[12] = { '\0' }; |
| 1013 | int seconds = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1014 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1015 | |
| 1016 | if (!tz || (count > sizeof(polling_string) - 1)) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1017 | return -EINVAL; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1018 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1019 | if (copy_from_user(polling_string, buffer, count)) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1020 | return -EFAULT; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1021 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1022 | polling_string[count] = '\0'; |
| 1023 | |
| 1024 | seconds = simple_strtoul(polling_string, NULL, 0); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1025 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1026 | result = acpi_thermal_set_polling(tz, seconds); |
| 1027 | if (result) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1028 | return result; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1029 | |
| 1030 | acpi_thermal_check(tz); |
| 1031 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1032 | return count; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1033 | } |
| 1034 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1035 | static int acpi_thermal_add_fs(struct acpi_device *device) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1036 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1037 | struct proc_dir_entry *entry = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1038 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1039 | |
| 1040 | if (!acpi_device_dir(device)) { |
| 1041 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1042 | acpi_thermal_dir); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1043 | if (!acpi_device_dir(device)) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1044 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1045 | acpi_device_dir(device)->owner = THIS_MODULE; |
| 1046 | } |
| 1047 | |
| 1048 | /* 'state' [R] */ |
| 1049 | entry = create_proc_entry(ACPI_THERMAL_FILE_STATE, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1050 | S_IRUGO, acpi_device_dir(device)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1051 | if (!entry) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1052 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1053 | else { |
| 1054 | entry->proc_fops = &acpi_thermal_state_fops; |
| 1055 | entry->data = acpi_driver_data(device); |
| 1056 | entry->owner = THIS_MODULE; |
| 1057 | } |
| 1058 | |
| 1059 | /* 'temperature' [R] */ |
| 1060 | entry = create_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1061 | S_IRUGO, acpi_device_dir(device)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1062 | if (!entry) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1063 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1064 | else { |
| 1065 | entry->proc_fops = &acpi_thermal_temp_fops; |
| 1066 | entry->data = acpi_driver_data(device); |
| 1067 | entry->owner = THIS_MODULE; |
| 1068 | } |
| 1069 | |
| 1070 | /* 'trip_points' [R/W] */ |
| 1071 | entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1072 | S_IFREG | S_IRUGO | S_IWUSR, |
| 1073 | acpi_device_dir(device)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1074 | if (!entry) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1075 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1076 | else { |
| 1077 | entry->proc_fops = &acpi_thermal_trip_fops; |
| 1078 | entry->data = acpi_driver_data(device); |
| 1079 | entry->owner = THIS_MODULE; |
| 1080 | } |
| 1081 | |
| 1082 | /* 'cooling_mode' [R/W] */ |
| 1083 | entry = create_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1084 | S_IFREG | S_IRUGO | S_IWUSR, |
| 1085 | acpi_device_dir(device)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1086 | if (!entry) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1087 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1088 | else { |
| 1089 | entry->proc_fops = &acpi_thermal_cooling_fops; |
| 1090 | entry->data = acpi_driver_data(device); |
| 1091 | entry->owner = THIS_MODULE; |
| 1092 | } |
| 1093 | |
| 1094 | /* 'polling_frequency' [R/W] */ |
| 1095 | entry = create_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1096 | S_IFREG | S_IRUGO | S_IWUSR, |
| 1097 | acpi_device_dir(device)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1098 | if (!entry) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1099 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1100 | else { |
| 1101 | entry->proc_fops = &acpi_thermal_polling_fops; |
| 1102 | entry->data = acpi_driver_data(device); |
| 1103 | entry->owner = THIS_MODULE; |
| 1104 | } |
| 1105 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1106 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1107 | } |
| 1108 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1109 | static int acpi_thermal_remove_fs(struct acpi_device *device) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1110 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1111 | |
| 1112 | if (acpi_device_dir(device)) { |
| 1113 | remove_proc_entry(ACPI_THERMAL_FILE_POLLING_FREQ, |
| 1114 | acpi_device_dir(device)); |
| 1115 | remove_proc_entry(ACPI_THERMAL_FILE_COOLING_MODE, |
| 1116 | acpi_device_dir(device)); |
| 1117 | remove_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, |
| 1118 | acpi_device_dir(device)); |
| 1119 | remove_proc_entry(ACPI_THERMAL_FILE_TEMPERATURE, |
| 1120 | acpi_device_dir(device)); |
| 1121 | remove_proc_entry(ACPI_THERMAL_FILE_STATE, |
| 1122 | acpi_device_dir(device)); |
| 1123 | remove_proc_entry(acpi_device_bid(device), acpi_thermal_dir); |
| 1124 | acpi_device_dir(device) = NULL; |
| 1125 | } |
| 1126 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1127 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1128 | } |
| 1129 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1130 | /* -------------------------------------------------------------------------- |
| 1131 | Driver Interface |
| 1132 | -------------------------------------------------------------------------- */ |
| 1133 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1134 | static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1135 | { |
Jan Engelhardt | 50dd096 | 2006-10-01 00:28:50 +0200 | [diff] [blame] | 1136 | struct acpi_thermal *tz = data; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1137 | struct acpi_device *device = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1138 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1139 | |
| 1140 | if (!tz) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1141 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1142 | |
Patrick Mochel | 8348e1b | 2006-05-19 16:54:40 -0400 | [diff] [blame] | 1143 | device = tz->device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1144 | |
| 1145 | switch (event) { |
| 1146 | case ACPI_THERMAL_NOTIFY_TEMPERATURE: |
| 1147 | acpi_thermal_check(tz); |
| 1148 | break; |
| 1149 | case ACPI_THERMAL_NOTIFY_THRESHOLDS: |
| 1150 | acpi_thermal_get_trip_points(tz); |
| 1151 | acpi_thermal_check(tz); |
| 1152 | acpi_bus_generate_event(device, event, 0); |
| 1153 | break; |
| 1154 | case ACPI_THERMAL_NOTIFY_DEVICES: |
| 1155 | if (tz->flags.devices) |
| 1156 | acpi_thermal_get_devices(tz); |
| 1157 | acpi_bus_generate_event(device, event, 0); |
| 1158 | break; |
| 1159 | default: |
| 1160 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1161 | "Unsupported event [0x%x]\n", event)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1162 | break; |
| 1163 | } |
| 1164 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1165 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1166 | } |
| 1167 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1168 | static int acpi_thermal_get_info(struct acpi_thermal *tz) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1169 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1170 | int result = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1171 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1172 | |
| 1173 | if (!tz) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1174 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1175 | |
| 1176 | /* Get temperature [_TMP] (required) */ |
| 1177 | result = acpi_thermal_get_temperature(tz); |
| 1178 | if (result) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1179 | return result; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1180 | |
| 1181 | /* Get trip points [_CRT, _PSV, etc.] (required) */ |
| 1182 | result = acpi_thermal_get_trip_points(tz); |
| 1183 | if (result) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1184 | return result; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1185 | |
| 1186 | /* Set the cooling mode [_SCP] to active cooling (default) */ |
| 1187 | result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1188 | if (!result) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1189 | tz->flags.cooling_mode = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1190 | |
| 1191 | /* Get default polling frequency [_TZP] (optional) */ |
| 1192 | if (tzp) |
| 1193 | tz->polling_frequency = tzp; |
| 1194 | else |
| 1195 | acpi_thermal_get_polling_frequency(tz); |
| 1196 | |
| 1197 | /* Get devices in this thermal zone [_TZD] (optional) */ |
| 1198 | result = acpi_thermal_get_devices(tz); |
| 1199 | if (!result) |
| 1200 | tz->flags.devices = 1; |
| 1201 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1202 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1203 | } |
| 1204 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1205 | static int acpi_thermal_add(struct acpi_device *device) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1206 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1207 | int result = 0; |
| 1208 | acpi_status status = AE_OK; |
| 1209 | struct acpi_thermal *tz = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1210 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1211 | |
| 1212 | if (!device) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1213 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1214 | |
Burman Yan | 36bcbec | 2006-12-19 12:56:11 -0800 | [diff] [blame] | 1215 | tz = kzalloc(sizeof(struct acpi_thermal), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1216 | if (!tz) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1217 | return -ENOMEM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1218 | |
Patrick Mochel | 8348e1b | 2006-05-19 16:54:40 -0400 | [diff] [blame] | 1219 | tz->device = device; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1220 | strcpy(tz->name, device->pnp.bus_id); |
| 1221 | strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); |
| 1222 | strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); |
| 1223 | acpi_driver_data(device) = tz; |
| 1224 | |
| 1225 | result = acpi_thermal_get_info(tz); |
| 1226 | if (result) |
| 1227 | goto end; |
| 1228 | |
| 1229 | result = acpi_thermal_add_fs(device); |
| 1230 | if (result) |
Vasily Averin | 09047e7 | 2006-04-27 05:25:00 -0400 | [diff] [blame] | 1231 | goto end; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1232 | |
| 1233 | init_timer(&tz->timer); |
| 1234 | |
| 1235 | acpi_thermal_check(tz); |
| 1236 | |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 1237 | status = acpi_install_notify_handler(device->handle, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1238 | ACPI_DEVICE_NOTIFY, |
| 1239 | acpi_thermal_notify, tz); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1240 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1241 | result = -ENODEV; |
| 1242 | goto end; |
| 1243 | } |
| 1244 | |
| 1245 | printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1246 | acpi_device_name(device), acpi_device_bid(device), |
| 1247 | KELVIN_TO_CELSIUS(tz->temperature)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1248 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1249 | end: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1250 | if (result) { |
| 1251 | acpi_thermal_remove_fs(device); |
| 1252 | kfree(tz); |
| 1253 | } |
| 1254 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1255 | return result; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1256 | } |
| 1257 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1258 | static int acpi_thermal_remove(struct acpi_device *device, int type) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1259 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1260 | acpi_status status = AE_OK; |
| 1261 | struct acpi_thermal *tz = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1262 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1263 | |
| 1264 | if (!device || !acpi_driver_data(device)) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1265 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1266 | |
Jan Engelhardt | 50dd096 | 2006-10-01 00:28:50 +0200 | [diff] [blame] | 1267 | tz = acpi_driver_data(device); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1268 | |
| 1269 | /* avoid timer adding new defer task */ |
| 1270 | tz->zombie = 1; |
| 1271 | /* wait for running timer (on other CPUs) finish */ |
| 1272 | del_timer_sync(&(tz->timer)); |
| 1273 | /* synchronize deferred task */ |
| 1274 | acpi_os_wait_events_complete(NULL); |
| 1275 | /* deferred task may reinsert timer */ |
| 1276 | del_timer_sync(&(tz->timer)); |
| 1277 | |
Patrick Mochel | 38ba7c9 | 2006-05-19 16:54:48 -0400 | [diff] [blame] | 1278 | status = acpi_remove_notify_handler(device->handle, |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1279 | ACPI_DEVICE_NOTIFY, |
| 1280 | acpi_thermal_notify); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1281 | |
| 1282 | /* Terminate policy */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1283 | if (tz->trips.passive.flags.valid && tz->trips.passive.flags.enabled) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1284 | tz->trips.passive.flags.enabled = 0; |
| 1285 | acpi_thermal_passive(tz); |
| 1286 | } |
| 1287 | if (tz->trips.active[0].flags.valid |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1288 | && tz->trips.active[0].flags.enabled) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1289 | tz->trips.active[0].flags.enabled = 0; |
| 1290 | acpi_thermal_active(tz); |
| 1291 | } |
| 1292 | |
| 1293 | acpi_thermal_remove_fs(device); |
| 1294 | |
| 1295 | kfree(tz); |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1296 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1297 | } |
| 1298 | |
Patrick Mochel | 5d9464a | 2006-12-07 20:56:27 +0800 | [diff] [blame] | 1299 | static int acpi_thermal_resume(struct acpi_device *device) |
Konstantin Karasyov | 74ce1468 | 2006-05-08 08:32:00 -0400 | [diff] [blame] | 1300 | { |
| 1301 | struct acpi_thermal *tz = NULL; |
Konstantin Karasyov | b1028c5 | 2007-02-16 02:23:07 -0500 | [diff] [blame] | 1302 | int i, j, power_state, result; |
| 1303 | |
Konstantin Karasyov | 74ce1468 | 2006-05-08 08:32:00 -0400 | [diff] [blame] | 1304 | |
| 1305 | if (!device || !acpi_driver_data(device)) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1306 | return -EINVAL; |
Konstantin Karasyov | 74ce1468 | 2006-05-08 08:32:00 -0400 | [diff] [blame] | 1307 | |
Jan Engelhardt | 50dd096 | 2006-10-01 00:28:50 +0200 | [diff] [blame] | 1308 | tz = acpi_driver_data(device); |
Konstantin Karasyov | 74ce1468 | 2006-05-08 08:32:00 -0400 | [diff] [blame] | 1309 | |
Konstantin Karasyov | bed936f | 2006-07-10 04:44:26 -0700 | [diff] [blame] | 1310 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { |
Konstantin Karasyov | b1028c5 | 2007-02-16 02:23:07 -0500 | [diff] [blame] | 1311 | if (!(&tz->trips.active[i])) |
| 1312 | break; |
| 1313 | if (!tz->trips.active[i].flags.valid) |
| 1314 | break; |
| 1315 | tz->trips.active[i].flags.enabled = 1; |
| 1316 | for (j = 0; j < tz->trips.active[i].devices.count; j++) { |
| 1317 | result = acpi_bus_get_power(tz->trips.active[i].devices. |
| 1318 | handles[j], &power_state); |
| 1319 | if (result || (power_state != ACPI_STATE_D0)) { |
| 1320 | tz->trips.active[i].flags.enabled = 0; |
| 1321 | break; |
| 1322 | } |
Konstantin Karasyov | bed936f | 2006-07-10 04:44:26 -0700 | [diff] [blame] | 1323 | } |
Konstantin Karasyov | b1028c5 | 2007-02-16 02:23:07 -0500 | [diff] [blame] | 1324 | tz->state.active |= tz->trips.active[i].flags.enabled; |
Konstantin Karasyov | bed936f | 2006-07-10 04:44:26 -0700 | [diff] [blame] | 1325 | } |
| 1326 | |
Konstantin Karasyov | b1028c5 | 2007-02-16 02:23:07 -0500 | [diff] [blame] | 1327 | acpi_thermal_check(tz); |
Konstantin Karasyov | 74ce1468 | 2006-05-08 08:32:00 -0400 | [diff] [blame] | 1328 | |
| 1329 | return AE_OK; |
| 1330 | } |
| 1331 | |
Len Brown | 0b5bfa1 | 2007-08-12 00:13:02 -0400 | [diff] [blame] | 1332 | #ifdef CONFIG_DMI |
| 1333 | static int thermal_act(struct dmi_system_id *d) { |
| 1334 | |
| 1335 | if (act == 0) { |
| 1336 | printk(KERN_NOTICE "ACPI: %s detected: " |
| 1337 | "disabling all active thermal trip points\n", d->ident); |
| 1338 | act = -1; |
| 1339 | } |
| 1340 | return 0; |
| 1341 | } |
| 1342 | static int thermal_tzp(struct dmi_system_id *d) { |
| 1343 | |
| 1344 | if (tzp == 0) { |
| 1345 | printk(KERN_NOTICE "ACPI: %s detected: " |
| 1346 | "enabling thermal zone polling\n", d->ident); |
| 1347 | tzp = 300; /* 300 dS = 30 Seconds */ |
| 1348 | } |
| 1349 | return 0; |
| 1350 | } |
| 1351 | static int thermal_psv(struct dmi_system_id *d) { |
| 1352 | |
| 1353 | if (psv == 0) { |
| 1354 | printk(KERN_NOTICE "ACPI: %s detected: " |
| 1355 | "disabling all passive thermal trip points\n", d->ident); |
| 1356 | psv = -1; |
| 1357 | } |
| 1358 | return 0; |
| 1359 | } |
| 1360 | |
| 1361 | static struct dmi_system_id thermal_dmi_table[] __initdata = { |
| 1362 | /* |
| 1363 | * Award BIOS on this AOpen makes thermal control almost worthless. |
| 1364 | * http://bugzilla.kernel.org/show_bug.cgi?id=8842 |
| 1365 | */ |
| 1366 | { |
| 1367 | .callback = thermal_act, |
| 1368 | .ident = "AOpen i915GMm-HFS", |
| 1369 | .matches = { |
| 1370 | DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"), |
| 1371 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), |
| 1372 | }, |
| 1373 | }, |
| 1374 | { |
| 1375 | .callback = thermal_psv, |
| 1376 | .ident = "AOpen i915GMm-HFS", |
| 1377 | .matches = { |
| 1378 | DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"), |
| 1379 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), |
| 1380 | }, |
| 1381 | }, |
| 1382 | { |
| 1383 | .callback = thermal_tzp, |
| 1384 | .ident = "AOpen i915GMm-HFS", |
| 1385 | .matches = { |
| 1386 | DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"), |
| 1387 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), |
| 1388 | }, |
| 1389 | }, |
| 1390 | {} |
| 1391 | }; |
| 1392 | #endif /* CONFIG_DMI */ |
| 1393 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1394 | static int __init acpi_thermal_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1395 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1396 | int result = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1397 | |
Len Brown | 0b5bfa1 | 2007-08-12 00:13:02 -0400 | [diff] [blame] | 1398 | dmi_check_system(thermal_dmi_table); |
| 1399 | |
Len Brown | 72b33ef | 2007-08-12 00:12:17 -0400 | [diff] [blame] | 1400 | if (off) { |
| 1401 | printk(KERN_NOTICE "ACPI: thermal control disabled\n"); |
| 1402 | return -ENODEV; |
| 1403 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1404 | acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir); |
| 1405 | if (!acpi_thermal_dir) |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1406 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1407 | acpi_thermal_dir->owner = THIS_MODULE; |
| 1408 | |
| 1409 | result = acpi_bus_register_driver(&acpi_thermal_driver); |
| 1410 | if (result < 0) { |
| 1411 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1412 | return -ENODEV; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1413 | } |
| 1414 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1415 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1416 | } |
| 1417 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 1418 | static void __exit acpi_thermal_exit(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1419 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1420 | |
| 1421 | acpi_bus_unregister_driver(&acpi_thermal_driver); |
| 1422 | |
| 1423 | remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir); |
| 1424 | |
Patrick Mochel | d550d98 | 2006-06-27 00:41:40 -0400 | [diff] [blame] | 1425 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1426 | } |
| 1427 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1428 | module_init(acpi_thermal_init); |
| 1429 | module_exit(acpi_thermal_exit); |