diff options
Diffstat (limited to 'firmware/target/arm/tcc780x')
-rw-r--r-- | firmware/target/arm/tcc780x/cowond2/power-cowond2.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/firmware/target/arm/tcc780x/cowond2/power-cowond2.c b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c index dfd692ecab..7e8f066c58 100644 --- a/firmware/target/arm/tcc780x/cowond2/power-cowond2.c +++ b/firmware/target/arm/tcc780x/cowond2/power-cowond2.c | |||
@@ -110,8 +110,26 @@ void EXT3(void) | |||
110 | #if CONFIG_CHARGING | 110 | #if CONFIG_CHARGING |
111 | unsigned int power_input_status(void) | 111 | unsigned int power_input_status(void) |
112 | { | 112 | { |
113 | return ((GPIOC & (1<<26)) == 0) ? | 113 | /* Players with a PCF50606 can use GPIOs to determine whether AC is inserted |
114 | POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE; | 114 | and whether charging is taking place. Newer players re-use C26 for the |
115 | touchscreen, so we need to monitor PCF50635 USB/adapter IRQs for this. */ | ||
116 | |||
117 | if (get_pmu_type() == PCF50606) | ||
118 | { | ||
119 | /* Check AC adapter */ | ||
120 | if (GPIOD & (1<<23)) | ||
121 | return POWER_INPUT_MAIN_CHARGER; | ||
122 | |||
123 | /* C26 indicates charging, without AC connected it implies USB power */ | ||
124 | if ((GPIOC & (1<<26)) == 0) | ||
125 | return POWER_INPUT_USB_CHARGER; | ||
126 | } | ||
127 | else | ||
128 | { | ||
129 | /* TODO: use adapter/usb connection state from PCF50635 driver */ | ||
130 | } | ||
131 | |||
132 | return POWER_INPUT_NONE; | ||
115 | } | 133 | } |
116 | #endif | 134 | #endif |
117 | 135 | ||