diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/battery.c | 2 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 8 | ||||
-rw-r--r-- | drivers/acpi/sbs.c | 25 |
3 files changed, 27 insertions, 8 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 192c244f6190..2e8e790c1180 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -153,6 +153,8 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
153 | val->intval = POWER_SUPPLY_STATUS_CHARGING; | 153 | val->intval = POWER_SUPPLY_STATUS_CHARGING; |
154 | else if (battery->state == 0) | 154 | else if (battery->state == 0) |
155 | val->intval = POWER_SUPPLY_STATUS_FULL; | 155 | val->intval = POWER_SUPPLY_STATUS_FULL; |
156 | else | ||
157 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; | ||
156 | break; | 158 | break; |
157 | case POWER_SUPPLY_PROP_PRESENT: | 159 | case POWER_SUPPLY_PROP_PRESENT: |
158 | val->intval = acpi_battery_present(battery); | 160 | val->intval = acpi_battery_present(battery); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 390f8f8666da..d6ddb547f2d9 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -890,12 +890,20 @@ int __init acpi_ec_ecdt_probe(void) | |||
890 | boot_ec->gpe = ecdt_ptr->gpe; | 890 | boot_ec->gpe = ecdt_ptr->gpe; |
891 | boot_ec->handle = ACPI_ROOT_OBJECT; | 891 | boot_ec->handle = ACPI_ROOT_OBJECT; |
892 | } else { | 892 | } else { |
893 | /* This workaround is needed only on some broken machines, | ||
894 | * which require early EC, but fail to provide ECDT */ | ||
895 | acpi_handle x; | ||
893 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); | 896 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); |
894 | status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, | 897 | status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, |
895 | boot_ec, NULL); | 898 | boot_ec, NULL); |
896 | /* Check that acpi_get_devices actually find something */ | 899 | /* Check that acpi_get_devices actually find something */ |
897 | if (ACPI_FAILURE(status) || !boot_ec->handle) | 900 | if (ACPI_FAILURE(status) || !boot_ec->handle) |
898 | goto error; | 901 | goto error; |
902 | /* We really need to limit this workaround, the only ASUS, | ||
903 | * which needs it, has fake EC._INI method, so use it as flag. | ||
904 | */ | ||
905 | if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x))) | ||
906 | goto error; | ||
899 | } | 907 | } |
900 | 908 | ||
901 | ret = ec_install_handlers(boot_ec); | 909 | ret = ec_install_handlers(boot_ec); |
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 90fd09c65f95..73c1ba314299 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -113,6 +113,7 @@ struct acpi_battery { | |||
113 | u16 spec; | 113 | u16 spec; |
114 | u8 id; | 114 | u8 id; |
115 | u8 present:1; | 115 | u8 present:1; |
116 | u8 have_sysfs_alarm:1; | ||
116 | }; | 117 | }; |
117 | 118 | ||
118 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); | 119 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); |
@@ -808,7 +809,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
808 | } | 809 | } |
809 | battery->bat.get_property = acpi_sbs_battery_get_property; | 810 | battery->bat.get_property = acpi_sbs_battery_get_property; |
810 | result = power_supply_register(&sbs->device->dev, &battery->bat); | 811 | result = power_supply_register(&sbs->device->dev, &battery->bat); |
811 | device_create_file(battery->bat.dev, &alarm_attr); | 812 | if (result) |
813 | goto end; | ||
814 | result = device_create_file(battery->bat.dev, &alarm_attr); | ||
815 | if (result) | ||
816 | goto end; | ||
817 | battery->have_sysfs_alarm = 1; | ||
818 | end: | ||
812 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", | 819 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", |
813 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), | 820 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), |
814 | battery->name, sbs->battery->present ? "present" : "absent"); | 821 | battery->name, sbs->battery->present ? "present" : "absent"); |
@@ -817,14 +824,16 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
817 | 824 | ||
818 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 825 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) |
819 | { | 826 | { |
820 | if (sbs->battery[id].bat.dev) | 827 | struct acpi_battery *battery = &sbs->battery[id]; |
821 | device_remove_file(sbs->battery[id].bat.dev, &alarm_attr); | 828 | |
822 | power_supply_unregister(&sbs->battery[id].bat); | 829 | if (battery->bat.dev) { |
823 | #ifdef CONFIG_ACPI_PROCFS | 830 | if (battery->have_sysfs_alarm) |
824 | if (sbs->battery[id].proc_entry) { | 831 | device_remove_file(battery->bat.dev, &alarm_attr); |
825 | acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry), | 832 | power_supply_unregister(&battery->bat); |
826 | acpi_battery_dir); | ||
827 | } | 833 | } |
834 | #ifdef CONFIG_ACPI_PROCFS | ||
835 | if (battery->proc_entry) | ||
836 | acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); | ||
828 | #endif | 837 | #endif |
829 | } | 838 | } |
830 | 839 | ||