mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-16 05:50:19 +00:00
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>
This commit is contained in:
parent
c2d00f2d1b
commit
5a21e4fe58
@ -533,7 +533,7 @@ static struct proc_dir_entry *acpi_battery_dir = NULL;
|
||||
|
||||
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)
|
||||
if (!battery->present)
|
||||
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),
|
||||
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),
|
||||
acpi_battery_units(battery));
|
||||
seq_printf(seq, "battery technology: rechargeable\n");
|
||||
@ -584,7 +584,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
|
||||
{
|
||||
struct acpi_battery *battery = seq->private;
|
||||
struct acpi_sbs *sbs = battery->sbs;
|
||||
int result = 0;
|
||||
int rate;
|
||||
|
||||
mutex_lock(&sbs->lock);
|
||||
seq_printf(seq, "present: %s\n",
|
||||
@ -598,9 +598,12 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
|
||||
seq_printf(seq, "charging state: %s\n",
|
||||
(battery->current_now < 0) ? "discharging" :
|
||||
((battery->current_now > 0) ? "charging" : "charged"));
|
||||
seq_printf(seq, "present rate: %d mA\n",
|
||||
abs(battery->current_now) * acpi_battery_ipscale(battery));
|
||||
seq_printf(seq, "remaining capacity: %i%s\n",
|
||||
rate = abs(battery->current_now) * acpi_battery_ipscale(battery);
|
||||
rate *= (acpi_battery_mode(battery))?(battery->voltage_now *
|
||||
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),
|
||||
acpi_battery_units(battery));
|
||||
seq_printf(seq, "present voltage: %i mV\n",
|
||||
@ -608,7 +611,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
|
||||
|
||||
end:
|
||||
mutex_unlock(&sbs->lock);
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
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)
|
||||
acpi_battery_get_alarm(battery);
|
||||
seq_printf(seq, "alarm: ");
|
||||
if (battery->alarm_capacity)
|
||||
seq_printf(seq, "%i%s\n",
|
||||
seq_printf(seq, "%i%sh\n",
|
||||
battery->alarm_capacity *
|
||||
acpi_battery_scale(battery),
|
||||
acpi_battery_units(battery));
|
||||
|
Loading…
Reference in New Issue
Block a user