[Letux-kernel] generic-adc-battery

H. Nikolaus Schaller hns at goldelico.com
Tue Feb 9 09:55:50 CET 2016


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.

I.e. offset: 400mA

USB 0mA (off) -> battery will contribute 400 mA and discharge with 400 mA	-> report "discharging"
USB 300 mA	-> battery will contribute 100 mA and discharge with 100 mA	-> report "discharging"
USB 500 mA	-> battery will contribute -100 mA and charge with 100 mA	-> report "charging"
USB 800 mA	-> battery will contribute -400 mA and charge with 400 mA	-> report "charging"

Using the series-resistance-mOhm parameter we can convert the
charge/discharge current into a voltage difference between system voltage
and internal battery voltage.

This will be of course wrong if we have WLAN and 3G enabled... But IMHO
the above is "good enough" for a practical solution.

@Marek:

yes, we should ask Sebastian and the power-supply list.

But before we do that we have to find the link to the slide show Pavel has
provided and understand it.

I have to locale all mails from Pavel and go through them until I find the
link.

BR,
Nikolaus



Am 09.02.2016 um 07:38 schrieb Andreas Kemnade <andreas at kemnade.info>:

> Hi,
> 
>>> So what? Do I have 60% or 10%? That makes quite a difference.
>>> 10% might cause userspace to do some harder power saving measures
>>> which might cause discomfort.
>>> Maybe there is something wrong in the driver. I am surprised how
>>> bad the values are. I repeated each measurement some times.
>> 
>> Yes, I also have the impression that it has become worse and may have
>> a bug (perhaps some iio API has changed). When Lukas developed the
>> non-DT version it worked well and when we started to convert to DT some
>> years ago.
>> 
>> Maybe the batteries we use have become worse? So their inner resistance
>> has increased? This could also make a difference.
>> 
> One part of the problem seems to be that "status" is broken.
> It seems to display whether current is flowing into the device from usb
> and not whether the battery is actually charged. So the wrong table is
> picked when usb current is lower than the total consumption of the device.
> 
> Regards,
> Andreas
> _______________________________________________
> 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



More information about the Letux-kernel mailing list