linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Johan Hovold <johan@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] USB: serial: ftdi_sio: Fix serial port stall after resume
Date: Tue, 29 Sep 2020 21:33:27 +0200	[thread overview]
Message-ID: <20200929193327.GA13987@ls3530.fritz.box> (raw)

With a 4-port serial USB HUB with FT232BM chips the serial ports stop
working after a software suspend/resume cycle.
Rewriting the latency timer during the resume phase fixes it.

Cc: stable@vger.kernel.org
Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 9823bb424abd..8ee6cf6215c1 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1092,6 +1092,7 @@ static u32 ftdi_232bm_baud_base_to_divisor(int baud, int base);
 static u32 ftdi_232bm_baud_to_divisor(int baud);
 static u32 ftdi_2232h_baud_base_to_divisor(int baud, int base);
 static u32 ftdi_2232h_baud_to_divisor(int baud);
+static int ftdi_reset_resume(struct usb_serial *serial);

 static struct usb_serial_driver ftdi_sio_device = {
 	.driver = {
@@ -1122,6 +1123,7 @@ static struct usb_serial_driver ftdi_sio_device = {
 	.set_termios =		ftdi_set_termios,
 	.break_ctl =		ftdi_break_ctl,
 	.tx_empty =		ftdi_tx_empty,
+	.reset_resume =		ftdi_reset_resume,
 };

 static struct usb_serial_driver * const serial_drivers[] = {
@@ -2379,6 +2381,16 @@ static int ftdi_stmclite_probe(struct usb_serial *serial)
 	return 0;
 }

+static int ftdi_reset_resume(struct usb_serial *serial)
+{
+	struct usb_serial_port *port = serial->port[0];
+
+	if (tty_port_initialized(&port->port))
+		write_latency_timer(port);
+
+	return usb_serial_generic_resume(serial);
+}
+
 static int ftdi_sio_port_remove(struct usb_serial_port *port)
 {
 	struct ftdi_private *priv = usb_get_serial_port_data(port);

             reply	other threads:[~2020-09-29 19:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29 19:33 Helge Deller [this message]
2020-10-08 15:21 ` [PATCH] USB: serial: ftdi_sio: Fix serial port stall after resume Johan Hovold
2020-10-08 18:16   ` Helge Deller
2020-10-27  9:00     ` Johan Hovold
2020-10-28 14:54       ` Helge Deller
2020-10-28 15:01         ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200929193327.GA13987@ls3530.fritz.box \
    --to=deller@gmx.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).