From 4f0825a352af5499beee068dedbd5e9cf5674262 Mon Sep 17 00:00:00 2001 From: Steve Markgraf Date: Tue, 30 Aug 2011 21:34:36 +0200 Subject: fw/abb/twl3025: handle interrupt on powerbutton press Since the powerbutton on the Pirelli DP-L10 doesn't seem to be connected to the keypad scan matrix at all, we're using Iota's PWON interrupt to determine if the powerbutton has been pressed, and power off the phone after it has been released again. This also affects the Compal phones, since the interrupt happens quite some time before the keypad driver notices the keypress. The code in the keypad driver that has been used so far to power off the phone will remain as a backup when running without interrupts at all (e.g. the loader application). Signed-off-by: Steve Markgraf --- src/target/firmware/abb/twl3025.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/target/firmware/abb/twl3025.c b/src/target/firmware/abb/twl3025.c index 0181713..564c34b 100644 --- a/src/target/firmware/abb/twl3025.c +++ b/src/target/firmware/abb/twl3025.c @@ -105,6 +105,13 @@ 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) -- cgit v1.2.3-55-g7522