diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2021-04-19 20:45:32 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-21 02:22:18 +0000 |
commit | 07a2b0e11684be396edf1f421b9e4dc2b8b30683 (patch) | |
tree | b4d2365a5812df30daeebe1e738eb5d8337c63b0 /driver/tcpm/nct38xx.c | |
parent | 0f69cef4c4871d70f959eff2e54761acc0e0921b (diff) | |
download | chrome-ec-07a2b0e11684be396edf1f421b9e4dc2b8b30683.tar.gz |
TCPC: Cleanup: Get Sink & SRC state from PD or PPC
Added option to get the Sinking or Sourcing state from either
PD or PPC.
BUG=none
BRANCH=none
TEST=make buildall -j
Change-Id: Ibb21ef69b5825ea5722ceacd5d7ef6f535aad17c
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2838127
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'driver/tcpm/nct38xx.c')
-rw-r--r-- | driver/tcpm/nct38xx.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/driver/tcpm/nct38xx.c b/driver/tcpm/nct38xx.c index 5d2be3ad2f..f4e3382d3a 100644 --- a/driver/tcpm/nct38xx.c +++ b/driver/tcpm/nct38xx.c @@ -148,19 +148,10 @@ static int nct38xx_tcpm_set_cc(int port, int pull) * SNKEN will be re-enabled in nct38xx_init above (from tcpm_init), or * when CC lines are set again, or when sinking is disabled. */ - enum mask_update_action action = MASK_SET; int rv; - - if (pull == TYPEC_CC_OPEN) { - bool is_sinking; - - rv = tcpm_get_snk_ctrl(port, &is_sinking); - if (rv) - return rv; - - if (is_sinking) - action = MASK_CLR; - } + enum mask_update_action action = + pull == TYPEC_CC_OPEN && tcpm_get_snk_ctrl(port) ? + MASK_CLR : MASK_SET; rv = tcpc_update8(port, NCT38XX_REG_CTRL_OUT_EN, |