From 1ce4f91e09ce0a71962e5293473d8cadb2cf8468 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Sun, 25 Aug 2019 05:36:21 -0500 Subject: [PATCH 147/323] rtc: sun6i: Use wake IRQ instead of device PM ops Since the RTC has a single IRQ, we can use the generic wake IRQ implementation instead of defining our own device PM ops. This has the same effect with quite a bit less code. Signed-off-by: Samuel Holland --- drivers/rtc/rtc-sun6i.c | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c index f2818cdd1..c73237f2d 100644 --- a/drivers/rtc/rtc-sun6i.c +++ b/drivers/rtc/rtc-sun6i.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -641,33 +642,6 @@ static const struct rtc_class_ops sun6i_rtc_ops = { .alarm_irq_enable = sun6i_rtc_alarm_irq_enable }; -#ifdef CONFIG_PM_SLEEP -/* Enable IRQ wake on suspend, to wake up from RTC. */ -static int sun6i_rtc_suspend(struct device *dev) -{ - struct sun6i_rtc_dev *chip = dev_get_drvdata(dev); - - if (device_may_wakeup(dev)) - enable_irq_wake(chip->irq); - - return 0; -} - -/* Disable IRQ wake on resume. */ -static int sun6i_rtc_resume(struct device *dev) -{ - struct sun6i_rtc_dev *chip = dev_get_drvdata(dev); - - if (device_may_wakeup(dev)) - disable_irq_wake(chip->irq); - - return 0; -} -#endif - -static SIMPLE_DEV_PM_OPS(sun6i_rtc_pm_ops, - sun6i_rtc_suspend, sun6i_rtc_resume); - static int sun6i_rtc_probe(struct platform_device *pdev) { struct sun6i_rtc_dev *chip = sun6i_rtc; @@ -718,6 +692,11 @@ static int sun6i_rtc_probe(struct platform_device *pdev) clk_prepare_enable(chip->losc); device_init_wakeup(&pdev->dev, 1); + ret = dev_pm_set_wake_irq(&pdev->dev, chip->irq); + if (ret) { + dev_err(&pdev->dev, "Could not set wake IRQ\n"); + return ret; + } chip->rtc = devm_rtc_allocate_device(&pdev->dev); if (IS_ERR(chip->rtc)) @@ -758,7 +737,6 @@ static struct platform_driver sun6i_rtc_driver = { .driver = { .name = "sun6i-rtc", .of_match_table = sun6i_rtc_dt_ids, - .pm = &sun6i_rtc_pm_ops, }, }; builtin_platform_driver(sun6i_rtc_driver); -- 2.34.0