diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/hwsleep.c | 43 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwvalid.c | 86 | ||||
-rw-r--r-- | drivers/acpi/acpica/rscreate.c | 27 | ||||
-rw-r--r-- | drivers/acpi/button.c | 140 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 1 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 4 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 28 | ||||
-rw-r--r-- | drivers/acpi/sleep.c | 35 | ||||
-rw-r--r-- | drivers/acpi/system.c | 11 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 2 | ||||
-rw-r--r-- | drivers/acpi/video.c | 51 |
11 files changed, 228 insertions, 200 deletions
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index baa5fc05e124..db307a356f08 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
@@ -211,6 +211,12 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | |||
211 | 211 | ||
212 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) | 212 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) |
213 | 213 | ||
214 | static unsigned int gts, bfs; | ||
215 | module_param(gts, uint, 0644); | ||
216 | module_param(bfs, uint, 0644); | ||
217 | MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | ||
218 | MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | ||
219 | |||
214 | /******************************************************************************* | 220 | /******************************************************************************* |
215 | * | 221 | * |
216 | * FUNCTION: acpi_enter_sleep_state | 222 | * FUNCTION: acpi_enter_sleep_state |
@@ -278,16 +284,18 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | |||
278 | return_ACPI_STATUS(status); | 284 | return_ACPI_STATUS(status); |
279 | } | 285 | } |
280 | 286 | ||
281 | /* Execute the _GTS method */ | 287 | if (gts) { |
288 | /* Execute the _GTS method */ | ||
282 | 289 | ||
283 | arg_list.count = 1; | 290 | arg_list.count = 1; |
284 | arg_list.pointer = &arg; | 291 | arg_list.pointer = &arg; |
285 | arg.type = ACPI_TYPE_INTEGER; | 292 | arg.type = ACPI_TYPE_INTEGER; |
286 | arg.integer.value = sleep_state; | 293 | arg.integer.value = sleep_state; |
287 | 294 | ||
288 | status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL); | 295 | status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL); |
289 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 296 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
290 | return_ACPI_STATUS(status); | 297 | return_ACPI_STATUS(status); |
298 | } | ||
291 | } | 299 | } |
292 | 300 | ||
293 | /* Get current value of PM1A control */ | 301 | /* Get current value of PM1A control */ |
@@ -513,18 +521,19 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state) | |||
513 | } | 521 | } |
514 | } | 522 | } |
515 | 523 | ||
516 | /* Execute the _BFS method */ | 524 | if (bfs) { |
525 | /* Execute the _BFS method */ | ||
517 | 526 | ||
518 | arg_list.count = 1; | 527 | arg_list.count = 1; |
519 | arg_list.pointer = &arg; | 528 | arg_list.pointer = &arg; |
520 | arg.type = ACPI_TYPE_INTEGER; | 529 | arg.type = ACPI_TYPE_INTEGER; |
521 | arg.integer.value = sleep_state; | 530 | arg.integer.value = sleep_state; |
522 | 531 | ||
523 | status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL); | 532 | status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL); |
524 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 533 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
525 | ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); | 534 | ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); |
535 | } | ||
526 | } | 536 | } |
527 | |||
528 | return_ACPI_STATUS(status); | 537 | return_ACPI_STATUS(status); |
529 | } | 538 | } |
530 | 539 | ||
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c index 7737afb157c3..ec33f270c5b7 100644 --- a/drivers/acpi/acpica/hwvalid.c +++ b/drivers/acpi/acpica/hwvalid.c | |||
@@ -90,6 +90,7 @@ static const struct acpi_port_info acpi_protected_ports[] = { | |||
90 | {"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP}, | 90 | {"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP}, |
91 | {"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP}, | 91 | {"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP}, |
92 | {"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP}, | 92 | {"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP}, |
93 | {"DMA1", 0x0081, 0x0083, ACPI_OSI_WIN_XP}, | ||
93 | {"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP}, | 94 | {"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP}, |
94 | {"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP}, | 95 | {"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP}, |
95 | {"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP}, | 96 | {"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP}, |
@@ -151,7 +152,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) | |||
151 | ACPI_ERROR((AE_INFO, | 152 | ACPI_ERROR((AE_INFO, |
152 | "Illegal I/O port address/length above 64K: 0x%p/%X", | 153 | "Illegal I/O port address/length above 64K: 0x%p/%X", |
153 | ACPI_CAST_PTR(void, address), byte_width)); | 154 | ACPI_CAST_PTR(void, address), byte_width)); |
154 | return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS); | 155 | return_ACPI_STATUS(AE_LIMIT); |
155 | } | 156 | } |
156 | 157 | ||
157 | /* Exit if requested address is not within the protected port table */ | 158 | /* Exit if requested address is not within the protected port table */ |
@@ -178,11 +179,12 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) | |||
178 | /* Port illegality may depend on the _OSI calls made by the BIOS */ | 179 | /* Port illegality may depend on the _OSI calls made by the BIOS */ |
179 | 180 | ||
180 | if (acpi_gbl_osi_data >= port_info->osi_dependency) { | 181 | if (acpi_gbl_osi_data >= port_info->osi_dependency) { |
181 | ACPI_ERROR((AE_INFO, | 182 | ACPI_DEBUG_PRINT((ACPI_DB_IO, |
182 | "Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)", | 183 | "Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)", |
183 | ACPI_CAST_PTR(void, address), | 184 | ACPI_CAST_PTR(void, address), |
184 | byte_width, port_info->name, | 185 | byte_width, port_info->name, |
185 | port_info->start, port_info->end)); | 186 | port_info->start, |
187 | port_info->end)); | ||
186 | 188 | ||
187 | return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS); | 189 | return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS); |
188 | } | 190 | } |
@@ -206,7 +208,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) | |||
206 | * Value Where value is placed | 208 | * Value Where value is placed |
207 | * Width Number of bits | 209 | * Width Number of bits |
208 | * | 210 | * |
209 | * RETURN: Value read from port | 211 | * RETURN: Status and value read from port |
210 | * | 212 | * |
211 | * DESCRIPTION: Read data from an I/O port or register. This is a front-end | 213 | * DESCRIPTION: Read data from an I/O port or register. This is a front-end |
212 | * to acpi_os_read_port that performs validation on both the port | 214 | * to acpi_os_read_port that performs validation on both the port |
@@ -217,14 +219,43 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) | |||
217 | acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) | 219 | acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) |
218 | { | 220 | { |
219 | acpi_status status; | 221 | acpi_status status; |
222 | u32 one_byte; | ||
223 | u32 i; | ||
224 | |||
225 | /* Validate the entire request and perform the I/O */ | ||
220 | 226 | ||
221 | status = acpi_hw_validate_io_request(address, width); | 227 | status = acpi_hw_validate_io_request(address, width); |
222 | if (ACPI_FAILURE(status)) { | 228 | if (ACPI_SUCCESS(status)) { |
229 | status = acpi_os_read_port(address, value, width); | ||
223 | return status; | 230 | return status; |
224 | } | 231 | } |
225 | 232 | ||
226 | status = acpi_os_read_port(address, value, width); | 233 | if (status != AE_AML_ILLEGAL_ADDRESS) { |
227 | return status; | 234 | return status; |
235 | } | ||
236 | |||
237 | /* | ||
238 | * There has been a protection violation within the request. Fall | ||
239 | * back to byte granularity port I/O and ignore the failing bytes. | ||
240 | * This provides Windows compatibility. | ||
241 | */ | ||
242 | for (i = 0, *value = 0; i < width; i += 8) { | ||
243 | |||
244 | /* Validate and read one byte */ | ||
245 | |||
246 | if (acpi_hw_validate_io_request(address, 8) == AE_OK) { | ||
247 | status = acpi_os_read_port(address, &one_byte, 8); | ||
248 | if (ACPI_FAILURE(status)) { | ||
249 | return status; | ||
250 | } | ||
251 | |||
252 | *value |= (one_byte << i); | ||
253 | } | ||
254 | |||
255 | address++; | ||
256 | } | ||
257 | |||
258 | return AE_OK; | ||
228 | } | 259 | } |
229 | 260 | ||
230 | /****************************************************************************** | 261 | /****************************************************************************** |
@@ -235,7 +266,7 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) | |||
235 | * Value Value to write | 266 | * Value Value to write |
236 | * Width Number of bits | 267 | * Width Number of bits |
237 | * | 268 | * |
238 | * RETURN: None | 269 | * RETURN: Status |
239 | * | 270 | * |
240 | * DESCRIPTION: Write data to an I/O port or register. This is a front-end | 271 | * DESCRIPTION: Write data to an I/O port or register. This is a front-end |
241 | * to acpi_os_write_port that performs validation on both the port | 272 | * to acpi_os_write_port that performs validation on both the port |
@@ -246,12 +277,39 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width) | |||
246 | acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width) | 277 | acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width) |
247 | { | 278 | { |
248 | acpi_status status; | 279 | acpi_status status; |
280 | u32 i; | ||
281 | |||
282 | /* Validate the entire request and perform the I/O */ | ||
249 | 283 | ||
250 | status = acpi_hw_validate_io_request(address, width); | 284 | status = acpi_hw_validate_io_request(address, width); |
251 | if (ACPI_FAILURE(status)) { | 285 | if (ACPI_SUCCESS(status)) { |
286 | status = acpi_os_write_port(address, value, width); | ||
252 | return status; | 287 | return status; |
253 | } | 288 | } |
254 | 289 | ||
255 | status = acpi_os_write_port(address, value, width); | 290 | if (status != AE_AML_ILLEGAL_ADDRESS) { |
256 | return status; | 291 | return status; |
292 | } | ||
293 | |||
294 | /* | ||
295 | * There has been a protection violation within the request. Fall | ||
296 | * back to byte granularity port I/O and ignore the failing bytes. | ||
297 | * This provides Windows compatibility. | ||
298 | */ | ||
299 | for (i = 0; i < width; i += 8) { | ||
300 | |||
301 | /* Validate and write one byte */ | ||
302 | |||
303 | if (acpi_hw_validate_io_request(address, 8) == AE_OK) { | ||
304 | status = | ||
305 | acpi_os_write_port(address, (value >> i) & 0xFF, 8); | ||
306 | if (ACPI_FAILURE(status)) { | ||
307 | return status; | ||
308 | } | ||
309 | } | ||
310 | |||
311 | address++; | ||
312 | } | ||
313 | |||
314 | return AE_OK; | ||
257 | } | 315 | } |
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index 663f692fffcf..a3c23d686d5f 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
@@ -191,8 +191,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
191 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); | 191 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); |
192 | 192 | ||
193 | for (index = 0; index < number_of_elements; index++) { | 193 | for (index = 0; index < number_of_elements; index++) { |
194 | int source_name_index = 2; | ||
195 | int source_index_index = 3; | ||
196 | 194 | ||
197 | /* | 195 | /* |
198 | * Point user_prt past this current structure | 196 | * Point user_prt past this current structure |
@@ -261,27 +259,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
261 | return_ACPI_STATUS(AE_BAD_DATA); | 259 | return_ACPI_STATUS(AE_BAD_DATA); |
262 | } | 260 | } |
263 | 261 | ||
264 | /* | ||
265 | * If BIOS erroneously reversed the _PRT source_name and source_index, | ||
266 | * then reverse them back. | ||
267 | */ | ||
268 | if ((sub_object_list[3])->common.type != | ||
269 | ACPI_TYPE_INTEGER) { | ||
270 | if (acpi_gbl_enable_interpreter_slack) { | ||
271 | source_name_index = 3; | ||
272 | source_index_index = 2; | ||
273 | printk(KERN_WARNING | ||
274 | "ACPI: Handling Garbled _PRT entry\n"); | ||
275 | } else { | ||
276 | ACPI_ERROR((AE_INFO, | ||
277 | "(PRT[%X].source_index) Need Integer, found %s", | ||
278 | index, | ||
279 | acpi_ut_get_object_type_name | ||
280 | (sub_object_list[3]))); | ||
281 | return_ACPI_STATUS(AE_BAD_DATA); | ||
282 | } | ||
283 | } | ||
284 | |||
285 | user_prt->pin = (u32) obj_desc->integer.value; | 262 | user_prt->pin = (u32) obj_desc->integer.value; |
286 | 263 | ||
287 | /* | 264 | /* |
@@ -304,7 +281,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
304 | * 3) Third subobject: Dereference the PRT.source_name | 281 | * 3) Third subobject: Dereference the PRT.source_name |
305 | * The name may be unresolved (slack mode), so allow a null object | 282 | * The name may be unresolved (slack mode), so allow a null object |
306 | */ | 283 | */ |
307 | obj_desc = sub_object_list[source_name_index]; | 284 | obj_desc = sub_object_list[2]; |
308 | if (obj_desc) { | 285 | if (obj_desc) { |
309 | switch (obj_desc->common.type) { | 286 | switch (obj_desc->common.type) { |
310 | case ACPI_TYPE_LOCAL_REFERENCE: | 287 | case ACPI_TYPE_LOCAL_REFERENCE: |
@@ -378,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
378 | 355 | ||
379 | /* 4) Fourth subobject: Dereference the PRT.source_index */ | 356 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
380 | 357 | ||
381 | obj_desc = sub_object_list[source_index_index]; | 358 | obj_desc = sub_object_list[3]; |
382 | if (obj_desc->common.type != ACPI_TYPE_INTEGER) { | 359 | if (obj_desc->common.type != ACPI_TYPE_INTEGER) { |
383 | ACPI_ERROR((AE_INFO, | 360 | ACPI_ERROR((AE_INFO, |
384 | "(PRT[%X].SourceIndex) Need Integer, found %s", | 361 | "(PRT[%X].SourceIndex) Need Integer, found %s", |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index d73c94b8441d..9195deba9d94 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * acpi_button.c - ACPI Button Driver ($Revision: 30 $) | 2 | * button.c - ACPI Button Driver |
3 | * | 3 | * |
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | 4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | 5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
@@ -41,17 +41,13 @@ | |||
41 | 41 | ||
42 | #define ACPI_BUTTON_SUBCLASS_POWER "power" | 42 | #define ACPI_BUTTON_SUBCLASS_POWER "power" |
43 | #define ACPI_BUTTON_HID_POWER "PNP0C0C" | 43 | #define ACPI_BUTTON_HID_POWER "PNP0C0C" |
44 | #define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button (CM)" | 44 | #define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button" |
45 | #define ACPI_BUTTON_DEVICE_NAME_POWERF "Power Button (FF)" | ||
46 | #define ACPI_BUTTON_TYPE_POWER 0x01 | 45 | #define ACPI_BUTTON_TYPE_POWER 0x01 |
47 | #define ACPI_BUTTON_TYPE_POWERF 0x02 | ||
48 | 46 | ||
49 | #define ACPI_BUTTON_SUBCLASS_SLEEP "sleep" | 47 | #define ACPI_BUTTON_SUBCLASS_SLEEP "sleep" |
50 | #define ACPI_BUTTON_HID_SLEEP "PNP0C0E" | 48 | #define ACPI_BUTTON_HID_SLEEP "PNP0C0E" |
51 | #define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button (CM)" | 49 | #define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button" |
52 | #define ACPI_BUTTON_DEVICE_NAME_SLEEPF "Sleep Button (FF)" | ||
53 | #define ACPI_BUTTON_TYPE_SLEEP 0x03 | 50 | #define ACPI_BUTTON_TYPE_SLEEP 0x03 |
54 | #define ACPI_BUTTON_TYPE_SLEEPF 0x04 | ||
55 | 51 | ||
56 | #define ACPI_BUTTON_SUBCLASS_LID "lid" | 52 | #define ACPI_BUTTON_SUBCLASS_LID "lid" |
57 | #define ACPI_BUTTON_HID_LID "PNP0C0D" | 53 | #define ACPI_BUTTON_HID_LID "PNP0C0D" |
@@ -95,7 +91,6 @@ static struct acpi_driver acpi_button_driver = { | |||
95 | }; | 91 | }; |
96 | 92 | ||
97 | struct acpi_button { | 93 | struct acpi_button { |
98 | struct acpi_device *device; /* Fixed button kludge */ | ||
99 | unsigned int type; | 94 | unsigned int type; |
100 | struct input_dev *input; | 95 | struct input_dev *input; |
101 | char phys[32]; /* for input device */ | 96 | char phys[32]; /* for input device */ |
@@ -126,14 +121,10 @@ static struct proc_dir_entry *acpi_button_dir; | |||
126 | 121 | ||
127 | static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) | 122 | static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) |
128 | { | 123 | { |
129 | struct acpi_button *button = seq->private; | 124 | struct acpi_device *device = seq->private; |
130 | |||
131 | if (!button || !button->device) | ||
132 | return 0; | ||
133 | 125 | ||
134 | seq_printf(seq, "type: %s\n", | 126 | seq_printf(seq, "type: %s\n", |
135 | acpi_device_name(button->device)); | 127 | acpi_device_name(device)); |
136 | |||
137 | return 0; | 128 | return 0; |
138 | } | 129 | } |
139 | 130 | ||
@@ -144,14 +135,11 @@ static int acpi_button_info_open_fs(struct inode *inode, struct file *file) | |||
144 | 135 | ||
145 | static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) | 136 | static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) |
146 | { | 137 | { |
147 | struct acpi_button *button = seq->private; | 138 | struct acpi_device *device = seq->private; |
148 | acpi_status status; | 139 | acpi_status status; |
149 | unsigned long long state; | 140 | unsigned long long state; |
150 | 141 | ||
151 | if (!button || !button->device) | 142 | status = acpi_evaluate_integer(device->handle, "_LID", NULL, &state); |
152 | return 0; | ||
153 | |||
154 | status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, &state); | ||
155 | seq_printf(seq, "state: %s\n", | 143 | seq_printf(seq, "state: %s\n", |
156 | ACPI_FAILURE(status) ? "unsupported" : | 144 | ACPI_FAILURE(status) ? "unsupported" : |
157 | (state ? "open" : "closed")); | 145 | (state ? "open" : "closed")); |
@@ -169,24 +157,17 @@ static struct proc_dir_entry *acpi_lid_dir; | |||
169 | 157 | ||
170 | static int acpi_button_add_fs(struct acpi_device *device) | 158 | static int acpi_button_add_fs(struct acpi_device *device) |
171 | { | 159 | { |
160 | struct acpi_button *button = acpi_driver_data(device); | ||
172 | struct proc_dir_entry *entry = NULL; | 161 | struct proc_dir_entry *entry = NULL; |
173 | struct acpi_button *button; | ||
174 | |||
175 | if (!device || !acpi_driver_data(device)) | ||
176 | return -EINVAL; | ||
177 | |||
178 | button = acpi_driver_data(device); | ||
179 | 162 | ||
180 | switch (button->type) { | 163 | switch (button->type) { |
181 | case ACPI_BUTTON_TYPE_POWER: | 164 | case ACPI_BUTTON_TYPE_POWER: |
182 | case ACPI_BUTTON_TYPE_POWERF: | ||
183 | if (!acpi_power_dir) | 165 | if (!acpi_power_dir) |
184 | acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, | 166 | acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, |
185 | acpi_button_dir); | 167 | acpi_button_dir); |
186 | entry = acpi_power_dir; | 168 | entry = acpi_power_dir; |
187 | break; | 169 | break; |
188 | case ACPI_BUTTON_TYPE_SLEEP: | 170 | case ACPI_BUTTON_TYPE_SLEEP: |
189 | case ACPI_BUTTON_TYPE_SLEEPF: | ||
190 | if (!acpi_sleep_dir) | 171 | if (!acpi_sleep_dir) |
191 | acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, | 172 | acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, |
192 | acpi_button_dir); | 173 | acpi_button_dir); |
@@ -210,8 +191,7 @@ static int acpi_button_add_fs(struct acpi_device *device) | |||
210 | /* 'info' [R] */ | 191 | /* 'info' [R] */ |
211 | entry = proc_create_data(ACPI_BUTTON_FILE_INFO, | 192 | entry = proc_create_data(ACPI_BUTTON_FILE_INFO, |
212 | S_IRUGO, acpi_device_dir(device), | 193 | S_IRUGO, acpi_device_dir(device), |
213 | &acpi_button_info_fops, | 194 | &acpi_button_info_fops, device); |
214 | acpi_driver_data(device)); | ||
215 | if (!entry) | 195 | if (!entry) |
216 | return -ENODEV; | 196 | return -ENODEV; |
217 | 197 | ||
@@ -219,8 +199,7 @@ static int acpi_button_add_fs(struct acpi_device *device) | |||
219 | if (button->type == ACPI_BUTTON_TYPE_LID) { | 199 | if (button->type == ACPI_BUTTON_TYPE_LID) { |
220 | entry = proc_create_data(ACPI_BUTTON_FILE_STATE, | 200 | entry = proc_create_data(ACPI_BUTTON_FILE_STATE, |
221 | S_IRUGO, acpi_device_dir(device), | 201 | S_IRUGO, acpi_device_dir(device), |
222 | &acpi_button_state_fops, | 202 | &acpi_button_state_fops, device); |
223 | acpi_driver_data(device)); | ||
224 | if (!entry) | 203 | if (!entry) |
225 | return -ENODEV; | 204 | return -ENODEV; |
226 | } | 205 | } |
@@ -250,15 +229,16 @@ static int acpi_button_remove_fs(struct acpi_device *device) | |||
250 | /* -------------------------------------------------------------------------- | 229 | /* -------------------------------------------------------------------------- |
251 | Driver Interface | 230 | Driver Interface |
252 | -------------------------------------------------------------------------- */ | 231 | -------------------------------------------------------------------------- */ |
253 | static int acpi_lid_send_state(struct acpi_button *button) | 232 | static int acpi_lid_send_state(struct acpi_device *device) |
254 | { | 233 | { |
234 | struct acpi_button *button = acpi_driver_data(device); | ||
255 | unsigned long long state; | 235 | unsigned long long state; |
256 | acpi_status status; | 236 | acpi_status status; |
257 | 237 | ||
258 | status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, | 238 | status = acpi_evaluate_integer(device->handle, "_LID", NULL, &state); |
259 | &state); | ||
260 | if (ACPI_FAILURE(status)) | 239 | if (ACPI_FAILURE(status)) |
261 | return -ENODEV; | 240 | return -ENODEV; |
241 | |||
262 | /* input layer checks if event is redundant */ | 242 | /* input layer checks if event is redundant */ |
263 | input_report_switch(button->input, SW_LID, !state); | 243 | input_report_switch(button->input, SW_LID, !state); |
264 | input_sync(button->input); | 244 | input_sync(button->input); |
@@ -270,9 +250,6 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) | |||
270 | struct acpi_button *button = acpi_driver_data(device); | 250 | struct acpi_button *button = acpi_driver_data(device); |
271 | struct input_dev *input; | 251 | struct input_dev *input; |
272 | 252 | ||
273 | if (!button || !button->device) | ||
274 | return; | ||
275 | |||
276 | switch (event) { | 253 | switch (event) { |
277 | case ACPI_FIXED_HARDWARE_EVENT: | 254 | case ACPI_FIXED_HARDWARE_EVENT: |
278 | event = ACPI_BUTTON_NOTIFY_STATUS; | 255 | event = ACPI_BUTTON_NOTIFY_STATUS; |
@@ -280,7 +257,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) | |||
280 | case ACPI_BUTTON_NOTIFY_STATUS: | 257 | case ACPI_BUTTON_NOTIFY_STATUS: |
281 | input = button->input; | 258 | input = button->input; |
282 | if (button->type == ACPI_BUTTON_TYPE_LID) { | 259 | if (button->type == ACPI_BUTTON_TYPE_LID) { |
283 | acpi_lid_send_state(button); | 260 | acpi_lid_send_state(device); |
284 | } else { | 261 | } else { |
285 | int keycode = test_bit(KEY_SLEEP, input->keybit) ? | 262 | int keycode = test_bit(KEY_SLEEP, input->keybit) ? |
286 | KEY_SLEEP : KEY_POWER; | 263 | KEY_SLEEP : KEY_POWER; |
@@ -291,43 +268,35 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) | |||
291 | input_sync(input); | 268 | input_sync(input); |
292 | } | 269 | } |
293 | 270 | ||
294 | acpi_bus_generate_proc_event(button->device, event, | 271 | acpi_bus_generate_proc_event(device, event, ++button->pushed); |
295 | ++button->pushed); | ||
296 | break; | 272 | break; |
297 | default: | 273 | default: |
298 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 274 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
299 | "Unsupported event [0x%x]\n", event)); | 275 | "Unsupported event [0x%x]\n", event)); |
300 | break; | 276 | break; |
301 | } | 277 | } |
302 | |||
303 | return; | ||
304 | } | 278 | } |
305 | 279 | ||
306 | static int acpi_button_resume(struct acpi_device *device) | 280 | static int acpi_button_resume(struct acpi_device *device) |
307 | { | 281 | { |
308 | struct acpi_button *button; | 282 | struct acpi_button *button = acpi_driver_data(device); |
309 | if (!device) | 283 | |
310 | return -EINVAL; | 284 | if (button->type == ACPI_BUTTON_TYPE_LID) |
311 | button = acpi_driver_data(device); | 285 | return acpi_lid_send_state(device); |
312 | if (button && button->type == ACPI_BUTTON_TYPE_LID) | ||
313 | return acpi_lid_send_state(button); | ||
314 | return 0; | 286 | return 0; |
315 | } | 287 | } |
316 | 288 | ||
317 | static int acpi_button_add(struct acpi_device *device) | 289 | static int acpi_button_add(struct acpi_device *device) |
318 | { | 290 | { |
319 | int error; | ||
320 | struct acpi_button *button; | 291 | struct acpi_button *button; |
321 | struct input_dev *input; | 292 | struct input_dev *input; |
322 | 293 | char *hid, *name, *class; | |
323 | if (!device) | 294 | int error; |
324 | return -EINVAL; | ||
325 | 295 | ||
326 | button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); | 296 | button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); |
327 | if (!button) | 297 | if (!button) |
328 | return -ENOMEM; | 298 | return -ENOMEM; |
329 | 299 | ||
330 | button->device = device; | ||
331 | device->driver_data = button; | 300 | device->driver_data = button; |
332 | 301 | ||
333 | button->input = input = input_allocate_device(); | 302 | button->input = input = input_allocate_device(); |
@@ -336,40 +305,29 @@ static int acpi_button_add(struct acpi_device *device) | |||
336 | goto err_free_button; | 305 | goto err_free_button; |
337 | } | 306 | } |
338 | 307 | ||
339 | /* | 308 | hid = acpi_device_hid(device); |
340 | * Determine the button type (via hid), as fixed-feature buttons | 309 | name = acpi_device_name(device); |
341 | * need to be handled a bit differently than generic-space. | 310 | class = acpi_device_class(device); |
342 | */ | 311 | |
343 | if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) { | 312 | if (!strcmp(hid, ACPI_BUTTON_HID_POWER) || |
313 | !strcmp(hid, ACPI_BUTTON_HID_POWERF)) { | ||
344 | button->type = ACPI_BUTTON_TYPE_POWER; | 314 | button->type = ACPI_BUTTON_TYPE_POWER; |
345 | strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_POWER); | 315 | strcpy(name, ACPI_BUTTON_DEVICE_NAME_POWER); |
346 | sprintf(acpi_device_class(device), "%s/%s", | 316 | sprintf(class, "%s/%s", |
347 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); | ||
348 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) { | ||
349 | button->type = ACPI_BUTTON_TYPE_POWERF; | ||
350 | strcpy(acpi_device_name(device), | ||
351 | ACPI_BUTTON_DEVICE_NAME_POWERF); | ||
352 | sprintf(acpi_device_class(device), "%s/%s", | ||
353 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); | 317 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER); |
354 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) { | 318 | } else if (!strcmp(hid, ACPI_BUTTON_HID_SLEEP) || |
319 | !strcmp(hid, ACPI_BUTTON_HID_SLEEPF)) { | ||
355 | button->type = ACPI_BUTTON_TYPE_SLEEP; | 320 | button->type = ACPI_BUTTON_TYPE_SLEEP; |
356 | strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_SLEEP); | 321 | strcpy(name, ACPI_BUTTON_DEVICE_NAME_SLEEP); |
357 | sprintf(acpi_device_class(device), "%s/%s", | 322 | sprintf(class, "%s/%s", |
358 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); | ||
359 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) { | ||
360 | button->type = ACPI_BUTTON_TYPE_SLEEPF; | ||
361 | strcpy(acpi_device_name(device), | ||
362 | ACPI_BUTTON_DEVICE_NAME_SLEEPF); | ||
363 | sprintf(acpi_device_class(device), "%s/%s", | ||
364 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); | 323 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP); |
365 | } else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) { | 324 | } else if (!strcmp(hid, ACPI_BUTTON_HID_LID)) { |
366 | button->type = ACPI_BUTTON_TYPE_LID; | 325 | button->type = ACPI_BUTTON_TYPE_LID; |
367 | strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_LID); | 326 | strcpy(name, ACPI_BUTTON_DEVICE_NAME_LID); |
368 | sprintf(acpi_device_class(device), "%s/%s", | 327 | sprintf(class, "%s/%s", |
369 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); | 328 | ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID); |
370 | } else { | 329 | } else { |
371 | printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", | 330 | printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", hid); |
372 | acpi_device_hid(device)); | ||
373 | error = -ENODEV; | 331 | error = -ENODEV; |
374 | goto err_free_input; | 332 | goto err_free_input; |
375 | } | 333 | } |
@@ -378,10 +336,9 @@ static int acpi_button_add(struct acpi_device *device) | |||
378 | if (error) | 336 | if (error) |
379 | goto err_free_input; | 337 | goto err_free_input; |
380 | 338 | ||
381 | snprintf(button->phys, sizeof(button->phys), | 339 | snprintf(button->phys, sizeof(button->phys), "%s/button/input0", hid); |
382 | "%s/button/input0", acpi_device_hid(device)); | ||
383 | 340 | ||
384 | input->name = acpi_device_name(device); | 341 | input->name = name; |
385 | input->phys = button->phys; | 342 | input->phys = button->phys; |
386 | input->id.bustype = BUS_HOST; | 343 | input->id.bustype = BUS_HOST; |
387 | input->id.product = button->type; | 344 | input->id.product = button->type; |
@@ -389,13 +346,11 @@ static int acpi_button_add(struct acpi_device *device) | |||
389 | 346 | ||
390 | switch (button->type) { | 347 | switch (button->type) { |
391 | case ACPI_BUTTON_TYPE_POWER: | 348 | case ACPI_BUTTON_TYPE_POWER: |
392 | case ACPI_BUTTON_TYPE_POWERF: | ||
393 | input->evbit[0] = BIT_MASK(EV_KEY); | 349 | input->evbit[0] = BIT_MASK(EV_KEY); |
394 | set_bit(KEY_POWER, input->keybit); | 350 | set_bit(KEY_POWER, input->keybit); |
395 | break; | 351 | break; |
396 | 352 | ||
397 | case ACPI_BUTTON_TYPE_SLEEP: | 353 | case ACPI_BUTTON_TYPE_SLEEP: |
398 | case ACPI_BUTTON_TYPE_SLEEPF: | ||
399 | input->evbit[0] = BIT_MASK(EV_KEY); | 354 | input->evbit[0] = BIT_MASK(EV_KEY); |
400 | set_bit(KEY_SLEEP, input->keybit); | 355 | set_bit(KEY_SLEEP, input->keybit); |
401 | break; | 356 | break; |
@@ -410,7 +365,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
410 | if (error) | 365 | if (error) |
411 | goto err_remove_fs; | 366 | goto err_remove_fs; |
412 | if (button->type == ACPI_BUTTON_TYPE_LID) | 367 | if (button->type == ACPI_BUTTON_TYPE_LID) |
413 | acpi_lid_send_state(button); | 368 | acpi_lid_send_state(device); |
414 | 369 | ||
415 | if (device->wakeup.flags.valid) { | 370 | if (device->wakeup.flags.valid) { |
416 | /* Button's GPE is run-wake GPE */ | 371 | /* Button's GPE is run-wake GPE */ |
@@ -422,9 +377,7 @@ static int acpi_button_add(struct acpi_device *device) | |||
422 | device->wakeup.state.enabled = 1; | 377 | device->wakeup.state.enabled = 1; |
423 | } | 378 | } |
424 | 379 | ||
425 | printk(KERN_INFO PREFIX "%s [%s]\n", | 380 | printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device)); |
426 | acpi_device_name(device), acpi_device_bid(device)); | ||
427 | |||
428 | return 0; | 381 | return 0; |
429 | 382 | ||
430 | err_remove_fs: | 383 | err_remove_fs: |
@@ -438,17 +391,11 @@ static int acpi_button_add(struct acpi_device *device) | |||
438 | 391 | ||
439 | static int acpi_button_remove(struct acpi_device *device, int type) | 392 | static int acpi_button_remove(struct acpi_device *device, int type) |
440 | { | 393 | { |
441 | struct acpi_button *button; | 394 | struct acpi_button *button = acpi_driver_data(device); |
442 | |||
443 | if (!device || !acpi_driver_data(device)) | ||
444 | return -EINVAL; | ||
445 | |||
446 | button = acpi_driver_data(device); | ||
447 | 395 | ||
448 | acpi_button_remove_fs(device); | 396 | acpi_button_remove_fs(device); |
449 | input_unregister_device(button->input); | 397 | input_unregister_device(button->input); |
450 | kfree(button); | 398 | kfree(button); |
451 | |||
452 | return 0; | 399 | return 0; |
453 | } | 400 | } |
454 | 401 | ||
@@ -459,6 +406,7 @@ static int __init acpi_button_init(void) | |||
459 | acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); | 406 | acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); |
460 | if (!acpi_button_dir) | 407 | if (!acpi_button_dir) |
461 | return -ENODEV; | 408 | return -ENODEV; |
409 | |||
462 | result = acpi_bus_register_driver(&acpi_button_driver); | 410 | result = acpi_bus_register_driver(&acpi_button_driver); |
463 | if (result < 0) { | 411 | if (result < 0) { |
464 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); | 412 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 04e90443eff7..391f331674c7 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -1065,6 +1065,7 @@ static int acpi_ec_resume(struct acpi_device *device) | |||
1065 | struct acpi_ec *ec = acpi_driver_data(device); | 1065 | struct acpi_ec *ec = acpi_driver_data(device); |
1066 | /* Enable use of GPE back */ | 1066 | /* Enable use of GPE back */ |
1067 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); | 1067 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); |
1068 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | ||
1068 | acpi_enable_gpe(NULL, ec->gpe); | 1069 | acpi_enable_gpe(NULL, ec->gpe); |
1069 | return 0; | 1070 | return 0; |
1070 | } | 1071 | } |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index d59f08ecaf16..d916bea729f1 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -353,8 +353,10 @@ static irqreturn_t acpi_irq(int irq, void *dev_id) | |||
353 | if (handled) { | 353 | if (handled) { |
354 | acpi_irq_handled++; | 354 | acpi_irq_handled++; |
355 | return IRQ_HANDLED; | 355 | return IRQ_HANDLED; |
356 | } else | 356 | } else { |
357 | acpi_irq_not_handled++; | ||
357 | return IRQ_NONE; | 358 | return IRQ_NONE; |
359 | } | ||
358 | } | 360 | } |
359 | 361 | ||
360 | acpi_status | 362 | acpi_status |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 6fe121434ffb..f7ca8c55956b 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -581,6 +581,11 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) | |||
581 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { | 581 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { |
582 | struct acpi_processor_cx *cx = &pr->power.states[i]; | 582 | struct acpi_processor_cx *cx = &pr->power.states[i]; |
583 | 583 | ||
584 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) | ||
585 | /* TSC could halt in idle, so notify users */ | ||
586 | if (tsc_halts_in_c(cx->type)) | ||
587 | mark_tsc_unstable("TSC halts in idle");; | ||
588 | #endif | ||
584 | switch (cx->type) { | 589 | switch (cx->type) { |
585 | case ACPI_STATE_C1: | 590 | case ACPI_STATE_C1: |
586 | cx->valid = 1; | 591 | cx->valid = 1; |
@@ -657,11 +662,9 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) | |||
657 | 662 | ||
658 | seq_printf(seq, "active state: C%zd\n" | 663 | seq_printf(seq, "active state: C%zd\n" |
659 | "max_cstate: C%d\n" | 664 | "max_cstate: C%d\n" |
660 | "bus master activity: %08x\n" | ||
661 | "maximum allowed latency: %d usec\n", | 665 | "maximum allowed latency: %d usec\n", |
662 | pr->power.state ? pr->power.state - pr->power.states : 0, | 666 | pr->power.state ? pr->power.state - pr->power.states : 0, |
663 | max_cstate, (unsigned)pr->power.bm_activity, | 667 | max_cstate, pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)); |
664 | pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)); | ||
665 | 668 | ||
666 | seq_puts(seq, "states:\n"); | 669 | seq_puts(seq, "states:\n"); |
667 | 670 | ||
@@ -871,11 +874,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
871 | kt2 = ktime_get_real(); | 874 | kt2 = ktime_get_real(); |
872 | idle_time = ktime_to_us(ktime_sub(kt2, kt1)); | 875 | idle_time = ktime_to_us(ktime_sub(kt2, kt1)); |
873 | 876 | ||
874 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) | ||
875 | /* TSC could halt in idle, so notify users */ | ||
876 | if (tsc_halts_in_c(cx->type)) | ||
877 | mark_tsc_unstable("TSC halts in idle");; | ||
878 | #endif | ||
879 | sleep_ticks = us_to_pm_timer_ticks(idle_time); | 877 | sleep_ticks = us_to_pm_timer_ticks(idle_time); |
880 | 878 | ||
881 | /* Tell the scheduler how much we idled: */ | 879 | /* Tell the scheduler how much we idled: */ |
@@ -955,6 +953,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
955 | */ | 953 | */ |
956 | acpi_state_timer_broadcast(pr, cx, 1); | 954 | acpi_state_timer_broadcast(pr, cx, 1); |
957 | 955 | ||
956 | kt1 = ktime_get_real(); | ||
958 | /* | 957 | /* |
959 | * disable bus master | 958 | * disable bus master |
960 | * bm_check implies we need ARB_DIS | 959 | * bm_check implies we need ARB_DIS |
@@ -976,10 +975,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
976 | ACPI_FLUSH_CPU_CACHE(); | 975 | ACPI_FLUSH_CPU_CACHE(); |
977 | } | 976 | } |
978 | 977 | ||
979 | kt1 = ktime_get_real(); | ||
980 | acpi_idle_do_entry(cx); | 978 | acpi_idle_do_entry(cx); |
981 | kt2 = ktime_get_real(); | ||
982 | idle_time = ktime_to_us(ktime_sub(kt2, kt1)); | ||
983 | 979 | ||
984 | /* Re-enable bus master arbitration */ | 980 | /* Re-enable bus master arbitration */ |
985 | if (pr->flags.bm_check && pr->flags.bm_control) { | 981 | if (pr->flags.bm_check && pr->flags.bm_control) { |
@@ -988,12 +984,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
988 | c3_cpu_count--; | 984 | c3_cpu_count--; |
989 | spin_unlock(&c3_lock); | 985 | spin_unlock(&c3_lock); |
990 | } | 986 | } |
987 | kt2 = ktime_get_real(); | ||
988 | idle_time = ktime_to_us(ktime_sub(kt2, kt1)); | ||
991 | 989 | ||
992 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) | ||
993 | /* TSC could halt in idle, so notify users */ | ||
994 | if (tsc_halts_in_c(ACPI_STATE_C3)) | ||
995 | mark_tsc_unstable("TSC halts in idle"); | ||
996 | #endif | ||
997 | sleep_ticks = us_to_pm_timer_ticks(idle_time); | 990 | sleep_ticks = us_to_pm_timer_ticks(idle_time); |
998 | /* Tell the scheduler how much we idled: */ | 991 | /* Tell the scheduler how much we idled: */ |
999 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | 992 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); |
@@ -1037,6 +1030,9 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) | |||
1037 | dev->states[i].desc[0] = '\0'; | 1030 | dev->states[i].desc[0] = '\0'; |
1038 | } | 1031 | } |
1039 | 1032 | ||
1033 | if (max_cstate == 0) | ||
1034 | max_cstate = 1; | ||
1035 | |||
1040 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) { | 1036 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) { |
1041 | cx = &pr->power.states[i]; | 1037 | cx = &pr->power.states[i]; |
1042 | state = &dev->states[count]; | 1038 | state = &dev->states[count]; |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 779e4e500df4..01574a066534 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -300,9 +300,9 @@ static int acpi_suspend_state_valid(suspend_state_t pm_state) | |||
300 | static struct platform_suspend_ops acpi_suspend_ops = { | 300 | static struct platform_suspend_ops acpi_suspend_ops = { |
301 | .valid = acpi_suspend_state_valid, | 301 | .valid = acpi_suspend_state_valid, |
302 | .begin = acpi_suspend_begin, | 302 | .begin = acpi_suspend_begin, |
303 | .prepare = acpi_pm_prepare, | 303 | .prepare_late = acpi_pm_prepare, |
304 | .enter = acpi_suspend_enter, | 304 | .enter = acpi_suspend_enter, |
305 | .finish = acpi_pm_finish, | 305 | .wake = acpi_pm_finish, |
306 | .end = acpi_pm_end, | 306 | .end = acpi_pm_end, |
307 | }; | 307 | }; |
308 | 308 | ||
@@ -328,9 +328,9 @@ static int acpi_suspend_begin_old(suspend_state_t pm_state) | |||
328 | static struct platform_suspend_ops acpi_suspend_ops_old = { | 328 | static struct platform_suspend_ops acpi_suspend_ops_old = { |
329 | .valid = acpi_suspend_state_valid, | 329 | .valid = acpi_suspend_state_valid, |
330 | .begin = acpi_suspend_begin_old, | 330 | .begin = acpi_suspend_begin_old, |
331 | .prepare = acpi_pm_disable_gpes, | 331 | .prepare_late = acpi_pm_disable_gpes, |
332 | .enter = acpi_suspend_enter, | 332 | .enter = acpi_suspend_enter, |
333 | .finish = acpi_pm_finish, | 333 | .wake = acpi_pm_finish, |
334 | .end = acpi_pm_end, | 334 | .end = acpi_pm_end, |
335 | .recover = acpi_pm_finish, | 335 | .recover = acpi_pm_finish, |
336 | }; | 336 | }; |
@@ -713,6 +713,32 @@ static void acpi_power_off(void) | |||
713 | acpi_enter_sleep_state(ACPI_STATE_S5); | 713 | acpi_enter_sleep_state(ACPI_STATE_S5); |
714 | } | 714 | } |
715 | 715 | ||
716 | /* | ||
717 | * ACPI 2.0 created the optional _GTS and _BFS, | ||
718 | * but industry adoption has been neither rapid nor broad. | ||
719 | * | ||
720 | * Linux gets into trouble when it executes poorly validated | ||
721 | * paths through the BIOS, so disable _GTS and _BFS by default, | ||
722 | * but do speak up and offer the option to enable them. | ||
723 | */ | ||
724 | void __init acpi_gts_bfs_check(void) | ||
725 | { | ||
726 | acpi_handle dummy; | ||
727 | |||
728 | if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__GTS, &dummy))) | ||
729 | { | ||
730 | printk(KERN_NOTICE PREFIX "BIOS offers _GTS\n"); | ||
731 | printk(KERN_NOTICE PREFIX "If \"acpi.gts=1\" improves suspend, " | ||
732 | "please notify linux-acpi@vger.kernel.org\n"); | ||
733 | } | ||
734 | if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__BFS, &dummy))) | ||
735 | { | ||
736 | printk(KERN_NOTICE PREFIX "BIOS offers _BFS\n"); | ||
737 | printk(KERN_NOTICE PREFIX "If \"acpi.bfs=1\" improves resume, " | ||
738 | "please notify linux-acpi@vger.kernel.org\n"); | ||
739 | } | ||
740 | } | ||
741 | |||
716 | int __init acpi_sleep_init(void) | 742 | int __init acpi_sleep_init(void) |
717 | { | 743 | { |
718 | acpi_status status; | 744 | acpi_status status; |
@@ -771,5 +797,6 @@ int __init acpi_sleep_init(void) | |||
771 | * object can also be evaluated when the system enters S5. | 797 | * object can also be evaluated when the system enters S5. |
772 | */ | 798 | */ |
773 | register_reboot_notifier(&tts_notifier); | 799 | register_reboot_notifier(&tts_notifier); |
800 | acpi_gts_bfs_check(); | ||
774 | return 0; | 801 | return 0; |
775 | } | 802 | } |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index da51f05ef8d8..0944daec064f 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -38,6 +38,7 @@ ACPI_MODULE_NAME("system"); | |||
38 | #define ACPI_SYSTEM_DEVICE_NAME "System" | 38 | #define ACPI_SYSTEM_DEVICE_NAME "System" |
39 | 39 | ||
40 | u32 acpi_irq_handled; | 40 | u32 acpi_irq_handled; |
41 | u32 acpi_irq_not_handled; | ||
41 | 42 | ||
42 | /* | 43 | /* |
43 | * Make ACPICA version work as module param | 44 | * Make ACPICA version work as module param |
@@ -214,8 +215,9 @@ err: | |||
214 | 215 | ||
215 | #define COUNT_GPE 0 | 216 | #define COUNT_GPE 0 |
216 | #define COUNT_SCI 1 /* acpi_irq_handled */ | 217 | #define COUNT_SCI 1 /* acpi_irq_handled */ |
217 | #define COUNT_ERROR 2 /* other */ | 218 | #define COUNT_SCI_NOT 2 /* acpi_irq_not_handled */ |
218 | #define NUM_COUNTERS_EXTRA 3 | 219 | #define COUNT_ERROR 3 /* other */ |
220 | #define NUM_COUNTERS_EXTRA 4 | ||
219 | 221 | ||
220 | struct event_counter { | 222 | struct event_counter { |
221 | u32 count; | 223 | u32 count; |
@@ -317,6 +319,8 @@ static ssize_t counter_show(struct kobject *kobj, | |||
317 | 319 | ||
318 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count = | 320 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI].count = |
319 | acpi_irq_handled; | 321 | acpi_irq_handled; |
322 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT].count = | ||
323 | acpi_irq_not_handled; | ||
320 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = | 324 | all_counters[num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_GPE].count = |
321 | acpi_gpe_count; | 325 | acpi_gpe_count; |
322 | 326 | ||
@@ -363,6 +367,7 @@ static ssize_t counter_set(struct kobject *kobj, | |||
363 | all_counters[i].count = 0; | 367 | all_counters[i].count = 0; |
364 | acpi_gpe_count = 0; | 368 | acpi_gpe_count = 0; |
365 | acpi_irq_handled = 0; | 369 | acpi_irq_handled = 0; |
370 | acpi_irq_not_handled = 0; | ||
366 | goto end; | 371 | goto end; |
367 | } | 372 | } |
368 | 373 | ||
@@ -456,6 +461,8 @@ void acpi_irq_stats_init(void) | |||
456 | sprintf(buffer, "gpe_all"); | 461 | sprintf(buffer, "gpe_all"); |
457 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) | 462 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) |
458 | sprintf(buffer, "sci"); | 463 | sprintf(buffer, "sci"); |
464 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI_NOT) | ||
465 | sprintf(buffer, "sci_not"); | ||
459 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR) | 466 | else if (i == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_ERROR) |
460 | sprintf(buffer, "error"); | 467 | sprintf(buffer, "error"); |
461 | else | 468 | else |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 9cd15e8c8932..564ea1424288 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -909,7 +909,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
909 | thermal_zone_device_register("acpitz", trips, tz, | 909 | thermal_zone_device_register("acpitz", trips, tz, |
910 | &acpi_thermal_zone_ops, | 910 | &acpi_thermal_zone_ops, |
911 | 0, 0, 0, | 911 | 0, 0, 0, |
912 | tz->polling_frequency); | 912 | tz->polling_frequency*100); |
913 | if (IS_ERR(tz->thermal_zone)) | 913 | if (IS_ERR(tz->thermal_zone)) |
914 | return -ENODEV; | 914 | return -ENODEV; |
915 | 915 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 8961e613e093..d7ff61c0d571 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -770,10 +770,12 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
770 | * In this case, the first two elements in _BCL packages | 770 | * In this case, the first two elements in _BCL packages |
771 | * are also supported brightness levels that OS should take care of. | 771 | * are also supported brightness levels that OS should take care of. |
772 | */ | 772 | */ |
773 | for (i = 2; i < count; i++) | 773 | for (i = 2; i < count; i++) { |
774 | if (br->levels[i] == br->levels[0] || | 774 | if (br->levels[i] == br->levels[0]) |
775 | br->levels[i] == br->levels[1]) | ||
776 | level_ac_battery++; | 775 | level_ac_battery++; |
776 | if (br->levels[i] == br->levels[1]) | ||
777 | level_ac_battery++; | ||
778 | } | ||
777 | 779 | ||
778 | if (level_ac_battery < 2) { | 780 | if (level_ac_battery < 2) { |
779 | level_ac_battery = 2 - level_ac_battery; | 781 | level_ac_battery = 2 - level_ac_battery; |
@@ -807,12 +809,19 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
807 | br->flags._BCM_use_index = br->flags._BCL_use_index; | 809 | br->flags._BCM_use_index = br->flags._BCL_use_index; |
808 | 810 | ||
809 | /* _BQC uses INDEX while _BCL uses VALUE in some laptops */ | 811 | /* _BQC uses INDEX while _BCL uses VALUE in some laptops */ |
810 | br->curr = max_level; | 812 | br->curr = level_old = max_level; |
813 | |||
814 | if (!device->cap._BQC) | ||
815 | goto set_level; | ||
816 | |||
811 | result = acpi_video_device_lcd_get_level_current(device, &level_old); | 817 | result = acpi_video_device_lcd_get_level_current(device, &level_old); |
812 | if (result) | 818 | if (result) |
813 | goto out_free_levels; | 819 | goto out_free_levels; |
814 | 820 | ||
815 | result = acpi_video_device_lcd_set_level(device, br->curr); | 821 | /* |
822 | * Set the level to maximum and check if _BQC uses indexed value | ||
823 | */ | ||
824 | result = acpi_video_device_lcd_set_level(device, max_level); | ||
816 | if (result) | 825 | if (result) |
817 | goto out_free_levels; | 826 | goto out_free_levels; |
818 | 827 | ||
@@ -820,25 +829,19 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
820 | if (result) | 829 | if (result) |
821 | goto out_free_levels; | 830 | goto out_free_levels; |
822 | 831 | ||
823 | if ((level != level_old) && !br->flags._BCM_use_index) { | 832 | br->flags._BQC_use_index = (level == max_level ? 0 : 1); |
824 | /* Note: | 833 | |
825 | * This piece of code does not work correctly if the current | 834 | if (!br->flags._BQC_use_index) |
826 | * brightness levels is 0. | 835 | goto set_level; |
827 | * But I guess boxes that boot with such a dark screen are rare | 836 | |
828 | * and no more code is needed to cover this specifial case. | 837 | if (br->flags._BCL_reversed) |
829 | */ | 838 | level_old = (br->count - 1) - level_old; |
830 | 839 | level_old = br->levels[level_old]; | |
831 | if (level_ac_battery != 2) { | 840 | |
832 | /* | 841 | set_level: |
833 | * For now, we don't support the _BCL like this: | 842 | result = acpi_video_device_lcd_set_level(device, level_old); |
834 | * 16, 15, 0, 1, 2, 3, ..., 14, 15, 16 | 843 | if (result) |
835 | * because we may mess up the index returned by _BQC. | 844 | goto out_free_levels; |
836 | * Plus: we have not got a box like this. | ||
837 | */ | ||
838 | ACPI_ERROR((AE_INFO, "_BCL not supported\n")); | ||
839 | } | ||
840 | br->flags._BQC_use_index = 1; | ||
841 | } | ||
842 | 845 | ||
843 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 846 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
844 | "found %d brightness levels\n", count - 2)); | 847 | "found %d brightness levels\n", count - 2)); |