summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInno.Park <ih.yoo.park@samsung.corp-partner.google.com>2020-07-06 13:33:26 +0900
committerCommit Bot <commit-bot@chromium.org>2020-07-26 00:18:37 +0000
commit1e5ff897b351f7908c66325c88b4340b111a7962 (patch)
tree111c95dfc4fa4427c7e420b76eaaf8b98b7537af
parent144d6304791ee38f082ae317d121e1a3e69197da (diff)
downloadchrome-ec-1e5ff897b351f7908c66325c88b4340b111a7962.tar.gz
nautilus: allow prswap to sink in S0ix and drswap in RO
This merged crrev.com/c/1585121 and crrev.com/c/1355371 and applied them to nautilus. BUG=b:117232092 BRANCH=none TEST=Plug in an unpowered dongle to nautilus in S0, close the lid to trigger S0ix, plug in power to the dongle and check if power role swap accepted. && Disable software sync on nautilus and confirmed a powered hub could reliably display, enable software sync and put the EC into hibernate, waking it with a powered hub, confirming data role swap in RO had no adverse affects or hard resets. Change-Id: I616ca8a0e948076c690ea2a6a3a47eb12a3fd389 Signed-off-by: Inno.Park <ih.yoo.park@samsung.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2282725 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Bob Moragues <moragues@chromium.org>
-rw-r--r--board/nautilus/usb_pd_policy.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/board/nautilus/usb_pd_policy.c b/board/nautilus/usb_pd_policy.c
index 3da3e00084..d6089d9692 100644
--- a/board/nautilus/usb_pd_policy.c
+++ b/board/nautilus/usb_pd_policy.c
@@ -143,24 +143,24 @@ int pd_board_checks(void)
int pd_check_power_swap(int port)
{
/*
- * Allow power swap as long as we are acting as a dual role device,
- * otherwise assume our role is fixed (not in S0 or console command
- * to fix our role).
+ * Allow power swap if we are acting as a dual role device. If we are
+ * not acting as dual role (ex. suspended), then only allow power swap
+ * if we are sourcing when we could be sinking.
*/
- return pd_get_dual_role() == PD_DRP_TOGGLE_ON ? 1 : 0;
+ if (pd_get_dual_role() == PD_DRP_TOGGLE_ON)
+ return 1;
+ else if (pd_get_role(port) == PD_ROLE_SOURCE)
+ return 1;
+
+ return 0;
}
int pd_check_data_swap(int port, int data_role)
{
/*
* Allow data swap if we are a UFP, otherwise don't allow.
- *
- * When we are still in the Read-Only firmware, avoid swapping roles
- * so we don't jump in RW as a SNK/DFP and potentially confuse the
- * power supply by sending a soft-reset with wrong data role.
*/
- return (data_role == PD_ROLE_UFP) &&
- (system_get_image_copy() != SYSTEM_IMAGE_RO) ? 1 : 0;
+ return (data_role == PD_ROLE_UFP);
}
int pd_check_vconn_swap(int port)
@@ -206,10 +206,10 @@ void pd_check_dr_role(int port, int dr_role, int flags)
{
/* If UFP, try to switch to DFP */
if ((flags & PD_FLAGS_PARTNER_DR_DATA) &&
- dr_role == PD_ROLE_UFP &&
- system_get_image_copy() != SYSTEM_IMAGE_RO)
+ dr_role == PD_ROLE_UFP)
pd_request_data_swap(port);
}
+
/* ----------------- Vendor Defined Messages ------------------ */
const struct svdm_response svdm_rsp = {
.identity = NULL,