* [PATCH] usb: typec: intel_pmc_mux: Avoid connect request on disconnect
@ 2020-07-09 0:24 Prashant Malani
0 siblings, 0 replies; only message in thread
From: Prashant Malani @ 2020-07-09 0:24 UTC (permalink / raw)
To: gregkh
Cc: linux-kernel, Prashant Malani, Benson Leung, Heikki Krogerus,
Rajmohan Mani, open list:USB TYPEC INTEL PMC MUX DRIVER
When pmc_usb_mux_set() is invoked when a device is disconnected, a valid
scenario is for state->alt == NULL and state->mode == TYPEC_STATE_USB.
In such cases, if a pmc_usb_disconnect() has already been issued (from
either pmc_usb_set_orientation() when orientation ==
TYPEC_ORIENTATION_NONE, or pmc_usb_set_role() when role ==
USB_ROLE_NONE), a pmc_usb_connect() will be issued despite no peripheral
being present.
This confuses the PMC and leads to all subsequent PMC IPC requests
returning errors due to timeout.
To prevent this, return early if the port orientation or role is already
set to none.
Cc: Benson Leung <bleung@chromium.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Rajmohan Mani <rajmohan.mani@intel.com>
Fixes: f3c1c41ebc67 ("usb: typec: intel_pmc_mux: Add support for USB4")
Signed-off-by: Prashant Malani <pmalani@chromium.org>
---
drivers/usb/typec/mux/intel_pmc_mux.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
index 2aba07c7b221..e4021e13af40 100644
--- a/drivers/usb/typec/mux/intel_pmc_mux.c
+++ b/drivers/usb/typec/mux/intel_pmc_mux.c
@@ -310,6 +310,9 @@ pmc_usb_mux_set(struct typec_mux *mux, struct typec_mux_state *state)
{
struct pmc_usb_port *port = typec_mux_get_drvdata(mux);
+ if (port->orientation == TYPEC_ORIENTATION_NONE || port->role == USB_ROLE_NONE)
+ return 0;
+
if (state->mode == TYPEC_STATE_SAFE)
return pmc_usb_mux_safe_state(port);
if (state->mode == TYPEC_STATE_USB)
--
2.27.0.383.g050319c2ae-goog
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-07-09 0:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 0:24 [PATCH] usb: typec: intel_pmc_mux: Avoid connect request on disconnect Prashant Malani
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.