Skip to content

Commit

Permalink
rtc: rv3028: Use IRQ flags obtained from device tree if available
Browse files Browse the repository at this point in the history
Make the interrupt pin of the RV3028 usable with GPIO controllers
without level type IRQs support, such as the TI Davinci GPIO controller.

Therefore, allow the IRQ type to be passed from the device tree if
available.

Based on commit d4785b4 ("rtc: pcf2127: use IRQ flags obtained from device tree if available")

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Link: https://lore.kernel.org/r/20221208133605.4193907-1-w.egorov@phytec.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
  • Loading branch information
Wadim Egorov authored and Alexandre Belloni committed Dec 15, 2022
1 parent 0feebde commit 16b26f6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/rtc/rtc-rv3028.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,9 +902,20 @@ static int rv3028_probe(struct i2c_client *client)
return PTR_ERR(rv3028->rtc);

if (client->irq > 0) {
unsigned long flags;

/*
* If flags = 0, devm_request_threaded_irq() will use IRQ flags
* obtained from device tree.
*/
if (dev_fwnode(&client->dev))
flags = 0;
else
flags = IRQF_TRIGGER_LOW;

ret = devm_request_threaded_irq(&client->dev, client->irq,
NULL, rv3028_handle_irq,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
flags | IRQF_ONESHOT,
"rv3028", rv3028);
if (ret) {
dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n");
Expand Down

0 comments on commit 16b26f6

Please sign in to comment.