summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/abb
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-01-25 12:19:23 +0100
committerHarald Welte <laforge@gnumonks.org>2012-01-28 13:15:48 +0100
commita6c98a79b29e964268ab2debd7ebd7fd2daf709d (patch)
tree70bded30105f058e8d9ca75d4fc29d11ee6e2511 /src/target/firmware/abb
parentbe142a0c2a7b18682775126a19203ab5411688a4 (diff)
Hold function for power button to turn off the phone
In order to allow applications to use the power button, the keypad handler will wait half a second if the key is pressed and hold, until the power is turned off. This way the application does not need to handle it. The power off function will then wait until the button is released, so the phone will not start again while the button is still pressed.
Diffstat (limited to 'src/target/firmware/abb')
-rw-r--r--src/target/firmware/abb/twl3025.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/target/firmware/abb/twl3025.c b/src/target/firmware/abb/twl3025.c
index 564c34ba..2e06199c 100644
--- a/src/target/firmware/abb/twl3025.c
+++ b/src/target/firmware/abb/twl3025.c
@@ -105,13 +105,6 @@ static void twl3025_irq(enum irq_nr nr)
case IRQ_EXTERNAL: // charger in/out, pwrbtn, adc done
src = twl3025_reg_read(ITSTATREG);
// printd("itstatreg 0x%02x\n", src);
- if (src & 0x04) {
- /* poll PWON status and power off the phone when the
- * powerbutton has been released (otherwise it will
- * poweron immediately again) */
- while (!(twl3025_reg_read(VRPCSTS) & 0x10)) { };
- twl3025_power_off();
- }
if (src & 0x08)
handle_charger();
if (src & 0x20)
@@ -193,6 +186,10 @@ static void twl3025_wait_ibic_access(void)
void twl3025_power_off(void)
{
+ /* poll PWON status and power off the phone when the
+ * powerbutton has been released (otherwise it will
+ * poweron immediately again) */
+ while (!(twl3025_reg_read(VRPCSTS) & 0x10)) { };
twl3025_reg_write(VRPCDEV, 0x01);
}