* [PATCH] rtc: pcf2127: use IRQ flags obtained from device tree if available
@ 2022-01-17 22:57 Hugo Villeneuve
2022-02-15 22:30 ` (subset) " Alexandre Belloni
0 siblings, 1 reply; 2+ messages in thread
From: Hugo Villeneuve @ 2022-01-17 22:57 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni
Cc: hugo, Hugo Villeneuve, linux-rtc, linux-kernel
From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
If the interrupt pin of the PCF2127 is routed to the input of a GPIO
expander using the pca953x driver, the later will only accept an IRQ
of type IRQ_TYPE_EDGE_FALLING or IRQ_TYPE_EDGE_RISING, and the IRQ
request will fail.
Therefore, allow the IRQ type to be passed from the device tree data
if available.
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
drivers/rtc/rtc-pcf2127.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index e6d0838ccfe3..cea10fdbb010 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -659,9 +659,20 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
clear_bit(RTC_FEATURE_ALARM, pcf2127->rtc->features);
if (alarm_irq > 0) {
+ unsigned long flags;
+
+ /*
+ * If flags = 0, devm_request_threaded_irq() will use IRQ flags
+ * obtained from device tree.
+ */
+ if (dev_fwnode(dev))
+ flags = 0;
+ else
+ flags = IRQF_TRIGGER_LOW;
+
ret = devm_request_threaded_irq(dev, alarm_irq, NULL,
pcf2127_rtc_irq,
- IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+ flags | IRQF_ONESHOT,
dev_name(dev), dev);
if (ret) {
dev_err(dev, "failed to request alarm irq\n");
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: (subset) [PATCH] rtc: pcf2127: use IRQ flags obtained from device tree if available
2022-01-17 22:57 [PATCH] rtc: pcf2127: use IRQ flags obtained from device tree if available Hugo Villeneuve
@ 2022-02-15 22:30 ` Alexandre Belloni
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2022-02-15 22:30 UTC (permalink / raw)
To: Alessandro Zummo, Hugo Villeneuve
Cc: Alexandre Belloni, linux-kernel, Hugo Villeneuve, linux-rtc
On Mon, 17 Jan 2022 17:57:42 -0500, Hugo Villeneuve wrote:
> From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
>
> If the interrupt pin of the PCF2127 is routed to the input of a GPIO
> expander using the pca953x driver, the later will only accept an IRQ
> of type IRQ_TYPE_EDGE_FALLING or IRQ_TYPE_EDGE_RISING, and the IRQ
> request will fail.
>
> [...]
Applied, thanks!
[1/1] rtc: pcf2127: use IRQ flags obtained from device tree if available
commit: d4785b46345cc9564f883c94acc4c4de6bbfeea5
Best regards,
--
Alexandre Belloni <alexandre.belloni@bootlin.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-15 22:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 22:57 [PATCH] rtc: pcf2127: use IRQ flags obtained from device tree if available Hugo Villeneuve
2022-02-15 22:30 ` (subset) " 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).