From patchwork Tue Sep 29 19:33:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 11806613 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE9D36CA for ; Tue, 29 Sep 2020 19:33:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 86B1C2083B for ; Tue, 29 Sep 2020 19:33:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="EaHAqZoZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728755AbgI2Tdf (ORCPT ); Tue, 29 Sep 2020 15:33:35 -0400 Received: from mout.gmx.net ([212.227.17.20]:52827 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728264AbgI2Tde (ORCPT ); Tue, 29 Sep 2020 15:33:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1601408009; bh=LACz1Prky4MmONxmw10GDUp4kVaA/QaOWNNS0asK8z4=; h=X-UI-Sender-Class:Date:From:To:Subject; b=EaHAqZoZ9vgWBfn3Z3HtL8dRd1bUG92qdszQNAV0O33/+mrNK6zhqSkVecQCP8q5c 8QYQisFyeiO3zywOPI/p1dZNpzFfX8SZ4k5dleRkqZHx+dnvkMLWZFJjVHRwTqwD7N XkuCxDE0ScdY5K02swjn+Tif/4QnE1QJr01dxBBA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from ls3530.fritz.box ([92.116.149.158]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mt79F-1kgnAW18Rd-00tSqi; Tue, 29 Sep 2020 21:33:29 +0200 Date: Tue, 29 Sep 2020 21:33:27 +0200 From: Helge Deller To: Johan Hovold , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] USB: serial: ftdi_sio: Fix serial port stall after resume Message-ID: <20200929193327.GA13987@ls3530.fritz.box> MIME-Version: 1.0 Content-Disposition: inline X-Provags-ID: V03:K1:WwCbttWo164ecU2xU07tVn0sMXp75TV8SmfImIYaQlYRDq6Lxiu LD//FzIEzJDbOc1owFQFaWeguLBqGyE9JhUZAGv+0ruH46ZUarnXVtzWcAY38+nGEaKTjMZ a2TJbeS2FaApMqR+MfcWruCe3kt2QauqwVS/iCjo/woEaDBwBZ3yDJWIzcwbRnqFwUO5W4w Dxuwp5olNqdQZ0qZaxEvA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:6j723MT5f50=:iPtfXI3n5XaCmP4yxANpY9 dfwu4eS7NolJya1/1BKKDdZae5EZRozoLBfbJ3RZ6+2vydrimlmvp7FFmahCzImAEvwxxlpyK tZtemXgz5CIBYSD9mjhdyiKJ9Q+vKjOnWHMZmNhgY+Srxoce6e9VKZUWXzZ0TjD7ypcusnIK7 rzpm/Bl7cD+GphcyQejmCdRZzlW/yTayRzo+ecCn6a8Glb2MR800S013UZttYNDCzpNnHe3WK l0+k8+imrB0DbvAQ5jMtC1bwhMT+f9kYEF+RiCwSsbCQ4IbHClRqn3ImjPISQCVMSzBsYveT9 Xb303R0m5tNTPNvEP8NmJtTOP1g41/O97CgIVhGcoXQW4LkgTW+sGjmAjQV3AMwRUbmcgecpP 9/x4VfJgjMUUp/WnmujPRBB1ETD3v4vGerOic9Iw+U8V3tdBYI8MMKiXiXqGlbJzvWotyvXLA zzxQAyogAx2+w+hhAzt5ZA7alaW7wrv9VwwoYY5FgSmWsGSTK25tkFjKP3IEASnhYsxxTqYMr MaODNnbKwVxCHG0qyCelbFf7/f5TryLSJvsfuR4lkRSStc9YUwPU2kZMwfK6011ceocLVGL0I oVVeD/VY8Nw/iUnd0XlYw8zvjZH6MF5sAoeL5yTDJbpY+qpZZkLe65LryYCRC/RgJ3Sqm9j4h NVHMhD28yMUSwdMX73yj/p4/byk1wjQrT0at9NQQReU4JliQ7dB3kBoJtZ9jbpwyQM1Dquu4a zwzlJUqOcHOiLHtGjgukvOE/WnlPrL7XRBIWYxDlYSy4IPkNM0J+mrwWxanP0C0wgUoAt7Jkn igE3Wb/u0iac9369V4IIZNYo7McddUf5fFy9pRSHdnGFKNAOUXkjpRf2pPSRm87K0Op6U8DmV 5i+X+ewFGvlqfJuFrSVY2D3JqYsX+Z+qVrx55wCrmgMTHWXBeILE2pB3BBRUeLN/ftP6Y4r5R vevpcxu1cw/mAhxfUjHR++UEdiT3nYcS18IByxgg9jkxTx7fGdfKhQjZucTNkT5sx6+3XrueW GQhxjOSBQglvdFYFxpJ+4iCMyT9bzsShkdgeZfcqaOktPnWkjnpMHA7pAWA63hrtGPGWpjgQD JDMZkUDzSp3X2neir+Dq74Hzac5Qil7OnSvGnyMDakrY/FxcP84zfzzd12falz+8d61qDlIlc DsxAjgJD5SVC3V2BdtMI6tIxyUSvOxyZmD7buJmzvo74rkqM1edtvk5l0Bt/9Up4jSZ9l6R5m 1UtuUCm8eb5EbPHrJ Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 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);