diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-04-09 10:03:40 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-04-10 14:24:10 -0700 |
commit | e5f4032866d703735808f934375d31072ff8603b (patch) | |
tree | b3cfa99414ee2b45520d17fd714aedb448652657 /common/pmu_tps65090_charger.c | |
parent | a1c99c7228086a4f3d06fc299fa43ba7928c6b48 (diff) | |
download | chrome-ec-e5f4032866d703735808f934375d31072ff8603b.tar.gz |
Clean up USB external power module
Make internal APIs static, and remove board_ prefix for clarity.
Move TSU6721 calls from charger task to extpower_usb functions for
better encapsulation.
No functional changes, just moving code. Yes, this will make
cherry-picking back from spring to TOT less convenient, but now the
code is more readable and it will make maintaining the PMU code easier
as we add boards.
BUG=chrome-os-partner:18343
BRANCH=none
TEST=build spring
Change-Id: I52b37e57fc8519859996a110b0503277c6f0bbc8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47657
Diffstat (limited to 'common/pmu_tps65090_charger.c')
-rw-r--r-- | common/pmu_tps65090_charger.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/common/pmu_tps65090_charger.c b/common/pmu_tps65090_charger.c index c1c7a03e53..b9295c242f 100644 --- a/common/pmu_tps65090_charger.c +++ b/common/pmu_tps65090_charger.c @@ -17,7 +17,6 @@ #include "system.h" #include "task.h" #include "timer.h" -#include "tsu6721.h" #include "util.h" #define CPUTS(outstr) cputs(CC_CHARGER, outstr) @@ -405,28 +404,16 @@ void charger_task(void) enable_charging(0); disable_sleep(SLEEP_MASK_CHARGING); -#ifdef CONFIG_TSU6721 - board_pwm_init_limit(); - - /* - * Somehow TSU6721 comes up slowly. Let's wait for a moment before - * accessing it. - * TODO(victoryang): Investigate slow init issue. - */ - msleep(500); - - tsu6721_init(); /* Init here until we can do with HOOK_INIT */ - gpio_enable_interrupt(GPIO_USB_CHG_INT); - msleep(100); /* TSU6721 doesn't work properly right away. */ - board_usb_charge_update(1); +#ifdef CONFIG_EXTPOWER_USB + extpower_charge_init(); #endif while (1) { last_waken = get_time(); pmu_clear_irq(); -#ifdef CONFIG_TSU6721 - board_usb_charge_update(0); +#ifdef CONFIG_EXTPOWER_USB + extpower_charge_update(0); #endif /* @@ -509,8 +496,8 @@ void charger_task(void) } } -#ifdef CONFIG_TSU6721 - has_pending_event |= tsu6721_peek_interrupts(); +#ifdef CONFIG_EXTPOWER_USB + has_pending_event |= extpower_charge_needs_update(); #endif if (!has_pending_event) { |