summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/ipod/power-ipod.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-12-03 19:54:25 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-12-03 19:54:25 +0000
commit58eb784a5d1f0ac800e656d5dfa3a1bff8fb2657 (patch)
tree084c7b7c5d374fbfef2f8cddb3673a3b2a26a7df /firmware/target/arm/ipod/power-ipod.c
parent0d0cc039f88ced4f6db5c4468b19913f52cd08c8 (diff)
downloadrockbox-58eb784a5d1f0ac800e656d5dfa3a1bff8fb2657.tar.gz
rockbox-58eb784a5d1f0ac800e656d5dfa3a1bff8fb2657.zip
Straighten out some powermanagement stuff. Give target complete control over how power inputs are sensed. Clean SIMULATOR stuff out of target files. Get rid of USB charging option on targets that don't support it or don't implement it yet. Menu string remains to avoid language incompatibility but should be removed on next cleanup for targets not using it (notice in english.lang). global_settings becomes incompatible for some builds and so plugin API version is incremented.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19315 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/ipod/power-ipod.c')
-rw-r--r--firmware/target/arm/ipod/power-ipod.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/firmware/target/arm/ipod/power-ipod.c b/firmware/target/arm/ipod/power-ipod.c
index af1ac9fc87..cb93fe398f 100644
--- a/firmware/target/arm/ipod/power-ipod.c
+++ b/firmware/target/arm/ipod/power-ipod.c
@@ -43,18 +43,28 @@ void power_init(void)
}
#if CONFIG_CHARGING
-bool charger_inserted(void)
+unsigned int power_input_status(void)
{
-#if defined(IPOD_VIDEO)
- return (GPIOL_INPUT_VAL & 0x08)?false:true;
+ unsigned int status = POWER_INPUT_NONE;
+
+#if defined(IPOD_NANO) || defined(IPOD_VIDEO)
+ if ((GPIOL_INPUT_VAL & 0x08) == 0)
+ status = POWER_INPUT_MAIN_CHARGER;
+
+ if ((GPIOL_INPUT_VAL & 0x10) != 0)
+ status |= POWER_INPUT_USB_CHARGER;
+ /* */
#elif defined(IPOD_4G) || defined(IPOD_COLOR) \
|| defined(IPOD_MINI) || defined(IPOD_MINI2G)
/* C2 is firewire power */
- return (GPIOC_INPUT_VAL & 0x04)?false:true;
+ if ((GPIOC_INPUT_VAL & 0x04) == 0)
+ status = POWER_INPUT_MAIN_CHARGER;
+ /* */
#else
/* This needs filling in for other ipods. */
- return false;
#endif
+
+ return status;
}
/* Returns true if the unit is charging the batteries. */