Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp19144pxb; Wed, 29 Sep 2021 23:31:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyD1bV8PZTHrylElxardLKJBjML3qMwvAgR60wOYFOUpqlu86to1qOnvdIT82dnCvzieNQY X-Received: by 2002:a62:1595:0:b0:44b:baf5:82b2 with SMTP id 143-20020a621595000000b0044bbaf582b2mr2685964pfv.66.1632983489985; Wed, 29 Sep 2021 23:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632983489; cv=none; d=google.com; s=arc-20160816; b=nq5TKxu9Q/VjLSJSeSIJ1qx3Xe68PJrMeM+yPlErmGbKw/cKwlo/bZ4THq9b8F1e4f Xno1zohpjkx5bTu7seKfvipe88wKRVmCC0V/eH0SyE5BRIjQMARZO2bdnmO/AsxBSPqF IbVRnmOhlo3axGL1kPb3NEl5838IG7WRXLORHxk/stHFSQl6ehDzbzRQLmIYJMFKm9uf AMNmDO5KQnhACGplekcW9jH5NSdtSDqvr9rQRpfhbYEMOApGg1h5Uy3Aq8k2616GBkLP ql8a2o8RaBL1NpHR6rGzV+z1AkRVcBurNTAt7Oc29013OFmyP/d2jtbFW9MjF6danMcz eXfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=skaQAIz9ctVG/Sd+ZqWGyhywWCJuUPqew1v1c7DuGDY=; b=cizVaaOAs+l6LgG5VHnG820uX7HN3tJsK9pFQaJ1FgLnQhq4UjX8NATGtW0bR9I0dR vFxLOUeCLfVrkvjAnykRzulLpaT8uR6hvWuidqHf+CvRZhzaC56UfjsCsOg4uoJ6Guyf FGe9Vv2yWw7u+H6AMWyKZ+hZo1k3HiHXal7xvJ5I+7TG4L35AZr/VJyktgO7TMdOUo6d 26R6Xfx6vmNLGOJXHE6VZT+kZdJ17S54XkTGA21w7+MuvRSWMPlL4H0Jq7oqoZUoyKgZ qukgF/5U9UVvdDolUP/MDUhNMFcPpMvqBckFkvLf1bTTmY6i30yXgBXxvjYsGeXsX50A RT0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s4si2308254pjf.156.2021.09.29.23.31.17; Wed, 29 Sep 2021 23:31:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348336AbhI3GbH (ORCPT + 99 others); Thu, 30 Sep 2021 02:31:07 -0400 Received: from muru.com ([72.249.23.125]:38878 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348324AbhI3GbE (ORCPT ); Thu, 30 Sep 2021 02:31:04 -0400 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id AB07E80CF; Thu, 30 Sep 2021 06:29:49 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman Cc: Andy Shevchenko , Jiri Slaby , Johan Hovold , Vignesh Raghavendra , linux-serial@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] serial: 8250_omap: Require a valid wakeirq for deeper idle states Date: Thu, 30 Sep 2021 09:29:05 +0300 Message-Id: <20210930062906.58937-4-tony@atomide.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210930062906.58937-1-tony@atomide.com> References: <20210930062906.58937-1-tony@atomide.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For deeper idle states the 8250 device gets powered off. The wakeup is handled with a separate wakeirq controller monitoring the RX pin. Let's check for a valid wakeirq before enabling deeper idle states. Signed-off-by: Tony Lindgren --- drivers/tty/serial/8250/8250_omap.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 @@ -133,6 +133,7 @@ struct omap8250_priv { spinlock_t rx_dma_lock; bool rx_dma_broken; bool throttled; + unsigned int allow_rpm:1; }; struct omap8250_dma_params { @@ -676,6 +677,7 @@ static int omap_8250_startup(struct uart_port *port) ret = dev_pm_set_dedicated_wake_irq(port->dev, priv->wakeirq); if (ret) return ret; + priv->allow_rpm = 1; } pm_runtime_get_sync(port->dev); @@ -722,6 +724,10 @@ static int omap_8250_startup(struct uart_port *port) if (up->dma && !(priv->habit & UART_HAS_EFR2)) up->dma->rx_dma(up); + /* Block runtime PM if no wakeirq, paired with shutdown */ + if (!priv->allow_rpm) + pm_runtime_get(port->dev); + pm_runtime_mark_last_busy(port->dev); pm_runtime_put_autosuspend(port->dev); return 0; @@ -760,6 +766,10 @@ static void omap_8250_shutdown(struct uart_port *port) serial_out(up, UART_LCR, up->lcr & ~UART_LCR_SBC); serial_out(up, UART_FCR, UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); + /* Clear possible PM runtime block to pair with startup */ + if (!priv->allow_rpm) + pm_runtime_put(port->dev); + pm_runtime_mark_last_busy(port->dev); pm_runtime_put_autosuspend(port->dev); free_irq(port->irq, port); -- 2.33.0