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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C02DBC433EF for ; Thu, 30 Sep 2021 07:26:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7D416136A for ; Thu, 30 Sep 2021 07:26:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348723AbhI3H1y (ORCPT ); Thu, 30 Sep 2021 03:27:54 -0400 Received: from muru.com ([72.249.23.125]:38994 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348693AbhI3H1w (ORCPT ); Thu, 30 Sep 2021 03:27:52 -0400 Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 9BD358050; Thu, 30 Sep 2021 07:26:38 +0000 (UTC) Date: Thu, 30 Sep 2021 10:26:07 +0300 From: Tony Lindgren To: Andy Shevchenko Cc: Greg Kroah-Hartman , Andy Shevchenko , Jiri Slaby , Johan Hovold , Vignesh Raghavendra , linux-serial@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] serial: core: Add wakeup() and start_pending_tx() for power management Message-ID: References: <20210930062906.58937-1-tony@atomide.com> <20210930062906.58937-2-tony@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Andy Shevchenko [210930 07:11]: > On Thu, Sep 30, 2021 at 9:30 AM Tony Lindgren wrote: > > > > If the serial driver implements PM runtime with autosuspend, the port may > > be powered down on TX. To wake up the port, let's add new wakeup() call > > for serial drivers to implement as needed. We can call wakeup() from > > __uart_start() and flow control related functions before attempting to > > write to the serial port registers. > > > > Let's keep track of the serial port with a new runtime_suspended flag > > that the device driver runtime PM suspend and resume can manage with > > atomic_set(). This is because only the device driver knows what the > > device runtime PM state as in Documentation/power/runtime_pm.rst > > under "9. Autosuspend, or automatically-delayed suspend" for locking. > > > > To allow the serial port drivers to send out pending tx on runtime PM > > resume, let's add start_pending_tx() as suggested by Johan Hovold > > . > > ... > > > + wakeup(port) > > + Wake up port if it has been runtime PM suspended. > > + > > + Locking: port->lock taken. > > + > > + Interrupts: locally disabled. > > > + This call must not sleep > > If it's suspended via ACPI methods, it can't be resumed here, right? It should work for that too assuming the runtime PM resume function is implemented. > Only what we can do is to schedule a resume, but it means we may not > access registers immediately after and we have to be sure that the > device is resumed. Yeah the only thing we do in the 8250_port wakeup() is schedule a resume if needed. Then the 8250 port device driver can call start_pending_tx() at the end of it's runtime PM resume function. > Dead end? I don't think so :) In serial_core we bail out on uart_port_wakeup() errors before register access. But maybe I missed some more moles to whack there :) Regards, Tony