summaryrefslogtreecommitdiff
path: root/firmware/powermgmt.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/powermgmt.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/powermgmt.c')
-rw-r--r--firmware/powermgmt.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 6f0c37b3c7..899e103d59 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -935,6 +935,23 @@ static inline void charging_algorithm_close(void)
935} 935}
936#endif /* CONFIG_CHARGING == CHARGING_CONTROL */ 936#endif /* CONFIG_CHARGING == CHARGING_CONTROL */
937 937
938#if CONFIG_CHARGING
939/* Shortcut function calls - compatibility, simplicity. */
940
941/* Returns true if any power input is capable of charging. */
942bool charger_inserted(void)
943{
944 return power_input_status() & POWER_INPUT_CHARGER;
945}
946
947/* Returns true if any power input is connected - charging-capable
948 * or not. */
949bool power_input_present(void)
950{
951 return power_input_status() & POWER_INPUT;
952}
953#endif /* CONFIG_CHARGING */
954
938/* 955/*
939 * This function is called to do the relativly long sleep waits from within the 956 * This function is called to do the relativly long sleep waits from within the
940 * main power_thread loop while at the same time servicing any other periodic 957 * main power_thread loop while at the same time servicing any other periodic
@@ -957,12 +974,7 @@ static void power_thread_sleep(int ticks)
957 * loop (including the subroutines), and end up back here where we 974 * loop (including the subroutines), and end up back here where we
958 * transition to the appropriate steady state charger on/off state. 975 * transition to the appropriate steady state charger on/off state.
959 */ 976 */
960 if(charger_inserted() 977 if(power_input_status() & POWER_INPUT_CHARGER) {
961#ifdef HAVE_USB_POWER /* USB powered or USB inserted both provide power */
962 || usb_powered()
963 || (usb_inserted() && usb_charging_enabled())
964#endif
965 ) {
966 switch(charger_input_state) { 978 switch(charger_input_state) {
967 case NO_CHARGER: 979 case NO_CHARGER:
968 case CHARGER_UNPLUGGED: 980 case CHARGER_UNPLUGGED: