From a6c0f370a7fe26d3d7ac1fdc7b3fe092f9bd2b5f Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Tue, 30 Oct 2018 09:45:13 -0700 Subject: nocturne: Only source 5V when chipset is on. The power rail for the 5V used for sourcing is not available while the chipset is off. Therefore pd_set_power_supply_ready() should return an error if chipset is off. BUG=b:118646299 BRANCH=firmware-nocturne-10984.B TEST=Flash nocturne; plug in a USB Type-C ethernet adapter, run `dut-control power_state:rec` and verify that VBUS is present at the insert screen. TEST=Repeat the above test 20 times and verify that it always succeeds. Change-Id: Ie675d862dfbbe1e1ce08f6b203008ee784eb8ede Signed-off-by: Aseda Aboagye Reviewed-on: https://chromium-review.googlesource.com/c/1307699 Commit-Queue: Aseda Aboagye Tested-by: Aseda Aboagye Reviewed-by: Furquan Shaikh (cherry picked from commit b6db88f25366a4519ad45d4b54e91cb40e7ea7fb) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1708266 Reviewed-by: Aseda Aboagye --- board/nocturne/usb_pd_policy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/board/nocturne/usb_pd_policy.c b/board/nocturne/usb_pd_policy.c index 8e2c06bd61..1ee6b8a3b6 100644 --- a/board/nocturne/usb_pd_policy.c +++ b/board/nocturne/usb_pd_policy.c @@ -149,6 +149,10 @@ int pd_set_power_supply_ready(int port) if (rv) return rv; + /* The 5V rail used for sourcing is not powered when the AP is off. */ + if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) + return EC_ERROR_NOT_POWERED; + /* Provide Vbus. */ rv = ppc_vbus_source_enable(port, 1); if (rv) -- cgit v1.2.1