summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/tcc780x
diff options
context:
space:
mode:
authorRob Purchase <shotofadds@rockbox.org>2009-10-20 20:38:35 +0000
committerRob Purchase <shotofadds@rockbox.org>2009-10-20 20:38:35 +0000
commitcb2db20a32b1bdb81803c11c7a3133e94c10a560 (patch)
tree73b9606410df56ce91a0c8f0a29d5c6b0e1ed4a1 /firmware/target/arm/tcc780x
parent1668cfa3dded5fcece8301a224402a709d956fec (diff)
downloadrockbox-cb2db20a32b1bdb81803c11c7a3133e94c10a560.tar.gz
rockbox-cb2db20a32b1bdb81803c11c7a3133e94c10a560.zip
Cleanup and expand D2 charger detection (not yet implemented for D2+).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23297 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/tcc780x')
-rw-r--r--firmware/target/arm/tcc780x/cowond2/power-cowond2.c22
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)
#if CONFIG_CHARGING
unsigned int power_input_status(void)
{
- return ((GPIOC & (1<<26)) == 0) ?
- POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
+ /* Players with a PCF50606 can use GPIOs to determine whether AC is inserted
+ and whether charging is taking place. Newer players re-use C26 for the
+ touchscreen, so we need to monitor PCF50635 USB/adapter IRQs for this. */
+
+ if (get_pmu_type() == PCF50606)
+ {
+ /* Check AC adapter */
+ if (GPIOD & (1<<23))
+ return POWER_INPUT_MAIN_CHARGER;
+
+ /* C26 indicates charging, without AC connected it implies USB power */
+ if ((GPIOC & (1<<26)) == 0)
+ return POWER_INPUT_USB_CHARGER;
+ }
+ else
+ {
+ /* TODO: use adapter/usb connection state from PCF50635 driver */
+ }
+
+ return POWER_INPUT_NONE;
}
#endif