From 2aadcea46120808076348783fc7202dcc3939d5a Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Wed, 27 Apr 2016 11:52:58 -0700 Subject: [PATCH] fusb302: Delay after enabling CC measurement switches Delay after enabling CC measurements, before checking CC levels, in order to improve accuracy. BUG=None TEST=Manual on Kevin. Verify CC levels are consistent with a specific charger. BRANCH=None Signed-off-by: Shawn Nematbakhsh Change-Id: Ib9abab2abd68b071fb22200bcac36bea6e361d67 Reviewed-on: https://chromium-review.googlesource.com/340885 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Joe Bauman Reviewed-by: Vincent Palatin --- driver/tcpm/fusb302.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/driver/tcpm/fusb302.c b/driver/tcpm/fusb302.c index 11464bbab3..2b84f31b3f 100644 --- a/driver/tcpm/fusb302.c +++ b/driver/tcpm/fusb302.c @@ -225,9 +225,11 @@ static void detect_cc_pin_sink(int port, int *cc1, int *cc2) tcpc_write(port, TCPC_REG_SWITCHES0, reg); - /* - * CC1 is now being measured by FUSB302. - */ + /* CC1 is now being measured by FUSB302. */ + + /* Wait on measurement */ + usleep(250); + tcpc_read(port, TCPC_REG_STATUS0, &bc_lvl_cc1); /* mask away unwanted bits */ @@ -245,9 +247,11 @@ static void detect_cc_pin_sink(int port, int *cc1, int *cc2) tcpc_write(port, TCPC_REG_SWITCHES0, reg); - /* - * CC2 is now being measured by FUSB302. - */ + /* CC2 is now being measured by FUSB302. */ + + /* Wait on measurement */ + usleep(250); + tcpc_read(port, TCPC_REG_STATUS0, &bc_lvl_cc2); /* mask away unwanted bits */