diff options
author | Alexey Starikovskiy <astarikovskiy@suse.de> | 2009-03-27 22:23:52 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-03-27 22:23:52 -0400 |
commit | 7faa144a518c456e2057918f030f50100144ccc6 (patch) | |
tree | 4f1a9406419ba486386b460164e3afb270a0beb5 /drivers/acpi/battery.c | |
parent | 8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff) |
ACPI: battery: add power_{now,avg} properties to power_class
ACPI has smart batteries, which work in units of energy and measure
rate of (dis)charge as power, thus it is not appropriate to export it
as a current_now. Current_now will still be exported to allow
for userland applications to match.
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/battery.c')
-rw-r--r-- | drivers/acpi/battery.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 69cbc57c2d1..09a2240d560 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -92,7 +92,7 @@ struct acpi_battery { #endif struct acpi_device *device; unsigned long update_time; - int current_now; + int rate_now; int capacity_now; int voltage_now; int design_capacity; @@ -196,7 +196,8 @@ static int acpi_battery_get_property(struct power_supply *psy, val->intval = battery->voltage_now * 1000; break; case POWER_SUPPLY_PROP_CURRENT_NOW: - val->intval = battery->current_now * 1000; + case POWER_SUPPLY_PROP_POWER_NOW: + val->intval = battery->rate_now * 1000; break; case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: @@ -247,6 +248,7 @@ static enum power_supply_property energy_battery_props[] = { POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_CURRENT_NOW, + POWER_SUPPLY_PROP_POWER_NOW, POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, POWER_SUPPLY_PROP_ENERGY_FULL, POWER_SUPPLY_PROP_ENERGY_NOW, @@ -273,7 +275,7 @@ struct acpi_offsets { static struct acpi_offsets state_offsets[] = { {offsetof(struct acpi_battery, state), 0}, - {offsetof(struct acpi_battery, current_now), 0}, + {offsetof(struct acpi_battery, rate_now), 0}, {offsetof(struct acpi_battery, capacity_now), 0}, {offsetof(struct acpi_battery, voltage_now), 0}, }; @@ -605,11 +607,11 @@ static int acpi_battery_print_state(struct seq_file *seq, int result) else seq_printf(seq, "charging state: charged\n"); - if (battery->current_now == ACPI_BATTERY_VALUE_UNKNOWN) + if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN) seq_printf(seq, "present rate: unknown\n"); else seq_printf(seq, "present rate: %d %s\n", - battery->current_now, acpi_battery_units(battery)); + battery->rate_now, acpi_battery_units(battery)); if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN) seq_printf(seq, "remaining capacity: unknown\n"); |