rtc: opal: enable support for the stardard "wakeup-source" property
authorSudeep Holla <Sudeep.Holla@arm.com>
Wed, 21 Oct 2015 10:10:00 +0000 (11:10 +0100)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Sun, 8 Nov 2015 13:12:30 +0000 (14:12 +0100)
Though the opal rtc driver should and will continue to support the legacy
"has-tpo" property to enable RTC as the wakeup source, we need to add
support for the new standard property "wakeup-source"

This patch adds support for "wakeup-source" property in addition to the
existing "has-tpo" property.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: rtc-linux@googlegroups.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-opal.c

index 590e1a45e0b2c25c80c926d48c4db384a77a458a..df39ce02a99d33f9b5c606b187ab374567290dae 100644 (file)
@@ -199,8 +199,9 @@ static int opal_rtc_probe(struct platform_device *pdev)
 {
        struct rtc_device *rtc;
 
-       if (pdev->dev.of_node && of_get_property(pdev->dev.of_node, "has-tpo",
-                                                NULL)) {
+       if (pdev->dev.of_node &&
+           (of_property_read_bool(pdev->dev.of_node, "wakeup-source") ||
+            of_property_read_bool(pdev->dev.of_node, "has-tpo")/* legacy */)) {
                device_set_wakeup_capable(&pdev->dev, true);
                opal_rtc_ops.read_alarm = opal_get_tpo_time;
                opal_rtc_ops.set_alarm = opal_set_tpo_time;