summaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorJingchang Lu <jingchang.lu@freescale.com>2014-09-22 08:58:24 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:36:30 (GMT)
commit915cad947438c87d5f4245880778a07cb14d2fbd (patch)
tree7a2c8483b6d9d6156cfae67a94218e67041a3073 /drivers/tty
parent6313b89ee179e04f83641703a07f47c202098f2a (diff)
downloadlinux-fsl-qoriq-915cad947438c87d5f4245880778a07cb14d2fbd.tar.xz
serial: of-serial: add PM suspend/resume support
This adds PM suspend/resume support for the of-serial driver to provide power management support on devices attatched to it. Signed-off-by: Jingchang Lu <jingchang.lu@freescale.com> This patch has been sent to upstream for review: https://patchwork.kernel.org/patch/4954521/ Change-Id: I06905237f7d7ef51bf5a1c135cd0880d92c4c104 Reviewed-on: http://git.am.freescale.net:8181/19728 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Chenhui Zhao <chenhui.zhao@freescale.com> Reviewed-by: Li Xiubo <Li.Xiubo@freescale.com> Reviewed-by: Zhengxiong Jin <Jason.Jin@freescale.com>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/of_serial.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index b4507be..a320fc5 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -240,6 +240,32 @@ static int of_platform_serial_remove(struct platform_device *ofdev)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+static int of_serial_suspend(struct device *dev)
+{
+ struct of_serial_info *info = dev_get_drvdata(dev);
+
+ serial8250_suspend_port(info->line);
+ if (info->clk)
+ clk_disable_unprepare(info->clk);
+
+ return 0;
+}
+
+static int of_serial_resume(struct device *dev)
+{
+ struct of_serial_info *info = dev_get_drvdata(dev);
+
+ if (info->clk)
+ clk_prepare_enable(info->clk);
+
+ serial8250_resume_port(info->line);
+
+ return 0;
+}
+#endif
+static SIMPLE_DEV_PM_OPS(of_serial_pm_ops, of_serial_suspend, of_serial_resume);
+
/*
* A few common types, add more as needed.
*/
@@ -273,6 +299,7 @@ static struct platform_driver of_platform_serial_driver = {
.name = "of_serial",
.owner = THIS_MODULE,
.of_match_table = of_platform_serial_table,
+ .pm = &of_serial_pm_ops,
},
.probe = of_platform_serial_probe,
.remove = of_platform_serial_remove,