diff options
author | Wai-Hong Tam <waihong@google.com> | 2019-05-15 09:23:23 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-05-20 21:14:55 -0700 |
commit | 2fa7472da15a402ba8649344016ab5351cb768e7 (patch) | |
tree | 7d4e42dbb39e92cd429a681a110c7a06c932e504 | |
parent | faff726eaf8bb86b195a19996f8d43e23014450f (diff) | |
download | chrome-ec-2fa7472da15a402ba8649344016ab5351cb768e7.tar.gz |
servo_v4: Enable VBUS voltage and current measurement
Enable the INA functions on the VBUS of the DUT port (PP_DUT) and the
VBUS of the CHG port (PP_CHG).
BUG=b:132807223
BRANCH=servo
TEST=Typed the console command "ina 0" and returned:
> ina 0
Configuration: 4127
Shunt voltage: 10d9 => 10782 uV
Bus voltage : 3d3a => 19592 mV
Power : 069b => 42275 mW
Current : 086d => 2157 mA
Calibration : 0400
Mask/Enable : 0008
Alert limit : 0000
Used a multimeter to measure the VBUS on the DUT port. The measured
voltage and current are close to the above values.
Did the same thing on the CHG port.
Change-Id: I1d49540b4685f299437821251cd6422b1c0ac0b8
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1613805
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
-rw-r--r-- | board/servo_v4/board.c | 5 | ||||
-rw-r--r-- | board/servo_v4/board.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c index d0e1bd08be..690e67b5fc 100644 --- a/board/servo_v4/board.c +++ b/board/servo_v4/board.c @@ -12,6 +12,7 @@ #include "gpio.h" #include "hooks.h" #include "i2c.h" +#include "ina2xx.h" #include "queue_policies.h" #include "registers.h" #include "spi.h" @@ -439,6 +440,10 @@ static void board_init(void) */ pd_set_max_voltage(PD_MIN_MV); + /* Calibrate INA0 (PP_DUT) and INA1 (PP_CHG) */ + ina2xx_init(0, 0x8000 /* Reset */, INA2XX_CALIB_1MA(5 /* mOhm */)); + ina2xx_init(1, 0x8000 /* Reset */, INA2XX_CALIB_1MA(5 /* mOhm */)); + hook_call_deferred(&ccd_measure_sbu_data, 1000 * MSEC); } diff --git a/board/servo_v4/board.h b/board/servo_v4/board.h index 3db2478ae4..ff2ae855b7 100644 --- a/board/servo_v4/board.h +++ b/board/servo_v4/board.h @@ -90,6 +90,7 @@ /* PD features */ #define CONFIG_ADC +#define CONFIG_INA231 #define CONFIG_BOARD_PRE_INIT /* * If task profiling is enabled then the rx falling edge detection interrupts |