Skip to content

Commit

Permalink
rtc: tps65910: Support wakeup-source property
Browse files Browse the repository at this point in the history
TPS65910 is a PMIC MFD device and RTC is one of its functions. The
wakeup-source DT property is specified for the parent MFD device and we
need to use this property for the RTC in order to allow to use RTC alarm
for waking up system from suspend by default, instead of requiring user
to enable wakeup manually via sysfs.

Tested-by: Peter Geis <pgwipeout@gmail.com>
Tested-by: Matt Merhar <mattmerhar@protonmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210120211603.18555-1-digetx@gmail.com
  • Loading branch information
digetx authored and alexandrebelloni committed Jan 25, 2021
1 parent f66e7f2 commit 454ba15
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/rtc/rtc-tps65910.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,14 @@ static int tps65910_rtc_probe(struct platform_device *pdev)
irq = -1;

tps_rtc->irq = irq;
if (irq != -1)
device_set_wakeup_capable(&pdev->dev, 1);
else
if (irq != -1) {
if (device_property_present(tps65910->dev, "wakeup-source"))
device_init_wakeup(&pdev->dev, 1);
else
device_set_wakeup_capable(&pdev->dev, 1);
} else {
clear_bit(RTC_FEATURE_ALARM, tps_rtc->rtc->features);
}

tps_rtc->rtc->ops = &tps65910_rtc_ops;
tps_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
Expand Down

0 comments on commit 454ba15

Please sign in to comment.