aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/battery.c
diff options
context:
space:
mode:
authorAlexey Starikovskiy <astarikovskiy@suse.de>2009-03-27 22:23:52 -0400
committerLen Brown <len.brown@intel.com>2009-03-27 22:23:52 -0400
commit7faa144a518c456e2057918f030f50100144ccc6 (patch)
tree4f1a9406419ba486386b460164e3afb270a0beb5 /drivers/acpi/battery.c
parent8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (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.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 69cbc57c2d1c..09a2240d5605 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -92,7 +92,7 @@ struct acpi_battery {
92#endif 92#endif
93 struct acpi_device *device; 93 struct acpi_device *device;
94 unsigned long update_time; 94 unsigned long update_time;
95 int current_now; 95 int rate_now;
96 int capacity_now; 96 int capacity_now;
97 int voltage_now; 97 int voltage_now;
98 int design_capacity; 98 int design_capacity;
@@ -196,7 +196,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
196 val->intval = battery->voltage_now * 1000; 196 val->intval = battery->voltage_now * 1000;
197 break; 197 break;
198 case POWER_SUPPLY_PROP_CURRENT_NOW: 198 case POWER_SUPPLY_PROP_CURRENT_NOW:
199 val->intval = battery->current_now * 1000; 199 case POWER_SUPPLY_PROP_POWER_NOW:
200 val->intval = battery->rate_now * 1000;
200 break; 201 break;
201 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: 202 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
202 case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: 203 case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
@@ -247,6 +248,7 @@ static enum power_supply_property energy_battery_props[] = {
247 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, 248 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
248 POWER_SUPPLY_PROP_VOLTAGE_NOW, 249 POWER_SUPPLY_PROP_VOLTAGE_NOW,
249 POWER_SUPPLY_PROP_CURRENT_NOW, 250 POWER_SUPPLY_PROP_CURRENT_NOW,
251 POWER_SUPPLY_PROP_POWER_NOW,
250 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, 252 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
251 POWER_SUPPLY_PROP_ENERGY_FULL, 253 POWER_SUPPLY_PROP_ENERGY_FULL,
252 POWER_SUPPLY_PROP_ENERGY_NOW, 254 POWER_SUPPLY_PROP_ENERGY_NOW,
@@ -273,7 +275,7 @@ struct acpi_offsets {
273 275
274static struct acpi_offsets state_offsets[] = { 276static struct acpi_offsets state_offsets[] = {
275 {offsetof(struct acpi_battery, state), 0}, 277 {offsetof(struct acpi_battery, state), 0},
276 {offsetof(struct acpi_battery, current_now), 0}, 278 {offsetof(struct acpi_battery, rate_now), 0},
277 {offsetof(struct acpi_battery, capacity_now), 0}, 279 {offsetof(struct acpi_battery, capacity_now), 0},
278 {offsetof(struct acpi_battery, voltage_now), 0}, 280 {offsetof(struct acpi_battery, voltage_now), 0},
279}; 281};
@@ -605,11 +607,11 @@ static int acpi_battery_print_state(struct seq_file *seq, int result)
605 else 607 else
606 seq_printf(seq, "charging state: charged\n"); 608 seq_printf(seq, "charging state: charged\n");
607 609
608 if (battery->current_now == ACPI_BATTERY_VALUE_UNKNOWN) 610 if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN)
609 seq_printf(seq, "present rate: unknown\n"); 611 seq_printf(seq, "present rate: unknown\n");
610 else 612 else
611 seq_printf(seq, "present rate: %d %s\n", 613 seq_printf(seq, "present rate: %d %s\n",
612 battery->current_now, acpi_battery_units(battery)); 614 battery->rate_now, acpi_battery_units(battery));
613 615
614 if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN) 616 if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN)
615 seq_printf(seq, "remaining capacity: unknown\n"); 617 seq_printf(seq, "remaining capacity: unknown\n");