diff options
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r-- | drivers/acpi/battery.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 1423b0c0cd2e..a0a178dd189c 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -174,6 +174,15 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
174 | break; | 174 | break; |
175 | case POWER_SUPPLY_PROP_CURRENT_NOW: | 175 | case POWER_SUPPLY_PROP_CURRENT_NOW: |
176 | 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 | } | ||
177 | break; | 186 | break; |
178 | case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: | 187 | case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: |
179 | case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: | 188 | case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: |