summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-07-06 16:06:25 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-06 09:52:55 +0000
commit54de8d24958a253298eaa4551f2c2474a94d1650 (patch)
treeb4ad9ded695f3fd872f8ebe67b38d64e8208dbd6
parentb5fe12673bab3076e67cc6fc0df16aaf952d83fc (diff)
downloadchrome-ec-54de8d24958a253298eaa4551f2c2474a94d1650.tar.gz
rt1718s: ignore cached source flag for enable sourcing
When FRS happens (failed or succeed), the cached source flag may not reflect the correct status immediately. So, ignore the source flag to update the VBUS charge supplier and enable source control. BUG=b:234352018 TEST=unplug FRS hub with adapter connected, and the VBUS supplier disappeared. BRANCH=cherry Change-Id: Ia735efb3ea15733be01990613ab256d8e73a7f4a Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3747170 Auto-Submit: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--driver/ppc/rt1718s.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/driver/ppc/rt1718s.c b/driver/ppc/rt1718s.c
index 3bcb161e25..1864bd3c47 100644
--- a/driver/ppc/rt1718s.c
+++ b/driver/ppc/rt1718s.c
@@ -65,18 +65,10 @@ static int rt1718s_is_sourcing_vbus(int port)
static int rt1718s_vbus_source_enable(int port, int enable)
{
- atomic_t prev_flag;
-
if (enable)
- prev_flag =
- atomic_or(&flags[port], RT1718S_FLAGS_SOURCE_ENABLED);
+ atomic_or(&flags[port], RT1718S_FLAGS_SOURCE_ENABLED);
else
- prev_flag = atomic_clear_bits(&flags[port],
- RT1718S_FLAGS_SOURCE_ENABLED);
-
- /* Return if status doesn't change */
- if (!!(prev_flag & RT1718S_FLAGS_SOURCE_ENABLED) == !!enable)
- return EC_SUCCESS;
+ atomic_clear_bits(&flags[port], RT1718S_FLAGS_SOURCE_ENABLED);
RETURN_ERROR(tcpm_set_src_ctrl(port, enable));