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: [PATCHv3 2/8] serial: imx: introduce serial_imx_enable_wakeup()
Date: Tue, 11 Aug 2015 10:21:21 -0700 [thread overview]
Message-ID: <1439313687-28502-3-git-send-email-edubezval@gmail.com> (raw)
In-Reply-To: <1439313687-28502-1-git-send-email-edubezval@gmail.com>
This change is a code reorganization. Here we introduce
serial_imx_enable_wakeup() helper function to do
the job of configuring and preparing wakeup sources
on imx serial device. The idea is to allow other
parts of the code to call this function whenever
the device is known to go to idle.
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>
---
arch/arm/boot/dts/Makefile | 1 +
drivers/tty/serial/imx.c | 22 ++++++++++++++--------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 821e015..d60b28f 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -330,6 +330,7 @@ dtb-$(CONFIG_SOC_IMX6Q) += \
imx6q-wandboard-revb1.dtb
dtb-$(CONFIG_SOC_IMX6SL) += \
imx6sl-evk.dtb \
+ imx6sl-fox-p1.dtb \
imx6sl-warp.dtb
dtb-$(CONFIG_SOC_IMX6SX) += \
imx6sx-sabreauto.dtb \
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index b27c232..3c2b0ac 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1972,6 +1972,18 @@ static int serial_imx_remove(struct platform_device *pdev)
return uart_remove_one_port(&imx_reg, &sport->port);
}
+static void serial_imx_enable_wakeup(struct imx_port *sport, bool on)
+{
+ unsigned int val;
+
+ val = readl(sport->port.membase + UCR3);
+ if (on)
+ val |= UCR3_AWAKEN;
+ else
+ val &= ~UCR3_AWAKEN;
+ writel(val, sport->port.membase + UCR3);
+}
+
static int imx_serial_port_suspend_noirq(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
@@ -2029,12 +2041,9 @@ static int imx_serial_port_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct imx_port *sport = platform_get_drvdata(pdev);
- unsigned int val;
/* enable wakeup from i.MX UART */
- val = readl(sport->port.membase + UCR3);
- val |= UCR3_AWAKEN;
- writel(val, sport->port.membase + UCR3);
+ serial_imx_enable_wakeup(sport, true);
uart_suspend_port(&imx_reg, &sport->port);
@@ -2045,12 +2054,9 @@ static int imx_serial_port_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct imx_port *sport = platform_get_drvdata(pdev);
- unsigned int val;
/* disable wakeup from i.MX UART */
- val = readl(sport->port.membase + UCR3);
- val &= ~UCR3_AWAKEN;
- writel(val, sport->port.membase + UCR3);
+ serial_imx_enable_wakeup(sport, false);
uart_resume_port(&imx_reg, &sport->port);
--
2.5.0
next prev parent reply other threads:[~2015-08-11 17:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-11 17:21 [PATCHv3 0/8] serial: imx: rework pm support and add runtime pm Eduardo Valentin
2015-08-11 17:21 ` [PATCHv3 1/8] serial: imx: remove unbalanced clk_prepare Eduardo Valentin
2015-08-11 17:21 ` Eduardo Valentin [this message]
2015-08-11 17:21 ` [PATCHv3 3/8] serial: imx: allow waking up on RTSD Eduardo Valentin
2015-08-11 17:21 ` [PATCHv3 4/8] serial: imx: save and restore context in the suspend path Eduardo Valentin
2015-08-11 17:21 ` [PATCHv3 5/8] serial: imx: add a flag to indicate we are " Eduardo Valentin
2015-08-11 17:21 ` [PATCHv3 6/8] serial: imx: add runtime pm support Eduardo Valentin
2015-08-15 0:23 ` Greg Kroah-Hartman
2015-08-15 1:20 ` Eduardo Valentin
2015-08-11 17:21 ` [PATCHv3 7/8] serial: imx: add pm_qos request Eduardo Valentin
2015-08-11 17:21 ` [PATCHv3 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=1439313687-28502-3-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).