[Letux-kernel] generic-adc-battery

H. Nikolaus Schaller hns at goldelico.com
Thu Feb 2 17:36:36 CET 2017


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%?

I think we have another scaling factor error in the capacity formula.

Otherwise we are coming closer to a really useful driver.

BR,
Nikolaus



More information about the Letux-kernel mailing list