[Letux-kernel] new generic battery driver
marek.belisko at gmail.com
Tue Jun 14 21:19:22 CEST 2016
On Wed, Jun 8, 2016 at 8:18 AM, H. Nikolaus Schaller <hns at goldelico.com> wrote:
>> Am 07.06.2016 um 17:45 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>> Am 07.06.2016 um 17:19 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>> 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
>>> technology: Li-ion
>>> capacity: 49%
>>> status: Discharging
>>> volt: 3824uV
>>> current: -750uA
>>> temp: 0°C
>>> charge: 0uAh
>>> full: uAh
>>> design: 4000uAh
>>> energy: J?
>>> power: W?
>>> 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).
>> and volt as well.
>>> 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
>>> 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).
> Here another set of values:
> Battery /sys/class/power_supply/generic-adc-batt
> type: Battery
> technology: Li-ion
> capacity: 3057%
> status: Discharging
> volt: 3648uV
> current: -745uA
> temp: 0.1°C
> charge: 0uAh
> full: uAh
> design: 4000uAh
> energy: J?
> power: W?
> discharge: s to empty average
> remaining: s to empty
> charging: s to full
> Looks as if our formula below 3.7V is wrong by factor 100.
This is strange. I verified everything by small helper program but
maybe I forgot to took something to kernel. Will look on that also.
Thanks for testing.
> Letux-kernel mailing list
> Letux-kernel at openphoenux.org
as simple and primitive as possible
Marek Belisko - OPEN-NANDRA
Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
More information about the Letux-kernel