ACPI / SBS: Correct the value of power_now and power_avg in the sysfs

https://bugzilla.kernel.org/show_bug.cgi?id=24492

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Lan Tianyu 2011-07-01 16:03:39 +08:00 коммит произвёл Len Brown
Родитель 1dd5c715e5
Коммит e4108292cc
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -230,11 +230,17 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_POWER_NOW: case POWER_SUPPLY_PROP_POWER_NOW:
val->intval = abs(battery->rate_now) * val->intval = abs(battery->rate_now) *
acpi_battery_ipscale(battery) * 1000; acpi_battery_ipscale(battery) * 1000;
val->intval *= (acpi_battery_mode(battery)) ?
(battery->voltage_now *
acpi_battery_vscale(battery) / 1000) : 1;
break; break;
case POWER_SUPPLY_PROP_CURRENT_AVG: case POWER_SUPPLY_PROP_CURRENT_AVG:
case POWER_SUPPLY_PROP_POWER_AVG: case POWER_SUPPLY_PROP_POWER_AVG:
val->intval = abs(battery->rate_avg) * val->intval = abs(battery->rate_avg) *
acpi_battery_ipscale(battery) * 1000; acpi_battery_ipscale(battery) * 1000;
val->intval *= (acpi_battery_mode(battery)) ?
(battery->voltage_now *
acpi_battery_vscale(battery) / 1000) : 1;
break; break;
case POWER_SUPPLY_PROP_CAPACITY: case POWER_SUPPLY_PROP_CAPACITY:
val->intval = battery->state_of_charge; val->intval = battery->state_of_charge;