rtc: pcf8523: use IRQ flags obtained from fwnode
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 23 Jan 2023 20:02:12 +0000 (21:02 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 1 Feb 2023 08:13:35 +0000 (09:13 +0100)
Allow the IRQ type to be passed from the device tree if available as there
may be components changing the trigger type of the interrupt between the
RTC and the IRQ controller.

Link: https://lore.kernel.org/r/20230123200217.1236011-7-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-pcf8523.c

index 92de99f..2e111cd 100644 (file)
@@ -445,13 +445,18 @@ static int pcf8523_probe(struct i2c_client *client)
        clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features);
 
        if (client->irq > 0) {
+               unsigned long irqflags = IRQF_TRIGGER_LOW;
+
+               if (dev_fwnode(&client->dev))
+                       irqflags = 0;
+
                err = regmap_write(pcf8523->regmap, PCF8523_TMR_CLKOUT_CTRL, 0x38);
                if (err < 0)
                        return err;
 
                err = devm_request_threaded_irq(&client->dev, client->irq,
                                                NULL, pcf8523_irq,
-                                               IRQF_SHARED | IRQF_ONESHOT | IRQF_TRIGGER_LOW,
+                                               IRQF_SHARED | IRQF_ONESHOT | irqflags,
                                                dev_name(&rtc->dev), pcf8523);
                if (err)
                        return err;