summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sbs.c
diff options
context:
space:
mode:
authorLan Tianyu <tianyu.lan@intel.com>2011-07-01 10:03:39 +0200
committerLen Brown <len.brown@intel.com>2011-07-14 06:01:34 +0200
commite4108292cc5b5ca07abc83af31a78338362810ca (patch)
tree77bd78f45fb5d2ba51ec36c3e6b8c46cdffc0354 /drivers/acpi/sbs.c
parentACPI / SBS: Add getting state operation in the acpi_sbs_battery_get_property() (diff)
downloadlinux-e4108292cc5b5ca07abc83af31a78338362810ca.tar.xz
linux-e4108292cc5b5ca07abc83af31a78338362810ca.zip
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>
Diffstat (limited to 'drivers/acpi/sbs.c')
-rw-r--r--drivers/acpi/sbs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 01dad1bedd17..c517ec8106e9 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -230,11 +230,17 @@ static int acpi_sbs_battery_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_POWER_NOW:
val->intval = abs(battery->rate_now) *
acpi_battery_ipscale(battery) * 1000;
+ val->intval *= (acpi_battery_mode(battery)) ?
+ (battery->voltage_now *
+ acpi_battery_vscale(battery) / 1000) : 1;
break;
case POWER_SUPPLY_PROP_CURRENT_AVG:
case POWER_SUPPLY_PROP_POWER_AVG:
val->intval = abs(battery->rate_avg) *
acpi_battery_ipscale(battery) * 1000;
+ val->intval *= (acpi_battery_mode(battery)) ?
+ (battery->voltage_now *
+ acpi_battery_vscale(battery) / 1000) : 1;
break;
case POWER_SUPPLY_PROP_CAPACITY:
val->intval = battery->state_of_charge;