[Letux-kernel] generic-adc-battery

Belisko Marek marek.belisko at gmail.com
Sat Mar 11 22:47:20 CET 2017


Hi Nikolaus,

On Thu, Feb 2, 2017 at 5:36 PM, H. Nikolaus Schaller <hns at goldelico.com> wrote:
> Hi Marek,
> I have now configured the gab driver for the Pyra
> by using the Palmas gpadc.
>
> There is one issue with the temperature readings.
>
> Probably the iio layer reports that it can not read the
> temperature because that one needs configuration/calibration
> for the NTC in use which does not exist.
>
> The bigger problem is that the gab does not gracefully ignore this:
>
> root at letux:~# cat /sys/class/power_supply/generic-adc-batt/uevent
> [  258.733304] palmas-gpadc 48070000.i2c:palmas at 48:gpadc: Mismatch with calibration
> [  258.760671] read channel error
> [  258.763920] power_supply generic-adc-batt: driver failed to report `temp' property: -22
> root at letux:~#
> root at letux:~#
> root at letux:~# grep '' /sys/class/power_supply/generic-adc-batt/*
> /sys/class/power_supply/generic-adc-batt/capacity:13
> /sys/class/power_supply/generic-adc-batt/charge_empty_design:0
> /sys/class/power_supply/generic-adc-batt/charge_full_design:6000
> /sys/class/power_supply/generic-adc-batt/charge_now:0
> /sys/class/power_supply/generic-adc-batt/current_now:0
> grep: /sys/class/power_supply/generic-adc-batt/device: Is a directory
> /sys/class/power_supply/generic-adc-batt/model_name:pyra-battery
> grep: /sys/class/power_supply/generic-adc-batt/power: Is a directory
> /sys/class/power_supply/generic-adc-batt/status:Discharging
> grep: /sys/class/power_supply/generic-adc-batt/subsystem: Is a directory
> /sys/class/power_supply/generic-adc-batt/technology:Li-ion
> [  277.259542] read channel error
> [  277.263097] power_supply generic-adc-batt: driver failed to report `temp' property: -22
> grep: /sys/class/power_supply/generic-adc-batt/temp: Invalid argument
> /sys/class/power_supply/generic-adc-batt/type:Battery
> [  277.306673] palmas-gpadc 48070000.i2c:palmas at 48:gpadc: Mismatch with calibration
> [  277.350582] read channel error
> [  277.353860] power_supply generic-adc-batt: driver failed to report `temp' property: -22
> /sys/class/power_supply/generic-adc-batt/voltage_max_design:0
> /sys/class/power_supply/generic-adc-batt/voltage_min_design:3200
> /sys/class/power_supply/generic-adc-batt/voltage_now:0
> root at letux:~#
>
> Especially not being able to read the uevent makes some problems...
>
> The other thing I noticed is that without battery the voltage_now is 0V.
> And there is no current flow. This is both ok.
>
> But the capacity is estimated for 13%?
This is obviously wrong calculation. I did look to formula and when we
got 0 voltage we have to return before pass to processing otherwise it
will really return 13. I'll post fix soon to generic-adc-battery
feature branch.
>
> I think we have another scaling factor error in the capacity formula.
>
> Otherwise we are coming closer to a really useful driver.
>
> BR,
> Nikolaus
>

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