usb: mdm_bridge: Fix autosuspend for tethered connections
As ctrl_bridge_write() calls usb_autopm_get asynchronously, ensure that
the HSIC MDM device is out of suspend before attempting to write
control packets. Do this by deferring the URBs if the device is still
suspended and submit them in the resume callback.
In ctrl_bridge_start_read(), before submitting the interrupt URB the
device needs to be active. However, since this function may also be
called from the resume callback, it cannot call usb_autopm_get_interface
synchronously, so move the call to ctrl_bridge_open().
Eliminate ctrl_bridge_stop_read() by anchoring the interrupt and control
URBs along with the other write URBs. This simplifies when we need to
cancel them all en masse. Having them anchored also lets us know they
are in flight to avoid resubmitting them.
Finally, fix the suspend/resume callback functions to not rely on the
bridge being open and instead use the data_bridge's ID field to figure
out which ctrl_bridge device to call. This fixes inconsistent suspend
behavior when the bridge is closed, i.e. when the host tethered USB cable
is disconnected.
Change-Id: I9372f9a880639451b8b687dbb630172d7f5ef2d8
Signed-off-by: Jack Pham <jackp@codeaurora.org>
2 files changed