@@ -485,25 +485,29 @@ static int da9063_rtc_probe(struct platform_device *pdev)
485
485
clear_bit (RTC_FEATURE_UPDATE_INTERRUPT , rtc -> rtc_dev -> features );
486
486
}
487
487
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 ) {
490
507
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
+ }
507
511
508
512
return devm_rtc_register_device (rtc -> rtc_dev );
509
513
}
0 commit comments