summaryrefslogtreecommitdiffstats
path: root/src/target/firmware
diff options
context:
space:
mode:
authorSteve Markgraf <steve@steve-m.de>2011-08-30 21:34:36 +0200
committerSteve Markgraf <steve@steve-m.de>2011-08-30 21:34:36 +0200
commit4f0825a352af5499beee068dedbd5e9cf5674262 (patch)
tree21348f1571c7266b48de5bb2106af7075ea10a92 /src/target/firmware
parentd84ba5616f9afbba90d38f2f99dede0f86af241c (diff)
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 <steve@steve-m.de>
Diffstat (limited to 'src/target/firmware')
-rw-r--r--src/target/firmware/abb/twl3025.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/target/firmware/abb/twl3025.c b/src/target/firmware/abb/twl3025.c
index 01817130..564c34ba 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)