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


Groups > linux.kernel > #1196103 > unrolled thread

[PATCH] rtc: mt6397: implement suspend/resume function in rtc-mt6397 driver

Started byHenry Chen <henryc.chen@mediatek.com>
First post2015-07-30 17:00 +0200
Last post2015-08-05 03:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] rtc: mt6397: implement suspend/resume function in rtc-mt6397 driver Henry Chen <henryc.chen@mediatek.com> - 2015-07-30 17:00 +0200
    Re: [PATCH] rtc: mt6397: implement suspend/resume function in  rtc-mt6397 driver Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2015-08-05 03:50 +0200

#1196103 — [PATCH] rtc: mt6397: implement suspend/resume function in rtc-mt6397 driver

FromHenry Chen <henryc.chen@mediatek.com>
Date2015-07-30 17:00 +0200
Subject[PATCH] rtc: mt6397: implement suspend/resume function in rtc-mt6397 driver
Message-ID<pRXto-1wm-19@gated-at.bofh.it>
Implement the suspend/resume function in order to control rtc's irq_wake flag and handle as wakeup source.

Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
---
 drivers/rtc/rtc-mt6397.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index c0090b6..9f6c9f8 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -373,6 +373,31 @@ static int mtk_rtc_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int mt6397_rtc_suspend(struct device *dev)
+{
+	struct mt6397_rtc *rtc = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev))
+		enable_irq_wake(rtc->irq);
+
+	return 0;
+}
+
+static int mt6397_rtc_resume(struct device *dev)
+{
+	struct mt6397_rtc *rtc = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev))
+		disable_irq_wake(rtc->irq);
+
+	return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_rtc_suspend,
+			mt6397_rtc_resume);
+
 static const struct of_device_id mt6397_rtc_of_match[] = {
 	{ .compatible = "mediatek,mt6397-rtc", },
 	{ }
@@ -382,6 +407,7 @@ static struct platform_driver mtk_rtc_driver = {
 	.driver = {
 		.name = "mt6397-rtc",
 		.of_match_table = mt6397_rtc_of_match,
+		.pm = &mt6397_pm_ops,
 	},
 	.probe	= mtk_rtc_probe,
 	.remove = mtk_rtc_remove,
-- 
1.8.1.1.dirty

--
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/

[toc] | [next] | [standalone]


#1200349 — Re: [PATCH] rtc: mt6397: implement suspend/resume function in rtc-mt6397 driver

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2015-08-05 03:50 +0200
SubjectRe: [PATCH] rtc: mt6397: implement suspend/resume function in rtc-mt6397 driver
Message-ID<pTW0a-3pK-15@gated-at.bofh.it>
In reply to#1196103
On 30/07/2015 at 22:53:14 +0800, Henry Chen wrote :
> Implement the suspend/resume function in order to control rtc's irq_wake flag and handle as wakeup source.
> 
> Signed-off-by: Henry Chen <henryc.chen@mediatek.com>
> ---
>  drivers/rtc/rtc-mt6397.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web