Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp679086pxb; Fri, 15 Oct 2021 13:46:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpjkRT9WAamiSZ8IDAM14sWu0OnudHw27kOFxuaQHhMCjo3supUfhFdQrCU+Nb3uf6ebB7 X-Received: by 2002:a17:90b:34a:: with SMTP id fh10mr30359018pjb.51.1634330792714; Fri, 15 Oct 2021 13:46:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634330792; cv=none; d=google.com; s=arc-20160816; b=Ydu+L5bUNTebzfhE5yHHbrDhqtyTBXVlRtxeLlD1kHr6acGA6FTDnknWXc3wE3FfOB ZZCBRlGkxG53CZx4syXbOAeVJ47CrkDXfzCiTsvTKTUaWTKziQ9xGaBFBdKIy+MGgh6G oraLDcNf1YeFPMW2scTx9t2DaaPc15F2Yw0b7iq8SgQHnKw2sKTuyCAJuX1z6pUXBHfD SB1WUYePgl7/7fHzJ8e6+7NR/C3OfpcbKLGtWmgvl0ly6i4a1KJNu4yp01xZMKj8uvTI fIaxXUK86IzWPrp/Q5RDmWTKas4lfd26k0LRL93kHWxpiwechv2yN8gAwIie5qiPM83n zZkg== 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=IlOY+v5JKBse9M7LSAkkwW1nyHCwgVCcR8AnA2R+10QAVtTLf216MXl8Oru64j3SVP G4pZjXhtZEW0JiJRRwjDpS05uTCnB35R13Eu2ZLhb0pLtZpYjqEU6wjPyy2UaBu9IFfy lW6t6Ai2XRauYS4Zo5pe7Uq1/GlKZME4HwJzusu7ytRr3IYw+7qeKCUNf1EtEKEuTW0k tDD7UpXSo/4/4RpzS/VUU59lL0x9+rm/5jfsO1FyRL6oosEc9lJ1qXWlN/rPz46c7Orb n9d6ImYouEdQlZgzbBk76ZaCEjMdcvovBjvvNnThiC6Jo6vbtX/Ge83g/qMFAAxTEvDE bJaA== 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 f14si11773526pfj.2.2021.10.15.13.45.51; Fri, 15 Oct 2021 13:46:32 -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 S238542AbhJOL2x (ORCPT + 99 others); Fri, 15 Oct 2021 07:28:53 -0400 Received: from muru.com ([72.249.23.125]:44978 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233242AbhJOL2p (ORCPT ); Fri, 15 Oct 2021 07:28:45 -0400 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id D98CB8203; Fri, 15 Oct 2021 11:27:09 +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: Fri, 15 Oct 2021 14:26:25 +0300 Message-Id: <20211015112626.35359-4-tony@atomide.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211015112626.35359-1-tony@atomide.com> References: <20211015112626.35359-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