u-boot low-battery handling
mail at mmontour.net
Thu Aug 28 06:09:56 CEST 2008
Andy Green wrote:
> What I am hoping we can do here is boot at slow CPU for the initial part
> of Linux boot to always be below 500mW on average, and stall in pcf50633
> driver init (which will be early in boot with 2.6.26 soon) until we
> either detect we have no charger, 1A charger, or get enumeration from
> host PC and can use 500mA ower. Typically this will add a second or so.
It's the "on average" that concerns me here, as that relies on having
enough battery capacity to supply current for the above-average pulses.
I've been doing quite a bit of testing in u-boot, and my current
preference is to have a simple check in u-boot/Qi that will program a
few PMU registers and then shut down the device if the battery is too
low. There can be a distinctive LED-flash pattern to tell the user that
this has happened, and we can allow the user to bypass this check by
Related to this, I recommend programming the PMU as follows whenever we
turn the device off (e.g. "neo1973 poweroff" command, Linux shutdown,
low-battery shutdown described above):
- charger enabled
- 98mA usb fast-charge limit (MBCC5=0x19)
- wake-on-USB disabled (OOCWAKE bit 6)
In this configuration the device should automatically charge the battery
at a safe 100mA whenever it is connected to a power source (meaning
there's no need to wake the CPU). This even works for a battery in which
the internal cutoff has triggered (I've tested this), so we reduce the
chance that the user will need to find a "jump-start" battery.
When the device is suspended, wake-on-USB-insert/removal needs be
enabled so that the device can respond to changes in available USB
current (e.g. unplug from charger and connect to an unpowered hub).
I'll try to send an updated u-boot patch in the next day or two.
More information about the openmoko-kernel