summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-09-09 07:49:25 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-09-09 07:49:25 +0000
commit32ba11f066688ac629cde6595372c40dbb0f0553 (patch)
tree82094832c046c99764ac21db4205bdb1267d2d79 /firmware/target
parent6e219f84d244d44f9da2b77781bb4c9d1d95eb9a (diff)
downloadrockbox-32ba11f066688ac629cde6595372c40dbb0f0553.tar.gz
rockbox-32ba11f066688ac629cde6595372c40dbb0f0553.zip
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
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/coldfire/iaudio/x5/pcf50606-x5.c34
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 2f3ee2bc09..dde20d8b7c 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)
154 154
155void pcf50606_init(void) 155void pcf50606_init(void)
156{ 156{
157 unsigned char read[3];
158
157 /* Bit banged I2C */ 159 /* Bit banged I2C */
158 or_l(0x00001000, &GPIO1_OUT); 160 or_l(0x00001000, &GPIO1_OUT);
159 or_l(0x00000400, &GPIO_OUT); 161 or_l(0x00000400, &GPIO_OUT);
@@ -164,8 +166,19 @@ void pcf50606_init(void)
164 166
165 i2c_add_node(&pcf50606_i2c); 167 i2c_add_node(&pcf50606_i2c);
166 168
169 /* unmask ONKEY1S - ONKEY held low for 1 second */
170 pcf50606_write(0x05, ~0x04);
171 /* clear INT1-3 as these are left set after standby */
172 pcf50606_read_multiple(0x02, read, 3);
173
167 set_voltages(); 174 set_voltages();
168 175
176 /* enable GPI0 interrupts (pcf50606 IRQ) */
177 and_l(~0x00000001, &GPIO_ENABLE);
178 or_l(0x00000001, &GPIO_FUNCTION);
179 or_l(0x00000100, &GPIO_INT_EN); /* GPI0 H-L */
180 INTPRI5 |= 0x00000006; /* INT32 - Priority 6 */
181
169 pcf50606_write(0x39, 0x00); /* GPOOD0 = green led OFF */ 182 pcf50606_write(0x39, 0x00); /* GPOOD0 = green led OFF */
170 pcf50606_write(0x3a, 0x00); /* GPOOD1 = red led OFF */ 183 pcf50606_write(0x3a, 0x00); /* GPOOD1 = red led OFF */
171 184
@@ -183,3 +196,24 @@ void pcf50606_init(void)
183 pcf50606_write(0x38, 0xb0); /* Backlight ON, GPO1INV=1, GPO1ACT=011 */ 196 pcf50606_write(0x38, 0xb0); /* Backlight ON, GPO1INV=1, GPO1ACT=011 */
184#endif 197#endif
185} 198}
199
200/* Handles interrupts generated by the pcf50606 */
201void GPI0(void) __attribute__ ((interrupt_handler, section(".text")));
202void GPI0(void)
203{
204 char read[3]; /* 0 = INT1, 1 = INT2, 2 = INT3 */
205
206 /* Clear pending interrupts from pcf50606 - reading all INT* registers
207 resets the INT pin to high */
208 pcf50606_read_multiple(0x02, read, 3);
209
210 if (read[0] & 0x04)
211 {
212 /** ONKEY1S **/
213 /* reset timeout or else pcf50606 will go into standby in 8s */
214 pcf50606_write(0x08, pcf50606_read(0x08) | 0x02); /* OOCC1 - TOTRST=1 */
215 }
216
217 /* Clear pending GPI0 interrupts */
218 or_l(0x00000100, &GPIO_INT_CLEAR);
219}