[Letux-kernel] new generic battery driver
Belisko Marek
marek.belisko at gmail.com
Tue Jun 14 21:19:22 CEST 2016
Hi Nikolaus,
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
>>> 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).
>>
>> 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
>>> 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
>
> Here another set of values:
>
> Battery /sys/class/power_supply/generic-adc-batt
> ==================
> type: Battery
> present:
> technology: Li-ion
> capacity: 3057%
> status: Discharging
> level:
> volt: 3648uV
> current: -745uA
> temp: 0.1°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
>
>
> 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.
>
> BR,
> Nikolaus
>
> _______________________________________________
> http://projects.goldelico.com/p/gta04-kernel/
> Letux-kernel mailing list
> Letux-kernel at openphoenux.org
> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel
BR,
marek
--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer
Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com
More information about the Letux-kernel
mailing list