diff options
author | Philip Chen <philipchen@google.com> | 2018-01-16 20:46:33 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-01-18 17:40:46 -0800 |
commit | bffb196a07e985280a45f5e5f7965c99b4332b0a (patch) | |
tree | 474faebf893e940f31b8df5d18c41a4f558a2191 | |
parent | 9e71ed4b4de20b375e49b5d6c427c38af022893a (diff) | |
download | chrome-ec-bffb196a07e985280a45f5e5f7965c99b4332b0a.tar.gz |
scarlet: Use TCPC to detect if AC is present
After VBUS is up, there is a delay of ~500ms for rt946x to determine
'VBUS is ready'.
But we need charger_task to detect AC presence and then set a proper
sleep time immediately.
When using fusb302 to detect VBUS, I almost don't see any delay.
BUG=b:71520398
BRANCH=none
TEST=Confirm BATTERY LED turns on immediately when AC is
plugged in a Scarlet in G3.
Change-Id: If1d6d40081b5822eeb9e012115f8deef172def37
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/869420
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r-- | board/scarlet/board.c | 2 | ||||
-rw-r--r-- | driver/charger/rt946x.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/board/scarlet/board.c b/board/scarlet/board.c index 4b9a71c746..277c91ca74 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -187,7 +187,7 @@ int extpower_is_present(void) if (board_vbus_source_enabled(0)) return 0; else - return rt946x_is_vbus_ready(); + return tcpm_get_vbus_level(0); } int pd_snk_is_vbus_provided(int port) diff --git a/driver/charger/rt946x.c b/driver/charger/rt946x.c index d7dbcc26ef..5cf558b033 100644 --- a/driver/charger/rt946x.c +++ b/driver/charger/rt946x.c @@ -760,6 +760,10 @@ int rt946x_enable_charger_boost(int en) (RT946X_REG_CHGCTRL2, RT946X_MASK_CHG_EN); } +/* + * rt946x reports VBUS ready after VBUS is up for ~500ms. + * Check if this works for the use case before calling this function. + */ int rt946x_is_vbus_ready(void) { int val = 0; |