diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/exmutex.c | 3 | ||||
-rw-r--r-- | drivers/acpi/battery.c | 86 | ||||
-rw-r--r-- | drivers/acpi/bus.c | 10 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 33 | ||||
-rw-r--r-- | drivers/acpi/internal.h | 2 | ||||
-rw-r--r-- | drivers/acpi/processor_throttling.c | 3 | ||||
-rw-r--r-- | drivers/acpi/sbs.c | 5 | ||||
-rw-r--r-- | drivers/acpi/sleep.c | 19 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 36 | ||||
-rw-r--r-- | drivers/acpi/utils.c | 45 | ||||
-rw-r--r-- | drivers/acpi/video.c | 28 |
11 files changed, 171 insertions, 99 deletions
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index cc8a10268f68..7116bc86494d 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
@@ -375,8 +375,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
375 | return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); | 375 | return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); |
376 | } | 376 | } |
377 | 377 | ||
378 | /* Must have a valid thread ID */ | 378 | /* Must have a valid thread. */ |
379 | |||
380 | if (!walk_state->thread) { | 379 | if (!walk_state->thread) { |
381 | ACPI_ERROR((AE_INFO, | 380 | ACPI_ERROR((AE_INFO, |
382 | "Cannot release Mutex [%4.4s], null thread info", | 381 | "Cannot release Mutex [%4.4s], null thread info", |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 58d2c91ba62b..75f39f2c166d 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #define ACPI_BATTERY_DEVICE_NAME "Battery" | 54 | #define ACPI_BATTERY_DEVICE_NAME "Battery" |
55 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 | 55 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 |
56 | #define ACPI_BATTERY_NOTIFY_INFO 0x81 | 56 | #define ACPI_BATTERY_NOTIFY_INFO 0x81 |
57 | #define ACPI_BATTERY_NOTIFY_THRESHOLD 0x82 | ||
57 | 58 | ||
58 | #define _COMPONENT ACPI_BATTERY_COMPONENT | 59 | #define _COMPONENT ACPI_BATTERY_COMPONENT |
59 | 60 | ||
@@ -88,10 +89,15 @@ static const struct acpi_device_id battery_device_ids[] = { | |||
88 | 89 | ||
89 | MODULE_DEVICE_TABLE(acpi, battery_device_ids); | 90 | MODULE_DEVICE_TABLE(acpi, battery_device_ids); |
90 | 91 | ||
91 | /* For buggy DSDTs that report negative 16-bit values for either charging | 92 | enum { |
92 | * or discharging current and/or report 0 as 65536 due to bad math. | 93 | ACPI_BATTERY_ALARM_PRESENT, |
93 | */ | 94 | ACPI_BATTERY_XINFO_PRESENT, |
94 | #define QUIRK_SIGNED16_CURRENT 0x0001 | 95 | /* For buggy DSDTs that report negative 16-bit values for either |
96 | * charging or discharging current and/or report 0 as 65536 | ||
97 | * due to bad math. | ||
98 | */ | ||
99 | ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, | ||
100 | }; | ||
95 | 101 | ||
96 | struct acpi_battery { | 102 | struct acpi_battery { |
97 | struct mutex lock; | 103 | struct mutex lock; |
@@ -109,6 +115,12 @@ struct acpi_battery { | |||
109 | int design_voltage; | 115 | int design_voltage; |
110 | int design_capacity_warning; | 116 | int design_capacity_warning; |
111 | int design_capacity_low; | 117 | int design_capacity_low; |
118 | int cycle_count; | ||
119 | int measurement_accuracy; | ||
120 | int max_sampling_time; | ||
121 | int min_sampling_time; | ||
122 | int max_averaging_interval; | ||
123 | int min_averaging_interval; | ||
112 | int capacity_granularity_1; | 124 | int capacity_granularity_1; |
113 | int capacity_granularity_2; | 125 | int capacity_granularity_2; |
114 | int alarm; | 126 | int alarm; |
@@ -118,8 +130,7 @@ struct acpi_battery { | |||
118 | char oem_info[32]; | 130 | char oem_info[32]; |
119 | int state; | 131 | int state; |
120 | int power_unit; | 132 | int power_unit; |
121 | u8 alarm_present; | 133 | unsigned long flags; |
122 | long quirks; | ||
123 | }; | 134 | }; |
124 | 135 | ||
125 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); | 136 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); |
@@ -198,6 +209,9 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
198 | case POWER_SUPPLY_PROP_TECHNOLOGY: | 209 | case POWER_SUPPLY_PROP_TECHNOLOGY: |
199 | val->intval = acpi_battery_technology(battery); | 210 | val->intval = acpi_battery_technology(battery); |
200 | break; | 211 | break; |
212 | case POWER_SUPPLY_PROP_CYCLE_COUNT: | ||
213 | val->intval = battery->cycle_count; | ||
214 | break; | ||
201 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: | 215 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: |
202 | val->intval = battery->design_voltage * 1000; | 216 | val->intval = battery->design_voltage * 1000; |
203 | break; | 217 | break; |
@@ -239,6 +253,7 @@ static enum power_supply_property charge_battery_props[] = { | |||
239 | POWER_SUPPLY_PROP_STATUS, | 253 | POWER_SUPPLY_PROP_STATUS, |
240 | POWER_SUPPLY_PROP_PRESENT, | 254 | POWER_SUPPLY_PROP_PRESENT, |
241 | POWER_SUPPLY_PROP_TECHNOLOGY, | 255 | POWER_SUPPLY_PROP_TECHNOLOGY, |
256 | POWER_SUPPLY_PROP_CYCLE_COUNT, | ||
242 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | 257 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, |
243 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | 258 | POWER_SUPPLY_PROP_VOLTAGE_NOW, |
244 | POWER_SUPPLY_PROP_CURRENT_NOW, | 259 | POWER_SUPPLY_PROP_CURRENT_NOW, |
@@ -254,6 +269,7 @@ static enum power_supply_property energy_battery_props[] = { | |||
254 | POWER_SUPPLY_PROP_STATUS, | 269 | POWER_SUPPLY_PROP_STATUS, |
255 | POWER_SUPPLY_PROP_PRESENT, | 270 | POWER_SUPPLY_PROP_PRESENT, |
256 | POWER_SUPPLY_PROP_TECHNOLOGY, | 271 | POWER_SUPPLY_PROP_TECHNOLOGY, |
272 | POWER_SUPPLY_PROP_CYCLE_COUNT, | ||
257 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | 273 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, |
258 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | 274 | POWER_SUPPLY_PROP_VOLTAGE_NOW, |
259 | POWER_SUPPLY_PROP_CURRENT_NOW, | 275 | POWER_SUPPLY_PROP_CURRENT_NOW, |
@@ -305,6 +321,28 @@ static struct acpi_offsets info_offsets[] = { | |||
305 | {offsetof(struct acpi_battery, oem_info), 1}, | 321 | {offsetof(struct acpi_battery, oem_info), 1}, |
306 | }; | 322 | }; |
307 | 323 | ||
324 | static struct acpi_offsets extended_info_offsets[] = { | ||
325 | {offsetof(struct acpi_battery, power_unit), 0}, | ||
326 | {offsetof(struct acpi_battery, design_capacity), 0}, | ||
327 | {offsetof(struct acpi_battery, full_charge_capacity), 0}, | ||
328 | {offsetof(struct acpi_battery, technology), 0}, | ||
329 | {offsetof(struct acpi_battery, design_voltage), 0}, | ||
330 | {offsetof(struct acpi_battery, design_capacity_warning), 0}, | ||
331 | {offsetof(struct acpi_battery, design_capacity_low), 0}, | ||
332 | {offsetof(struct acpi_battery, cycle_count), 0}, | ||
333 | {offsetof(struct acpi_battery, measurement_accuracy), 0}, | ||
334 | {offsetof(struct acpi_battery, max_sampling_time), 0}, | ||
335 | {offsetof(struct acpi_battery, min_sampling_time), 0}, | ||
336 | {offsetof(struct acpi_battery, max_averaging_interval), 0}, | ||
337 | {offsetof(struct acpi_battery, min_averaging_interval), 0}, | ||
338 | {offsetof(struct acpi_battery, capacity_granularity_1), 0}, | ||
339 | {offsetof(struct acpi_battery, capacity_granularity_2), 0}, | ||
340 | {offsetof(struct acpi_battery, model_number), 1}, | ||
341 | {offsetof(struct acpi_battery, serial_number), 1}, | ||
342 | {offsetof(struct acpi_battery, type), 1}, | ||
343 | {offsetof(struct acpi_battery, oem_info), 1}, | ||
344 | }; | ||
345 | |||
308 | static int extract_package(struct acpi_battery *battery, | 346 | static int extract_package(struct acpi_battery *battery, |
309 | union acpi_object *package, | 347 | union acpi_object *package, |
310 | struct acpi_offsets *offsets, int num) | 348 | struct acpi_offsets *offsets, int num) |
@@ -350,22 +388,29 @@ static int acpi_battery_get_info(struct acpi_battery *battery) | |||
350 | { | 388 | { |
351 | int result = -EFAULT; | 389 | int result = -EFAULT; |
352 | acpi_status status = 0; | 390 | acpi_status status = 0; |
391 | char *name = test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags)? | ||
392 | "_BIX" : "_BIF"; | ||
393 | |||
353 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 394 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
354 | 395 | ||
355 | if (!acpi_battery_present(battery)) | 396 | if (!acpi_battery_present(battery)) |
356 | return 0; | 397 | return 0; |
357 | mutex_lock(&battery->lock); | 398 | mutex_lock(&battery->lock); |
358 | status = acpi_evaluate_object(battery->device->handle, "_BIF", | 399 | status = acpi_evaluate_object(battery->device->handle, name, |
359 | NULL, &buffer); | 400 | NULL, &buffer); |
360 | mutex_unlock(&battery->lock); | 401 | mutex_unlock(&battery->lock); |
361 | 402 | ||
362 | if (ACPI_FAILURE(status)) { | 403 | if (ACPI_FAILURE(status)) { |
363 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); | 404 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating %s", name)); |
364 | return -ENODEV; | 405 | return -ENODEV; |
365 | } | 406 | } |
366 | 407 | if (test_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags)) | |
367 | result = extract_package(battery, buffer.pointer, | 408 | result = extract_package(battery, buffer.pointer, |
368 | info_offsets, ARRAY_SIZE(info_offsets)); | 409 | extended_info_offsets, |
410 | ARRAY_SIZE(extended_info_offsets)); | ||
411 | else | ||
412 | result = extract_package(battery, buffer.pointer, | ||
413 | info_offsets, ARRAY_SIZE(info_offsets)); | ||
369 | kfree(buffer.pointer); | 414 | kfree(buffer.pointer); |
370 | return result; | 415 | return result; |
371 | } | 416 | } |
@@ -399,7 +444,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
399 | battery->update_time = jiffies; | 444 | battery->update_time = jiffies; |
400 | kfree(buffer.pointer); | 445 | kfree(buffer.pointer); |
401 | 446 | ||
402 | if ((battery->quirks & QUIRK_SIGNED16_CURRENT) && | 447 | if (test_bit(ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, &battery->flags) && |
403 | battery->rate_now != -1) | 448 | battery->rate_now != -1) |
404 | battery->rate_now = abs((s16)battery->rate_now); | 449 | battery->rate_now = abs((s16)battery->rate_now); |
405 | 450 | ||
@@ -412,7 +457,8 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery) | |||
412 | union acpi_object arg0 = { .type = ACPI_TYPE_INTEGER }; | 457 | union acpi_object arg0 = { .type = ACPI_TYPE_INTEGER }; |
413 | struct acpi_object_list arg_list = { 1, &arg0 }; | 458 | struct acpi_object_list arg_list = { 1, &arg0 }; |
414 | 459 | ||
415 | if (!acpi_battery_present(battery)|| !battery->alarm_present) | 460 | if (!acpi_battery_present(battery) || |
461 | !test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags)) | ||
416 | return -ENODEV; | 462 | return -ENODEV; |
417 | 463 | ||
418 | arg0.integer.value = battery->alarm; | 464 | arg0.integer.value = battery->alarm; |
@@ -437,10 +483,10 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery) | |||
437 | /* See if alarms are supported, and if so, set default */ | 483 | /* See if alarms are supported, and if so, set default */ |
438 | status = acpi_get_handle(battery->device->handle, "_BTP", &handle); | 484 | status = acpi_get_handle(battery->device->handle, "_BTP", &handle); |
439 | if (ACPI_FAILURE(status)) { | 485 | if (ACPI_FAILURE(status)) { |
440 | battery->alarm_present = 0; | 486 | clear_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags); |
441 | return 0; | 487 | return 0; |
442 | } | 488 | } |
443 | battery->alarm_present = 1; | 489 | set_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags); |
444 | if (!battery->alarm) | 490 | if (!battery->alarm) |
445 | battery->alarm = battery->design_capacity_warning; | 491 | battery->alarm = battery->design_capacity_warning; |
446 | return acpi_battery_set_alarm(battery); | 492 | return acpi_battery_set_alarm(battery); |
@@ -510,9 +556,8 @@ static void sysfs_remove_battery(struct acpi_battery *battery) | |||
510 | 556 | ||
511 | static void acpi_battery_quirks(struct acpi_battery *battery) | 557 | static void acpi_battery_quirks(struct acpi_battery *battery) |
512 | { | 558 | { |
513 | battery->quirks = 0; | ||
514 | if (dmi_name_in_vendors("Acer") && battery->power_unit) { | 559 | if (dmi_name_in_vendors("Acer") && battery->power_unit) { |
515 | battery->quirks |= QUIRK_SIGNED16_CURRENT; | 560 | set_bit(ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, &battery->flags); |
516 | } | 561 | } |
517 | } | 562 | } |
518 | 563 | ||
@@ -590,6 +635,7 @@ static int acpi_battery_print_info(struct seq_file *seq, int result) | |||
590 | seq_printf(seq, "design capacity low: %d %sh\n", | 635 | seq_printf(seq, "design capacity low: %d %sh\n", |
591 | battery->design_capacity_low, | 636 | battery->design_capacity_low, |
592 | acpi_battery_units(battery)); | 637 | acpi_battery_units(battery)); |
638 | seq_printf(seq, "cycle count: %i\n", battery->cycle_count); | ||
593 | seq_printf(seq, "capacity granularity 1: %d %sh\n", | 639 | seq_printf(seq, "capacity granularity 1: %d %sh\n", |
594 | battery->capacity_granularity_1, | 640 | battery->capacity_granularity_1, |
595 | acpi_battery_units(battery)); | 641 | acpi_battery_units(battery)); |
@@ -841,6 +887,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
841 | { | 887 | { |
842 | int result = 0; | 888 | int result = 0; |
843 | struct acpi_battery *battery = NULL; | 889 | struct acpi_battery *battery = NULL; |
890 | acpi_handle handle; | ||
844 | if (!device) | 891 | if (!device) |
845 | return -EINVAL; | 892 | return -EINVAL; |
846 | battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); | 893 | battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); |
@@ -851,6 +898,9 @@ static int acpi_battery_add(struct acpi_device *device) | |||
851 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); | 898 | strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); |
852 | device->driver_data = battery; | 899 | device->driver_data = battery; |
853 | mutex_init(&battery->lock); | 900 | mutex_init(&battery->lock); |
901 | if (ACPI_SUCCESS(acpi_get_handle(battery->device->handle, | ||
902 | "_BIX", &handle))) | ||
903 | set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); | ||
854 | acpi_battery_update(battery); | 904 | acpi_battery_update(battery); |
855 | #ifdef CONFIG_ACPI_PROCFS_POWER | 905 | #ifdef CONFIG_ACPI_PROCFS_POWER |
856 | result = acpi_battery_add_fs(device); | 906 | result = acpi_battery_add_fs(device); |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index a52126e46307..b70cd3756142 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -190,16 +190,16 @@ int acpi_bus_get_power(acpi_handle handle, int *state) | |||
190 | * Get the device's power state either directly (via _PSC) or | 190 | * Get the device's power state either directly (via _PSC) or |
191 | * indirectly (via power resources). | 191 | * indirectly (via power resources). |
192 | */ | 192 | */ |
193 | if (device->power.flags.explicit_get) { | 193 | if (device->power.flags.power_resources) { |
194 | result = acpi_power_get_inferred_state(device); | ||
195 | if (result) | ||
196 | return result; | ||
197 | } else if (device->power.flags.explicit_get) { | ||
194 | status = acpi_evaluate_integer(device->handle, "_PSC", | 198 | status = acpi_evaluate_integer(device->handle, "_PSC", |
195 | NULL, &psc); | 199 | NULL, &psc); |
196 | if (ACPI_FAILURE(status)) | 200 | if (ACPI_FAILURE(status)) |
197 | return -ENODEV; | 201 | return -ENODEV; |
198 | device->power.state = (int)psc; | 202 | device->power.state = (int)psc; |
199 | } else if (device->power.flags.power_resources) { | ||
200 | result = acpi_power_get_inferred_state(device); | ||
201 | if (result) | ||
202 | return result; | ||
203 | } | 203 | } |
204 | 204 | ||
205 | *state = device->power.state; | 205 | *state = device->power.state; |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index d7a6bbbb834c..1ac28c6a672e 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -76,8 +76,9 @@ enum ec_command { | |||
76 | enum { | 76 | enum { |
77 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ | 77 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
78 | EC_FLAGS_GPE_STORM, /* GPE storm detected */ | 78 | EC_FLAGS_GPE_STORM, /* GPE storm detected */ |
79 | EC_FLAGS_HANDLERS_INSTALLED /* Handlers for GPE and | 79 | EC_FLAGS_HANDLERS_INSTALLED, /* Handlers for GPE and |
80 | * OpReg are installed */ | 80 | * OpReg are installed */ |
81 | EC_FLAGS_FROZEN, /* Transactions are suspended */ | ||
81 | }; | 82 | }; |
82 | 83 | ||
83 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ | 84 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ |
@@ -291,6 +292,10 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t) | |||
291 | if (t->rdata) | 292 | if (t->rdata) |
292 | memset(t->rdata, 0, t->rlen); | 293 | memset(t->rdata, 0, t->rlen); |
293 | mutex_lock(&ec->lock); | 294 | mutex_lock(&ec->lock); |
295 | if (test_bit(EC_FLAGS_FROZEN, &ec->flags)) { | ||
296 | status = -EINVAL; | ||
297 | goto unlock; | ||
298 | } | ||
294 | if (ec->global_lock) { | 299 | if (ec->global_lock) { |
295 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 300 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
296 | if (ACPI_FAILURE(status)) { | 301 | if (ACPI_FAILURE(status)) { |
@@ -453,6 +458,32 @@ int ec_transaction(u8 command, | |||
453 | 458 | ||
454 | EXPORT_SYMBOL(ec_transaction); | 459 | EXPORT_SYMBOL(ec_transaction); |
455 | 460 | ||
461 | void acpi_ec_suspend_transactions(void) | ||
462 | { | ||
463 | struct acpi_ec *ec = first_ec; | ||
464 | |||
465 | if (!ec) | ||
466 | return; | ||
467 | |||
468 | mutex_lock(&ec->lock); | ||
469 | /* Prevent transactions from being carried out */ | ||
470 | set_bit(EC_FLAGS_FROZEN, &ec->flags); | ||
471 | mutex_unlock(&ec->lock); | ||
472 | } | ||
473 | |||
474 | void acpi_ec_resume_transactions(void) | ||
475 | { | ||
476 | struct acpi_ec *ec = first_ec; | ||
477 | |||
478 | if (!ec) | ||
479 | return; | ||
480 | |||
481 | mutex_lock(&ec->lock); | ||
482 | /* Allow transactions to be carried out again */ | ||
483 | clear_bit(EC_FLAGS_FROZEN, &ec->flags); | ||
484 | mutex_unlock(&ec->lock); | ||
485 | } | ||
486 | |||
456 | static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data) | 487 | static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data) |
457 | { | 488 | { |
458 | int result; | 489 | int result; |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 9c4c962e46e3..e28411367239 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -49,6 +49,8 @@ void acpi_early_processor_set_pdc(void); | |||
49 | int acpi_ec_init(void); | 49 | int acpi_ec_init(void); |
50 | int acpi_ec_ecdt_probe(void); | 50 | int acpi_ec_ecdt_probe(void); |
51 | int acpi_boot_ec_enable(void); | 51 | int acpi_boot_ec_enable(void); |
52 | void acpi_ec_suspend_transactions(void); | ||
53 | void acpi_ec_resume_transactions(void); | ||
52 | 54 | ||
53 | /*-------------------------------------------------------------------------- | 55 | /*-------------------------------------------------------------------------- |
54 | Suspend/Resume | 56 | Suspend/Resume |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 7ded7542fc9d..29c6f5766dcf 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -1133,9 +1133,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
1133 | int result = 0; | 1133 | int result = 0; |
1134 | struct acpi_processor_throttling *pthrottling; | 1134 | struct acpi_processor_throttling *pthrottling; |
1135 | 1135 | ||
1136 | if (!pr) | ||
1137 | return -EINVAL; | ||
1138 | |||
1139 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 1136 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
1140 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", | 1137 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", |
1141 | pr->throttling.address, | 1138 | pr->throttling.address, |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index b16ddbf23a9c..89ad11138e48 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -217,6 +217,9 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy, | |||
217 | case POWER_SUPPLY_PROP_TECHNOLOGY: | 217 | case POWER_SUPPLY_PROP_TECHNOLOGY: |
218 | val->intval = acpi_battery_technology(battery); | 218 | val->intval = acpi_battery_technology(battery); |
219 | break; | 219 | break; |
220 | case POWER_SUPPLY_PROP_CYCLE_COUNT: | ||
221 | val->intval = battery->cycle_count; | ||
222 | break; | ||
220 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: | 223 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: |
221 | val->intval = battery->design_voltage * | 224 | val->intval = battery->design_voltage * |
222 | acpi_battery_vscale(battery) * 1000; | 225 | acpi_battery_vscale(battery) * 1000; |
@@ -276,6 +279,7 @@ static enum power_supply_property sbs_charge_battery_props[] = { | |||
276 | POWER_SUPPLY_PROP_STATUS, | 279 | POWER_SUPPLY_PROP_STATUS, |
277 | POWER_SUPPLY_PROP_PRESENT, | 280 | POWER_SUPPLY_PROP_PRESENT, |
278 | POWER_SUPPLY_PROP_TECHNOLOGY, | 281 | POWER_SUPPLY_PROP_TECHNOLOGY, |
282 | POWER_SUPPLY_PROP_CYCLE_COUNT, | ||
279 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | 283 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, |
280 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | 284 | POWER_SUPPLY_PROP_VOLTAGE_NOW, |
281 | POWER_SUPPLY_PROP_CURRENT_NOW, | 285 | POWER_SUPPLY_PROP_CURRENT_NOW, |
@@ -560,6 +564,7 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) | |||
560 | battery->design_voltage * acpi_battery_vscale(battery)); | 564 | battery->design_voltage * acpi_battery_vscale(battery)); |
561 | seq_printf(seq, "design capacity warning: unknown\n"); | 565 | seq_printf(seq, "design capacity warning: unknown\n"); |
562 | seq_printf(seq, "design capacity low: unknown\n"); | 566 | seq_printf(seq, "design capacity low: unknown\n"); |
567 | seq_printf(seq, "cycle count: %i\n", battery->cycle_count); | ||
563 | seq_printf(seq, "capacity granularity 1: unknown\n"); | 568 | seq_printf(seq, "capacity granularity 1: unknown\n"); |
564 | seq_printf(seq, "capacity granularity 2: unknown\n"); | 569 | seq_printf(seq, "capacity granularity 2: unknown\n"); |
565 | seq_printf(seq, "model number: %s\n", battery->device_name); | 570 | seq_printf(seq, "model number: %s\n", battery->device_name); |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 3bde594a9979..f74834a544fd 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -552,8 +552,17 @@ static void acpi_hibernation_leave(void) | |||
552 | hibernate_nvs_restore(); | 552 | hibernate_nvs_restore(); |
553 | } | 553 | } |
554 | 554 | ||
555 | static void acpi_pm_enable_gpes(void) | 555 | static int acpi_pm_pre_restore(void) |
556 | { | 556 | { |
557 | acpi_disable_all_gpes(); | ||
558 | acpi_os_wait_events_complete(NULL); | ||
559 | acpi_ec_suspend_transactions(); | ||
560 | return 0; | ||
561 | } | ||
562 | |||
563 | static void acpi_pm_restore_cleanup(void) | ||
564 | { | ||
565 | acpi_ec_resume_transactions(); | ||
557 | acpi_enable_all_runtime_gpes(); | 566 | acpi_enable_all_runtime_gpes(); |
558 | } | 567 | } |
559 | 568 | ||
@@ -565,8 +574,8 @@ static struct platform_hibernation_ops acpi_hibernation_ops = { | |||
565 | .prepare = acpi_pm_prepare, | 574 | .prepare = acpi_pm_prepare, |
566 | .enter = acpi_hibernation_enter, | 575 | .enter = acpi_hibernation_enter, |
567 | .leave = acpi_hibernation_leave, | 576 | .leave = acpi_hibernation_leave, |
568 | .pre_restore = acpi_pm_disable_gpes, | 577 | .pre_restore = acpi_pm_pre_restore, |
569 | .restore_cleanup = acpi_pm_enable_gpes, | 578 | .restore_cleanup = acpi_pm_restore_cleanup, |
570 | }; | 579 | }; |
571 | 580 | ||
572 | /** | 581 | /** |
@@ -618,8 +627,8 @@ static struct platform_hibernation_ops acpi_hibernation_ops_old = { | |||
618 | .prepare = acpi_pm_disable_gpes, | 627 | .prepare = acpi_pm_disable_gpes, |
619 | .enter = acpi_hibernation_enter, | 628 | .enter = acpi_hibernation_enter, |
620 | .leave = acpi_hibernation_leave, | 629 | .leave = acpi_hibernation_leave, |
621 | .pre_restore = acpi_pm_disable_gpes, | 630 | .pre_restore = acpi_pm_pre_restore, |
622 | .restore_cleanup = acpi_pm_enable_gpes, | 631 | .restore_cleanup = acpi_pm_restore_cleanup, |
623 | .recover = acpi_pm_finish, | 632 | .recover = acpi_pm_finish, |
624 | }; | 633 | }; |
625 | #endif /* CONFIG_HIBERNATION */ | 634 | #endif /* CONFIG_HIBERNATION */ |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 9073ada88835..5d3893558cf7 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -368,7 +368,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
368 | int valid = 0; | 368 | int valid = 0; |
369 | int i; | 369 | int i; |
370 | 370 | ||
371 | /* Critical Shutdown (required) */ | 371 | /* Critical Shutdown */ |
372 | if (flag & ACPI_TRIPS_CRITICAL) { | 372 | if (flag & ACPI_TRIPS_CRITICAL) { |
373 | status = acpi_evaluate_integer(tz->device->handle, | 373 | status = acpi_evaluate_integer(tz->device->handle, |
374 | "_CRT", NULL, &tmp); | 374 | "_CRT", NULL, &tmp); |
@@ -379,17 +379,19 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
379 | * Below zero (Celsius) values clearly aren't right for sure.. | 379 | * Below zero (Celsius) values clearly aren't right for sure.. |
380 | * ... so lets discard those as invalid. | 380 | * ... so lets discard those as invalid. |
381 | */ | 381 | */ |
382 | if (ACPI_FAILURE(status) || | 382 | if (ACPI_FAILURE(status)) { |
383 | tz->trips.critical.temperature <= 2732) { | 383 | tz->trips.critical.flags.valid = 0; |
384 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
385 | "No critical threshold\n")); | ||
386 | } else if (tmp <= 2732) { | ||
387 | printk(KERN_WARNING FW_BUG "Invalid critical threshold " | ||
388 | "(%llu)\n", tmp); | ||
384 | tz->trips.critical.flags.valid = 0; | 389 | tz->trips.critical.flags.valid = 0; |
385 | ACPI_EXCEPTION((AE_INFO, status, | ||
386 | "No or invalid critical threshold")); | ||
387 | return -ENODEV; | ||
388 | } else { | 390 | } else { |
389 | tz->trips.critical.flags.valid = 1; | 391 | tz->trips.critical.flags.valid = 1; |
390 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 392 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
391 | "Found critical threshold [%lu]\n", | 393 | "Found critical threshold [%lu]\n", |
392 | tz->trips.critical.temperature)); | 394 | tz->trips.critical.temperature)); |
393 | } | 395 | } |
394 | if (tz->trips.critical.flags.valid == 1) { | 396 | if (tz->trips.critical.flags.valid == 1) { |
395 | if (crt == -1) { | 397 | if (crt == -1) { |
@@ -575,7 +577,23 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) | |||
575 | 577 | ||
576 | static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) | 578 | static int acpi_thermal_get_trip_points(struct acpi_thermal *tz) |
577 | { | 579 | { |
578 | return acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT); | 580 | int i, valid, ret = acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT); |
581 | |||
582 | if (ret) | ||
583 | return ret; | ||
584 | |||
585 | valid = tz->trips.critical.flags.valid | | ||
586 | tz->trips.hot.flags.valid | | ||
587 | tz->trips.passive.flags.valid; | ||
588 | |||
589 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) | ||
590 | valid |= tz->trips.active[i].flags.valid; | ||
591 | |||
592 | if (!valid) { | ||
593 | printk(KERN_WARNING FW_BUG "No valid trip found\n"); | ||
594 | return -ENODEV; | ||
595 | } | ||
596 | return 0; | ||
579 | } | 597 | } |
580 | 598 | ||
581 | static void acpi_thermal_check(void *data) | 599 | static void acpi_thermal_check(void *data) |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 11882dbe2094..c9a49f4747e6 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -289,51 +289,6 @@ acpi_evaluate_integer(acpi_handle handle, | |||
289 | 289 | ||
290 | EXPORT_SYMBOL(acpi_evaluate_integer); | 290 | EXPORT_SYMBOL(acpi_evaluate_integer); |
291 | 291 | ||
292 | #if 0 | ||
293 | acpi_status | ||
294 | acpi_evaluate_string(acpi_handle handle, | ||
295 | acpi_string pathname, | ||
296 | acpi_object_list * arguments, acpi_string * data) | ||
297 | { | ||
298 | acpi_status status = AE_OK; | ||
299 | acpi_object *element = NULL; | ||
300 | acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
301 | |||
302 | |||
303 | if (!data) | ||
304 | return AE_BAD_PARAMETER; | ||
305 | |||
306 | status = acpi_evaluate_object(handle, pathname, arguments, &buffer); | ||
307 | if (ACPI_FAILURE(status)) { | ||
308 | acpi_util_eval_error(handle, pathname, status); | ||
309 | return status; | ||
310 | } | ||
311 | |||
312 | element = (acpi_object *) buffer.pointer; | ||
313 | |||
314 | if ((element->type != ACPI_TYPE_STRING) | ||
315 | || (element->type != ACPI_TYPE_BUFFER) | ||
316 | || !element->string.length) { | ||
317 | acpi_util_eval_error(handle, pathname, AE_BAD_DATA); | ||
318 | return AE_BAD_DATA; | ||
319 | } | ||
320 | |||
321 | *data = kzalloc(element->string.length + 1, GFP_KERNEL); | ||
322 | if (!data) { | ||
323 | printk(KERN_ERR PREFIX "Memory allocation\n"); | ||
324 | return -ENOMEM; | ||
325 | } | ||
326 | |||
327 | memcpy(*data, element->string.pointer, element->string.length); | ||
328 | |||
329 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Return value [%s]\n", *data)); | ||
330 | |||
331 | kfree(buffer.pointer); | ||
332 | |||
333 | return AE_OK; | ||
334 | } | ||
335 | #endif | ||
336 | |||
337 | acpi_status | 292 | acpi_status |
338 | acpi_evaluate_reference(acpi_handle handle, | 293 | acpi_evaluate_reference(acpi_handle handle, |
339 | acpi_string pathname, | 294 | acpi_string pathname, |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 6e9b49149fce..2ff2b6ab5b6c 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -327,7 +327,7 @@ static int acpi_video_device_lcd_set_level(struct acpi_video_device *device, | |||
327 | int level); | 327 | int level); |
328 | static int acpi_video_device_lcd_get_level_current( | 328 | static int acpi_video_device_lcd_get_level_current( |
329 | struct acpi_video_device *device, | 329 | struct acpi_video_device *device, |
330 | unsigned long long *level); | 330 | unsigned long long *level, int init); |
331 | static int acpi_video_get_next_level(struct acpi_video_device *device, | 331 | static int acpi_video_get_next_level(struct acpi_video_device *device, |
332 | u32 level_current, u32 event); | 332 | u32 level_current, u32 event); |
333 | static int acpi_video_switch_brightness(struct acpi_video_device *device, | 333 | static int acpi_video_switch_brightness(struct acpi_video_device *device, |
@@ -345,7 +345,7 @@ static int acpi_video_get_brightness(struct backlight_device *bd) | |||
345 | struct acpi_video_device *vd = | 345 | struct acpi_video_device *vd = |
346 | (struct acpi_video_device *)bl_get_data(bd); | 346 | (struct acpi_video_device *)bl_get_data(bd); |
347 | 347 | ||
348 | if (acpi_video_device_lcd_get_level_current(vd, &cur_level)) | 348 | if (acpi_video_device_lcd_get_level_current(vd, &cur_level, 0)) |
349 | return -EINVAL; | 349 | return -EINVAL; |
350 | for (i = 2; i < vd->brightness->count; i++) { | 350 | for (i = 2; i < vd->brightness->count; i++) { |
351 | if (vd->brightness->levels[i] == cur_level) | 351 | if (vd->brightness->levels[i] == cur_level) |
@@ -414,7 +414,7 @@ static int video_get_cur_state(struct thermal_cooling_device *cooling_dev, unsig | |||
414 | unsigned long long level; | 414 | unsigned long long level; |
415 | int offset; | 415 | int offset; |
416 | 416 | ||
417 | if (acpi_video_device_lcd_get_level_current(video, &level)) | 417 | if (acpi_video_device_lcd_get_level_current(video, &level, 0)) |
418 | return -EINVAL; | 418 | return -EINVAL; |
419 | for (offset = 2; offset < video->brightness->count; offset++) | 419 | for (offset = 2; offset < video->brightness->count; offset++) |
420 | if (level == video->brightness->levels[offset]) { | 420 | if (level == video->brightness->levels[offset]) { |
@@ -609,7 +609,7 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
609 | 609 | ||
610 | static int | 610 | static int |
611 | acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | 611 | acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, |
612 | unsigned long long *level) | 612 | unsigned long long *level, int init) |
613 | { | 613 | { |
614 | acpi_status status = AE_OK; | 614 | acpi_status status = AE_OK; |
615 | int i; | 615 | int i; |
@@ -633,10 +633,16 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, | |||
633 | device->brightness->curr = *level; | 633 | device->brightness->curr = *level; |
634 | return 0; | 634 | return 0; |
635 | } | 635 | } |
636 | /* BQC returned an invalid level. Stop using it. */ | 636 | if (!init) { |
637 | ACPI_WARNING((AE_INFO, "%s returned an invalid level", | 637 | /* |
638 | buf)); | 638 | * BQC returned an invalid level. |
639 | device->cap._BQC = device->cap._BCQ = 0; | 639 | * Stop using it. |
640 | */ | ||
641 | ACPI_WARNING((AE_INFO, | ||
642 | "%s returned an invalid level", | ||
643 | buf)); | ||
644 | device->cap._BQC = device->cap._BCQ = 0; | ||
645 | } | ||
640 | } else { | 646 | } else { |
641 | /* Fixme: | 647 | /* Fixme: |
642 | * should we return an error or ignore this failure? | 648 | * should we return an error or ignore this failure? |
@@ -892,7 +898,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
892 | if (!device->cap._BQC) | 898 | if (!device->cap._BQC) |
893 | goto set_level; | 899 | goto set_level; |
894 | 900 | ||
895 | result = acpi_video_device_lcd_get_level_current(device, &level_old); | 901 | result = acpi_video_device_lcd_get_level_current(device, &level_old, 1); |
896 | if (result) | 902 | if (result) |
897 | goto out_free_levels; | 903 | goto out_free_levels; |
898 | 904 | ||
@@ -903,7 +909,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
903 | if (result) | 909 | if (result) |
904 | goto out_free_levels; | 910 | goto out_free_levels; |
905 | 911 | ||
906 | result = acpi_video_device_lcd_get_level_current(device, &level); | 912 | result = acpi_video_device_lcd_get_level_current(device, &level, 0); |
907 | if (result) | 913 | if (result) |
908 | goto out_free_levels; | 914 | goto out_free_levels; |
909 | 915 | ||
@@ -1996,7 +2002,7 @@ acpi_video_switch_brightness(struct acpi_video_device *device, int event) | |||
1996 | goto out; | 2002 | goto out; |
1997 | 2003 | ||
1998 | result = acpi_video_device_lcd_get_level_current(device, | 2004 | result = acpi_video_device_lcd_get_level_current(device, |
1999 | &level_current); | 2005 | &level_current, 0); |
2000 | if (result) | 2006 | if (result) |
2001 | goto out; | 2007 | goto out; |
2002 | 2008 | ||