From dce1b1e8b17a21e577dd6446932d27bf93056a36 Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Wed, 7 Jan 2015 09:26:25 -0800 Subject: twinkie: turn on/off VCONN INA the VCONN INA is off by default to avoid a leakage path on CC2. Turn it on when asking for a VCONN measurement ("twinkie vconn"), then off aftwerwards. Signed-off-by: Vincent Palatin BRANCH=none BUG=none TEST=On the Twinkie command-line, "tw vconn" with the Twinkie interposed between a Samus and a DingDong. Change-Id: I8cd78b285512644af0824a44c735585b684fee66 Reviewed-on: https://chromium-review.googlesource.com/239212 Reviewed-by: Alec Berg Tested-by: Vincent Palatin Reviewed-by: Todd Broch Commit-Queue: Vincent Palatin --- board/twinkie/injector.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/board/twinkie/injector.c b/board/twinkie/injector.c index 03db1c4af5..7365712551 100644 --- a/board/twinkie/injector.c +++ b/board/twinkie/injector.c @@ -427,9 +427,21 @@ static int cmd_rx_threshold(int argc, char **argv) static int cmd_ina_dump(int argc, char **argv, int index) { + if (index == 1) { /* VCONN INA is off by default, switch it on */ + ina2xx_write(index, INA2XX_REG_CONFIG, 0x4123); + /* + * wait for the end of conversion : 2x 1.1ms as defined + * by the Vb and Vsh CT bits in the CONFIG register above. + */ + udelay(2200); + } + ccprintf("%s = %d mV ; %d mA\n", index == 0 ? "VBUS" : "VCONN", ina2xx_get_voltage(index), ina2xx_get_current(index)); + if (index == 1) /* power off VCONN INA */ + ina2xx_write(index, INA2XX_REG_CONFIG, 0); + return EC_SUCCESS; } -- cgit v1.2.1