need help with android fuel gauge

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

need help with android fuel gauge

Jump to solution
3,012 Views
kobusgoosen
Contributor II

I have a IMX6 system built around a CPU module. the module's original base board was powered, and thus had emulated battery support. my system is like a tablet, so I added a ds2786 fuel gauge IC, and added it to my board config in the kernel.

I also removed the battery emulation in my android init.rc file.

The IC seems to work. in android I get a battery icon with a believable percentage value, but it never changes.

I added some kernel printk() statements to the fuel gauge code, and the battery capacity seems to be read, but only twice; once around where the device is probed, and then once more once android starts up. After that its never updated. I havent added a power button yet, so i'm not sure if this would be checked again when exiting suspend, but I feel there is some sort of power monitor process thats not being called. I dont know if this is in the android side or the kernel side.

Does anyone have any ideas?  

Labels (2)
0 Kudos
1 Solution
1,527 Views
rickchu
Contributor IV

You can reference with kernel_imx/drivers/power/bq27x00_battery.c, to know how to update battery percentage information by using schedule_delayed_work().

git tag: jb4.2.2_1.1.0-ga

Rick

View solution in original post

0 Kudos
4 Replies
1,526 Views
kobusgoosen
Contributor II

anyone? please help.

0 Kudos
1,528 Views
rickchu
Contributor IV

You can reference with kernel_imx/drivers/power/bq27x00_battery.c, to know how to update battery percentage information by using schedule_delayed_work().

git tag: jb4.2.2_1.1.0-ga

Rick

0 Kudos
1,526 Views
kobusgoosen
Contributor II

Ah, thanks. I thought it might be something like that. I noticed the battery used in the sabre design used an interrupt to signal the CPU, so I gues it makes sense that this driver should have some sort of work handler.

It seems like a rather important piece to leave out of this device's driver though... I had a look at the driver for ds2782_battery.c, and it does actually have a work handler, but only in kernel 3.10 and up. I'll have a go at working this into my kernel soon. 

0 Kudos
1,526 Views
SergioSolis
NXP Employee
NXP Employee

Thank you Rick for your answer!.


Kobus, let us know of any other question you may have.

0 Kudos