Recent kernel commit breaks battery sensing

Neil Brown neilb at suse.de
Wed Mar 4 11:52:38 CET 2009


On Wednesday March 4, andy at openmoko.com wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Somebody in the thread at some point said:
> | Hi,
> |  the recent kernel commit
> |
> |    commit b9de904e7aadd7b37c4035fd5d6f59e5f80089b6
> |
> | removes the line
> |
> | -#define HDQ_SAMPLE_PERIOD_US   20
> |
> | from drivers/power/hdq.c
> | So HDQ_SAMPLE_PERIOD_US gets the value '10' from include/linux/hdq.h
> |
> | In hdq.c there is a line
> |
> | 		hdq_priv.hdq_ctr = 3000 / HDQ_SAMPLE_PERIOD_US;
> |
> | which previously resulted in 150, and now results in 300.
> |
> | As hdq_ctr is an 8 bit value we lose something, and the compiler
> | complains.
> | Also I cannot read most values from /sys/class/power_supply/battery
> | I get an error Timer expired.
> |
> | Restoring the #define makes my battery status visible again, but I
> | don't know if that is the right fix...
> 
> This is my fault, I fixed it on andy-tracking by reducing the 3ms
> timeout to 2.5ms with a reported-by for yourself.

Thanks... only that doesn't fix it.

I couldn't actually try the patch in-situ as 
   commit 830ed8523da5f82235e4bead282f0d4cd595e449

breaks all sorts of things.
The accelerometers don't work:
    lis302dl spi3.0: unknown who_am_i signature 0xff
The FIQ (??) doesn't work
    Count not initialize FIQ for GTA02
    ^^^^^!!!!

and the battery doesn't appear at all:
# ls -l /sys/class/power_supply/
total 0
drwxr-xr-x 3 root root 0 Mar  4 21:33 ac
drwxr-xr-x 3 root root 0 Mar  4 21:33 adapter
drwxr-xr-x 3 root root 0 Mar  4 21:33 usb


So I applied your one-line change to the previous commit.
It got rid of the compiler warning, but not the error when reading the
battery.
I only have success if I restore the #define.

Is this 20usec or 10usec timer the one set up by
gta02_fiq_enable in mach-gta02.c???  That says something about 32usec.
I think I'm totally confused.

NeilBrown



More information about the openmoko-kernel mailing list