summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-06-25 11:33:51 -0600
committerCommit Bot <commit-bot@chromium.org>2021-07-07 16:44:01 +0000
commit08fb59cd346692eea2391f3604c09cc7e9485aba (patch)
tree5512ee2ed7069e7e887d774aec2b8b522a250eba
parent7dd1f09fab19c2505c420df1339bd57400e10da1 (diff)
downloadchrome-ec-08fb59cd346692eea2391f3604c09cc7e9485aba.tar.gz
Guybrush: Switch to TCPC sourcing detection
Both PPC drivers used by guybrush report Vbus sourcing through a set of cached flags. However, with FRS in the picture their flags will no longer accurately reflect whether we're sourcing. The TCPC however will correctly report that we're sourcing in its power control register. This should also be a more reliable source of information when the system is resetting or sysjumping. It no longer seems necessary to confirm that a port is not sourcing before performing a power supply reset, so this has been removed as well. BRANCH=None BUG=b:183586640 TEST=on guybrush with FRS enabled, perform a failed FR swap and see that Type-C ErrorRecovery correctly turns off Vbus. Perform a successful FR swap and ensure we don't have a lingering Vbus supplier in the charge manager. With no battery, boot from both ports with only a charger plugged in. Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I7833f52dc84e2d5b097c4deb6acf7f2c29b8d48a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2987597 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--baseboard/guybrush/baseboard.c2
-rw-r--r--baseboard/guybrush/usb_pd_policy.c19
2 files changed, 7 insertions, 14 deletions
diff --git a/baseboard/guybrush/baseboard.c b/baseboard/guybrush/baseboard.c
index d6c2ee8d2f..ea69ac875c 100644
--- a/baseboard/guybrush/baseboard.c
+++ b/baseboard/guybrush/baseboard.c
@@ -605,7 +605,7 @@ int board_set_active_charge_port(int port)
/* Check if the port is sourcing VBUS. */
- if (ppc_is_sourcing_vbus(port)) {
+ if (tcpm_get_src_ctrl(port)) {
CPRINTSUSB("Skip enable C%d", port);
return EC_ERROR_INVAL;
}
diff --git a/baseboard/guybrush/usb_pd_policy.c b/baseboard/guybrush/usb_pd_policy.c
index 6a9e28704d..86e4400b63 100644
--- a/baseboard/guybrush/usb_pd_policy.c
+++ b/baseboard/guybrush/usb_pd_policy.c
@@ -30,19 +30,12 @@ int pd_check_vconn_swap(int port)
void pd_power_supply_reset(int port)
{
- /*
- * Don't need to shutoff VBus if we are not sourcing it
- * TODO: Ensure Vbus sourcing is being disabled appropriately to
- * avoid invalid TC states
- */
- if (ppc_is_sourcing_vbus(port)) {
- /* Disable VBUS. */
- ppc_vbus_source_enable(port, 0);
+ /* Disable VBUS. */
+ ppc_vbus_source_enable(port, 0);
- /* Enable discharge if we were previously sourcing 5V */
- if (IS_ENABLED(CONFIG_USB_PD_DISCHARGE))
- pd_set_vbus_discharge(port, 1);
- }
+ /* Enable discharge if we were previously sourcing 5V */
+ if (IS_ENABLED(CONFIG_USB_PD_DISCHARGE))
+ pd_set_vbus_discharge(port, 1);
/* Notify host of power info change. */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
@@ -74,7 +67,7 @@ int pd_set_power_supply_ready(int port)
/* Used by Vbus discharge common code with CONFIG_USB_PD_DISCHARGE */
int board_vbus_source_enabled(int port)
{
- return ppc_is_sourcing_vbus(port);
+ return tcpm_get_src_ctrl(port);
}
/* Used by USB charger task with CONFIG_USB_PD_5V_EN_CUSTOM */