aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Osipenko <[email protected]>2021-01-21 00:16:02 +0300
committerAlexandre Belloni <[email protected]>2021-01-25 23:57:24 +0100
commit454ba154a62c8806e82a3581c5233a5176cd7dd7 (patch)
treeb387bd22dadecd72f5ad828093059fee6d123583
parentf66e7f2d32b9f53b4c43d9c4ac0c1c83141db735 (diff)
rtc: tps65910: Support wakeup-source property
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 <[email protected]> Tested-by: Matt Merhar <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--drivers/rtc/rtc-tps65910.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c
index e1415a49f4ee..288abb1abdb8 100644
--- a/drivers/rtc/rtc-tps65910.c
+++ b/drivers/rtc/rtc-tps65910.c
@@ -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;