diff options
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/power-imx31.c')
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/power-imx31.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/power-imx31.c b/firmware/target/arm/imx31/gigabeat-s/power-imx31.c index 9d9cc6bcb6..62f9982dd5 100644 --- a/firmware/target/arm/imx31/gigabeat-s/power-imx31.c +++ b/firmware/target/arm/imx31/gigabeat-s/power-imx31.c | |||
@@ -27,8 +27,6 @@ | |||
27 | #include "avic-imx31.h" | 27 | #include "avic-imx31.h" |
28 | #include "mc13783.h" | 28 | #include "mc13783.h" |
29 | 29 | ||
30 | #ifndef SIMULATOR | ||
31 | |||
32 | static bool charger_detect = false; | 30 | static bool charger_detect = false; |
33 | 31 | ||
34 | /* This is called from the mc13783 interrupt thread */ | 32 | /* This is called from the mc13783 interrupt thread */ |
@@ -38,9 +36,17 @@ void charger_detect_event(void) | |||
38 | mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_CHGDETS; | 36 | mc13783_read(MC13783_INTERRUPT_SENSE0) & MC13783_CHGDETS; |
39 | } | 37 | } |
40 | 38 | ||
41 | bool charger_inserted(void) | 39 | unsigned int power_input_status(void) |
42 | { | 40 | { |
43 | return charger_detect; | 41 | unsigned int status = POWER_INPUT_NONE; |
42 | |||
43 | if ((GPIO3_DR & (1 << 20)) != 0) | ||
44 | status |= POWER_INPUT_BATTERY; | ||
45 | |||
46 | if (charger_detect) | ||
47 | status |= POWER_INPUT_MAIN_CHARGER; | ||
48 | |||
49 | return status; | ||
44 | } | 50 | } |
45 | 51 | ||
46 | /* Returns true if the unit is charging the batteries. */ | 52 | /* Returns true if the unit is charging the batteries. */ |
@@ -90,26 +96,3 @@ void power_init(void) | |||
90 | mc13783_enable_event(MC13783_CHGDET_EVENT); | 96 | mc13783_enable_event(MC13783_CHGDET_EVENT); |
91 | } | 97 | } |
92 | 98 | ||
93 | #else /* SIMULATOR */ | ||
94 | |||
95 | bool charger_inserted(void) | ||
96 | { | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | void charger_enable(bool on) | ||
101 | { | ||
102 | (void)on; | ||
103 | } | ||
104 | |||
105 | void power_off(void) | ||
106 | { | ||
107 | } | ||
108 | |||
109 | void ide_power_enable(bool on) | ||
110 | { | ||
111 | (void)on; | ||
112 | } | ||
113 | |||
114 | #endif /* SIMULATOR */ | ||
115 | |||