Skip to content

Commit 4c9a91b

Browse files
pcf8563: add wakeup-source support
In some platforms, the RTC is able to wake up the system but is not directly connected to an IRQ. Add wakeup-source property support to be able to express this in the Device Tree. Link: https://lore.kernel.org/r/20240426225821.448963-1-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent eca1b3c commit 4c9a91b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/rtc/rtc-pcf8563.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,6 @@ static int pcf8563_probe(struct i2c_client *client)
527527

528528
i2c_set_clientdata(client, pcf8563);
529529
pcf8563->client = client;
530-
device_set_wakeup_capable(&client->dev, 1);
531530

532531
/* Set timer to lowest frequency to save power (ref Haoyu datasheet) */
533532
buf = PCF8563_TMRC_1_60;
@@ -553,6 +552,7 @@ static int pcf8563_probe(struct i2c_client *client)
553552
/* the pcf8563 alarm only supports a minute accuracy */
554553
set_bit(RTC_FEATURE_ALARM_RES_MINUTE, pcf8563->rtc->features);
555554
clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, pcf8563->rtc->features);
555+
clear_bit(RTC_FEATURE_ALARM, pcf8563->rtc->features);
556556
pcf8563->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
557557
pcf8563->rtc->range_max = RTC_TIMESTAMP_END_2099;
558558
pcf8563->rtc->set_start_time = true;
@@ -573,7 +573,12 @@ static int pcf8563_probe(struct i2c_client *client)
573573
return err;
574574
}
575575
} else {
576-
clear_bit(RTC_FEATURE_ALARM, pcf8563->rtc->features);
576+
client->irq = 0;
577+
}
578+
579+
if (client->irq > 0 || device_property_read_bool(&client->dev, "wakeup-source")) {
580+
device_init_wakeup(&client->dev, true);
581+
set_bit(RTC_FEATURE_ALARM, pcf8563->rtc->features);
577582
}
578583

579584
err = devm_rtc_register_device(pcf8563->rtc);

0 commit comments

Comments
 (0)