* [PATCH v2] rtc: hym8563: enable wakeup when applicable
@ 2020-11-06 9:06 Guillaume Tucker
2020-11-14 22:37 ` Alexandre Belloni
0 siblings, 1 reply; 2+ messages in thread
From: Guillaume Tucker @ 2020-11-06 9:06 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni, Heiko Stuebner
Cc: Andrew Morton, linux-rtc, linux-kernel, kernel, Guillaume Tucker
Enable wakeup in the hym8563 driver if the IRQ was successfully
requested or if wakeup-source is set in the devicetree.
As per the description of device_init_wakeup(), it should be enabled
for "devices that everyone expects to be wakeup sources". One would
expect this to be the case with a real-time clock.
Tested on rk3288-rock2-square, which has an IRQ configured for the
RTC. As a result, wakeup was enabled during driver initialisation.
Fixes: dcaf03849352 ("rtc: add hym8563 rtc-driver")
Reported-by: kernelci.org bot <bot@kernelci.org>
Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
---
Notes:
v2: enable wakeup if irq or wakeup-source
drivers/rtc/rtc-hym8563.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c
index 0fb79c4afb46..24e0095be058 100644
--- a/drivers/rtc/rtc-hym8563.c
+++ b/drivers/rtc/rtc-hym8563.c
@@ -527,8 +527,6 @@ static int hym8563_probe(struct i2c_client *client,
hym8563->client = client;
i2c_set_clientdata(client, hym8563);
- device_set_wakeup_capable(&client->dev, true);
-
ret = hym8563_init_device(client);
if (ret) {
dev_err(&client->dev, "could not init device, %d\n", ret);
@@ -547,6 +545,11 @@ static int hym8563_probe(struct i2c_client *client,
}
}
+ if (client->irq > 0 ||
+ device_property_read_bool(&client->dev, "wakeup-source")) {
+ device_init_wakeup(&client->dev, true);
+ }
+
/* check state of calendar information */
ret = i2c_smbus_read_byte_data(client, HYM8563_SEC);
if (ret < 0)
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] rtc: hym8563: enable wakeup when applicable
2020-11-06 9:06 [PATCH v2] rtc: hym8563: enable wakeup when applicable Guillaume Tucker
@ 2020-11-14 22:37 ` Alexandre Belloni
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2020-11-14 22:37 UTC (permalink / raw)
To: Heiko Stuebner, Guillaume Tucker, Alessandro Zummo
Cc: Alexandre Belloni, kernel, linux-kernel, Andrew Morton, linux-rtc
On Fri, 6 Nov 2020 09:06:31 +0000, Guillaume Tucker wrote:
> Enable wakeup in the hym8563 driver if the IRQ was successfully
> requested or if wakeup-source is set in the devicetree.
>
> As per the description of device_init_wakeup(), it should be enabled
> for "devices that everyone expects to be wakeup sources". One would
> expect this to be the case with a real-time clock.
>
> [...]
Applied, thanks!
[1/1] rtc: hym8563: enable wakeup when applicable
commit: c56ac7a0f468ceb38d24db41f4446d98ab94da2d
Best regards,
--
Alexandre Belloni <alexandre.belloni@bootlin.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-14 22:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06 9:06 [PATCH v2] rtc: hym8563: enable wakeup when applicable Guillaume Tucker
2020-11-14 22:37 ` Alexandre Belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).