Skip to content

Commit 40bf8f1

Browse files
Rajat Khandelwalgregkh
authored andcommitted
usb: typec: mux: Enter safe mode only when pins need to be reconfigured
There is no point to enter safe mode during DP/TBT configuration if the DP/TBT was already configured in mux. This is because safe mode is only applicable when there is a need to reconfigure the pins in order to avoid damage within/to port partner. In some chrome systems, IOM/mux is already configured before OS comes up. Thus, when driver is probed, it blindly enters safe mode due to PD negotiations but only after gfx driver lowers dp_phy_ownership, will the IOM complete safe mode and send an ack to PMC. Since, that never happens, we see IPC timeout. Hence, allow safe mode only when pin reconfiguration is not required, which makes sense. Fixes: 43d596e ("usb: typec: intel_pmc_mux: Check the port status before connect") Cc: stable <[email protected]> Signed-off-by: Rajat Khandelwal <[email protected]> Signed-off-by: Lee Shawn C <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 341fd15 commit 40bf8f1

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

drivers/usb/typec/mux/intel_pmc_mux.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,24 @@ pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)
369369
return pmc_usb_command(port, (void *)&req, sizeof(req));
370370
}
371371

372-
static int pmc_usb_mux_safe_state(struct pmc_usb_port *port)
372+
static int pmc_usb_mux_safe_state(struct pmc_usb_port *port,
373+
struct typec_mux_state *state)
373374
{
374375
u8 msg;
375376

376377
if (IOM_PORT_ACTIVITY_IS(port->iom_status, SAFE_MODE))
377378
return 0;
378379

380+
if ((IOM_PORT_ACTIVITY_IS(port->iom_status, DP) ||
381+
IOM_PORT_ACTIVITY_IS(port->iom_status, DP_MFD)) &&
382+
state->alt && state->alt->svid == USB_TYPEC_DP_SID)
383+
return 0;
384+
385+
if ((IOM_PORT_ACTIVITY_IS(port->iom_status, TBT) ||
386+
IOM_PORT_ACTIVITY_IS(port->iom_status, ALT_MODE_TBT_USB)) &&
387+
state->alt && state->alt->svid == USB_TYPEC_TBT_SID)
388+
return 0;
389+
379390
msg = PMC_USB_SAFE_MODE;
380391
msg |= port->usb3_port << PMC_USB_MSG_USB3_PORT_SHIFT;
381392

@@ -443,7 +454,7 @@ pmc_usb_mux_set(struct typec_mux_dev *mux, struct typec_mux_state *state)
443454
return 0;
444455

445456
if (state->mode == TYPEC_STATE_SAFE)
446-
return pmc_usb_mux_safe_state(port);
457+
return pmc_usb_mux_safe_state(port, state);
447458
if (state->mode == TYPEC_STATE_USB)
448459
return pmc_usb_connect(port, port->role);
449460

0 commit comments

Comments
 (0)