aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorAlexey Starikovskiy <astarikovskiy@suse.de>2007-12-08 05:02:46 -0500
committerLen Brown <len.brown@intel.com>2007-12-14 15:14:23 -0500
commit5a21e4fe587ebb793bf3a1c02755f8a845170328 (patch)
treeed138219505186db6c8d347ba935f104f3339e25 /drivers/acpi
parentc2d00f2d1bf8dd721f5557b0df23729addc1898d (diff)
ACPI: SBS: Return rate in mW if capacity in mWh
klaptopd assumes rate to be in same units as capacity. http://bugzilla.kernel.org/show_bug.cgi?id=9362 Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/sbs.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 813ef328f743..22cb95b349e4 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -533,7 +533,7 @@ static struct proc_dir_entry *acpi_battery_dir = NULL;
533 533
534static inline char *acpi_battery_units(struct acpi_battery *battery) 534static inline char *acpi_battery_units(struct acpi_battery *battery)
535{ 535{
536 return acpi_battery_mode(battery) ? " mWh" : " mAh"; 536 return acpi_battery_mode(battery) ? " mW" : " mA";
537} 537}
538 538
539 539
@@ -550,10 +550,10 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
550 if (!battery->present) 550 if (!battery->present)
551 goto end; 551 goto end;
552 552
553 seq_printf(seq, "design capacity: %i%s\n", 553 seq_printf(seq, "design capacity: %i%sh\n",
554 battery->design_capacity * acpi_battery_scale(battery), 554 battery->design_capacity * acpi_battery_scale(battery),
555 acpi_battery_units(battery)); 555 acpi_battery_units(battery));
556 seq_printf(seq, "last full capacity: %i%s\n", 556 seq_printf(seq, "last full capacity: %i%sh\n",
557 battery->full_charge_capacity * acpi_battery_scale(battery), 557 battery->full_charge_capacity * acpi_battery_scale(battery),
558 acpi_battery_units(battery)); 558 acpi_battery_units(battery));
559 seq_printf(seq, "battery technology: rechargeable\n"); 559 seq_printf(seq, "battery technology: rechargeable\n");
@@ -584,7 +584,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
584{ 584{
585 struct acpi_battery *battery = seq->private; 585 struct acpi_battery *battery = seq->private;
586 struct acpi_sbs *sbs = battery->sbs; 586 struct acpi_sbs *sbs = battery->sbs;
587 int result = 0; 587 int rate;
588 588
589 mutex_lock(&sbs->lock); 589 mutex_lock(&sbs->lock);
590 seq_printf(seq, "present: %s\n", 590 seq_printf(seq, "present: %s\n",
@@ -598,9 +598,12 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
598 seq_printf(seq, "charging state: %s\n", 598 seq_printf(seq, "charging state: %s\n",
599 (battery->current_now < 0) ? "discharging" : 599 (battery->current_now < 0) ? "discharging" :
600 ((battery->current_now > 0) ? "charging" : "charged")); 600 ((battery->current_now > 0) ? "charging" : "charged"));
601 seq_printf(seq, "present rate: %d mA\n", 601 rate = abs(battery->current_now) * acpi_battery_ipscale(battery);
602 abs(battery->current_now) * acpi_battery_ipscale(battery)); 602 rate *= (acpi_battery_mode(battery))?(battery->voltage_now *
603 seq_printf(seq, "remaining capacity: %i%s\n", 603 acpi_battery_vscale(battery)/1000):1;
604 seq_printf(seq, "present rate: %d%s\n", rate,
605 acpi_battery_units(battery));
606 seq_printf(seq, "remaining capacity: %i%sh\n",
604 battery->capacity_now * acpi_battery_scale(battery), 607 battery->capacity_now * acpi_battery_scale(battery),
605 acpi_battery_units(battery)); 608 acpi_battery_units(battery));
606 seq_printf(seq, "present voltage: %i mV\n", 609 seq_printf(seq, "present voltage: %i mV\n",
@@ -608,7 +611,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
608 611
609 end: 612 end:
610 mutex_unlock(&sbs->lock); 613 mutex_unlock(&sbs->lock);
611 return result; 614 return 0;
612} 615}
613 616
614static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) 617static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
@@ -632,7 +635,7 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
632 acpi_battery_get_alarm(battery); 635 acpi_battery_get_alarm(battery);
633 seq_printf(seq, "alarm: "); 636 seq_printf(seq, "alarm: ");
634 if (battery->alarm_capacity) 637 if (battery->alarm_capacity)
635 seq_printf(seq, "%i%s\n", 638 seq_printf(seq, "%i%sh\n",
636 battery->alarm_capacity * 639 battery->alarm_capacity *
637 acpi_battery_scale(battery), 640 acpi_battery_scale(battery),
638 acpi_battery_units(battery)); 641 acpi_battery_units(battery));