public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Groth <cwg@falma.de>
To: linux-acpi@vger.kernel.org
Subject: /sys/class/power_supply/BAT0/ confusion
Date: Sat, 05 Nov 2011 09:46:46 +0100	[thread overview]
Message-ID: <87wrbfot1l.fsf@falma.de> (raw)

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

             reply	other threads:[~2011-11-05  8:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-05  8:46 Christoph Groth [this message]
2011-11-09  6:22 ` /sys/class/power_supply/BAT0/ confusion Lan, Tianyu
2011-11-09  6:54   ` Christoph Groth
2011-11-13  9:45   ` Christoph Groth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wrbfot1l.fsf@falma.de \
    --to=cwg@falma.de \
    --cc=linux-acpi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox