[Letux-kernel] generic-adc-battery

H. Nikolaus Schaller hns at goldelico.com
Sat Feb 6 11:26:32 CET 2016


> Am 06.02.2016 um 10:42 schrieb Andreas Kemnade <andreas at kemnade.info>:
> Hi,
> On Fri, 5 Feb 2016 23:02:13 +0100
> Belisko Marek <marek at goldelico.com> wrote:
>> Hi,
>> I did look about converting generic-adc-battery to DT and reuse it
>> also for our twl4030_madc driver. What I understand is that this
>> driver accept in platform_data -> which must be converted to DT,
>> battery name, type and other parameters. Some properties which we have
>> in twl4030_madc are missing in generic like temperature, chargenow but
>> instead there are other which aren't used in twl4030_madc (min_design,
>> max_design ..). I did check usage and found that it's used only 2
>> times for LIPO batteries. Basically conversion is doable but I'm not
>> sure how community will respond to our enhancements (conversion to DT
>> should be OK). So question is if we should invest time to this rework?
>> Formula was valid only for LioN batteries, not sure if something else
>> exists for LIPO batteries type. Suggestions? Thanks.
> Do you mean this by formula:
>                charging-calibration-data = <4200 100 4100 75 4000 55 3900 25 3800 5 3700 2 3600 1 3300 0>;
>                discharging-calibration-data = <4200 100 4100 95 4000 70 3800 50 3700 10 3600 5 3300 0>;
> I do not find this kind of formula useful because it gives only good 
> values if you are charging with high currents. So it is only good for
> limited usecases. If you charge only with low currents because the device
> itself draws a lot of current, voltage behaves like somewhere between 
> charging and discharging. E.g. for 3.8V you would have something between
> 5% and 50%.
> I doubt if converting something to give the same broken, useless values
> to somewhere else is worth any work.
> I am not convinced that such a formula belongs into the kernel. Maybe it does,
> maybe not.
> Userspace does not know that these values are only guesswork.
> To have good values there has either to be a formula which considers both
> voltage and current or look at power only at well defined conditions.

The problem is that in case of Letux devices w/o bq27000 (e.g. L3704, L7004)
there is no charge indication at all.

Most user-spaces are prepared to simply scan /sys/class/power for batteries and
find a "charge level" indication there. They are not prepared to detect that there
is a battery with uncalibrated data and then do the calibration in user space...

This means we need a simple kernel driver that translates voltage to %.

This all is what this driver is about. Being a fallback if there is no exact fuel gauge.
So I would assume a precision of +/-20% is ok... And better than nothing.

We have this driver in our kernel for a long time - incl. mainline. But in mainline
there is no calibration by DT... And our proposal was rejected because people
don't want such calibration in DT. And proposed to use a formula which they
think is exact.

Deeper analysis shows that a formula is not more exact than such a table...
 I.e. they want an overengineered solution which is impossible to


More information about the Letux-kernel mailing list