aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-max77686.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-max77686.c')
-rw-r--r--drivers/rtc/rtc-max77686.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 9efe118a28ba..d20a7f0786eb 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -492,16 +492,11 @@ static int max77686_rtc_init_reg(struct max77686_rtc_info *info)
492 return ret; 492 return ret;
493} 493}
494 494
495static struct regmap_config max77686_rtc_regmap_config = {
496 .reg_bits = 8,
497 .val_bits = 8,
498};
499
500static int max77686_rtc_probe(struct platform_device *pdev) 495static int max77686_rtc_probe(struct platform_device *pdev)
501{ 496{
502 struct max77686_dev *max77686 = dev_get_drvdata(pdev->dev.parent); 497 struct max77686_dev *max77686 = dev_get_drvdata(pdev->dev.parent);
503 struct max77686_rtc_info *info; 498 struct max77686_rtc_info *info;
504 int ret, virq; 499 int ret;
505 500
506 dev_info(&pdev->dev, "%s\n", __func__); 501 dev_info(&pdev->dev, "%s\n", __func__);
507 502
@@ -514,14 +509,7 @@ static int max77686_rtc_probe(struct platform_device *pdev)
514 info->dev = &pdev->dev; 509 info->dev = &pdev->dev;
515 info->max77686 = max77686; 510 info->max77686 = max77686;
516 info->rtc = max77686->rtc; 511 info->rtc = max77686->rtc;
517 info->max77686->rtc_regmap = devm_regmap_init_i2c(info->max77686->rtc, 512
518 &max77686_rtc_regmap_config);
519 if (IS_ERR(info->max77686->rtc_regmap)) {
520 ret = PTR_ERR(info->max77686->rtc_regmap);
521 dev_err(info->max77686->dev, "Failed to allocate register map: %d\n",
522 ret);
523 return ret;
524 }
525 platform_set_drvdata(pdev, info); 513 platform_set_drvdata(pdev, info);
526 514
527 ret = max77686_rtc_init_reg(info); 515 ret = max77686_rtc_init_reg(info);
@@ -550,15 +538,16 @@ static int max77686_rtc_probe(struct platform_device *pdev)
550 ret = -EINVAL; 538 ret = -EINVAL;
551 goto err_rtc; 539 goto err_rtc;
552 } 540 }
553 virq = irq_create_mapping(max77686->irq_domain, MAX77686_RTCIRQ_RTCA1); 541
554 if (!virq) { 542 info->virq = regmap_irq_get_virq(max77686->rtc_irq_data,
543 MAX77686_RTCIRQ_RTCA1);
544 if (!info->virq) {
555 ret = -ENXIO; 545 ret = -ENXIO;
556 goto err_rtc; 546 goto err_rtc;
557 } 547 }
558 info->virq = virq;
559 548
560 ret = devm_request_threaded_irq(&pdev->dev, virq, NULL, 549 ret = devm_request_threaded_irq(&pdev->dev, info->virq, NULL,
561 max77686_rtc_alarm_irq, 0, "rtc-alarm0", info); 550 max77686_rtc_alarm_irq, 0, "rtc-alarm1", info);
562 if (ret < 0) 551 if (ret < 0)
563 dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", 552 dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
564 info->virq, ret); 553 info->virq, ret);