Commit 5a21e4fe authored by Alexey Starikovskiy's avatar Alexey Starikovskiy Committed by Len Brown

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=9362Signed-off-by: default avatarAlexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent c2d00f2d
...@@ -533,7 +533,7 @@ static struct proc_dir_entry *acpi_battery_dir = NULL; ...@@ -533,7 +533,7 @@ static struct proc_dir_entry *acpi_battery_dir = NULL;
static inline char *acpi_battery_units(struct acpi_battery *battery) static inline char *acpi_battery_units(struct acpi_battery *battery)
{ {
return acpi_battery_mode(battery) ? " mWh" : " mAh"; return acpi_battery_mode(battery) ? " mW" : " mA";
} }
...@@ -550,10 +550,10 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset) ...@@ -550,10 +550,10 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
if (!battery->present) if (!battery->present)
goto end; goto end;
seq_printf(seq, "design capacity: %i%s\n", seq_printf(seq, "design capacity: %i%sh\n",
battery->design_capacity * acpi_battery_scale(battery), battery->design_capacity * acpi_battery_scale(battery),
acpi_battery_units(battery)); acpi_battery_units(battery));
seq_printf(seq, "last full capacity: %i%s\n", seq_printf(seq, "last full capacity: %i%sh\n",
battery->full_charge_capacity * acpi_battery_scale(battery), battery->full_charge_capacity * acpi_battery_scale(battery),
acpi_battery_units(battery)); acpi_battery_units(battery));
seq_printf(seq, "battery technology: rechargeable\n"); seq_printf(seq, "battery technology: rechargeable\n");
...@@ -584,7 +584,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) ...@@ -584,7 +584,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
{ {
struct acpi_battery *battery = seq->private; struct acpi_battery *battery = seq->private;
struct acpi_sbs *sbs = battery->sbs; struct acpi_sbs *sbs = battery->sbs;
int result = 0; int rate;
mutex_lock(&sbs->lock); mutex_lock(&sbs->lock);
seq_printf(seq, "present: %s\n", seq_printf(seq, "present: %s\n",
...@@ -598,9 +598,12 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset) ...@@ -598,9 +598,12 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
seq_printf(seq, "charging state: %s\n", seq_printf(seq, "charging state: %s\n",
(battery->current_now < 0) ? "discharging" : (battery->current_now < 0) ? "discharging" :
((battery->current_now > 0) ? "charging" : "charged")); ((battery->current_now > 0) ? "charging" : "charged"));
seq_printf(seq, "present rate: %d mA\n", rate = abs(battery->current_now) * acpi_battery_ipscale(battery);
abs(battery->current_now) * acpi_battery_ipscale(battery)); rate *= (acpi_battery_mode(battery))?(battery->voltage_now *
seq_printf(seq, "remaining capacity: %i%s\n", acpi_battery_vscale(battery)/1000):1;
seq_printf(seq, "present rate: %d%s\n", rate,
acpi_battery_units(battery));
seq_printf(seq, "remaining capacity: %i%sh\n",
battery->capacity_now * acpi_battery_scale(battery), battery->capacity_now * acpi_battery_scale(battery),
acpi_battery_units(battery)); acpi_battery_units(battery));
seq_printf(seq, "present voltage: %i mV\n", 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,7 +611,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
end: end:
mutex_unlock(&sbs->lock); mutex_unlock(&sbs->lock);
return result; return 0;
} }
static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) static 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,7 +635,7 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
acpi_battery_get_alarm(battery); acpi_battery_get_alarm(battery);
seq_printf(seq, "alarm: "); seq_printf(seq, "alarm: ");
if (battery->alarm_capacity) if (battery->alarm_capacity)
seq_printf(seq, "%i%s\n", seq_printf(seq, "%i%sh\n",
battery->alarm_capacity * battery->alarm_capacity *
acpi_battery_scale(battery), acpi_battery_scale(battery),
acpi_battery_units(battery)); acpi_battery_units(battery));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment