diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2006-09-09 07:49:25 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2006-09-09 07:49:25 +0000 |
| commit | 32ba11f066688ac629cde6595372c40dbb0f0553 (patch) | |
| tree | 82094832c046c99764ac21db4205bdb1267d2d79 | |
| parent | 6e219f84d244d44f9da2b77781bb4c9d1d95eb9a (diff) | |
| download | rockbox-32ba11f066688ac629cde6595372c40dbb0f0553.zip rockbox-32ba11f066688ac629cde6595372c40dbb0f0553.tar.gz rockbox-32ba11f066688ac629cde6595372c40dbb0f0553.tar.bz2 rockbox-32ba11f066688ac629cde6595372c40dbb0f0553.tar.xz | |
Fixed the problem on the x5 of spontaneous shutdown after holding the power key for 1s.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10904 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/target/coldfire/iaudio/x5/pcf50606-x5.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c b/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c index 2f3ee2b..dde20d8 100644 --- a/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c +++ b/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c @@ -154,6 +154,8 @@ static void set_voltages(void) void pcf50606_init(void) { + unsigned char read[3]; + /* Bit banged I2C */ or_l(0x00001000, &GPIO1_OUT); or_l(0x00000400, &GPIO_OUT); @@ -164,8 +166,19 @@ void pcf50606_init(void) i2c_add_node(&pcf50606_i2c); + /* unmask ONKEY1S - ONKEY held low for 1 second */ + pcf50606_write(0x05, ~0x04); + /* clear INT1-3 as these are left set after standby */ + pcf50606_read_multiple(0x02, read, 3); + set_voltages(); + /* enable GPI0 interrupts (pcf50606 IRQ) */ + and_l(~0x00000001, &GPIO_ENABLE); + or_l(0x00000001, &GPIO_FUNCTION); + or_l(0x00000100, &GPIO_INT_EN); /* GPI0 H-L */ + INTPRI5 |= 0x00000006; /* INT32 - Priority 6 */ + pcf50606_write(0x39, 0x00); /* GPOOD0 = green led OFF */ pcf50606_write(0x3a, 0x00); /* GPOOD1 = red led OFF */ @@ -183,3 +196,24 @@ void pcf50606_init(void) pcf50606_write(0x38, 0xb0); /* Backlight ON, GPO1INV=1, GPO1ACT=011 */ #endif } + +/* Handles interrupts generated by the pcf50606 */ +void GPI0(void) __attribute__ ((interrupt_handler, section(".text"))); +void GPI0(void) +{ + char read[3]; /* 0 = INT1, 1 = INT2, 2 = INT3 */ + + /* Clear pending interrupts from pcf50606 - reading all INT* registers + resets the INT pin to high */ + pcf50606_read_multiple(0x02, read, 3); + + if (read[0] & 0x04) + { + /** ONKEY1S **/ + /* reset timeout or else pcf50606 will go into standby in 8s */ + pcf50606_write(0x08, pcf50606_read(0x08) | 0x02); /* OOCC1 - TOTRST=1 */ + } + + /* Clear pending GPI0 interrupts */ + or_l(0x00000100, &GPIO_INT_CLEAR); +} |