[Letux-kernel] generic-adc-battery
H. Nikolaus Schaller
hns at goldelico.com
Wed Feb 10 08:56:52 CET 2016
Am 10.02.2016 um 08:49 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>
> Am 10.02.2016 um 07:38 schrieb Andreas Kemnade <andreas at kemnade.info>:
>
>> Hi,
>>
>> On Tue, 9 Feb 2016 09:55:50 +0100
>> "H. Nikolaus Schaller" <hns at goldelico.com> wrote:
>>
>>> Hi,
>>> @Andreas:
>>>
>>> yes, the status is broken. We just know how much current is coming in through USB.
>>> We do not know how it is split between system and charging.
>>>
>>> I think we can compensate by charge-current-offset-mA. I.e. if we subtract
>>> the default power consumption, any excess current from USB will charge.
>>>
>> maybe we can also use some dU magic. There are ModelGauge things from Maxim.
>> I think they do something like that.
>
> Ok, that would need to store some voltage samples over time and detect the differences.
>
>>
>>> I.e. offset: 400mA
>>>
>> Maybe there could be a range named "unknown",
>> That state is possible in the interface.
>
> Well, it is not really "unknown" - it is not precisely enough known which is almost the same
> but only almost.
>
> Anyways, I have found the slides Pavel was referring to. But they don't show the
> formula:
>
> http://cseweb.ucsd.edu/~trosing/lectures/battery.pdf
>
> Here is his full response (including an extended formula by Pavel for the range below
> 3.3V and 19%):
>
> https://lkml.org/lkml/2015/4/1/557
>
> Now I understand a little why Pavel is behaving so strangely since that discussion.
>
> He did some technical contribution and we did not appreciate enough. I don't remember
> why, but most likely because the discussion already took more time than we had for it
> and running such discussions is time consuming (and distracting from other important
> things). (Successful) upstreaming is a full-day-job...
>
> So we should probably pick up at exactly this mail. Something like:
>
> What about adding this formula as a default for the voltage-to-percent-conversion to
> the generic-adc-battery driver (and converting it to DT)? Would that be a better solution
> than a table driven and twl4030 only driver?
BTW: I think the CHARGE_NOW is even completely broken:
http://lxr.free-electrons.com/source/drivers/power/generic-adc-battery.c#L168
http://lxr.free-electrons.com/source/include/linux/power/generic-adc-battery.h#L23
It does not read any ADC and the result parameter passed to pdata->cal_charge()
is initialized to 0.
BR,
Nikolaus
More information about the Letux-kernel
mailing list