summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2020-01-23 07:19:06 -0800
committerCommit Bot <commit-bot@chromium.org>2020-01-28 02:35:08 +0000
commit50d60e3fe12a852ae412d9502ca22a5b72cb441b (patch)
tree3d5f925aba3d00f523812acb5238548a6e3dc4a1
parent43dfea03a49d46677590ac42f2fce4419835e1e7 (diff)
downloadchrome-ec-50d60e3fe12a852ae412d9502ca22a5b72cb441b.tar.gz
usb_mux: cleanup: Replace mux state enums with ec_command bit flag
BUG=b:145796172 BRANCH=none TEST=make buildall -j Change-Id: Ie4ffaf208745764262931501f0dff77b525a4e59 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2017569 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--baseboard/grunt/usb_pd_policy.c21
-rw-r--r--baseboard/kukui/usb_pd_policy.c7
-rw-r--r--baseboard/zork/baseboard.c6
-rw-r--r--baseboard/zork/usb_pd_policy.c23
-rw-r--r--board/chell/usb_pd_policy.c4
-rw-r--r--board/cheza/usb_pd_policy.c6
-rw-r--r--board/flapjack/usb_pd_policy.c2
-rw-r--r--board/nocturne/usb_pd_policy.c2
-rw-r--r--board/pdeval-stm32f072/usb_pd_policy.c15
-rw-r--r--board/samus_pd/usb_mux.c14
-rw-r--r--board/samus_pd/usb_pd_config.h2
-rw-r--r--board/trogdor/usb_pd_policy.c4
-rw-r--r--common/usb_common.c23
-rw-r--r--common/usb_pd_policy.c4
-rw-r--r--common/usb_pd_protocol.c18
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c22
-rw-r--r--driver/retimer/pi3dpx1207.c12
-rw-r--r--driver/retimer/ps8802.c16
-rw-r--r--driver/retimer/ps8818.c8
-rw-r--r--driver/tcpm/anx7447.c28
-rw-r--r--driver/tcpm/anx74xx.c33
-rw-r--r--driver/tcpm/anx7688.c4
-rw-r--r--driver/tcpm/tcpci.c12
-rw-r--r--driver/usb_mux/amd_fp5.c33
-rw-r--r--driver/usb_mux/anx7440.c12
-rw-r--r--driver/usb_mux/it5205.c14
-rw-r--r--driver/usb_mux/pi3usb3x532.c12
-rw-r--r--driver/usb_mux/ps874x.c12
-rw-r--r--driver/usb_mux/usb_mux.c19
-rw-r--r--include/ec_commands.h3
-rw-r--r--include/usb_mux.h26
-rw-r--r--test/fake_usbc.c7
-rw-r--r--test/usb_typec_drp_acc_trysrc.c8
33 files changed, 217 insertions, 215 deletions
diff --git a/baseboard/grunt/usb_pd_policy.c b/baseboard/grunt/usb_pd_policy.c
index 9ec482c750..4edee5f232 100644
--- a/baseboard/grunt/usb_pd_policy.c
+++ b/baseboard/grunt/usb_pd_policy.c
@@ -80,7 +80,7 @@ int board_vbus_source_enabled(int port)
/* ----------------- Vendor Defined Messages ------------------ */
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static enum typec_mux svdm_dp_mux_mode(int port)
+mux_state_t svdm_dp_mux_mode(int port)
{
int mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]);
int pin_mode = pd_dfp_dp_get_pin_mode(port, dp_status[port]);
@@ -89,9 +89,9 @@ static enum typec_mux svdm_dp_mux_mode(int port)
* supported.
*/
if ((pin_mode & MODE_DP_PIN_MF_MASK) && mf_pref)
- return TYPEC_MUX_DOCK;
+ return USB_PD_MUX_DOCK;
else
- return TYPEC_MUX_DP;
+ return USB_PD_MUX_DP_ENABLED;
}
__override int svdm_dp_config(int port, uint32_t *payload)
@@ -99,7 +99,7 @@ __override int svdm_dp_config(int port, uint32_t *payload)
int opos = pd_alt_mode(port, USB_SID_DISPLAYPORT);
int mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]);
int pin_mode = pd_dfp_dp_get_pin_mode(port, dp_status[port]);
- enum typec_mux mux_mode = svdm_dp_mux_mode(port);
+ mux_state_t mux_mode = svdm_dp_mux_mode(port);
if (!pin_mode)
return 0;
@@ -108,13 +108,14 @@ __override int svdm_dp_config(int port, uint32_t *payload)
/*
* Place the USB Type-C pins that are to be re-configured to DisplayPort
- * Configuration into the Safe state. For TYPEC_MUX_DOCK, the superspeed
- * signals can remain connected. For TYPEC_MUX_DP, disconnect the
- * superspeed signals here, before the pins are re-configured to
- * DisplayPort (in svdm_dp_post_config, when we receive the config ack).
+ * Configuration into the Safe state. For USB_PD_MUX_DOCK, the
+ * superspeed signals can remain connected. For USB_PD_MUX_DP_ENABLED,
+ * disconnect the superspeed signals here, before the pins are
+ * re-configured to DisplayPort (in svdm_dp_post_config, when we receive
+ * the config ack).
*/
- if (mux_mode == TYPEC_MUX_DP)
- usb_mux_set(port, TYPEC_MUX_NONE, USB_SWITCH_CONNECT,
+ if (mux_mode == USB_PD_MUX_DP_ENABLED)
+ usb_mux_set(port, USB_PD_MUX_NONE, USB_SWITCH_CONNECT,
pd_get_polarity(port));
payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
diff --git a/baseboard/kukui/usb_pd_policy.c b/baseboard/kukui/usb_pd_policy.c
index 8ae257d16e..b88f85219e 100644
--- a/baseboard/kukui/usb_pd_policy.c
+++ b/baseboard/kukui/usb_pd_policy.c
@@ -102,7 +102,7 @@ __override void svdm_safe_dp_mode(int port)
/* make DP interface safe until configure */
dp_flags[port] = 0;
dp_status[port] = 0;
- usb_mux_set(port, TYPEC_MUX_NONE,
+ usb_mux_set(port, USB_PD_MUX_NONE,
USB_SWITCH_CONNECT, board_get_polarity(port));
}
@@ -144,10 +144,11 @@ __override int svdm_dp_config(int port, uint32_t *payload)
return 0;
if (board_has_virtual_mux())
- usb_mux_set(port, TYPEC_MUX_DP, USB_SWITCH_CONNECT,
+ usb_mux_set(port, USB_PD_MUX_DP_ENABLED, USB_SWITCH_CONNECT,
board_get_polarity(port));
else
- usb_mux_set(port, mf_pref ? TYPEC_MUX_DOCK : TYPEC_MUX_DP,
+ usb_mux_set(port, mf_pref ?
+ USB_PD_MUX_DOCK : USB_PD_MUX_DP_ENABLED,
USB_SWITCH_CONNECT, board_get_polarity(port));
payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c
index b1c8662a07..3dcbd96560 100644
--- a/baseboard/zork/baseboard.c
+++ b/baseboard/zork/baseboard.c
@@ -473,7 +473,7 @@ void bc12_interrupt(enum gpio_signal signal)
static int zork_c1_retimer_set_mux(int port, mux_state_t mux_state)
{
return amd_fp5_usb_retimer.set(port,
- mux_state & ~MUX_POLARITY_INVERTED);
+ mux_state & ~USB_PD_MUX_POLARITY_INVERTED);
}
const struct usb_retimer_driver zork_c1_usb_retimer = {
@@ -569,7 +569,7 @@ static int zork_c1_set_mux(int port, mux_state_t mux_state)
* Try to detect, give an error if we are setting to a
* MUX value that is not NONE when we have no power.
*/
- rv = zork_c1_detect(port, mux_state != TYPEC_MUX_NONE);
+ rv = zork_c1_detect(port, mux_state != USB_PD_MUX_NONE);
if (rv)
return rv;
@@ -596,7 +596,7 @@ static int zork_c1_get_mux(int port, mux_state_t *mux_state)
* and make it a good status
*/
if (rv == EC_ERROR_NOT_POWERED) {
- *mux_state = TYPEC_MUX_NONE;
+ *mux_state = USB_PD_MUX_NONE;
rv = EC_SUCCESS;
}
return rv;
diff --git a/baseboard/zork/usb_pd_policy.c b/baseboard/zork/usb_pd_policy.c
index aba5a40033..66433f9ac0 100644
--- a/baseboard/zork/usb_pd_policy.c
+++ b/baseboard/zork/usb_pd_policy.c
@@ -88,7 +88,7 @@ int board_vbus_source_enabled(int port)
/* ----------------- Vendor Defined Messages ------------------ */
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
-static enum typec_mux svdm_dp_mux_mode(int port)
+mux_state_t svdm_dp_mux_mode(int port)
{
int mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]);
int pin_mode = pd_dfp_dp_get_pin_mode(port, dp_status[port]);
@@ -97,9 +97,9 @@ static enum typec_mux svdm_dp_mux_mode(int port)
* supported.
*/
if ((pin_mode & MODE_DP_PIN_MF_MASK) && mf_pref)
- return TYPEC_MUX_DOCK;
+ return USB_PD_MUX_DOCK;
else
- return TYPEC_MUX_DP;
+ return USB_PD_MUX_DP_ENABLED;
}
__override int svdm_dp_config(int port, uint32_t *payload)
@@ -107,7 +107,7 @@ __override int svdm_dp_config(int port, uint32_t *payload)
int opos = pd_alt_mode(port, USB_SID_DISPLAYPORT);
int mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]);
int pin_mode = pd_dfp_dp_get_pin_mode(port, dp_status[port]);
- enum typec_mux mux_mode = svdm_dp_mux_mode(port);
+ mux_state_t mux_mode = svdm_dp_mux_mode(port);
if (!pin_mode)
return 0;
@@ -116,13 +116,14 @@ __override int svdm_dp_config(int port, uint32_t *payload)
/*
* Place the USB Type-C pins that are to be re-configured to DisplayPort
- * Configuration into the Safe state. For TYPEC_MUX_DOCK, the superspeed
- * signals can remain connected. For TYPEC_MUX_DP, disconnect the
- * superspeed signals here, before the pins are re-configured to
- * DisplayPort (in svdm_dp_post_config, when we receive the config ack).
+ * Configuration into the Safe state. For USB_PD_MUX_DOCK, the
+ * superspeed signals can remain connected. For USB_PD_MUX_DP_ENABLED,
+ * disconnect the superspeed signals here, before the pins are
+ * re-configured to DisplayPort (in svdm_dp_post_config, when we receive
+ * the config ack).
*/
- if (mux_mode == TYPEC_MUX_DP)
- usb_mux_set(port, TYPEC_MUX_NONE, USB_SWITCH_CONNECT,
+ if (mux_mode == USB_PD_MUX_DP_ENABLED)
+ usb_mux_set(port, USB_PD_MUX_NONE, USB_SWITCH_CONNECT,
pd_get_polarity(port));
payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
@@ -162,7 +163,7 @@ __override void svdm_exit_dp_mode(int port)
dp_flags[port] = 0;
dp_status[port] = 0;
- usb_mux_set(port, TYPEC_MUX_NONE, USB_SWITCH_CONNECT,
+ usb_mux_set(port, USB_PD_MUX_NONE, USB_SWITCH_CONNECT,
pd_get_polarity(port));
gpio_set_level(PORT_TO_HPD(port), 0);
diff --git a/board/chell/usb_pd_policy.c b/board/chell/usb_pd_policy.c
index d87a2c8059..5a1dada9e2 100644
--- a/board/chell/usb_pd_policy.c
+++ b/board/chell/usb_pd_policy.c
@@ -211,7 +211,7 @@ static void svdm_safe_dp_mode(int port)
/* make DP interface safe until configure */
dp_flags[port] = 0;
dp_status[port] = 0;
- usb_mux_set(port, TYPEC_MUX_NONE,
+ usb_mux_set(port, USB_PD_MUX_NONE,
USB_SWITCH_CONNECT, pd_get_polarity(port));
}
@@ -252,7 +252,7 @@ static int svdm_dp_config(int port, uint32_t *payload)
if (!pin_mode)
return 0;
- usb_mux_set(port, mf_pref ? TYPEC_MUX_DOCK : TYPEC_MUX_DP,
+ usb_mux_set(port, mf_pref ? USB_PD_MUX_DOCK : USB_PD_MUX_DP_ENABLED,
USB_SWITCH_CONNECT, pd_get_polarity(port));
payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
diff --git a/board/cheza/usb_pd_policy.c b/board/cheza/usb_pd_policy.c
index e56324dfec..17f75136f9 100644
--- a/board/cheza/usb_pd_policy.c
+++ b/board/cheza/usb_pd_policy.c
@@ -190,10 +190,12 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
*/
gpio_set_level(GPIO_USBC_MUX_CONF1, port == 1);
- usb_mux_set(port, mf_pref ? TYPEC_MUX_DOCK : TYPEC_MUX_DP,
+ usb_mux_set(port, mf_pref ?
+ USB_PD_MUX_DOCK : USB_PD_MUX_DP_ENABLED,
USB_SWITCH_CONNECT, pd_get_polarity(port));
} else {
- usb_mux_set(port, mf_pref ? TYPEC_MUX_USB : TYPEC_MUX_NONE,
+ usb_mux_set(port, mf_pref ?
+ USB_PD_MUX_USB_ENABLED : USB_PD_MUX_NONE,
USB_SWITCH_CONNECT, pd_get_polarity(port));
}
diff --git a/board/flapjack/usb_pd_policy.c b/board/flapjack/usb_pd_policy.c
index 738e10f421..7174389dde 100644
--- a/board/flapjack/usb_pd_policy.c
+++ b/board/flapjack/usb_pd_policy.c
@@ -108,7 +108,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
return 1;
}
- usb_mux_set(port, lvl ? TYPEC_MUX_DP : TYPEC_MUX_NONE,
+ usb_mux_set(port, lvl ? USB_PD_MUX_DP_ENABLED : USB_PD_MUX_NONE,
USB_SWITCH_CONNECT, pd_get_polarity(port));
mux->hpd_update(port, lvl, irq);
diff --git a/board/nocturne/usb_pd_policy.c b/board/nocturne/usb_pd_policy.c
index ed94e3eec8..e2951f291e 100644
--- a/board/nocturne/usb_pd_policy.c
+++ b/board/nocturne/usb_pd_policy.c
@@ -96,7 +96,7 @@ int pd_set_power_supply_ready(int port)
__override void svdm_safe_dp_mode(int port)
{
/* make DP interface safe until configure */
- usb_mux_set(port, TYPEC_MUX_NONE,
+ usb_mux_set(port, USB_PD_MUX_NONE,
USB_SWITCH_CONNECT, pd_get_polarity(port));
/*
diff --git a/board/pdeval-stm32f072/usb_pd_policy.c b/board/pdeval-stm32f072/usb_pd_policy.c
index c8663ea12d..2f0022d211 100644
--- a/board/pdeval-stm32f072/usb_pd_policy.c
+++ b/board/pdeval-stm32f072/usb_pd_policy.c
@@ -193,7 +193,7 @@ __override void svdm_safe_dp_mode(int port)
{
/* make DP interface safe until configure */
dp_flags[port] = 0;
- /* board_set_usb_mux(port, TYPEC_MUX_NONE, pd_get_polarity(port)); */
+ /* board_set_usb_mux(port, USB_PD_MUX_NONE, pd_get_polarity(port)); */
}
__override int svdm_dp_config(int port, uint32_t *payload)
@@ -202,9 +202,9 @@ __override int svdm_dp_config(int port, uint32_t *payload)
int pin_mode = pd_dfp_dp_get_pin_mode(port, dp_status[port]);
#ifdef CONFIG_USB_PD_TCPM_ANX7447
- mux_state_t mux_state = TYPEC_MUX_NONE;
+ mux_state_t mux_state = USB_PD_MUX_NONE;
if (pd_get_polarity(port))
- mux_state |= MUX_POLARITY_INVERTED;
+ mux_state |= USB_PD_MUX_POLARITY_INVERTED;
#endif
CPRINTS("pin_mode = %d", pin_mode);
@@ -216,19 +216,22 @@ __override int svdm_dp_config(int port, uint32_t *payload)
case MODE_DP_PIN_A:
case MODE_DP_PIN_C:
case MODE_DP_PIN_E:
- mux_state |= TYPEC_MUX_DP;
+ mux_state |= USB_PD_MUX_DP_ENABLED;
usb_muxes[port].driver->set(port, mux_state);
break;
case MODE_DP_PIN_B:
case MODE_DP_PIN_D:
case MODE_DP_PIN_F:
- mux_state |= TYPEC_MUX_DOCK;
+ mux_state |= USB_PD_MUX_DOCK;
usb_muxes[port].driver->set(port, mux_state);
break;
}
#endif
- /* board_set_usb_mux(port, TYPEC_MUX_DP, pd_get_polarity(port)); */
+ /*
+ * board_set_usb_mux(port, USB_PD_MUX_DP_ENABLED,
+ * pd_get_polarity(port));
+ */
payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
CMD_DP_CONFIG | VDO_OPOS(opos));
payload[1] = VDO_DP_CFG(pin_mode, /* pin mode */
diff --git a/board/samus_pd/usb_mux.c b/board/samus_pd/usb_mux.c
index 2c3a0b3a45..732de79968 100644
--- a/board/samus_pd/usb_mux.c
+++ b/board/samus_pd/usb_mux.c
@@ -48,7 +48,7 @@ static int board_init_usb_mux(int port)
static int board_set_usb_mux(int port, mux_state_t mux_state)
{
const struct usb_port_mux *usb_mux = mux_gpios + port;
- int polarity = mux_state & MUX_POLARITY_INVERTED;
+ int polarity = mux_state & USB_PD_MUX_POLARITY_INVERTED;
/* reset everything */
gpio_set_level(usb_mux->ss1_en_l, 1);
@@ -58,16 +58,16 @@ static int board_set_usb_mux(int port, mux_state_t mux_state)
gpio_set_level(usb_mux->ss1_dp_mode, 1);
gpio_set_level(usb_mux->ss2_dp_mode, 1);
- if (!(mux_state & (MUX_USB_ENABLED | MUX_DP_ENABLED)))
+ if (!(mux_state & (USB_PD_MUX_USB_ENABLED | USB_PD_MUX_DP_ENABLED)))
/* everything is already disabled, we can return */
return EC_SUCCESS;
- if (mux_state & MUX_USB_ENABLED)
+ if (mux_state & USB_PD_MUX_USB_ENABLED)
/* USB 3.0 uses 2 superspeed lanes */
gpio_set_level(polarity ? usb_mux->ss2_dp_mode :
usb_mux->ss1_dp_mode, 0);
- if (mux_state & MUX_DP_ENABLED) {
+ if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* DP uses available superspeed lanes (x2 or x4) */
gpio_set_level(usb_mux->dp_polarity, polarity);
gpio_set_level(usb_mux->dp_mode_l, 0);
@@ -88,13 +88,13 @@ static int board_get_usb_mux(int port, mux_state_t *mux_state)
if (!gpio_get_level(usb_mux->ss1_dp_mode) ||
!gpio_get_level(usb_mux->ss2_dp_mode))
- *mux_state |= MUX_USB_ENABLED;
+ *mux_state |= USB_PD_MUX_USB_ENABLED;
if (!gpio_get_level(usb_mux->dp_mode_l))
- *mux_state |= MUX_DP_ENABLED;
+ *mux_state |= USB_PD_MUX_DP_ENABLED;
if (gpio_get_level(usb_mux->dp_polarity))
- *mux_state |= MUX_POLARITY_INVERTED;
+ *mux_state |= USB_PD_MUX_POLARITY_INVERTED;
return EC_SUCCESS;
}
diff --git a/board/samus_pd/usb_pd_config.h b/board/samus_pd/usb_pd_config.h
index 8b01e30b64..c81b0bf113 100644
--- a/board/samus_pd/usb_pd_config.h
+++ b/board/samus_pd/usb_pd_config.h
@@ -243,7 +243,7 @@ static inline void pd_config_init(int port, uint8_t power_role)
pd_tx_init();
/* Reset mux ... for NONE polarity doesn't matter */
- usb_mux_set(port, TYPEC_MUX_NONE, USB_SWITCH_DISCONNECT, 0);
+ usb_mux_set(port, USB_PD_MUX_NONE, USB_SWITCH_DISCONNECT, 0);
if (port == 0) {
gpio_set_level(GPIO_USB_C0_CC1_VCONN1_EN_L, 1);
diff --git a/board/trogdor/usb_pd_policy.c b/board/trogdor/usb_pd_policy.c
index 0fbfd9013e..c88768f63a 100644
--- a/board/trogdor/usb_pd_policy.c
+++ b/board/trogdor/usb_pd_policy.c
@@ -188,7 +188,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
* because of the board USB-C topology (limited to 2
* lanes DP).
*/
- usb_mux_set(port, TYPEC_MUX_DOCK,
+ usb_mux_set(port, USB_PD_MUX_DOCK,
USB_SWITCH_CONNECT, pd_get_polarity(port));
} else {
/* TODO(waihong): Info user? */
@@ -204,7 +204,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
ppc_set_sbu(port, 0);
/* Disconnect the DP but keep the USB SS lines in TCPC chip. */
- usb_mux_set(port, TYPEC_MUX_USB,
+ usb_mux_set(port, USB_PD_MUX_USB_ENABLED,
USB_SWITCH_CONNECT, pd_get_polarity(port));
}
diff --git a/common/usb_common.c b/common/usb_common.c
index 3ab01430bd..aeab0bdfdd 100644
--- a/common/usb_common.c
+++ b/common/usb_common.c
@@ -486,7 +486,7 @@ enum pd_drp_next_states drp_auto_toggle_next_state(
}
}
-static enum typec_mux get_mux_mode_to_set(int port)
+mux_state_t get_mux_mode_to_set(int port)
{
/*
* If the SoC is down, then we disconnect the MUX to save power since
@@ -494,7 +494,7 @@ static enum typec_mux get_mux_mode_to_set(int port)
*/
if (IS_ENABLED(CONFIG_POWER_COMMON) &&
chipset_in_or_transitioning_to_state(CHIPSET_STATE_ANY_OFF))
- return TYPEC_MUX_NONE;
+ return USB_PD_MUX_NONE;
/*
* When PD stack is disconnected, then mux should be disconnected, which
@@ -503,13 +503,13 @@ static enum typec_mux get_mux_mode_to_set(int port)
* be set correctly again.
*/
if (pd_is_disconnected(port))
- return TYPEC_MUX_NONE;
+ return USB_PD_MUX_NONE;
/* If new data role isn't DFP & we only support DFP, also disconnect. */
if (IS_ENABLED(CONFIG_USB_PD_DUAL_ROLE) &&
IS_ENABLED(CONFIG_USBC_SS_MUX_DFP_ONLY) &&
pd_get_data_role(port) != PD_ROLE_DFP)
- return TYPEC_MUX_NONE;
+ return USB_PD_MUX_NONE;
/*
* If the power role is sink and the partner device is not capable
@@ -518,17 +518,18 @@ static enum typec_mux get_mux_mode_to_set(int port)
if (IS_ENABLED(CONFIG_USB_PD_DUAL_ROLE) &&
pd_get_power_role(port) == PD_ROLE_SINK &&
!pd_get_partner_usb_comm_capable(port))
- return TYPEC_MUX_NONE;
+ return USB_PD_MUX_NONE;
/* Otherwise connect mux since we are in S3+ */
- return TYPEC_MUX_USB;
+ return USB_PD_MUX_USB_ENABLED;
}
void set_usb_mux_with_current_data_role(int port)
{
if (IS_ENABLED(CONFIG_USBC_SS_MUX)) {
- enum typec_mux mux_mode = get_mux_mode_to_set(port);
- enum usb_switch usb_switch_mode = (mux_mode == TYPEC_MUX_NONE) ?
+ mux_state_t mux_mode = get_mux_mode_to_set(port);
+ enum usb_switch usb_switch_mode =
+ (mux_mode == USB_PD_MUX_NONE) ?
USB_SWITCH_DISCONNECT : USB_SWITCH_CONNECT;
usb_mux_set(port, mux_mode, usb_switch_mode,
@@ -783,7 +784,7 @@ __overridable int pd_custom_vdm(int port, int cnt, uint32_t *payload,
void usb_mux_set_safe_mode(int port)
{
usb_mux_set(port, IS_ENABLED(CONFIG_USB_MUX_VIRTUAL) ?
- TYPEC_MUX_SAFE : TYPEC_MUX_NONE,
+ USB_PD_MUX_SAFE_MODE : USB_PD_MUX_NONE,
USB_SWITCH_CONNECT, pd_get_polarity(port));
/* Isolate the SBU lines. */
@@ -870,7 +871,7 @@ __overridable int svdm_dp_config(int port, uint32_t *payload)
int opos = pd_alt_mode(port, USB_SID_DISPLAYPORT);
int mf_pref = PD_VDO_DPSTS_MF_PREF(dp_status[port]);
uint8_t pin_mode = get_dp_pin_mode(port);
- enum typec_mux mux_mode;
+ mux_state_t mux_mode;
if (!pin_mode)
return 0;
@@ -880,7 +881,7 @@ __overridable int svdm_dp_config(int port, uint32_t *payload)
* supported.
*/
mux_mode = ((pin_mode & MODE_DP_PIN_MF_MASK) && mf_pref) ?
- TYPEC_MUX_DOCK : TYPEC_MUX_DP;
+ USB_PD_MUX_DOCK : USB_PD_MUX_DP_ENABLED;
CPRINTS("pin_mode: %x, mf: %d, mux: %d", pin_mode, mf_pref, mux_mode);
/* Connect the SBU and USB lines to the connector. */
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index 685bf061a2..f220293434 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -286,8 +286,8 @@ static void set_tbt_compat_mode_ready(int port)
ppc_set_sbu(port, 1);
/* Set usb mux to Thunderbolt-compatible mode */
- usb_mux_set(port, TYPEC_MUX_TBT_COMPAT, USB_SWITCH_CONNECT,
- pd_get_polarity(port));
+ usb_mux_set(port, USB_PD_MUX_TBT_COMPAT_ENABLED,
+ USB_SWITCH_CONNECT, pd_get_polarity(port));
}
}
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 9188f2720b..c2d937e8ef 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -832,7 +832,7 @@ static inline void set_state(int port, enum pd_states next_state)
*/
pd_execute_data_swap(port, PD_ROLE_DFP);
#ifdef CONFIG_USBC_SS_MUX
- usb_mux_set(port, TYPEC_MUX_NONE, USB_SWITCH_DISCONNECT,
+ usb_mux_set(port, USB_PD_MUX_NONE, USB_SWITCH_DISCONNECT,
pd[port].polarity);
#endif
/* Disable TCPC RX */
@@ -3389,7 +3389,7 @@ void pd_task(void *u)
PD_ROLE_VCONN_OFF);
#endif /* CONFIG_USBC_VCONN */
#ifdef CONFIG_USBC_SS_MUX
- usb_mux_set(port, TYPEC_MUX_NONE,
+ usb_mux_set(port, USB_PD_MUX_NONE,
USB_SWITCH_DISCONNECT,
pd[port].polarity);
#endif /* CONFIG_USBC_SS_MUX */
@@ -5356,12 +5356,12 @@ static const enum pd_dual_role_states dual_role_map[USB_PD_CTRL_ROLE_COUNT] = {
#endif
#ifdef CONFIG_USBC_SS_MUX
-static const enum typec_mux typec_mux_map[USB_PD_CTRL_MUX_COUNT] = {
- [USB_PD_CTRL_MUX_NONE] = TYPEC_MUX_NONE,
- [USB_PD_CTRL_MUX_USB] = TYPEC_MUX_USB,
- [USB_PD_CTRL_MUX_AUTO] = TYPEC_MUX_DP,
- [USB_PD_CTRL_MUX_DP] = TYPEC_MUX_DP,
- [USB_PD_CTRL_MUX_DOCK] = TYPEC_MUX_DOCK,
+static const mux_state_t typec_mux_map[USB_PD_CTRL_MUX_COUNT] = {
+ [USB_PD_CTRL_MUX_NONE] = USB_PD_MUX_NONE,
+ [USB_PD_CTRL_MUX_USB] = USB_PD_MUX_USB_ENABLED,
+ [USB_PD_CTRL_MUX_AUTO] = USB_PD_MUX_DP_ENABLED,
+ [USB_PD_CTRL_MUX_DP] = USB_PD_MUX_DP_ENABLED,
+ [USB_PD_CTRL_MUX_DOCK] = USB_PD_MUX_DOCK,
};
#endif
@@ -5412,7 +5412,7 @@ static enum ec_status hc_usb_pd_control(struct host_cmd_handler_args *args)
#ifdef CONFIG_USBC_SS_MUX
if (p->mux != USB_PD_CTRL_MUX_NO_CHANGE)
usb_mux_set(p->port, typec_mux_map[p->mux],
- typec_mux_map[p->mux] == TYPEC_MUX_NONE ?
+ typec_mux_map[p->mux] == USB_PD_MUX_NONE ?
USB_SWITCH_DISCONNECT :
USB_SWITCH_CONNECT,
pd_get_polarity(p->port));
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 06c2b82e50..5e7fd25319 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -1191,12 +1191,12 @@ static const enum pd_dual_role_states dual_role_map[USB_PD_CTRL_ROLE_COUNT] = {
};
#ifdef CONFIG_USBC_SS_MUX
-static const enum typec_mux typec_mux_map[USB_PD_CTRL_MUX_COUNT] = {
- [USB_PD_CTRL_MUX_NONE] = TYPEC_MUX_NONE,
- [USB_PD_CTRL_MUX_USB] = TYPEC_MUX_USB,
- [USB_PD_CTRL_MUX_AUTO] = TYPEC_MUX_DP,
- [USB_PD_CTRL_MUX_DP] = TYPEC_MUX_DP,
- [USB_PD_CTRL_MUX_DOCK] = TYPEC_MUX_DOCK,
+static const mux_state_t typec_mux_map[USB_PD_CTRL_MUX_COUNT] = {
+ [USB_PD_CTRL_MUX_NONE] = USB_PD_MUX_NONE,
+ [USB_PD_CTRL_MUX_USB] = USB_PD_MUX_USB_ENABLED,
+ [USB_PD_CTRL_MUX_AUTO] = USB_PD_MUX_DP_ENABLED,
+ [USB_PD_CTRL_MUX_DP] = USB_PD_MUX_DP_ENABLED,
+ [USB_PD_CTRL_MUX_DOCK] = USB_PD_MUX_DOCK,
};
#endif
@@ -1223,7 +1223,7 @@ static enum ec_status hc_usb_pd_control(struct host_cmd_handler_args *args)
#ifdef CONFIG_USBC_SS_MUX
if (p->mux != USB_PD_CTRL_MUX_NO_CHANGE)
usb_mux_set(p->port, typec_mux_map[p->mux],
- typec_mux_map[p->mux] == TYPEC_MUX_NONE ?
+ typec_mux_map[p->mux] == USB_PD_MUX_NONE ?
USB_SWITCH_DISCONNECT :
USB_SWITCH_CONNECT,
pd_get_polarity(p->port));
@@ -1676,7 +1676,7 @@ static void tc_unattached_snk_entry(const int port)
tc[port].next_role_swap = get_time().val + PD_T_DRP_SNK;
if (IS_ENABLED(CONFIG_USBC_SS_MUX))
- usb_mux_set(port, TYPEC_MUX_NONE,
+ usb_mux_set(port, USB_PD_MUX_NONE,
USB_SWITCH_DISCONNECT, tc[port].polarity);
if (IS_ENABLED(CONFIG_USB_PE_SM)) {
@@ -2076,7 +2076,7 @@ static void tc_unoriented_dbg_acc_src_entry(const int port)
/* Enable VBUS */
if (pd_set_power_supply_ready(port)) {
if (IS_ENABLED(CONFIG_USBC_SS_MUX))
- usb_mux_set(port, TYPEC_MUX_NONE,
+ usb_mux_set(port, USB_PD_MUX_NONE,
USB_SWITCH_DISCONNECT, tc[port].polarity);
}
@@ -2558,7 +2558,7 @@ static void tc_attached_src_entry(const int port)
set_vconn(port, 0);
if (IS_ENABLED(CONFIG_USBC_SS_MUX))
- usb_mux_set(port, TYPEC_MUX_NONE,
+ usb_mux_set(port, USB_PD_MUX_NONE,
USB_SWITCH_DISCONNECT, tc[port].polarity);
}
@@ -2592,7 +2592,7 @@ static void tc_attached_src_entry(const int port)
set_vconn(port, 0);
if (IS_ENABLED(CONFIG_USBC_SS_MUX))
- usb_mux_set(port, TYPEC_MUX_NONE,
+ usb_mux_set(port, USB_PD_MUX_NONE,
USB_SWITCH_DISCONNECT, tc[port].polarity);
}
#endif /* CONFIG_USB_PE_SM */
diff --git a/driver/retimer/pi3dpx1207.c b/driver/retimer/pi3dpx1207.c
index de00b5a082..74eb80aac1 100644
--- a/driver/retimer/pi3dpx1207.c
+++ b/driver/retimer/pi3dpx1207.c
@@ -100,28 +100,28 @@ static int pi3dpx1207_set_mux(int port, mux_state_t mux_state)
const int gpio_dp_enable = pi3dpx1207_controls[port].dp_enable_gpio;
/* USB */
- if (mux_state & MUX_USB_ENABLED) {
+ if (mux_state & USB_PD_MUX_USB_ENABLED) {
gpio_or_ioex_set_level(gpio_enable, 1);
/* USB with DP */
- if (mux_state & MUX_DP_ENABLED) {
+ if (mux_state & USB_PD_MUX_DP_ENABLED) {
gpio_or_ioex_set_level(gpio_dp_enable, 1);
- mode_val |= (mux_state & MUX_POLARITY_INVERTED)
+ mode_val |= (mux_state & USB_PD_MUX_POLARITY_INVERTED)
? PI3DPX1207_MODE_CONF_USB_DP_FLIP
: PI3DPX1207_MODE_CONF_USB_DP;
}
/* USB without DP */
else {
gpio_or_ioex_set_level(gpio_dp_enable, 0);
- mode_val |= (mux_state & MUX_POLARITY_INVERTED)
+ mode_val |= (mux_state & USB_PD_MUX_POLARITY_INVERTED)
? PI3DPX1207_MODE_CONF_USB_FLIP
: PI3DPX1207_MODE_CONF_USB;
}
}
/* DP without USB */
- else if (mux_state & MUX_DP_ENABLED) {
+ else if (mux_state & USB_PD_MUX_DP_ENABLED) {
gpio_or_ioex_set_level(gpio_enable, 1);
gpio_or_ioex_set_level(gpio_dp_enable, 1);
- mode_val |= (mux_state & MUX_POLARITY_INVERTED)
+ mode_val |= (mux_state & USB_PD_MUX_POLARITY_INVERTED)
? PI3DPX1207_MODE_CONF_DP_FLIP
: PI3DPX1207_MODE_CONF_DP;
}
diff --git a/driver/retimer/ps8802.c b/driver/retimer/ps8802.c
index 5b9736dba4..cb8b179bc0 100644
--- a/driver/retimer/ps8802.c
+++ b/driver/retimer/ps8802.c
@@ -75,18 +75,18 @@ static int ps8802_set_mux(int port, mux_state_t mux_state)
int rv;
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
- return (mux_state == TYPEC_MUX_NONE) ? EC_SUCCESS
+ return (mux_state == USB_PD_MUX_NONE) ? EC_SUCCESS
: EC_ERROR_NOT_POWERED;
rv = ps8802_i2c_wake(port);
if (rv)
return rv;
- if (mux_state & MUX_USB_ENABLED)
+ if (mux_state & USB_PD_MUX_USB_ENABLED)
val |= PS8802_MODE_USB_ENABLE;
- if (mux_state & MUX_DP_ENABLED)
+ if (mux_state & USB_PD_MUX_DP_ENABLED)
val |= PS8802_MODE_DP_ENABLE;
- if (mux_state & MUX_POLARITY_INVERTED)
+ if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
val |= PS8802_MODE_FLIP_ENABLE;
return ps8802_i2c_write(port, PS8802_REG_MODE, val);
@@ -97,7 +97,7 @@ static int ps8802_get_mux(int port, mux_state_t *mux_state)
int rv;
int val;
- *mux_state = TYPEC_MUX_NONE;
+ *mux_state = USB_PD_MUX_NONE;
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
return EC_ERROR_NOT_POWERED;
@@ -111,11 +111,11 @@ static int ps8802_get_mux(int port, mux_state_t *mux_state)
return rv;
if (val & PS8802_MODE_USB_ENABLE)
- *mux_state |= MUX_USB_ENABLED;
+ *mux_state |= USB_PD_MUX_USB_ENABLED;
if (val & PS8802_MODE_DP_ENABLE)
- *mux_state |= MUX_DP_ENABLED;
+ *mux_state |= USB_PD_MUX_DP_ENABLED;
if (val & PS8802_MODE_FLIP_ENABLE)
- *mux_state |= MUX_POLARITY_INVERTED;
+ *mux_state |= USB_PD_MUX_POLARITY_INVERTED;
return rv;
}
diff --git a/driver/retimer/ps8818.c b/driver/retimer/ps8818.c
index c542152a16..99802b7fcc 100644
--- a/driver/retimer/ps8818.c
+++ b/driver/retimer/ps8818.c
@@ -46,12 +46,12 @@ static int ps8818_set_mux(int port, mux_state_t mux_state)
int val = 0;
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
- return (mux_state == TYPEC_MUX_NONE) ? EC_SUCCESS
+ return (mux_state == USB_PD_MUX_NONE) ? EC_SUCCESS
: EC_ERROR_NOT_POWERED;
- if (mux_state & MUX_USB_ENABLED)
+ if (mux_state & USB_PD_MUX_USB_ENABLED)
val |= PS8818_MODE_USB_ENABLE;
- if (mux_state & MUX_DP_ENABLED)
+ if (mux_state & USB_PD_MUX_DP_ENABLED)
val |= PS8818_MODE_DP_ENABLE;
rv = ps8818_i2c_write(port, PS8818_REG_MODE, val);
@@ -59,7 +59,7 @@ static int ps8818_set_mux(int port, mux_state_t mux_state)
return rv;
val = 0;
- if (mux_state & MUX_POLARITY_INVERTED)
+ if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
val |= PS8818_FLIP_CONFIG;
return ps8818_i2c_write(port, PS8818_REG_FLIP, val);
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c
index e123366a91..a765af5c2e 100644
--- a/driver/tcpm/anx7447.c
+++ b/driver/tcpm/anx7447.c
@@ -370,7 +370,7 @@ static int anx7447_init(int port)
* If this TCPC is not also the MUX then don't initialize to NONE
*/
if (!(usb_muxes[port].flags & USB_MUX_FLAG_NOT_TCPC))
- rv |= anx7447_mux_set(port, TYPEC_MUX_NONE);
+ rv |= anx7447_mux_set(port, USB_PD_MUX_NONE);
#endif /* CONFIG_USB_PD_TCPM_MUX */
return rv;
@@ -504,11 +504,11 @@ static int anx7447_mux_init(int port)
anx7447_hpd_output_en(port);
/*
- * ANX initializes its muxes to (MUX_USB_ENABLED | MUX_DP_ENABLED)
- * when reinitialized, we need to force initialize it to
- * TYPEC_MUX_NONE
+ * ANX initializes its muxes to (USB_PD_MUX_USB_ENABLED |
+ * USB_PD_MUX_DP_ENABLED) when reinitialized, we need to force
+ * initialize it to USB_PD_MUX_NONE
*/
- return anx7447_mux_set(port, TYPEC_MUX_NONE);
+ return anx7447_mux_set(port, USB_PD_MUX_NONE);
}
#ifdef CONFIG_USB_PD_TCPM_ANX7447_AUX_PU_PD
@@ -562,39 +562,39 @@ static int anx7447_mux_set(int port, mux_state_t mux_state)
int sw_sel = 0x00, aux_sw = 0x00;
int rv;
- cc_direction = mux_state & MUX_POLARITY_INVERTED;
- mux_type = mux_state & TYPEC_MUX_DOCK;
+ cc_direction = mux_state & USB_PD_MUX_POLARITY_INVERTED;
+ mux_type = mux_state & USB_PD_MUX_DOCK;
CPRINTS("C%d mux_state = 0x%x, mux_type = 0x%x",
port, mux_state, mux_type);
if (cc_direction == 0) {
/* cc1 connection */
- if (mux_type == TYPEC_MUX_DOCK) {
+ if (mux_type == USB_PD_MUX_DOCK) {
/* ml0-a10/11, ml1-b2/b3, sstx-a2/a3, ssrx-b10/11 */
sw_sel = 0x21;
/* aux+ <-> sbu1, aux- <-> sbu2 */
aux_sw = 0x03;
- } else if (mux_type == TYPEC_MUX_DP) {
+ } else if (mux_type == USB_PD_MUX_DP_ENABLED) {
/* ml0-a10/11, ml1-b2/b3, ml2-a2/a3, ml3-b10/11 */
sw_sel = 0x09;
/* aux+ <-> sbu1, aux- <-> sbu2 */
aux_sw = 0x03;
- } else if (mux_type == TYPEC_MUX_USB) {
+ } else if (mux_type == USB_PD_MUX_USB_ENABLED) {
/* ssrxp<->b11, ssrxn<->b10, sstxp<->a2, sstxn<->a3 */
sw_sel = 0x20;
}
} else {
/* cc2 connection */
- if (mux_type == TYPEC_MUX_DOCK) {
+ if (mux_type == USB_PD_MUX_DOCK) {
/* ml0-b10/11, ml1-a2/b3, sstx-b2/a3, ssrx-a10/11 */
sw_sel = 0x12;
/* aux+ <-> sbu2, aux- <-> sbu1 */
aux_sw = 0x0C;
- } else if (mux_type == TYPEC_MUX_DP) {
+ } else if (mux_type == USB_PD_MUX_DP_ENABLED) {
/* ml0-b10/11, ml1-a2/b3, ml2-b2/a3, ml3-a10/11 */
sw_sel = 0x06;
/* aux+ <-> sbu2, aux- <-> sbu1 */
aux_sw = 0x0C;
- } else if (mux_type == TYPEC_MUX_USB) {
+ } else if (mux_type == USB_PD_MUX_USB_ENABLED) {
/* ssrxp<->a11, ssrxn<->a10, sstxp<->b2, sstxn<->b3 */
sw_sel = 0x10;
}
@@ -618,7 +618,7 @@ static int anx7447_mux_set(int port, mux_state_t mux_state)
* DP and Dock mode: after configured the Mux, change the Mux to
* normal mode, otherwise: keep safe mode.
*/
- if (mux_type != TYPEC_MUX_NONE) {
+ if (mux_type != USB_PD_MUX_NONE) {
anx7447_configure_aux_src(port, 1);
anx7447_mux_safemode(port, 0);
} else
diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c
index 2e37d65a13..c91c39bc58 100644
--- a/driver/tcpm/anx74xx.c
+++ b/driver/tcpm/anx74xx.c
@@ -267,9 +267,9 @@ void anx74xx_tcpc_clear_hpd_status(int port)
static int anx74xx_tcpm_mux_init(int port)
{
/* Nothing to do here, ANX initializes its muxes
- * as (MUX_USB_ENABLED | MUX_DP_ENABLED)
+ * as (USB_PD_MUX_USB_ENABLED | USB_PD_MUX_DP_ENABLED)
*/
- anx[port].mux_state = MUX_USB_ENABLED | MUX_DP_ENABLED;
+ anx[port].mux_state = USB_PD_MUX_USB_ENABLED | USB_PD_MUX_DP_ENABLED;
return EC_SUCCESS;
}
@@ -308,9 +308,9 @@ static int anx74xx_tcpm_mux_exit(int port)
/*
* Safe mode must be entered before any changes are made to the mux
- * settings used to enable ALT_DP mode. This funciton is called either
- * from anx74xx_tcpm_mux_set when TYPEC_MUX_NONE is selected as the new
- * mux state, or when both cc lines are determined to be
+ * settings used to enable ALT_DP mode. This function is called either
+ * from anx74xx_tcpm_mux_set when USB_PD_MUX_NONE is selected as the
+ * new mux state, or when both cc lines are determined to be
* TYPEC_CC_VOLT_OPEN. Therefore, safe mode must be entered and exited
* here so that both entry paths are handled.
*/
@@ -379,7 +379,7 @@ static int anx74xx_tcpm_mux_set(int i2c_addr, mux_state_t mux_state)
int rv;
int port = i2c_addr;
- if (!(mux_state & ~MUX_POLARITY_INVERTED)) {
+ if (!(mux_state & ~USB_PD_MUX_POLARITY_INVERTED)) {
anx[port].mux_state = mux_state;
return anx74xx_tcpm_mux_exit(port);
}
@@ -389,18 +389,18 @@ static int anx74xx_tcpm_mux_set(int i2c_addr, mux_state_t mux_state)
return EC_ERROR_UNKNOWN;
ctrl5 &= 0x0f;
- if (mux_state & MUX_USB_ENABLED) {
+ if (mux_state & USB_PD_MUX_USB_ENABLED) {
/* Connect USB SS switches */
- if (mux_state & MUX_POLARITY_INVERTED) {
+ if (mux_state & USB_PD_MUX_POLARITY_INVERTED) {
ctrl1 = ANX74XX_REG_MUX_SSRX_RX2;
ctrl5 |= ANX74XX_REG_MUX_SSTX_TX2;
} else {
ctrl1 = ANX74XX_REG_MUX_SSRX_RX1;
ctrl5 |= ANX74XX_REG_MUX_SSTX_TX1;
}
- if (mux_state & MUX_DP_ENABLED) {
+ if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* Set pin assignment D */
- if (mux_state & MUX_POLARITY_INVERTED)
+ if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
ctrl1 |= (ANX74XX_REG_MUX_ML0_RX1 |
ANX74XX_REG_MUX_ML1_TX1);
else
@@ -408,9 +408,9 @@ static int anx74xx_tcpm_mux_set(int i2c_addr, mux_state_t mux_state)
ANX74XX_REG_MUX_ML1_TX2);
}
/* Keep ML0/ML1 unconnected if DP is not enabled */
- } else if (mux_state & MUX_DP_ENABLED) {
+ } else if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* Set pin assignment C */
- if (mux_state & MUX_POLARITY_INVERTED) {
+ if (mux_state & USB_PD_MUX_POLARITY_INVERTED) {
ctrl1 = (ANX74XX_REG_MUX_ML0_RX1 |
ANX74XX_REG_MUX_ML1_TX1 |
ANX74XX_REG_MUX_ML3_RX2);
@@ -443,8 +443,9 @@ static int anx74xx_tcpm_mux_set(int i2c_addr, mux_state_t mux_state)
return EC_ERROR_UNKNOWN;
/* Configure DP aux to sbu settings */
- if (anx74xx_mux_aux_to_sbu(port, mux_state & MUX_POLARITY_INVERTED,
- mux_state & MUX_DP_ENABLED))
+ if (anx74xx_mux_aux_to_sbu(port,
+ mux_state & USB_PD_MUX_POLARITY_INVERTED,
+ mux_state & USB_PD_MUX_DP_ENABLED))
return EC_ERROR_UNKNOWN;
/* Exit safe mode */
@@ -785,9 +786,9 @@ static int anx74xx_tcpm_set_polarity(int port, enum tcpc_cc_polarity polarity)
/* Update mux polarity */
#ifdef CONFIG_USB_PD_TCPM_MUX
- mux_state = anx[port].mux_state & ~MUX_POLARITY_INVERTED;
+ mux_state = anx[port].mux_state & ~USB_PD_MUX_POLARITY_INVERTED;
if (polarity)
- mux_state |= MUX_POLARITY_INVERTED;
+ mux_state |= USB_PD_MUX_POLARITY_INVERTED;
anx74xx_tcpm_mux_set(port, mux_state);
#endif
return rv;
diff --git a/driver/tcpm/anx7688.c b/driver/tcpm/anx7688.c
index fe1d2498d4..bc3d1b8354 100644
--- a/driver/tcpm/anx7688.c
+++ b/driver/tcpm/anx7688.c
@@ -154,9 +154,9 @@ static int anx7688_mux_set(int port, mux_state_t mux_state)
return rv;
reg &= ~TCPC_REG_CONFIG_STD_OUTPUT_MUX_MASK;
- if (mux_state & MUX_USB_ENABLED)
+ if (mux_state & USB_PD_MUX_USB_ENABLED)
reg |= TCPC_REG_CONFIG_STD_OUTPUT_MUX_USB;
- if (mux_state & MUX_DP_ENABLED)
+ if (mux_state & USB_PD_MUX_DP_ENABLED)
reg |= TCPC_REG_CONFIG_STD_OUTPUT_MUX_DP;
/* ANX7688 needs to set bit0 */
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index 64694617c1..c369d0c48b 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -1170,11 +1170,11 @@ int tcpci_tcpm_mux_set(int port, mux_state_t mux_state)
reg &= ~(TCPC_REG_CONFIG_STD_OUTPUT_MUX_MASK |
TCPC_REG_CONFIG_STD_OUTPUT_CONNECTOR_FLIPPED);
- if (mux_state & MUX_USB_ENABLED)
+ if (mux_state & USB_PD_MUX_USB_ENABLED)
reg |= TCPC_REG_CONFIG_STD_OUTPUT_MUX_USB;
- if (mux_state & MUX_DP_ENABLED)
+ if (mux_state & USB_PD_MUX_DP_ENABLED)
reg |= TCPC_REG_CONFIG_STD_OUTPUT_MUX_DP;
- if (mux_state & MUX_POLARITY_INVERTED)
+ if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
reg |= TCPC_REG_CONFIG_STD_OUTPUT_CONNECTOR_FLIPPED;
/* Parameter is port only */
@@ -1196,11 +1196,11 @@ int tcpci_tcpm_mux_get(int port, mux_state_t *mux_state)
return rv;
if (reg & TCPC_REG_CONFIG_STD_OUTPUT_MUX_USB)
- *mux_state |= MUX_USB_ENABLED;
+ *mux_state |= USB_PD_MUX_USB_ENABLED;
if (reg & TCPC_REG_CONFIG_STD_OUTPUT_MUX_DP)
- *mux_state |= MUX_DP_ENABLED;
+ *mux_state |= USB_PD_MUX_DP_ENABLED;
if (reg & TCPC_REG_CONFIG_STD_OUTPUT_CONNECTOR_FLIPPED)
- *mux_state |= MUX_POLARITY_INVERTED;
+ *mux_state |= USB_PD_MUX_POLARITY_INVERTED;
return EC_SUCCESS;
}
diff --git a/driver/usb_mux/amd_fp5.c b/driver/usb_mux/amd_fp5.c
index a2c9ad68fb..3258552b49 100644
--- a/driver/usb_mux/amd_fp5.c
+++ b/driver/usb_mux/amd_fp5.c
@@ -48,18 +48,19 @@ static int amd_fp5_set_mux(int port, mux_state_t mux_state)
* it because a powered down MUX is off.
*/
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
- return (mux_state == TYPEC_MUX_NONE)
+ return (mux_state == USB_PD_MUX_NONE)
? EC_SUCCESS
: EC_ERROR_NOT_POWERED;
- if ((mux_state & MUX_USB_ENABLED) && (mux_state & MUX_DP_ENABLED))
- val = (mux_state & MUX_POLARITY_INVERTED)
+ if ((mux_state & USB_PD_MUX_USB_ENABLED) &&
+ (mux_state & USB_PD_MUX_DP_ENABLED))
+ val = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
? AMD_FP5_MUX_DOCK_INVERTED : AMD_FP5_MUX_DOCK;
- else if (mux_state & MUX_USB_ENABLED)
- val = (mux_state & MUX_POLARITY_INVERTED)
+ else if (mux_state & USB_PD_MUX_USB_ENABLED)
+ val = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
? AMD_FP5_MUX_USB_INVERTED : AMD_FP5_MUX_USB;
- else if (mux_state & MUX_DP_ENABLED)
- val = (mux_state & MUX_POLARITY_INVERTED)
+ else if (mux_state & USB_PD_MUX_DP_ENABLED)
+ val = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
? AMD_FP5_MUX_DP_INVERTED : AMD_FP5_MUX_DP;
return amd_fp5_mux_write(port, val);
@@ -85,27 +86,29 @@ static int amd_fp5_get_mux(int port, mux_state_t *mux_state)
switch (val) {
case AMD_FP5_MUX_USB:
- *mux_state = MUX_USB_ENABLED;
+ *mux_state = USB_PD_MUX_USB_ENABLED;
break;
case AMD_FP5_MUX_USB_INVERTED:
- *mux_state = MUX_USB_ENABLED | MUX_POLARITY_INVERTED;
+ *mux_state = USB_PD_MUX_USB_ENABLED |
+ USB_PD_MUX_POLARITY_INVERTED;
break;
case AMD_FP5_MUX_DOCK:
- *mux_state = MUX_USB_ENABLED | MUX_DP_ENABLED;
+ *mux_state = USB_PD_MUX_USB_ENABLED | USB_PD_MUX_DP_ENABLED;
break;
case AMD_FP5_MUX_DOCK_INVERTED:
- *mux_state = MUX_USB_ENABLED | MUX_DP_ENABLED
- | MUX_POLARITY_INVERTED;
+ *mux_state = USB_PD_MUX_USB_ENABLED | USB_PD_MUX_DP_ENABLED
+ | USB_PD_MUX_POLARITY_INVERTED;
break;
case AMD_FP5_MUX_DP:
- *mux_state = MUX_DP_ENABLED;
+ *mux_state = USB_PD_MUX_DP_ENABLED;
break;
case AMD_FP5_MUX_DP_INVERTED:
- *mux_state = MUX_DP_ENABLED | MUX_POLARITY_INVERTED;
+ *mux_state = USB_PD_MUX_DP_ENABLED |
+ USB_PD_MUX_POLARITY_INVERTED;
break;
case AMD_FP5_MUX_SAFE:
default:
- *mux_state = TYPEC_MUX_NONE;
+ *mux_state = USB_PD_MUX_NONE;
break;
}
diff --git a/driver/usb_mux/anx7440.c b/driver/usb_mux/anx7440.c
index ec02b8f90b..1c9633c536 100644
--- a/driver/usb_mux/anx7440.c
+++ b/driver/usb_mux/anx7440.c
@@ -68,11 +68,11 @@ static int anx7440_set_mux(int port, mux_state_t mux_state)
return res;
reg &= ~ANX7440_CHIP_CTRL_SW_OP_MODE_CLEAR;
- if (mux_state & MUX_USB_ENABLED)
+ if (mux_state & USB_PD_MUX_USB_ENABLED)
reg |= ANX7440_CHIP_CTRL_SW_OP_MODE_USB;
- if (mux_state & MUX_DP_ENABLED)
+ if (mux_state & USB_PD_MUX_DP_ENABLED)
reg |= ANX7440_CHIP_CTRL_SW_OP_MODE_DP;
- if (mux_state & MUX_POLARITY_INVERTED)
+ if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
reg |= ANX7440_CHIP_CTRL_SW_FLIP;
return anx7440_write(port, ANX7440_REG_CHIP_CTRL, reg);
@@ -89,11 +89,11 @@ static int anx7440_get_mux(int port, mux_state_t *mux_state)
return res;
if (reg & ANX7440_CHIP_CTRL_OP_MODE_FINAL_USB)
- *mux_state |= MUX_USB_ENABLED;
+ *mux_state |= USB_PD_MUX_USB_ENABLED;
if (reg & ANX7440_CHIP_CTRL_OP_MODE_FINAL_DP)
- *mux_state |= MUX_DP_ENABLED;
+ *mux_state |= USB_PD_MUX_DP_ENABLED;
if (reg & ANX7440_CHIP_CTRL_FINAL_FLIP)
- *mux_state |= MUX_POLARITY_INVERTED;
+ *mux_state |= USB_PD_MUX_POLARITY_INVERTED;
return EC_SUCCESS;
}
diff --git a/driver/usb_mux/it5205.c b/driver/usb_mux/it5205.c
index 9a6f71dade..e7911b80e3 100644
--- a/driver/usb_mux/it5205.c
+++ b/driver/usb_mux/it5205.c
@@ -12,7 +12,7 @@
#include "usb_mux.h"
#include "util.h"
-#define MUX_STATE_DP_USB_MASK (MUX_USB_ENABLED | MUX_DP_ENABLED)
+#define MUX_STATE_DP_USB_MASK (USB_PD_MUX_USB_ENABLED | USB_PD_MUX_DP_ENABLED)
static int it5205_read(int port, uint8_t reg, int *val)
{
@@ -63,10 +63,10 @@ static int it5205_set_mux(int port, mux_state_t mux_state)
uint8_t reg;
switch (mux_state & MUX_STATE_DP_USB_MASK) {
- case MUX_USB_ENABLED:
+ case USB_PD_MUX_USB_ENABLED:
reg = IT5205_USB;
break;
- case MUX_DP_ENABLED:
+ case USB_PD_MUX_DP_ENABLED:
reg = IT5205_DP;
break;
case MUX_STATE_DP_USB_MASK:
@@ -77,7 +77,7 @@ static int it5205_set_mux(int port, mux_state_t mux_state)
break;
}
- if (mux_state & MUX_POLARITY_INVERTED)
+ if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
reg |= IT5205_POLARITY_INVERTED;
return it5205_write(port, IT5205_REG_MUXCR, reg);
@@ -94,10 +94,10 @@ static int it5205_get_mux(int port, mux_state_t *mux_state)
switch (reg & IT5205_DP_USB_CTRL_MASK) {
case IT5205_USB:
- *mux_state = MUX_USB_ENABLED;
+ *mux_state = USB_PD_MUX_USB_ENABLED;
break;
case IT5205_DP:
- *mux_state = MUX_DP_ENABLED;
+ *mux_state = USB_PD_MUX_DP_ENABLED;
break;
case IT5205_DP_USB:
*mux_state = MUX_STATE_DP_USB_MASK;
@@ -108,7 +108,7 @@ static int it5205_get_mux(int port, mux_state_t *mux_state)
}
if (reg & IT5205_POLARITY_INVERTED)
- *mux_state |= MUX_POLARITY_INVERTED;
+ *mux_state |= USB_PD_MUX_POLARITY_INVERTED;
return EC_SUCCESS;
}
diff --git a/driver/usb_mux/pi3usb3x532.c b/driver/usb_mux/pi3usb3x532.c
index 2d69f4c647..bf6d1f5a01 100644
--- a/driver/usb_mux/pi3usb3x532.c
+++ b/driver/usb_mux/pi3usb3x532.c
@@ -71,11 +71,11 @@ static int pi3usb3x532_set_mux(int port, mux_state_t mux_state)
{
uint8_t reg = 0;
- if (mux_state & MUX_USB_ENABLED)
+ if (mux_state & USB_PD_MUX_USB_ENABLED)
reg |= PI3USB3X532_MODE_USB;
- if (mux_state & MUX_DP_ENABLED)
+ if (mux_state & USB_PD_MUX_DP_ENABLED)
reg |= PI3USB3X532_MODE_DP;
- if (mux_state & MUX_POLARITY_INVERTED)
+ if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
reg |= PI3USB3X532_BIT_SWAP;
return pi3usb3x532_write(port, PI3USB3X532_REG_CONTROL,
@@ -94,11 +94,11 @@ static int pi3usb3x532_get_mux(int port, mux_state_t *mux_state)
return res;
if (reg & PI3USB3X532_MODE_USB)
- *mux_state |= MUX_USB_ENABLED;
+ *mux_state |= USB_PD_MUX_USB_ENABLED;
if (reg & PI3USB3X532_MODE_DP)
- *mux_state |= MUX_DP_ENABLED;
+ *mux_state |= USB_PD_MUX_DP_ENABLED;
if (reg & PI3USB3X532_BIT_SWAP)
- *mux_state |= MUX_POLARITY_INVERTED;
+ *mux_state |= USB_PD_MUX_POLARITY_INVERTED;
return EC_SUCCESS;
}
diff --git a/driver/usb_mux/ps874x.c b/driver/usb_mux/ps874x.c
index db13180c1c..08f526d28a 100644
--- a/driver/usb_mux/ps874x.c
+++ b/driver/usb_mux/ps874x.c
@@ -78,11 +78,11 @@ static int ps874x_set_mux(int port, mux_state_t mux_state)
{
uint8_t reg = 0;
- if (mux_state & MUX_USB_ENABLED)
+ if (mux_state & USB_PD_MUX_USB_ENABLED)
reg |= PS874X_MODE_USB_ENABLED;
- if (mux_state & MUX_DP_ENABLED)
+ if (mux_state & USB_PD_MUX_DP_ENABLED)
reg |= PS874X_MODE_DP_ENABLED;
- if (mux_state & MUX_POLARITY_INVERTED)
+ if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
reg |= PS874X_MODE_POLARITY_INVERTED;
return ps874x_write(port, PS874X_REG_MODE, reg);
@@ -100,11 +100,11 @@ static int ps874x_get_mux(int port, mux_state_t *mux_state)
*mux_state = 0;
if (reg & PS874X_STATUS_USB_ENABLED)
- *mux_state |= MUX_USB_ENABLED;
+ *mux_state |= USB_PD_MUX_USB_ENABLED;
if (reg & PS874X_STATUS_DP_ENABLED)
- *mux_state |= MUX_DP_ENABLED;
+ *mux_state |= USB_PD_MUX_DP_ENABLED;
if (reg & PS874X_STATUS_POLARITY_INVERTED)
- *mux_state |= MUX_POLARITY_INVERTED;
+ *mux_state |= USB_PD_MUX_POLARITY_INVERTED;
return EC_SUCCESS;
}
diff --git a/driver/usb_mux/usb_mux.c b/driver/usb_mux/usb_mux.c
index e7849738bb..f38f153000 100644
--- a/driver/usb_mux/usb_mux.c
+++ b/driver/usb_mux/usb_mux.c
@@ -151,12 +151,13 @@ void usb_mux_init(int port)
* TODO(crbug.com/505480): Setting muxes often involves I2C transcations,
* which can block. Consider implementing an asynchronous task.
*/
-void usb_mux_set(int port, enum typec_mux mux_mode,
+void usb_mux_set(int port, mux_state_t mux_mode,
enum usb_switch usb_mode, int polarity)
{
mux_state_t mux_state;
const int should_enter_low_power_mode =
- mux_mode == TYPEC_MUX_NONE && usb_mode == USB_SWITCH_DISCONNECT;
+ (mux_mode == USB_PD_MUX_NONE &&
+ usb_mode == USB_SWITCH_DISCONNECT);
/* Configure USB2.0 */
if (IS_ENABLED(CONFIG_USB_CHARGER))
@@ -173,8 +174,8 @@ void usb_mux_set(int port, enum typec_mux mux_mode,
exit_low_power_mode(port);
/* Configure superspeed lanes */
- mux_state = ((mux_mode != TYPEC_MUX_NONE) && polarity)
- ? mux_mode | MUX_POLARITY_INVERTED
+ mux_state = ((mux_mode != USB_PD_MUX_NONE) && polarity)
+ ? mux_mode | USB_PD_MUX_POLARITY_INVERTED
: mux_mode;
if (configure_mux(port, USB_MUX_SET_MODE, &mux_state))
@@ -214,10 +215,10 @@ void usb_mux_flip(int port)
if (configure_mux(port, USB_MUX_GET_MODE, &mux_state))
return;
- if (mux_state & MUX_POLARITY_INVERTED)
- mux_state &= ~MUX_POLARITY_INVERTED;
+ if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
+ mux_state &= ~USB_PD_MUX_POLARITY_INVERTED;
else
- mux_state |= MUX_POLARITY_INVERTED;
+ mux_state |= USB_PD_MUX_POLARITY_INVERTED;
configure_mux(port, USB_MUX_SET_MODE, &mux_state);
}
@@ -243,7 +244,7 @@ static int command_typec(int argc, char **argv)
const char * const mux_name[] = {"none", "usb", "dp", "dock"};
char *e;
int port;
- enum typec_mux mux = TYPEC_MUX_NONE;
+ mux_state_t mux = USB_PD_MUX_NONE;
int i;
if (argc == 2 && !strcasecmp(argv[1], "debug")) {
@@ -279,7 +280,7 @@ static int command_typec(int argc, char **argv)
for (i = 0; i < ARRAY_SIZE(mux_name); i++)
if (!strcasecmp(argv[2], mux_name[i]))
mux = i;
- usb_mux_set(port, mux, mux == TYPEC_MUX_NONE ?
+ usb_mux_set(port, mux, mux == USB_PD_MUX_NONE ?
USB_SWITCH_DISCONNECT :
USB_SWITCH_CONNECT,
pd_get_polarity(port));
diff --git a/include/ec_commands.h b/include/ec_commands.h
index cc37caaa99..4112ae33f9 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -5524,6 +5524,9 @@ struct ec_params_usb_pd_mux_info {
#define USB_PD_MUX_SAFE_MODE BIT(5) /* DP is in safe mode */
#define USB_PD_MUX_TBT_COMPAT_ENABLED BIT(6) /* TBT compat enabled */
+/* USB-C Dock connected */
+#define USB_PD_MUX_DOCK (USB_PD_MUX_USB_ENABLED | USB_PD_MUX_DP_ENABLED)
+
struct ec_response_usb_pd_mux_info {
uint8_t flags; /* USB_PD_MUX_*-encoded USB mux state */
} __ec_align1;
diff --git a/include/usb_mux.h b/include/usb_mux.h
index 1fe44fd10c..152b240fa0 100644
--- a/include/usb_mux.h
+++ b/include/usb_mux.h
@@ -17,7 +17,7 @@
* USB-C mux state
*
* A bitwise combination of the USB_PD_MUX_* flags.
- * The bottom 2 bits also correspond to the typec_mux enum type.
+ * Note: this is 8 bits right now to make ec_response_usb_pd_mux_info size.
*/
typedef uint8_t mux_state_t;
@@ -29,28 +29,6 @@ typedef uint8_t mux_state_t;
#define MUX_PORT(port) (usb_muxes[port].port_addr >> 8)
#define MUX_ADDR(port) (usb_muxes[port].port_addr & 0xFF)
-/*
- * Mux state attributes
- * TODO (b:145796172): Directly use USB_PD_MUX_* everywhere,
- * remove the below defines and enum typec_mux.
- */
-#define MUX_USB_ENABLED USB_PD_MUX_USB_ENABLED
-#define MUX_DP_ENABLED USB_PD_MUX_DP_ENABLED
-#define MUX_POLARITY_INVERTED USB_PD_MUX_POLARITY_INVERTED
-#define MUX_SAFE_MODE USB_PD_MUX_SAFE_MODE
-
-/* Mux modes, decoded to attributes */
-enum typec_mux {
- TYPEC_MUX_NONE = 0, /* Open switch */
- TYPEC_MUX_USB = MUX_USB_ENABLED, /* USB only */
- TYPEC_MUX_DP = MUX_DP_ENABLED, /* DP only */
- TYPEC_MUX_DOCK = MUX_USB_ENABLED | /* Both USB and DP */
- MUX_DP_ENABLED,
- TYPEC_MUX_SAFE = MUX_SAFE_MODE, /* Safe mode */
- /* Thunderbolt-compatible only */
- TYPEC_MUX_TBT_COMPAT = USB_PD_MUX_TBT_COMPAT_ENABLED,
-};
-
/* Mux driver function pointers */
struct usb_mux_driver {
/**
@@ -255,7 +233,7 @@ void usb_mux_init(int port);
* @param usb_config usb2.0 selected function.
* @param polarity plug polarity (0=CC1, 1=CC2).
*/
-void usb_mux_set(int port, enum typec_mux mux_mode,
+void usb_mux_set(int port, mux_state_t mux_mode,
enum usb_switch usb_config, int polarity);
/**
diff --git a/test/fake_usbc.c b/test/fake_usbc.c
index 6953d07190..2ee1791717 100644
--- a/test/fake_usbc.c
+++ b/test/fake_usbc.c
@@ -141,3 +141,10 @@ void pd_dev_get_rw_hash(int port, uint16_t *dev_id, uint8_t *rw_hash,
uint32_t *current_image)
{
}
+
+#ifndef CONFIG_USB_TYPEC_DRP_ACC_TRYSRC
+bool pd_is_disconnected(int port)
+{
+ return false;
+}
+#endif /* CONFIG_USB_TYPEC_DRP_ACC_TRYSRC */
diff --git a/test/usb_typec_drp_acc_trysrc.c b/test/usb_typec_drp_acc_trysrc.c
index 205ef6ad3a..c7a0790d1e 100644
--- a/test/usb_typec_drp_acc_trysrc.c
+++ b/test/usb_typec_drp_acc_trysrc.c
@@ -46,7 +46,7 @@ __maybe_unused static int test_mux_con_dis_as_src(void)
task_wait_event(SECOND);
/* We are in Attached.SRC now */
- TEST_EQ(mock_usb_mux.state, TYPEC_MUX_USB, "%d");
+ TEST_EQ(mock_usb_mux.state, USB_PD_MUX_USB_ENABLED, "%d");
TEST_EQ(mock_usb_mux.num_set_calls, 1, "%d");
mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN;
@@ -57,7 +57,7 @@ __maybe_unused static int test_mux_con_dis_as_src(void)
task_wait_event(10 * SECOND);
/* We are in Unattached.SNK. The mux should have detached */
- TEST_EQ(mock_usb_mux.state, TYPEC_MUX_NONE, "%d");
+ TEST_EQ(mock_usb_mux.state, USB_PD_MUX_NONE, "%d");
TEST_EQ(mock_usb_mux.num_set_calls, 2, "%d");
return EC_SUCCESS;
@@ -75,7 +75,7 @@ __maybe_unused static int test_mux_con_dis_as_snk(void)
task_wait_event(5 * SECOND);
/* We are in Attached.SNK now */
- TEST_EQ(mock_usb_mux.state, TYPEC_MUX_USB, "%d");
+ TEST_EQ(mock_usb_mux.state, USB_PD_MUX_USB_ENABLED, "%d");
TEST_EQ(mock_usb_mux.num_set_calls, 1, "%d");
mock_tcpc.cc1 = TYPEC_CC_VOLT_OPEN;
@@ -87,7 +87,7 @@ __maybe_unused static int test_mux_con_dis_as_snk(void)
task_wait_event(10 * SECOND);
/* We are in Unattached.SNK. The mux should have detached */
- TEST_EQ(mock_usb_mux.state, TYPEC_MUX_NONE, "%d");
+ TEST_EQ(mock_usb_mux.state, USB_PD_MUX_NONE, "%d");
TEST_EQ(mock_usb_mux.num_set_calls, 2, "%d");
return EC_SUCCESS;