aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/battery.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r--drivers/acpi/battery.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index b2133e89ad9a..a0a178dd189c 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -46,7 +46,6 @@
46 46
47#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF 47#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
48 48
49#define ACPI_BATTERY_COMPONENT 0x00040000
50#define ACPI_BATTERY_CLASS "battery" 49#define ACPI_BATTERY_CLASS "battery"
51#define ACPI_BATTERY_DEVICE_NAME "Battery" 50#define ACPI_BATTERY_DEVICE_NAME "Battery"
52#define ACPI_BATTERY_NOTIFY_STATUS 0x80 51#define ACPI_BATTERY_NOTIFY_STATUS 0x80
@@ -175,6 +174,15 @@ static int acpi_battery_get_property(struct power_supply *psy,
175 break; 174 break;
176 case POWER_SUPPLY_PROP_CURRENT_NOW: 175 case POWER_SUPPLY_PROP_CURRENT_NOW:
177 val->intval = battery->current_now * 1000; 176 val->intval = battery->current_now * 1000;
177 /* if power units are mW, convert to mA by
178 dividing by current voltage (mV/1000) */
179 if (!battery->power_unit) {
180 if (battery->voltage_now) {
181 val->intval /= battery->voltage_now;
182 val->intval *= 1000;
183 } else
184 val->intval = -1;
185 }
178 break; 186 break;
179 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: 187 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
180 case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: 188 case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
@@ -782,7 +790,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
782 acpi_bus_generate_proc_event(device, event, 790 acpi_bus_generate_proc_event(device, event,
783 acpi_battery_present(battery)); 791 acpi_battery_present(battery));
784 acpi_bus_generate_netlink_event(device->pnp.device_class, 792 acpi_bus_generate_netlink_event(device->pnp.device_class,
785 device->dev.bus_id, event, 793 dev_name(&device->dev), event,
786 acpi_battery_present(battery)); 794 acpi_battery_present(battery));
787#ifdef CONFIG_ACPI_SYSFS_POWER 795#ifdef CONFIG_ACPI_SYSFS_POWER
788 /* acpi_batter_update could remove power_supply object */ 796 /* acpi_batter_update could remove power_supply object */