summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/power-e200.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/firmware/target/arm/sandisk/sansa-e200/power-e200.c b/firmware/target/arm/sandisk/sansa-e200/power-e200.c
index a01654fced..dfa4211a91 100644
--- a/firmware/target/arm/sandisk/sansa-e200/power-e200.c
+++ b/firmware/target/arm/sandisk/sansa-e200/power-e200.c
@@ -18,6 +18,7 @@
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include <stdbool.h> 20#include <stdbool.h>
21#include "system.h"
21#include "cpu.h" 22#include "cpu.h"
22#include "i2c-pp.h" 23#include "i2c-pp.h"
23 24
@@ -28,11 +29,25 @@ void power_init(void)
28void power_off(void) 29void power_off(void)
29{ 30{
30 char byte; 31 char byte;
32
33 /* Disable interrupts on this core */
34 set_interrupt_status(IRQ_FIQ_DISABLED, IRQ_FIQ_STATUS);
35
36 /* Mask them on both cores */
37 CPU_INT_CLR = -1;
38 COP_INT_CLR = -1;
39
40 /* Send shutdown command to PMU */
31 byte = i2c_readbyte(0x46, 0x20); 41 byte = i2c_readbyte(0x46, 0x20);
32 byte &= ~0x1; 42 byte &= ~0x1;
33 pp_i2c_send(0x46, 0x20, byte); 43 pp_i2c_send(0x46, 0x20, byte);
34 44
35 while(1); /* Wait for device to power off */ 45 /* Halt everything and wait for device to power off */
46 while (1)
47 {
48 CPU_CTL = PROC_SLEEP;
49 COP_CTL = PROC_SLEEP;
50 }
36} 51}
37 52
38bool charger_inserted(void) 53bool charger_inserted(void)