All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andy Shevchenko <andriy.shevchenko@intel.com>,
	Jiri Slaby <jirislaby@kernel.org>,
	Johan Hovold <johan@kernel.org>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-serial@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 5/6] serial: 8250_omap: Require a valid wakeirq for deeper idle states
Date: Tue, 21 Sep 2021 13:33:45 +0300	[thread overview]
Message-ID: <20210921103346.64824-6-tony@atomide.com> (raw)
In-Reply-To: <20210921103346.64824-1-tony@atomide.com>

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 <tony@atomide.com>
---
 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

  parent reply	other threads:[~2021-09-21 10:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 10:33 [PATCH 0/6] Get rid of pm_runtime_irq_safe() for 8250_omap Tony Lindgren
2021-09-21 10:33 ` [PATCH 1/6] n_tty: Start making use of -EAGAIN returned from process_output_block() Tony Lindgren
2021-09-21 11:58   ` Andy Shevchenko
2021-09-21 10:33 ` [PATCH 2/6] tty: n_gsm: Don't ignore write return value in gsmld_output() Tony Lindgren
2021-09-21 10:33 ` [PATCH 3/6] serial: core: Add new prep_tx for power management Tony Lindgren
2021-09-23 12:45   ` Johan Hovold
2021-09-23 15:02     ` Tony Lindgren
2021-09-24 14:37       ` Johan Hovold
2021-09-24 15:09         ` Tony Lindgren
2021-09-27 14:05           ` Johan Hovold
2021-09-21 10:33 ` [PATCH 4/6] serial: 8250: Implement " Tony Lindgren
2021-09-23 12:49   ` Johan Hovold
2021-09-23 15:05     ` Tony Lindgren
2021-09-24 14:44       ` Johan Hovold
2021-09-24 15:16         ` Tony Lindgren
2021-09-21 10:33 ` Tony Lindgren [this message]
2021-09-21 10:33 ` [PATCH 6/6] serial: 8250_omap: Drop the use of pm_runtime_irq_safe() Tony Lindgren
2021-09-21 12:03 ` [PATCH 0/6] Get rid of pm_runtime_irq_safe() for 8250_omap Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210921103346.64824-6-tony@atomide.com \
    --to=tony@atomide.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.