summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tcc780x/cowond2/power-cowond2.c
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/cowond2/power-cowond2.c
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/cowond2/power-cowond2.c')
-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)
110#if CONFIG_CHARGING 110#if CONFIG_CHARGING
111unsigned int power_input_status(void) 111unsigned 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