linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Valentin <edubezval@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>, Fabio Estevam <festevam@gmail.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>,
	Linux PM <linux-pm@vger.kernel.org>,
	linux-serial@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Eduardo Valentin <edubezval@gmail.com>
Subject: [PATCHv2 5/8] serial: imx: add a flag to indicate we are in the suspend path
Date: Mon, 10 Aug 2015 18:35:46 -0700	[thread overview]
Message-ID: <1439256949-626-6-git-send-email-edubezval@gmail.com> (raw)
In-Reply-To: <1439256949-626-1-git-send-email-edubezval@gmail.com>

This is a simple flag that gets set across prepare and complete
callbacks in the suspend path. We the flag we may avoid
runtime pm idling at the same time.

Cc: Fabio Estevam <festevam@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: linux-serial@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
 drivers/tty/serial/imx.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index fe3d41c..50abb60 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -218,6 +218,8 @@ struct imx_port {
 	wait_queue_head_t	dma_wait;
 	unsigned int            saved_reg[10];
 	bool			context_saved;
+
+	bool			is_suspending;
 };
 
 struct imx_port_ucrs {
@@ -2026,6 +2028,22 @@ static void serial_imx_enable_wakeup(struct imx_port *sport, bool on)
 	writel(val, sport->port.membase + UCR1);
 }
 
+static int serial_imx_prepare(struct device *dev)
+{
+	struct imx_port *sport = dev_get_drvdata(dev);
+
+	sport->is_suspending = true;
+
+	return 0;
+}
+
+static void serial_imx_complete(struct device *dev)
+{
+	struct imx_port *sport = dev_get_drvdata(dev);
+
+	sport->is_suspending = false;
+}
+
 static int imx_serial_port_suspend_noirq(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
@@ -2091,6 +2109,8 @@ static const struct dev_pm_ops imx_serial_port_pm_ops = {
 	.resume_noirq = imx_serial_port_resume_noirq,
 	.suspend = imx_serial_port_suspend,
 	.resume = imx_serial_port_resume,
+	.prepare = serial_imx_prepare,
+	.complete = serial_imx_complete,
 };
 
 static struct platform_driver serial_imx_driver = {
-- 
2.5.0


  parent reply	other threads:[~2015-08-11  1:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-11  1:35 [PATCHv2 0/8] serial: imx: rework pm support and add runtime pm Eduardo Valentin
2015-08-11  1:35 ` [PATCHv2 1/8] serial: imx: remove unbalanced clk_prepare Eduardo Valentin
2015-08-11  1:35 ` [PATCHv2 2/8] serial: imx: introduce serial_imx_enable_wakeup() Eduardo Valentin
2015-08-11  1:35 ` [PATCHv2 3/8] serial: imx: allow waking up on RTSD Eduardo Valentin
2015-08-11  1:35 ` [PATCHv2 4/8] serial: imx: save and restore context in the suspend path Eduardo Valentin
2015-08-11  1:35 ` Eduardo Valentin [this message]
2015-08-11  1:35 ` [PATCHv2 6/8] serial: imx: add runtime pm support Eduardo Valentin
2015-08-11  3:02   ` Fabio Estevam
2015-08-11 16:51     ` Eduardo Valentin
2015-08-12 19:32   ` Kevin Hilman
2015-08-11  1:35 ` [PATCHv2 7/8] serial: imx: add pm_qos request Eduardo Valentin
2015-08-11  1:35 ` [PATCHv2 8/8] serial: imx: use SET_*SYSTEM_PM_OPS helper functions Eduardo Valentin

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=1439256949-626-6-git-send-email-edubezval@gmail.com \
    --to=edubezval@gmail.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).