]> git.baikalelectronics.ru Git - kernel.git/commit
usb: typec: intel_pmc_mux: Avoid connect request on disconnect
authorPrashant Malani <pmalani@chromium.org>
Thu, 9 Jul 2020 00:24:41 +0000 (17:24 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Jul 2020 11:38:21 +0000 (13:38 +0200)
commit7f2f85f46fcc71752d9229cefec767109318e927
tree0bf1a9e3bdda212a4b80b11667b3fd8526d4a5d4
parentdf20720c46fac232bdffc15a1fc13741163c2a38
usb: typec: intel_pmc_mux: Avoid connect request on disconnect

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: ccfebf9cd7c7 ("usb: typec: intel_pmc_mux: Add support for USB4")
Signed-off-by: Prashant Malani <pmalani@chromium.org>
Link: https://lore.kernel.org/r/20200709002441.1309189-1-pmalani@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/mux/intel_pmc_mux.c