Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp662828imm; Fri, 27 Jul 2018 04:02:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfNakBWVYBDvlKT30LuGLGD6lSAGFie6uQiku5FgbSk6GbYsUE6ow1zOi+ZmYzwVsIQNyqJ X-Received: by 2002:a17:902:7446:: with SMTP id e6-v6mr5692570plt.161.1532689361621; Fri, 27 Jul 2018 04:02:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532689361; cv=none; d=google.com; s=arc-20160816; b=LUE3O+a3sr530hg6r/d6Q9PWKfui83bPWIY5OHX0j7on1Ex5WvdDM6w1NTLV4HVzWv /2PgOI9YeWEHn0HgYsxLU53UIzBCnE/FxQyiItnIMEgt1ELzEOjObhLXRj3LbsxNV+bH 2/o5KK6qO8K83cuY1es6wW7Sel5A4OztUCe9mSvGDBsMFnqHUodt/cfOZu8eC3ZVfvKS IlTTyK9yXM/epyAdUhoGryipgpcYkcYk9Dh7O1HG3R38yMCpPramshhwM3uDCBVD2y2W b4osePZRu7MG9+7ajGbduZEVwmtyJv3D2nxV3jiN29CO6FCdJVrD0/5tLSol903KsGfL 780A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:date:cc:to:from:subject :message-id:arc-authentication-results; bh=YHgNmsmVh8j0pGTNYJw585rKObkTsh3PXMdk3okc1I4=; b=lrHrdpMn+drydgdemgtzyORtf7EO0VBOyf7todpuZue4Q60xwU5+Jkv48AKEc0pdIr Vb+bGYKnL+hK/MZopuZkxh2gXXsBfcr/79z8Upq9oAfp/AW2wQ0BXRvl09gsgoFPet+Z jOS3Kb2wB65K5wk23CH0GMyu/adFE+ZsfQqjmTSY7LF4uXhVnkkNcaij4unXE7pgty64 I9nVIcUnr/JgIZDaMTmfGcw3fVPiDV1x1JN5LX4CDuNl73Z0gFJT6W7zJNfu4NLLKJBL qmTKW75PWrXgaf6zymApvBWizSNpMNXPXhcF1aEY1mP/GJ3tYsjwLRtn7S+z7FMpBL/W Ex8g== 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 p9-v6si3631237pgk.645.2018.07.27.04.02.26; Fri, 27 Jul 2018 04:02:41 -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 S1732791AbeG0MVx (ORCPT + 99 others); Fri, 27 Jul 2018 08:21:53 -0400 Received: from mga09.intel.com ([134.134.136.24]:30196 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730515AbeG0MVx (ORCPT ); Fri, 27 Jul 2018 08:21:53 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jul 2018 04:00:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,408,1526367600"; d="scan'208";a="59957567" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by orsmga007.jf.intel.com with ESMTP; 27 Jul 2018 04:00:25 -0700 Message-ID: Subject: Re: [PATCH] serial: 8250_dw: always set baud rate in dw8250_set_termios From: Andy Shevchenko To: Chen Hu , andy.shevchenko@gmail.com Cc: Greg Kroah-Hartman , Jiri Slaby , Subramony Sesha , Heikki Krogerus , Stefan Potyra , Philipp Zabel , Archana Patni , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 27 Jul 2018 14:00:25 +0300 In-Reply-To: <20180727103242.29675-1-hu1.chen@intel.com> References: <20180727103242.29675-1-hu1.chen@intel.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-07-27 at 18:32 +0800, Chen Hu wrote: > 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. You forgot to add Fixes: 4e26b134bd17 ("serial: 8250_dw: clock rate handling for all ACPI platforms") Cc: Heikki Krogerus The change itself LGTM, Reviewed-by: Andy Shevchenko > > 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); -- Andy Shevchenko Intel Finland Oy