From e5f4032866d703735808f934375d31072ff8603b Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Tue, 9 Apr 2013 10:03:40 -0700 Subject: 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 Reviewed-on: https://gerrit.chromium.org/gerrit/47657 --- common/pmu_tps65090_charger.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) (limited to 'common/pmu_tps65090_charger.c') 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) { -- cgit v1.2.1