]> www.infradead.org Git - users/dwmw2/linux.git/commit
USB: serial: ftdi_sio: fix GPIO not working in autosuspend
authorKaroly Pados <pados@pados.hu>
Mon, 14 Jan 2019 12:30:03 +0000 (13:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Jan 2019 07:15:35 +0000 (08:15 +0100)
commitd99be59504760692913c40bd7c7e36117e5020b1
tree98ee8ee7c3afc30c2ade68dcbd88c2bffbfada38
parent8f720afc41dcbc606e37e4d663d318ed86788e95
USB: serial: ftdi_sio: fix GPIO not working in autosuspend

commit a8eda9fa1bd84065b75bfa81bf675a7af9055478 upstream.

There is a bug in the current GPIO code for ftdi_sio: it failed to take USB
autosuspend into account. If the device is in autosuspend, calls to
usb_control_msg() fail with -EHOSTUNREACH. Because the standard value for
autosuspend timeout is usually 2-5 seconds, this made it almost impossible
to use the GPIOs on machines that have USB autosuspend enabled. This patch
fixes the issue by acquiring a PM lock on the device for the duration of
the USB transfers. Tested on an FT231X device.

Signed-off-by: Karoly Pados <pados@pados.hu>
[ johan: simplify code somewhat ]
Fixes: ba93cc7da896 ("USB: serial: ftdi_sio: implement GPIO support for FT-X devices")
Cc: stable <stable@vger.kernel.org> # 4.20
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/ftdi_sio.c