rtc: rv8803: add wakeup-source support
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 8 Jan 2024 00:43:57 +0000 (01:43 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 15 Jan 2024 21:29:48 +0000 (22:29 +0100)
The RV8803 can be wired directly to a PMIC that can wake up an SoC without
the CPU getting interrupts.

Link: https://lore.kernel.org/r/20240108004357.602918-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Documentation/devicetree/bindings/rtc/epson,rx8900.yaml
drivers/rtc/rtc-rv8803.c

index 1df7c45d95c18ef90c8e996be5b83bc243099155..b770149c5fd677137bbeee87178d4188e5a0b59b 100644 (file)
@@ -29,6 +29,8 @@ properties:
 
   trickle-diode-disable: true
 
+  wakeup-source: true
+
 required:
   - compatible
   - reg
index 11e6b0d31f5d72a490741495340ac24ae4c3c4f8..1327251e527c21cae4a247a62791ec3cbf0df067 100644 (file)
@@ -712,9 +712,12 @@ static int rv8803_probe(struct i2c_client *client)
                        if (err)
                                dev_err(&client->dev, "failed to set wake IRQ\n");
                }
+       } else {
+               if (device_property_read_bool(&client->dev, "wakeup-source"))
+                       device_init_wakeup(&client->dev, true);
+               else
+                       clear_bit(RTC_FEATURE_ALARM, rv8803->rtc->features);
        }
-       if (!client->irq)
-               clear_bit(RTC_FEATURE_ALARM, rv8803->rtc->features);
 
        if (of_property_read_bool(client->dev.of_node, "epson,vdet-disable"))
                rv8803->backup |= RX8900_FLAG_VDETOFF;