diff options
author | Diana Z <dzigterman@chromium.org> | 2020-09-11 15:42:22 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-15 17:51:06 +0000 |
commit | 50a60938781de636dd29bc29c18a7a512f4b8e33 (patch) | |
tree | d4cadba905a070a3c51b0370e823cb737daac1b3 /board/drawcia | |
parent | 7e8b12fa6b223c443f967c5e3dc3acb80a147dae (diff) | |
download | chrome-ec-50a60938781de636dd29bc29c18a7a512f4b8e33.tar.gz |
Dedede: Add Vbus check override for SM variants
The SM charger chip has a Vbus ADC which we may use to precisely
evaluate vSafe0V and vSafe5V for waddledee and drawlat. Correct
evaluation of vSafe0V creates more robust power role swap behavior.
BRANCH=None
BUG=b:167666781,b:160996247
TEST=on drawlat, confirm monitor power role swap from SRC to SNK now
completes correctly
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Iaf5e9c1203005cfba10da0ff2863f9c109d8b1a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2406342
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/drawcia')
-rw-r--r-- | board/drawcia/usb_pd_policy.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/board/drawcia/usb_pd_policy.c b/board/drawcia/usb_pd_policy.c index 9ead3c9fd1..a3d1741a41 100644 --- a/board/drawcia/usb_pd_policy.c +++ b/board/drawcia/usb_pd_policy.c @@ -73,6 +73,20 @@ int pd_set_power_supply_ready(int port) return EC_SUCCESS; } +__override bool pd_check_vbus_level(int port, enum vbus_level level) +{ + int vbus_voltage; + + /* If we're unable to speak to the charger, best to guess false */ + if (charger_get_vbus_voltage(port, &vbus_voltage)) + return false; + + if (level == VBUS_SAFE0V) + return vbus_voltage < PD_V_SAFE0V_MAX; + else + return vbus_voltage > PD_V_SAFE5V_MIN; +} + int pd_snk_is_vbus_provided(int port) { return sm5803_is_vbus_present(port); |