diff options
author | Anson Huang <anson.huang@nxp.com> | 2019-04-11 05:19:48 +0300 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2019-04-12 00:18:33 +0300 |
commit | fbc5ee9a6955e6e1a10b736856f9f8f8984ce809 (patch) | |
tree | a3ec1a6b5712754c85edd8f6cd6ec78767b2a652 /drivers/rtc/rtc-mxc_v2.c | |
parent | bc0e731fc2893f96037ef5125e40fd28c6b97bd9 (diff) | |
download | linux-fbc5ee9a6955e6e1a10b736856f9f8f8984ce809.tar.xz |
rtc: mxc_v2: use dev_pm_set_wake_irq() to simplify code
With calling dev_pm_set_wake_irq() to set MXC_V2 RTC as wakeup source
for suspend, generic wake irq mechanism will automatically enable
it as wakeup source when suspend, then the suspend/resume callback
which are ONLY for enabling/disabling irq wake can be removed, it
simplifies the code.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-mxc_v2.c')
-rw-r--r-- | drivers/rtc/rtc-mxc_v2.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/drivers/rtc/rtc-mxc_v2.c b/drivers/rtc/rtc-mxc_v2.c index 007879a5042d..5b970a816631 100644 --- a/drivers/rtc/rtc-mxc_v2.c +++ b/drivers/rtc/rtc-mxc_v2.c @@ -10,6 +10,7 @@ #include <linux/module.h> #include <linux/mod_devicetable.h> #include <linux/platform_device.h> +#include <linux/pm_wakeirq.h> #include <linux/rtc.h> #define SRTC_LPPDR_INIT 0x41736166 /* init for glitch detect */ @@ -305,6 +306,9 @@ static int mxc_rtc_probe(struct platform_device *pdev) return pdata->irq; device_init_wakeup(&pdev->dev, 1); + ret = dev_pm_set_wake_irq(&pdev->dev, pdata->irq); + if (ret) + dev_err(&pdev->dev, "failed to enable irq wake\n"); ret = clk_prepare_enable(pdata->clk); if (ret) @@ -367,30 +371,6 @@ static int mxc_rtc_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int mxc_rtc_suspend(struct device *dev) -{ - struct mxc_rtc_data *pdata = dev_get_drvdata(dev); - - if (device_may_wakeup(dev)) - enable_irq_wake(pdata->irq); - - return 0; -} - -static int mxc_rtc_resume(struct device *dev) -{ - struct mxc_rtc_data *pdata = dev_get_drvdata(dev); - - if (device_may_wakeup(dev)) - disable_irq_wake(pdata->irq); - - return 0; -} -#endif - -static SIMPLE_DEV_PM_OPS(mxc_rtc_pm_ops, mxc_rtc_suspend, mxc_rtc_resume); - static const struct of_device_id mxc_ids[] = { { .compatible = "fsl,imx53-rtc", }, {} @@ -400,7 +380,6 @@ static struct platform_driver mxc_rtc_driver = { .driver = { .name = "mxc_rtc_v2", .of_match_table = mxc_ids, - .pm = &mxc_rtc_pm_ops, }, .probe = mxc_rtc_probe, .remove = mxc_rtc_remove, |