From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0034BECE58C for ; Mon, 7 Oct 2019 15:56:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D47942067B for ; Mon, 7 Oct 2019 15:56:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728130AbfJGP4t (ORCPT ); Mon, 7 Oct 2019 11:56:49 -0400 Received: from muru.com ([72.249.23.125]:35636 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727791AbfJGP4t (ORCPT ); Mon, 7 Oct 2019 11:56:49 -0400 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id E459280A5; Mon, 7 Oct 2019 15:57:20 +0000 (UTC) Date: Mon, 7 Oct 2019 08:56:44 -0700 From: Tony Lindgren To: Adam Ford Cc: Peter Hurley , Greg Kroah-Hartman , Peter Ujfalusi , Sebastian Andrzej Siewior , Vignesh R , linux-serial@vger.kernel.org, Linux-OMAP , Linux Kernel Mailing List , Johan Hovold Subject: Re: [PATCH] serial: 8250_omap: Fix idling for unloaded serdev drivers Message-ID: <20191007155644.GR5610@atomide.com> References: <20190723115400.46432-1-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Adam Ford [191004 19:30]: > On Tue, Jul 23, 2019 at 5:21 PM Tony Lindgren wrote: > > > > For many years omap variants have been setting the runtime PM > > autosuspend delay to -1 to prevent unsafe policy with lossy first > > character on wake-up. The user must specifically enable the timeout > > for UARTs if desired. > > > > We must not enable the workaround for serdev devices though. It leads > > into UARTs not idling if no serdev devices are loaded and there is no > > sysfs entry to configure the UART in that case. And this means that > > my PM may not work unless the serdev modules are loaded. > > > > We can detect a serdev device being configured based on a dts child > > node, and we can simply skip the workround in that case. And the > > serdev driver can idle the port during runtime when suitable if an > > out-of-band wake-up GPIO line exists for example. > > > > Let's also add some comments to the workaround while at it. > > This seems to help some of the stability issues I am seeing on the > DM3730 UART2 running Bluetooth at 3000000 baud. > Does it make sense to backport this to the stable kernels? Sure if it helps with issues, it should be safe to apply to earlier kernels that have serdev potentially in use. No need for earlier kernels before serdev though. Regards, Tony > > Cc: Johan Hovold > > Signed-off-by: Tony Lindgren > > --- > > drivers/tty/serial/8250/8250_omap.c | 11 ++++++++++- > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c > > --- a/drivers/tty/serial/8250/8250_omap.c > > +++ b/drivers/tty/serial/8250/8250_omap.c > > @@ -1234,7 +1234,16 @@ static int omap8250_probe(struct platform_device *pdev) > > > > device_init_wakeup(&pdev->dev, true); > > pm_runtime_use_autosuspend(&pdev->dev); > > - pm_runtime_set_autosuspend_delay(&pdev->dev, -1); > > + > > + /* > > + * Disable runtime PM until autosuspend delay unless specifically > > + * enabled by the user via sysfs. This is the historic way to > > + * prevent an unsafe default policy with lossy characters on wake-up. > > + * For serdev devices this is not needed, the policy can be managed by > > + * the serdev driver. > > + */ > > + if (!of_get_available_child_count(pdev->dev.of_node)) > > + pm_runtime_set_autosuspend_delay(&pdev->dev, -1); > > > > pm_runtime_irq_safe(&pdev->dev); > > pm_runtime_enable(&pdev->dev); > > -- > > 2.21.0