Battery Diver - SOC and Temperature not updated

79 views
Skip to first unread message

Daniel B

unread,
May 16, 2018, 2:33:51 PM5/16/18
to android-porting
Hello,

i try to port a battery driver to the odroid c2 running android.
I want to make my own device, which is powered from battery and android should show the remaining soc, temperature and so on.

I downloaded the kernel source from the hardkernel github repository:

For the first test i simply activate the driver "max17042.c" over the kconfig option.
The values for the first test are simply increment each second within the working thread of the driver itself.
Later the values are provided over I2C (external µC / battery gauge IC).

The driver is successfully loaded and it seems, that all work fine.
But then i realized, that the battery soc and temperature stuck on fixed values.
SOC = 100, Temperature = 42.2C

Battery voltage, state and so on are changing as expected.

When i check the "sys/class/power_supply/battery" I get:
adb shell grep '' /sys/class/power_supply/battery/*
/sys/class/power_supply/battery/capacity:77
grep: /sys/class/power_supply/battery/device: Is a directory
/sys/class/power_supply/battery/health:Overheat
grep: /sys/class/power_supply/battery/power: Is a directory
/sys/class/power_supply/battery/present:0
/sys/class/power_supply/battery/status:Discharging
grep: /sys/class/power_supply/battery/subsystem: Is a directory
/sys/class/power_supply/battery/technology:Li-poly
/sys/class/power_supply/battery/temp:100
/sys/class/power_supply/battery/type:Battery
/sys/class/power_supply/battery/uevent:POWER_SUPPLY_NAME=battery
/sys/class/power_supply/battery/uevent:POWER_SUPPLY_STATUS=Discharging
/sys/class/power_supply/battery/uevent:POWER_SUPPLY_HEALTH=Overheat
/sys/class/power_supply/battery/uevent:POWER_SUPPLY_PRESENT=0
/sys/class/power_supply/battery/uevent:POWER_SUPPLY_TECHNOLOGY=Li-poly
/sys/class/power_supply/battery/uevent:POWER_SUPPLY_VOLTAGE_NOW=5000
/sys/class/power_supply/battery/uevent:POWER_SUPPLY_TEMP=100
/sys/class/power_supply/battery/uevent:POWER_SUPPLY_CAPACITY=77
/sys/class/power_supply/battery/voltage_now:5000

SOC and Temperature are changing here, too.
But on android userspace I always get SOC = 100%, temperature = 42,2C and AC Power supply connected.

I checked the "BatteryService.java" but i con not see any reason, why soc and temperature are not reported correctly.
The battery Icon in the statebar is also not shown

I placed all necessary files to my github repo:


Are there any configuration options i could miss?

Kind Regards
Danie


Daniel B

unread,
Jun 13, 2018, 7:36:30 PM6/13/18
to android-porting
Nobody knows where to start searching for this issue?
Reply all
Reply to author
Forward
0 new messages