[Letux-kernel] new generic battery driver

H. Nikolaus Schaller hns at goldelico.com
Tue Jun 7 17:19:40 CEST 2016


Hi Marek,
I have now merged/fixed (the DT patch had to be included in work/hns/dt/gta04)
and I hope that I did not forget/break anything.

What I now get is:

Battery /sys/class/power_supply/generic-adc-batt
==================
type: Battery
present:
technology: Li-ion
capacity: 49%
status: Discharging
level:
volt: 3824uV
current: -750uA
temp: 0°C
charge: 0uAh
full: uAh
design: 4000uAh
energy: J?
power: W?
cycles:
health:
discharge: s to empty average
remaining: s to empty
charging: s to full

This looks already quite good.

Volt & capacity look reasonable, but for current I think it must convert between mA (iio) and µA (power_supply).

Design should be something like 1200000 uAh (and configured by device tree).
We can simply make "full" === "design".
Charge could then be capacity (%) * full uAh.

So we can even report more useful values.

One thing I think we should add is a current offset. The reason is that the charging
current is split between battery and OMAP and only what the OMAP does not draw is
charging.

So we need to compensate for this effect. That adds another DT parameter
for the current-offset-mA. We will set this to ca. 300mA.

I have still seen "discharging" even if the charger is active. This might also have something
to do with this issue.

And the battery resistance should also be a DT parameter (internal-battery-resistance-mOhm).

I will push the new version to git (overwriting yours) so that you can compare with your local
branch. If something is missing or to be added, please commit to git version (and let me know
so that I will pull it before pushing).

BR,
Nikolaus





More information about the Letux-kernel mailing list