aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorJeremy Erickson <jerickso@cs.unc.edu>2014-04-18 17:06:00 -0400
committerJeremy Erickson <jerickso@cs.unc.edu>2014-04-18 17:06:00 -0400
commita215aa7b9ab3759c047201199fba64d3042d7f13 (patch)
treebca37493d9b2233450e6d3ffced1261d0e4f71fe /drivers/acpi
parentd31199a77ef606f1d06894385f1852181ba6136b (diff)
Update 2.6.36 to 2.6.36.4wip-dissipation2-jerickso
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpica/dswexec.c19
-rw-r--r--drivers/acpi/battery.c38
-rw-r--r--drivers/acpi/bus.c7
-rw-r--r--drivers/acpi/debugfs.c2
-rw-r--r--drivers/acpi/ec.c3
5 files changed, 64 insertions, 5 deletions
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c
index d555b374e314..6b0b5d08d97a 100644
--- a/drivers/acpi/acpica/dswexec.c
+++ b/drivers/acpi/acpica/dswexec.c
@@ -300,10 +300,25 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
300 * we must enter this object into the namespace. The created 300 * we must enter this object into the namespace. The created
301 * object is temporary and will be deleted upon completion of 301 * object is temporary and will be deleted upon completion of
302 * the execution of this method. 302 * the execution of this method.
303 *
304 * Note 10/2010: Except for the Scope() op. This opcode does
305 * not actually create a new object, it refers to an existing
306 * object. However, for Scope(), we want to indeed open a
307 * new scope.
303 */ 308 */
304 status = acpi_ds_load2_begin_op(walk_state, NULL); 309 if (op->common.aml_opcode != AML_SCOPE_OP) {
310 status =
311 acpi_ds_load2_begin_op(walk_state, NULL);
312 } else {
313 status =
314 acpi_ds_scope_stack_push(op->named.node,
315 op->named.node->
316 type, walk_state);
317 if (ACPI_FAILURE(status)) {
318 return_ACPI_STATUS(status);
319 }
320 }
305 } 321 }
306
307 break; 322 break;
308 323
309 case AML_CLASS_EXECUTE: 324 case AML_CLASS_EXECUTE:
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 98417201e9ce..4c0a0a37d46e 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -98,6 +98,7 @@ enum {
98 * due to bad math. 98 * due to bad math.
99 */ 99 */
100 ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, 100 ACPI_BATTERY_QUIRK_SIGNED16_CURRENT,
101 ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY,
101}; 102};
102 103
103struct acpi_battery { 104struct acpi_battery {
@@ -412,6 +413,8 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
412 result = extract_package(battery, buffer.pointer, 413 result = extract_package(battery, buffer.pointer,
413 info_offsets, ARRAY_SIZE(info_offsets)); 414 info_offsets, ARRAY_SIZE(info_offsets));
414 kfree(buffer.pointer); 415 kfree(buffer.pointer);
416 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags))
417 battery->full_charge_capacity = battery->design_capacity;
415 return result; 418 return result;
416} 419}
417 420
@@ -448,6 +451,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
448 battery->rate_now != -1) 451 battery->rate_now != -1)
449 battery->rate_now = abs((s16)battery->rate_now); 452 battery->rate_now = abs((s16)battery->rate_now);
450 453
454 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags)
455 && battery->capacity_now >= 0 && battery->capacity_now <= 100)
456 battery->capacity_now = (battery->capacity_now *
457 battery->full_charge_capacity) / 100;
451 return result; 458 return result;
452} 459}
453 460
@@ -561,6 +568,33 @@ static void acpi_battery_quirks(struct acpi_battery *battery)
561 } 568 }
562} 569}
563 570
571/*
572 * According to the ACPI spec, some kinds of primary batteries can
573 * report percentage battery remaining capacity directly to OS.
574 * In this case, it reports the Last Full Charged Capacity == 100
575 * and BatteryPresentRate == 0xFFFFFFFF.
576 *
577 * Now we found some battery reports percentage remaining capacity
578 * even if it's rechargeable.
579 * https://bugzilla.kernel.org/show_bug.cgi?id=15979
580 *
581 * Handle this correctly so that they won't break userspace.
582 */
583static void acpi_battery_quirks2(struct acpi_battery *battery)
584{
585 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags))
586 return ;
587
588 if (battery->full_charge_capacity == 100 &&
589 battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN &&
590 battery->capacity_now >=0 && battery->capacity_now <= 100) {
591 set_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags);
592 battery->full_charge_capacity = battery->design_capacity;
593 battery->capacity_now = (battery->capacity_now *
594 battery->full_charge_capacity) / 100;
595 }
596}
597
564static int acpi_battery_update(struct acpi_battery *battery) 598static int acpi_battery_update(struct acpi_battery *battery)
565{ 599{
566 int result, old_present = acpi_battery_present(battery); 600 int result, old_present = acpi_battery_present(battery);
@@ -586,7 +620,9 @@ static int acpi_battery_update(struct acpi_battery *battery)
586 if (!battery->bat.dev) 620 if (!battery->bat.dev)
587 sysfs_add_battery(battery); 621 sysfs_add_battery(battery);
588#endif 622#endif
589 return acpi_battery_get_state(battery); 623 result = acpi_battery_get_state(battery);
624 acpi_battery_quirks2(battery);
625 return result;
590} 626}
591 627
592/* -------------------------------------------------------------------------- 628/* --------------------------------------------------------------------------
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 310e3b9749cb..d68bd61072bb 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -935,6 +935,12 @@ static int __init acpi_bus_init(void)
935 goto error1; 935 goto error1;
936 } 936 }
937 937
938 /*
939 * _PDC control method may load dynamic SSDT tables,
940 * and we need to install the table handler before that.
941 */
942 acpi_sysfs_init();
943
938 acpi_early_processor_set_pdc(); 944 acpi_early_processor_set_pdc();
939 945
940 /* 946 /*
@@ -1026,7 +1032,6 @@ static int __init acpi_init(void)
1026 acpi_scan_init(); 1032 acpi_scan_init();
1027 acpi_ec_init(); 1033 acpi_ec_init();
1028 acpi_power_init(); 1034 acpi_power_init();
1029 acpi_sysfs_init();
1030 acpi_debugfs_init(); 1035 acpi_debugfs_init();
1031 acpi_sleep_proc_init(); 1036 acpi_sleep_proc_init();
1032 acpi_wakeup_device_init(); 1037 acpi_wakeup_device_init();
diff --git a/drivers/acpi/debugfs.c b/drivers/acpi/debugfs.c
index 7de27d49c4b9..74c4a398604a 100644
--- a/drivers/acpi/debugfs.c
+++ b/drivers/acpi/debugfs.c
@@ -79,7 +79,7 @@ int __init acpi_debugfs_init(void)
79 if (!acpi_dir) 79 if (!acpi_dir)
80 goto err; 80 goto err;
81 81
82 cm_dentry = debugfs_create_file("custom_method", S_IWUGO, 82 cm_dentry = debugfs_create_file("custom_method", S_IWUSR,
83 acpi_dir, NULL, &cm_fops); 83 acpi_dir, NULL, &cm_fops);
84 if (!cm_dentry) 84 if (!cm_dentry)
85 goto err; 85 goto err;
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index f31291ba94d0..7bff18b33089 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -929,6 +929,9 @@ static struct dmi_system_id __initdata ec_dmi_table[] = {
929 ec_flag_msi, "MSI hardware", { 929 ec_flag_msi, "MSI hardware", {
930 DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL}, 930 DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL},
931 { 931 {
932 ec_flag_msi, "MSI hardware", {
933 DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR")}, NULL},
934 {
932 ec_validate_ecdt, "ASUS hardware", { 935 ec_validate_ecdt, "ASUS hardware", {
933 DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, 936 DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL},
934 {}, 937 {},