summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2017-11-01 13:51:41 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-11-04 12:13:45 +0100
commit94be6d74d040c614a332555f5b6d57c26dc272fc (patch)
treee1260465bca2db039fb9a9f9da656e69d81b998f /drivers/tty
parent2a76fa2830981e15bfa33c2b0e5f2dfd35b0455c (diff)
downloadop-kernel-dev-94be6d74d040c614a332555f5b6d57c26dc272fc.zip
op-kernel-dev-94be6d74d040c614a332555f5b6d57c26dc272fc.tar.gz
serial: imx: add hibernation support
During hibernation, freeze/thaw/restore dev_pm_ops are called instead of suspend/resume. Hook up the hibernation ops. The _noirq parts are identical, but suspend/resume are replaced with variants that do not enable wakeup from i.MX UART. There is no need to restore register contents in thaw_noirq. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/imx.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 76818a2..2d042c6 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2350,11 +2350,39 @@ static int imx_serial_port_resume(struct device *dev)
return 0;
}
+static int imx_serial_port_freeze(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct imx_port *sport = platform_get_drvdata(pdev);
+
+ uart_suspend_port(&imx_reg, &sport->port);
+
+ /* Needed to enable clock in suspend_noirq */
+ return clk_prepare(sport->clk_ipg);
+}
+
+static int imx_serial_port_thaw(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct imx_port *sport = platform_get_drvdata(pdev);
+
+ uart_resume_port(&imx_reg, &sport->port);
+
+ clk_unprepare(sport->clk_ipg);
+
+ return 0;
+}
+
static const struct dev_pm_ops imx_serial_port_pm_ops = {
.suspend_noirq = imx_serial_port_suspend_noirq,
.resume_noirq = imx_serial_port_resume_noirq,
+ .freeze_noirq = imx_serial_port_suspend_noirq,
+ .restore_noirq = imx_serial_port_resume_noirq,
.suspend = imx_serial_port_suspend,
.resume = imx_serial_port_resume,
+ .freeze = imx_serial_port_freeze,
+ .thaw = imx_serial_port_thaw,
+ .restore = imx_serial_port_thaw,
};
static struct platform_driver serial_imx_driver = {
OpenPOWER on IntegriCloud