X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Facpi%2Fbattery.c;h=a0a178dd189c3259fcc82f323b6c4011fe1442a4;hb=558073dd56707864f09d563b64e7c37c021e89d2;hp=1423b0c0cd2eecc6e3c7b2f5c78746cee5fac4eb;hpb=7b4d469228a92a00e412675817cedd60133de38a;p=linux-2.6-omap-h63xx.git diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 1423b0c0cd2..a0a178dd189 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, break; case POWER_SUPPLY_PROP_CURRENT_NOW: val->intval = battery->current_now * 1000; + /* if power units are mW, convert to mA by + dividing by current voltage (mV/1000) */ + if (!battery->power_unit) { + if (battery->voltage_now) { + val->intval /= battery->voltage_now; + val->intval *= 1000; + } else + val->intval = -1; + } break; case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: