deadbat-cpu-idle.patch
commit0f0533a0434cdb71247bb308c225d2b372331dfc
authorWerner Almesberger <werner@openmoko.org>
Tue, 15 Jul 2008 11:33:24 +0000 (15 12:33 +0100)
committerAndy Green <agreen@localhost.localdomain>
Tue, 15 Jul 2008 11:33:24 +0000 (15 12:33 +0100)
treeb3986482a03ba5965f62805bd29bcebcf73eb447
parent1e126c864247702abaf78b9f7def168f5904dca5
deadbat-cpu-idle.patch

This patch makes the CPU enter IDLE mode while waiting in wait_for_power.

To wake up from IDLE mode, we need an interrupt. Note that this interrupt
only needs to be signaled to the CPU, but the CPU does not have to execute
it. However, it has to clear the interrupt or, upon returning from the
interrupt handler, the system will immediately be interrupted by the same
interrupt.

We have the following sources of external events:

- battery insertion / battery voltage rises above Vth(batok)
- USB insertion (giving us 100mA)
- adapter insertion (giving us 1A)
- USB host signals availability of 500mA
- 1Hz tick

USB signaling is already handled by an interrupt handler, so we just use
what's there. USB insertion and the 1Hz tick cause PMU interrupts, so we
need to enable the interrupt path from the PMU. Adapter insertion is
handled as part of USB insertion.

We don't wake up from IDLE on battery insertion or when the battery
voltage rises above the threshold. Instead, we just poll for it on each
1Hz tick.

Signed-off-by: Werner Almesberger <werner@openmoko.org>
board/neo1973/gta02/gta02.c