summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-01-07 09:26:25 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-08 22:36:23 +0000
commitdce1b1e8b17a21e577dd6446932d27bf93056a36 (patch)
tree8ee584af152f888e7621e300563ba1245e8ad37d
parent963d4762b2ecb23d5a048592d122901bd5b3b6e4 (diff)
downloadchrome-ec-dce1b1e8b17a21e577dd6446932d27bf93056a36.tar.gz
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 <vpalatin@chromium.org> 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 <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/twinkie/injector.c12
1 files changed, 12 insertions, 0 deletions
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;
}