Skip to content

Commit 8681de6

Browse files
bijudasalexandrebelloni
authored andcommitted
rtc: da9063: Make IRQ as optional
On some platforms (eg: RZ/{G2UL,Five} SMARC EVK), there is no IRQ populated by default. Add irq optional support. Signed-off-by: Biju Das <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent dd7fe5d commit 8681de6

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

drivers/rtc/rtc-da9063.c

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -485,25 +485,29 @@ static int da9063_rtc_probe(struct platform_device *pdev)
485485
clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->rtc_dev->features);
486486
}
487487

488-
irq_alarm = platform_get_irq_byname(pdev, "ALARM");
489-
if (irq_alarm < 0)
488+
irq_alarm = platform_get_irq_byname_optional(pdev, "ALARM");
489+
if (irq_alarm >= 0) {
490+
ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,
491+
da9063_alarm_event,
492+
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
493+
"ALARM", rtc);
494+
if (ret)
495+
dev_err(&pdev->dev,
496+
"Failed to request ALARM IRQ %d: %d\n",
497+
irq_alarm, ret);
498+
499+
ret = dev_pm_set_wake_irq(&pdev->dev, irq_alarm);
500+
if (ret)
501+
dev_warn(&pdev->dev,
502+
"Failed to set IRQ %d as a wake IRQ: %d\n",
503+
irq_alarm, ret);
504+
505+
device_init_wakeup(&pdev->dev, true);
506+
} else if (irq_alarm != -ENXIO) {
490507
return irq_alarm;
491-
492-
ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,
493-
da9063_alarm_event,
494-
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
495-
"ALARM", rtc);
496-
if (ret)
497-
dev_err(&pdev->dev, "Failed to request ALARM IRQ %d: %d\n",
498-
irq_alarm, ret);
499-
500-
ret = dev_pm_set_wake_irq(&pdev->dev, irq_alarm);
501-
if (ret)
502-
dev_warn(&pdev->dev,
503-
"Failed to set IRQ %d as a wake IRQ: %d\n",
504-
irq_alarm, ret);
505-
506-
device_init_wakeup(&pdev->dev, true);
508+
} else {
509+
clear_bit(RTC_FEATURE_ALARM, rtc->rtc_dev->features);
510+
}
507511

508512
return devm_rtc_register_device(rtc->rtc_dev);
509513
}

0 commit comments

Comments
 (0)