Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1208008

[PATCHv4 1/4] serial: imx: add a flag to indicate we are in the suspend path

From Eduardo Valentin <edubezval@gmail.com>
Newsgroups linux.kernel
Subject [PATCHv4 1/4] serial: imx: add a flag to indicate we are in the suspend path
Date 2015-08-15 06:40 +0200
Message-ID <pXBqa-7u1-7@gated-at.bofh.it> (permalink)
References <pXBqa-7u1-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv4 0/4] serial: imx: rework pm support and add runtime pm Eduardo Valentin <edubezval@gmail.com> - 2015-08-15 06:40 +0200
  [PATCHv4 1/4] serial: imx: add a flag to indicate we are in the suspend path Eduardo Valentin <edubezval@gmail.com> - 2015-08-15 06:40 +0200
  [PATCHv4 2/4] serial: imx: add runtime pm support Eduardo Valentin <edubezval@gmail.com> - 2015-08-15 06:40 +0200
    Re: [PATCHv4 2/4] serial: imx: add runtime pm support Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> - 2015-08-17 17:50 +0200
      Re: [PATCHv4 2/4] serial: imx: add runtime pm support Eduardo Valentin <edubezval@gmail.com> - 2015-08-17 19:30 +0200

csiph-web