diff options
Diffstat (limited to 'firmware/powermgmt.c')
-rw-r--r-- | firmware/powermgmt.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 5aa85c883d..065690fdb3 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -374,6 +374,7 @@ static int runcurrent(void) | |||
374 | current = CURRENT_NORMAL; | 374 | current = CURRENT_NORMAL; |
375 | #endif /* MEM == 8 */ | 375 | #endif /* MEM == 8 */ |
376 | 376 | ||
377 | #ifndef BOOTLOADER | ||
377 | if (usb_inserted() | 378 | if (usb_inserted() |
378 | #ifdef HAVE_USB_POWER | 379 | #ifdef HAVE_USB_POWER |
379 | #if (CURRENT_USB < CURRENT_NORMAL) | 380 | #if (CURRENT_USB < CURRENT_NORMAL) |
@@ -405,6 +406,7 @@ static int runcurrent(void) | |||
405 | if (remote_detect()) | 406 | if (remote_detect()) |
406 | current += CURRENT_REMOTE; | 407 | current += CURRENT_REMOTE; |
407 | #endif | 408 | #endif |
409 | #endif /* BOOTLOADER */ | ||
408 | 410 | ||
409 | return current; | 411 | return current; |
410 | } | 412 | } |
@@ -447,7 +449,12 @@ void reset_battery_filter(int millivolts) | |||
447 | #endif /* HAVE_BATTERY_SWITCH */ | 449 | #endif /* HAVE_BATTERY_SWITCH */ |
448 | 450 | ||
449 | /** Generic charging algorithms for common charging types **/ | 451 | /** Generic charging algorithms for common charging types **/ |
450 | #if CONFIG_CHARGING == CHARGING_SIMPLE | 452 | #if CONFIG_CHARGING == 0 || CONFIG_CHARGING == CHARGING_SIMPLE |
453 | static inline void powermgmt_init_target(void) | ||
454 | { | ||
455 | /* Nothing to do */ | ||
456 | } | ||
457 | |||
451 | static inline void charging_algorithm_step(void) | 458 | static inline void charging_algorithm_step(void) |
452 | { | 459 | { |
453 | /* Nothing to do */ | 460 | /* Nothing to do */ |
@@ -461,6 +468,11 @@ static inline void charging_algorithm_close(void) | |||
461 | /* | 468 | /* |
462 | * Monitor CHARGING/DISCHARGING state. | 469 | * Monitor CHARGING/DISCHARGING state. |
463 | */ | 470 | */ |
471 | static inline void powermgmt_init_target(void) | ||
472 | { | ||
473 | /* Nothing to do */ | ||
474 | } | ||
475 | |||
464 | static inline void charging_algorithm_step(void) | 476 | static inline void charging_algorithm_step(void) |
465 | { | 477 | { |
466 | switch (charger_input_state) | 478 | switch (charger_input_state) |
@@ -664,9 +676,7 @@ static void power_thread(void) | |||
664 | battery_percent += battery_percent < 100; | 676 | battery_percent += battery_percent < 100; |
665 | } | 677 | } |
666 | 678 | ||
667 | #if CONFIG_CHARGING == CHARGING_TARGET | ||
668 | powermgmt_init_target(); | 679 | powermgmt_init_target(); |
669 | #endif | ||
670 | 680 | ||
671 | next_power_hist = current_tick + HZ*60; | 681 | next_power_hist = current_tick + HZ*60; |
672 | 682 | ||