summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2022-09-30 16:07:50 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-10-04 20:53:20 +0000
commitfae4f102c3f74b14cebb579a79180ea78d5eb605 (patch)
treeebf7df7e1df4387afaf3748b45cedc7d7e8eb5e6
parent46e51dc78601066da3dfc91e8dc6fceb0e3ab88e (diff)
downloadchrome-ec-fae4f102c3f74b14cebb579a79180ea78d5eb605.tar.gz
usb_mux: Clarify hpd_update API
This clarifies that usb_mux.hpd_update() only uses 2 relevant flags in mux_state. These can be masked using MUX_STATE_HPD_UPDATE_MASK. BRANCH=none BUG=b:245753005 TEST=buildall passes Change-Id: I4b746c053ca9a59bb57aa278c0e53bd48967c1fd Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3931288 Reviewed-by: Diana Z <dzigterman@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
-rw-r--r--driver/usb_mux/virtual.c4
-rw-r--r--include/usb_mux.h11
2 files changed, 9 insertions, 6 deletions
diff --git a/driver/usb_mux/virtual.c b/driver/usb_mux/virtual.c
index 417a48c577..dc6f4c3334 100644
--- a/driver/usb_mux/virtual.c
+++ b/driver/usb_mux/virtual.c
@@ -107,14 +107,14 @@ static int virtual_get_mux(const struct usb_mux *me, mux_state_t *mux_state)
return EC_SUCCESS;
}
-void virtual_hpd_update(const struct usb_mux *me, mux_state_t mux_state,
+void virtual_hpd_update(const struct usb_mux *me, mux_state_t hpd_state,
bool *ack_required)
{
int port = me->usb_port;
/* Current HPD related mux status + existing USB & DP mux status */
mux_state_t new_mux_state =
- mux_state | (virtual_mux_state[port] & USB_PD_MUX_USB_DP_STATE);
+ hpd_state | (virtual_mux_state[port] & USB_PD_MUX_USB_DP_STATE);
virtual_mux_update_state(port, new_mux_state, ack_required);
}
diff --git a/include/usb_mux.h b/include/usb_mux.h
index bc89c0ea85..90edbb98d7 100644
--- a/include/usb_mux.h
+++ b/include/usb_mux.h
@@ -33,6 +33,9 @@
#endif /* CONFIG_ZEPHYR */
+/* usb_mux.hpd_update API only specifies 2 relevant bits in mux_state */
+#define MUX_STATE_HPD_UPDATE_MASK (USB_PD_MUX_HPD_LVL | USB_PD_MUX_HPD_IRQ)
+
/*
* USB-C mux state
*
@@ -168,11 +171,11 @@ struct usb_mux {
*
* @param[in] me usb_mux
* @param[in] mux_state with HPD IRQ and HPD LVL flags set
- * accordingly
+ * accordingly. Other flags are undefined.
* @param[out] ack_required: indication of whether this function
* requires a wait for an AP ACK after
*/
- void (*hpd_update)(const struct usb_mux *me, mux_state_t mux_state,
+ void (*hpd_update)(const struct usb_mux *me, mux_state_t hpd_state,
bool *ack_required);
};
@@ -206,7 +209,7 @@ extern const struct usb_mux_chain usb_muxes[];
#endif
/* Supported hpd_update functions */
-void virtual_hpd_update(const struct usb_mux *me, mux_state_t mux_state,
+void virtual_hpd_update(const struct usb_mux *me, mux_state_t hpd_state,
bool *ack_required);
/*
@@ -300,7 +303,7 @@ void usb_mux_flip(int port);
* @param port port number.
* @param mux_state HPD IRQ and LVL mux flags
*/
-void usb_mux_hpd_update(int port, mux_state_t mux_state);
+void usb_mux_hpd_update(int port, mux_state_t hpd_state);
/**
* Port information about retimer firmware update support.