Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp651816imm; Fri, 27 Jul 2018 03:49:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcXvldfZQIG9gm7f0jpdQPlD5dF5nr7NQ7LTGSgIZP2Ll6ZeD5fJNPMOIm2A5JEl/nIUQ0z X-Received: by 2002:a62:9042:: with SMTP id a63-v6mr6229864pfe.52.1532688569065; Fri, 27 Jul 2018 03:49:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532688569; cv=none; d=google.com; s=arc-20160816; b=u8fv3FYPTFqATQ6DSBCiBtF/X5Hi+1O8Z+Ni/yiwgUEQT5XSBiBQQ6Yn20a0kZ5WFQ d4AeFN3/4x912pQcFidwp+67Az4li43+qNu1tpve+KHxbzobKVMf+jbbG8LnvJ4HCV3B nemKX/KIFfk0jNt7UMde8Aa158gmpxQFAQQJcVU8Q1ijfl78jnWAAENpKZuXfeo79YwU J5kJkSw5+EK6ALmJVckge/Rh2u2VDPCz4HJFNgALRSa2K+hm/f8G3B/O9t4XTFxDxYDc qxPZxjS2QwGwv7UTrbWPzbp1AKAEaI5k2ES3FDhGQw+ON/wx3EVr8YRatgKF6XcG0nMb J+Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=MlqdtxbkoOrZIU+m8X6gS6qQyBDEPZW2f0PHoNE/0bA=; b=Xuy6U6QddY8m6AQLWVqas7FK/6a/CQU159Y/Du3aW2H46lfc+er43RUbFgnrVK3Z0f ayCOSMEIyIBT1i1axkfx7FB3b+qIm5kk6br1xdwNCU5PSAIYD/oDDK8rIFgvrB4+tZ5H FJoVE7AGmIXweZ7C1xI26vdwfrI4P8HHwMN8MUvEy8GEZmrvGpeShrdSs++H3qxchpyv eNONLHFMOweT2iuimX01+A3xXwvwmxh+TXqQ8WE2qVG8UTCwj2ndYWnLLH/Dw4D3db7w 68JOziGv1wuVJt5PjNrKL91W/HGzjJIo/u8MVhUip3m2I6USwOkOOwyEa6DG8dvVxKik Z28A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e94-v6si576758plb.435.2018.07.27.03.49.13; Fri, 27 Jul 2018 03:49:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730564AbeG0MJr (ORCPT + 99 others); Fri, 27 Jul 2018 08:09:47 -0400 Received: from mga14.intel.com ([192.55.52.115]:15432 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729955AbeG0MJr (ORCPT ); Fri, 27 Jul 2018 08:09:47 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jul 2018 03:48:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,408,1526367600"; d="scan'208";a="57609564" Received: from hu.sh.intel.com ([10.239.160.33]) by fmsmga007.fm.intel.com with ESMTP; 27 Jul 2018 03:48:24 -0700 From: Chen Hu To: andy.shevchenko@gmail.com Cc: Chen Hu , Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko , Subramony Sesha , Heikki Krogerus , Stefan Potyra , Philipp Zabel , Archana Patni , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] serial: 8250_dw: always set baud rate in dw8250_set_termios Date: Fri, 27 Jul 2018 18:32:41 +0800 Message-Id: <20180727103242.29675-1-hu1.chen@intel.com> X-Mailer: git-send-email 2.13.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dw8250_set_termios() doesn't set baud rate if the arg "old ktermios" is NULL. This happens during resume. Call Trace: ... [ 54.928108] dw8250_set_termios+0x162/0x170 [ 54.928114] serial8250_set_termios+0x17/0x20 [ 54.928117] uart_change_speed+0x64/0x160 [ 54.928119] uart_resume_port ... So the baud rate is not restored after S3 and breaks the apps who use UART, for example, console and bluetooth etc. We address this issue by setting the baud rate irrespective of arg "old", just like the drivers for other 8250 IPs. This is tested with Intel Broxton platform. Signed-off-by: Chen Hu --- We found UART based apps such as console and bluetooth etc. are broken after S3 on Intel Broxton platform. The further debug shows that the baud rate of all UARTs are different with our settings after S3. During S3, the 8250 related IPs may lose power and thus lose the OS's baud rate setting. The driver should restore it during resume. However, Desinware 8250's driver doesn't restore the baud if the arg "old ktermios" is NULL. Unfortunely, it get a NULL arg from serial_core and skips this step in resume path. Andy guide me that he doesn't see other 8250 IPs judge old==NULL to set baud. With the modification in this email, the baud rate is OK after S3. A local quick test doesn't show any error. Report the issue here and hope some serial experts can present formal patch to fix. drivers/tty/serial/8250/8250_dw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 02a9b995e8f9..82bf46507f6d 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -250,7 +250,7 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, long rate; int ret; - if (IS_ERR(d->clk) || !old) + if (IS_ERR(d->clk)) goto out; clk_disable_unprepare(d->clk); -- 2.13.0