summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-08-14 22:58:16 -0600
committerCommit Bot <commit-bot@chromium.org>2021-09-16 17:14:04 +0000
commitabc6c7ad71d85532db725198cecab0aa282e7b50 (patch)
tree49b217857e2079e69a4a7f472eddb95a83adff19 /driver
parent414feb169e244b2037e6a92a45500cc73faeea08 (diff)
downloadchrome-ec-abc6c7ad71d85532db725198cecab0aa282e7b50.tar.gz
USB MUX: Update mux HPD update interface to use mux_state_t
Since the drivers are now taking a mux_state_t set of flags to update, go ahead and unify the usb_mux API this way as well. It makes the parameters more apparent than the 1/0 inputs, and aligns the stack to use the same parameters. BRANCH=None BUG=b:172222942 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ie943dbdf03818d8497c0e328adf2b9794585d96e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3095438 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/usb_mux/usb_mux.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/driver/usb_mux/usb_mux.c b/driver/usb_mux/usb_mux.c
index 56eb104b5d..a362412995 100644
--- a/driver/usb_mux/usb_mux.c
+++ b/driver/usb_mux/usb_mux.c
@@ -326,10 +326,9 @@ void usb_mux_flip(int port)
configure_mux(port, USB_MUX_SET_MODE, &mux_state);
}
-void usb_mux_hpd_update(int port, int hpd_lvl, int hpd_irq)
+void usb_mux_hpd_update(int port, mux_state_t hpd_state)
{
- mux_state_t mux_state = (hpd_lvl ? USB_PD_MUX_HPD_LVL : 0) |
- (hpd_irq ? USB_PD_MUX_HPD_IRQ : 0);
+ mux_state_t get_state;
if (port >= board_get_usb_pd_port_count()) {
return;
@@ -342,12 +341,11 @@ void usb_mux_hpd_update(int port, int hpd_lvl, int hpd_irq)
if (exit_low_power_mode(port) != EC_SUCCESS)
return;
- configure_mux(port, USB_MUX_HPD_UPDATE, &mux_state);
+ configure_mux(port, USB_MUX_HPD_UPDATE, &hpd_state);
- if (!configure_mux(port, USB_MUX_GET_MODE, &mux_state)) {
- mux_state |= (hpd_lvl ? USB_PD_MUX_HPD_LVL : 0) |
- (hpd_irq ? USB_PD_MUX_HPD_IRQ : 0);
- configure_mux(port, USB_MUX_SET_MODE, &mux_state);
+ if (!configure_mux(port, USB_MUX_GET_MODE, &get_state)) {
+ get_state |= hpd_state;
+ configure_mux(port, USB_MUX_SET_MODE, &get_state);
}
}
@@ -475,7 +473,7 @@ static enum ec_status hc_usb_pd_mux_info(struct host_cmd_handler_args *args)
/* Clear HPD IRQ event since we're about to inform host of it. */
if (IS_ENABLED(CONFIG_USB_MUX_VIRTUAL) &&
(r->flags & USB_PD_MUX_HPD_IRQ)) {
- usb_mux_hpd_update(port, r->flags & USB_PD_MUX_HPD_LVL, 0);
+ usb_mux_hpd_update(port, r->flags & USB_PD_MUX_HPD_LVL);
}
args->response_size = sizeof(*r);