* /sys/class/power_supply/BAT0/ confusion
@ 2011-11-05 8:46 Christoph Groth
2011-11-09 6:22 ` Lan, Tianyu
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Groth @ 2011-11-05 8:46 UTC (permalink / raw)
To: linux-acpi
Hello,
I'm running kernel 3.0.0 from Debian testing. On my new Thinkpad X220,
I noticed that the "acpi" command gives way too optimistic "remaining
time on battery" estimates.
To calculate the remaining time, the "acpi" tools divides the
"charge_now" value by "current_now" which seems to make sense physically
if the units of these values would be what the names imply. However,
this gives a remaining time of 5.35 hours which is way too high for the
small 4 cell battery I have.
Let's look at a snapshot of the BAT0 directory:
/sys/class/power_supply/BAT0% grep . *
alarm:156000
charge_full:3135000
charge_full_design:2886000
charge_now:2761000
current_now:516000
cycle_count:0
manufacturer:SANYO
model_name:42T4899
present:1
serial_number:19797
status:Discharging
technology:Li-ion
type:Battery
uevent:POWER_SUPPLY_NAME=BAT0
uevent:POWER_SUPPLY_STATUS=Discharging
uevent:POWER_SUPPLY_PRESENT=1
uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion
uevent:POWER_SUPPLY_CYCLE_COUNT=0
uevent:POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
uevent:POWER_SUPPLY_VOLTAGE_NOW=15993000
uevent:POWER_SUPPLY_CURRENT_NOW=516000
uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=2886000
uevent:POWER_SUPPLY_CHARGE_FULL=3135000
uevent:POWER_SUPPLY_CHARGE_NOW=2761000
uevent:POWER_SUPPLY_MODEL_NAME=42T4899
uevent:POWER_SUPPLY_MANUFACTURER=SANYO
uevent:POWER_SUPPLY_SERIAL_NUMBER=19797
voltage_min_design:14800000
voltage_now:15993000
The nominal energy capacity of my battery is 29 Wh, so charge_now seems
to be in units of 10 µWh! (Yes, charge_now == 2761000 seems to mean that
the _energy_ is 27.61 Wh.) This is bogus!
current_now and voltage_now seem to be in the reasonable units µA and
µV, as
current_now * voltage_now * 1e-12 = 8.25
which seems to be the correct power in Watts. (This is also the power
which "powertop" is reporting.)
The remaining runtime in hours in my case seems to be given by
charge_now * 1e-5 / (current_now * voltage_now * 1e-12) = 3.35
which looks like a good estimate of the real situation.
This does not seem to be the way things are supposed to be. The kernel
source file include/linux/power_supply.h states
/*
* All voltages, currents, charges, energies, time and temperatures in uV,
* µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise
* stated. It's driver's job to convert its raw values to units in which
* this class operates.
*/
So this seems to be a bug of either the battery driver or the internal
battery software.
I hope this report will be useful for linux ACPI developers.
Christoph
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: /sys/class/power_supply/BAT0/ confusion
2011-11-05 8:46 /sys/class/power_supply/BAT0/ confusion Christoph Groth
@ 2011-11-09 6:22 ` Lan, Tianyu
2011-11-09 6:54 ` Christoph Groth
2011-11-13 9:45 ` Christoph Groth
0 siblings, 2 replies; 4+ messages in thread
From: Lan, Tianyu @ 2011-11-09 6:22 UTC (permalink / raw)
To: Christoph Groth; +Cc: linux-acpi@vger.kernel.org
Hi Christoph:
> charge_now:2761000
The unit of charge_now is µA.
What is data shown on the battery?
29 Wh?
Can you test on 3.1 or higher version?
-----Original Message-----
From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-owner@vger.kernel.org] On Behalf Of Christoph Groth
Sent: Saturday, November 05, 2011 4:47 PM
To: linux-acpi@vger.kernel.org
Subject: /sys/class/power_supply/BAT0/ confusion
Hello,
I'm running kernel 3.0.0 from Debian testing. On my new Thinkpad X220,
I noticed that the "acpi" command gives way too optimistic "remaining
time on battery" estimates.
To calculate the remaining time, the "acpi" tools divides the
"charge_now" value by "current_now" which seems to make sense physically
if the units of these values would be what the names imply. However,
this gives a remaining time of 5.35 hours which is way too high for the
small 4 cell battery I have.
Let's look at a snapshot of the BAT0 directory:
/sys/class/power_supply/BAT0% grep . *
alarm:156000
charge_full:3135000
charge_full_design:2886000
charge_now:2761000
current_now:516000
cycle_count:0
manufacturer:SANYO
model_name:42T4899
present:1
serial_number:19797
status:Discharging
technology:Li-ion
type:Battery
uevent:POWER_SUPPLY_NAME=BAT0
uevent:POWER_SUPPLY_STATUS=Discharging
uevent:POWER_SUPPLY_PRESENT=1
uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion
uevent:POWER_SUPPLY_CYCLE_COUNT=0
uevent:POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
uevent:POWER_SUPPLY_VOLTAGE_NOW=15993000
uevent:POWER_SUPPLY_CURRENT_NOW=516000
uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=2886000
uevent:POWER_SUPPLY_CHARGE_FULL=3135000
uevent:POWER_SUPPLY_CHARGE_NOW=2761000
uevent:POWER_SUPPLY_MODEL_NAME=42T4899
uevent:POWER_SUPPLY_MANUFACTURER=SANYO
uevent:POWER_SUPPLY_SERIAL_NUMBER=19797
voltage_min_design:14800000
voltage_now:15993000
The nominal energy capacity of my battery is 29 Wh, so charge_now seems
to be in units of 10 µWh! (Yes, charge_now == 2761000 seems to mean that
the _energy_ is 27.61 Wh.) This is bogus!
current_now and voltage_now seem to be in the reasonable units µA and
µV, as
current_now * voltage_now * 1e-12 = 8.25
which seems to be the correct power in Watts. (This is also the power
which "powertop" is reporting.)
The remaining runtime in hours in my case seems to be given by
charge_now * 1e-5 / (current_now * voltage_now * 1e-12) = 3.35
which looks like a good estimate of the real situation.
This does not seem to be the way things are supposed to be. The kernel
source file include/linux/power_supply.h states
/*
* All voltages, currents, charges, energies, time and temperatures in uV,
* µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise
* stated. It's driver's job to convert its raw values to units in which
* this class operates.
*/
So this seems to be a bug of either the battery driver or the internal
battery software.
I hope this report will be useful for linux ACPI developers.
Christoph
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: /sys/class/power_supply/BAT0/ confusion
2011-11-09 6:22 ` Lan, Tianyu
@ 2011-11-09 6:54 ` Christoph Groth
2011-11-13 9:45 ` Christoph Groth
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Groth @ 2011-11-09 6:54 UTC (permalink / raw)
To: linux-acpi; +Cc: tianyu.lan
Tianyu, thanks for your reaction.
"Lan, Tianyu" <tianyu.lan@intel.com> writes:
> > charge_now:2761000
> The unit of charge_now is µA.
> What is data shown on the battery?
> 29 Wh?
Yes: 29 Wh, 14.4 V, 2 Ah. Computer and battery are factory-new.
> Can you test on 3.1 or higher version?
I will, when I have some time on the weekend.
Meanwhile, I observed that one time I booted (always with the same
default debian kernel) /sys/class/power_supply/BAT0/ was different. It
had files like power_now and energy_now. Don't know how to reproduce
this, though.
Christoph
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: /sys/class/power_supply/BAT0/ confusion
2011-11-09 6:22 ` Lan, Tianyu
2011-11-09 6:54 ` Christoph Groth
@ 2011-11-13 9:45 ` Christoph Groth
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Groth @ 2011-11-13 9:45 UTC (permalink / raw)
To: linux-acpi; +Cc: tianyu.lan
"Lan, Tianyu" <tianyu.lan@intel.com> writes:
> The unit of charge_now is µA.
> What is data shown on the battery?
> 29 Wh?
> Can you test on 3.1 or higher version?
I tested v3.2-rc1-282-g3439a8d
The problem is still the same. After suspend to RAM the presented
interface changes and everything seems OK.
I attach the outputs of "date; grep . *" taken in the
/sys/class/power_supply/BAT0/ directory and a third one taken after
waking up from suspend to RAM.
Christoph
################ running on battery, after boot
Sun Nov 13 10:14:27 CET 2011
alarm:156000
charge_full:3132000
charge_full_design:2886000
charge_now:2970000
current_now:469000
cycle_count:0
manufacturer:SANYO
model_name:42T4899
present:1
serial_number:19797
status:Discharging
technology:Li-ion
type:Battery
uevent:POWER_SUPPLY_NAME=BAT0
uevent:POWER_SUPPLY_STATUS=Discharging
uevent:POWER_SUPPLY_PRESENT=1
uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion
uevent:POWER_SUPPLY_CYCLE_COUNT=0
uevent:POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
uevent:POWER_SUPPLY_VOLTAGE_NOW=16162000
uevent:POWER_SUPPLY_CURRENT_NOW=469000
uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=2886000
uevent:POWER_SUPPLY_CHARGE_FULL=3132000
uevent:POWER_SUPPLY_CHARGE_NOW=2970000
uevent:POWER_SUPPLY_MODEL_NAME=42T4899
uevent:POWER_SUPPLY_MANUFACTURER=SANYO
uevent:POWER_SUPPLY_SERIAL_NUMBER=19797
voltage_min_design:14800000
voltage_now:16162000
################ running on battery, after boot, a few minutes later
Sun Nov 13 10:18:42 CET 2011
alarm:156000
charge_full:3132000
charge_full_design:2886000
charge_now:2909000
current_now:470000
cycle_count:0
manufacturer:SANYO
model_name:42T4899
present:1
serial_number:19797
status:Discharging
technology:Li-ion
type:Battery
uevent:POWER_SUPPLY_NAME=BAT0
uevent:POWER_SUPPLY_STATUS=Discharging
uevent:POWER_SUPPLY_PRESENT=1
uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion
uevent:POWER_SUPPLY_CYCLE_COUNT=0
uevent:POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
uevent:POWER_SUPPLY_VOLTAGE_NOW=16132000
uevent:POWER_SUPPLY_CURRENT_NOW=470000
uevent:POWER_SUPPLY_CHARGE_FULL_DESIGN=2886000
uevent:POWER_SUPPLY_CHARGE_FULL=3132000
uevent:POWER_SUPPLY_CHARGE_NOW=2909000
uevent:POWER_SUPPLY_MODEL_NAME=42T4899
uevent:POWER_SUPPLY_MANUFACTURER=SANYO
uevent:POWER_SUPPLY_SERIAL_NUMBER=19797
voltage_min_design:14800000
voltage_now:16132000
################ running on battery, after wakeup from suspend to RAM
Sun Nov 13 10:26:02 CET 2011
alarm:1566000
cycle_count:0
energy_full:31320000
energy_full_design:28860000
energy_now:27770000
manufacturer:SANYO
model_name:42T4899
power_now:7746000
present:1
serial_number:19797
status:Discharging
technology:Li-ion
type:Battery
uevent:POWER_SUPPLY_NAME=BAT0
uevent:POWER_SUPPLY_STATUS=Discharging
uevent:POWER_SUPPLY_PRESENT=1
uevent:POWER_SUPPLY_TECHNOLOGY=Li-ion
uevent:POWER_SUPPLY_CYCLE_COUNT=0
uevent:POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
uevent:POWER_SUPPLY_VOLTAGE_NOW=16006000
uevent:POWER_SUPPLY_POWER_NOW=7746000
uevent:POWER_SUPPLY_ENERGY_FULL_DESIGN=28860000
uevent:POWER_SUPPLY_ENERGY_FULL=31320000
uevent:POWER_SUPPLY_ENERGY_NOW=27770000
uevent:POWER_SUPPLY_MODEL_NAME=42T4899
uevent:POWER_SUPPLY_MANUFACTURER=SANYO
uevent:POWER_SUPPLY_SERIAL_NUMBER=19797
voltage_min_design:14800000
voltage_now:16006000
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-11-13 9:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-05 8:46 /sys/class/power_supply/BAT0/ confusion Christoph Groth
2011-11-09 6:22 ` Lan, Tianyu
2011-11-09 6:54 ` Christoph Groth
2011-11-13 9:45 ` Christoph Groth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox