aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sbs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/sbs.c')
-rw-r--r--drivers/acpi/sbs.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 6045cdbe176b..22cb95b349e4 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -54,12 +54,6 @@
54#define ACPI_BATTERY_DIR_NAME "BAT%i" 54#define ACPI_BATTERY_DIR_NAME "BAT%i"
55#define ACPI_AC_DIR_NAME "AC0" 55#define ACPI_AC_DIR_NAME "AC0"
56 56
57enum acpi_sbs_device_addr {
58 ACPI_SBS_CHARGER = 0x9,
59 ACPI_SBS_MANAGER = 0xa,
60 ACPI_SBS_BATTERY = 0xb,
61};
62
63#define ACPI_SBS_NOTIFY_STATUS 0x80 57#define ACPI_SBS_NOTIFY_STATUS 0x80
64#define ACPI_SBS_NOTIFY_INFO 0x81 58#define ACPI_SBS_NOTIFY_INFO 0x81
65 59
@@ -539,7 +533,7 @@ static struct proc_dir_entry *acpi_battery_dir = NULL;
539 533
540static inline char *acpi_battery_units(struct acpi_battery *battery) 534static inline char *acpi_battery_units(struct acpi_battery *battery)
541{ 535{
542 return acpi_battery_mode(battery) ? " mWh" : " mAh"; 536 return acpi_battery_mode(battery) ? " mW" : " mA";
543} 537}
544 538
545 539
@@ -556,10 +550,10 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
556 if (!battery->present) 550 if (!battery->present)
557 goto end; 551 goto end;
558 552
559 seq_printf(seq, "design capacity: %i%s\n", 553 seq_printf(seq, "design capacity: %i%sh\n",
560 battery->design_capacity * acpi_battery_scale(battery), 554 battery->design_capacity * acpi_battery_scale(battery),
561 acpi_battery_units(battery)); 555 acpi_battery_units(battery));
562 seq_printf(seq, "last full capacity: %i%s\n", 556 seq_printf(seq, "last full capacity: %i%sh\n",
563 battery->full_charge_capacity * acpi_battery_scale(battery), 557 battery->full_charge_capacity * acpi_battery_scale(battery),
564 acpi_battery_units(battery)); 558 acpi_battery_units(battery));
565 seq_printf(seq, "battery technology: rechargeable\n"); 559 seq_printf(seq, "battery technology: rechargeable\n");
@@ -590,7 +584,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
590{ 584{
591 struct acpi_battery *battery = seq->private; 585 struct acpi_battery *battery = seq->private;
592 struct acpi_sbs *sbs = battery->sbs; 586 struct acpi_sbs *sbs = battery->sbs;
593 int result = 0; 587 int rate;
594 588
595 mutex_lock(&sbs->lock); 589 mutex_lock(&sbs->lock);
596 seq_printf(seq, "present: %s\n", 590 seq_printf(seq, "present: %s\n",
@@ -604,9 +598,12 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
604 seq_printf(seq, "charging state: %s\n", 598 seq_printf(seq, "charging state: %s\n",
605 (battery->current_now < 0) ? "discharging" : 599 (battery->current_now < 0) ? "discharging" :
606 ((battery->current_now > 0) ? "charging" : "charged")); 600 ((battery->current_now > 0) ? "charging" : "charged"));
607 seq_printf(seq, "present rate: %d mA\n", 601 rate = abs(battery->current_now) * acpi_battery_ipscale(battery);
608 abs(battery->current_now) * acpi_battery_ipscale(battery)); 602 rate *= (acpi_battery_mode(battery))?(battery->voltage_now *
609 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",
610 battery->capacity_now * acpi_battery_scale(battery), 607 battery->capacity_now * acpi_battery_scale(battery),
611 acpi_battery_units(battery)); 608 acpi_battery_units(battery));
612 seq_printf(seq, "present voltage: %i mV\n", 609 seq_printf(seq, "present voltage: %i mV\n",
@@ -614,7 +611,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
614 611
615 end: 612 end:
616 mutex_unlock(&sbs->lock); 613 mutex_unlock(&sbs->lock);
617 return result; 614 return 0;
618} 615}
619 616
620static 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)
@@ -638,7 +635,7 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
638 acpi_battery_get_alarm(battery); 635 acpi_battery_get_alarm(battery);
639 seq_printf(seq, "alarm: "); 636 seq_printf(seq, "alarm: ");
640 if (battery->alarm_capacity) 637 if (battery->alarm_capacity)
641 seq_printf(seq, "%i%s\n", 638 seq_printf(seq, "%i%sh\n",
642 battery->alarm_capacity * 639 battery->alarm_capacity *
643 acpi_battery_scale(battery), 640 acpi_battery_scale(battery),
644 acpi_battery_units(battery)); 641 acpi_battery_units(battery));