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>
This commit is contained in:
Philip Chen
2018-01-16 20:46:33 -08:00
committed by chrome-bot
parent 9e71ed4b4d
commit bffb196a07
2 changed files with 5 additions and 1 deletions

View File

@@ -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)

View File

@@ -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;