rtc: ds1307: Use irq when available for wakeup-source device
authorNishanth Menon <nm@ti.com>
Tue, 19 Apr 2016 16:23:54 +0000 (11:23 -0500)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Thu, 21 Apr 2016 21:21:00 +0000 (23:21 +0200)
With commit 8bc2a40730ec ("rtc: ds1307: add support for the
DT property 'wakeup-source'") we lost the ability for rtc irq
functionality for devices that are actually hooked on a real IRQ
line and have capability to wakeup as well. This is not an expected
behavior. So, instead of just not requesting IRQ, skip the IRQ
requirement only if interrupts are not defined for the device.

Fixes: 8bc2a40730ec ("rtc: ds1307: add support for the DT property 'wakeup-source'")
Reported-by: Tony Lindgren <tony@atomide.com>
Cc: Michael Lange <linuxstuff@milaw.biz>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-ds1307.c

index ee3cae2f212e0ba3774afdb521df373f9740c3a1..ecb7dbae9be9daa0ee96ede34a446a78e8e7debd 100644 (file)
@@ -1531,7 +1531,7 @@ read_rtc:
                return PTR_ERR(ds1307->rtc);
        }
 
-       if (ds1307_can_wakeup_device) {
+       if (ds1307_can_wakeup_device && ds1307->client->irq <= 0) {
                /* Disable request for an IRQ */
                want_irq = false;
                dev_info(&client->dev, "'wakeup-source' is set, request for an IRQ is disabled!\n");