Skip to content

Commit b4b06c9

Browse files
RajmohanManibleungatchromium
authored andcommitted
platform/chrome: cros_ec_types: Support disconnect events without partners
There are certain scenarios, where a disconnect event might occur on a Type-C port with no port partners. This is required to enable communication to Burnside Bridge USB4 retimers. Signed-off-by: Rajmohan Mani <rajmohan.mani@intel.com> Reviewed-by: Prashant Malani <pmalani@chromium.org> Link: https://lore.kernel.org/r/20210205195113.20277-3-rajmohan.mani@intel.com Signed-off-by: Benson Leung <bleung@chromium.org>
1 parent 38f5606 commit b4b06c9

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

drivers/platform/chrome/cros_ec_typec.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,20 +203,26 @@ static void cros_typec_unregister_altmodes(struct cros_typec_data *typec, int po
203203
}
204204
}
205205

206-
static void cros_typec_remove_partner(struct cros_typec_data *typec,
207-
int port_num)
206+
static int cros_typec_usb_disconnect_state(struct cros_typec_port *port)
208207
{
209-
struct cros_typec_port *port = typec->ports[port_num];
210-
211-
cros_typec_unregister_altmodes(typec, port_num, true);
212-
213208
port->state.alt = NULL;
214209
port->state.mode = TYPEC_STATE_USB;
215210
port->state.data = NULL;
216211

217212
usb_role_switch_set_role(port->role_sw, USB_ROLE_NONE);
218213
typec_switch_set(port->ori_sw, TYPEC_ORIENTATION_NONE);
219-
typec_mux_set(port->mux, &port->state);
214+
215+
return typec_mux_set(port->mux, &port->state);
216+
}
217+
218+
static void cros_typec_remove_partner(struct cros_typec_data *typec,
219+
int port_num)
220+
{
221+
struct cros_typec_port *port = typec->ports[port_num];
222+
223+
cros_typec_unregister_altmodes(typec, port_num, true);
224+
225+
cros_typec_usb_disconnect_state(port);
220226

221227
typec_unregister_partner(port->partner);
222228
port->partner = NULL;
@@ -536,6 +542,11 @@ static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num,
536542
enum typec_orientation orientation;
537543
int ret;
538544

545+
if (mux_flags == USB_PD_MUX_NONE) {
546+
ret = cros_typec_usb_disconnect_state(port);
547+
goto mux_ack;
548+
}
549+
539550
if (mux_flags & USB_PD_MUX_POLARITY_INVERTED)
540551
orientation = TYPEC_ORIENTATION_REVERSE;
541552
else
@@ -569,6 +580,7 @@ static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num,
569580
mux_flags);
570581
}
571582

583+
mux_ack:
572584
if (!typec->needs_mux_ack)
573585
return ret;
574586

0 commit comments

Comments
 (0)