summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Chen <philipchen@google.com>2017-11-26 00:11:49 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-11-27 22:50:47 -0800
commit675bdc2e2c58cd36161dcec98a5240eb22b43fda (patch)
tree11e3df7bdfd92092ed371e6f7258815337d6d270
parenta2e2be193a46826fa6af7fbaab0e567e248e40b4 (diff)
downloadchrome-ec-675bdc2e2c58cd36161dcec98a5240eb22b43fda.tar.gz
Separate VBUS detection and measurement mechanisms
For now we guard charger-based VBUS voltage measurement behind CONFIG_USB_PD_VBUS_DETECT_CHARGER. But we should be able to measure VBUS voltage by charger while detecting VBUS presence by other methods. BUG=b:67991345 BRANCH=none TEST=plug in guppy on Scarlet rev2, 'ectool usbpdpower' on console, and see VBUS is measured as 4975mV Change-Id: I94cada81159ea4b097001997e2444873ec2d8763 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/789910 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--common/charge_manager.c2
-rw-r--r--include/config.h11
2 files changed, 12 insertions, 1 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c
index 4a6808b50f..dbf97f000b 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -370,7 +370,7 @@ static void charge_manager_fill_power_info(int port,
if (r->role == USB_PD_PORT_POWER_SINK_NOT_CHARGING)
r->meas.voltage_now = 5000;
else {
-#ifdef CONFIG_USB_PD_VBUS_DETECT_CHARGER
+#ifdef CONFIG_USB_PD_VBUS_MEASURE_CHARGER
r->meas.voltage_now = charger_get_vbus_voltage(port);
#else
if (ADC_VBUS >= 0)
diff --git a/include/config.h b/include/config.h
index 45e144484d..4d3f401070 100644
--- a/include/config.h
+++ b/include/config.h
@@ -3096,6 +3096,17 @@
/*****************************************************************************/
/*
+ * Define CONFIG_USB_PD_VBUS_MEASURE_CHARGER if the charger on the board
+ * supports VBUS measurement.
+ */
+#if defined(CONFIG_CHARGER_BD9995X) || \
+ defined(CONFIG_CHARGER_RT9466) || \
+ defined(CONFIG_CHARGER_RT9467)
+#define CONFIG_USB_PD_VBUS_MEASURE_CHARGER
+#endif
+
+/*****************************************************************************/
+/*
* Handle task-dependent configs.
*
* This prevent sub-modules from being compiled when the task and parent module