rtc: imxdi: set range
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 16 Apr 2019 08:34:28 +0000 (10:34 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 29 Apr 2019 13:53:43 +0000 (15:53 +0200)
The RTC Time Counter MSB Register contains the 32 most significant bits
(47:16) of the 47-bit RTC Time Counter. Clocked by a 32.768 KHz clock, this
register is effectively a 32-bit seconds counter.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-imxdi.c

index 80931114c8997a93dddd55a857593ce301a3c4d4..43d9cad69241b66fe4c1fb64fd266f8e7dcdf353 100644 (file)
@@ -796,6 +796,10 @@ static int __init dryice_rtc_probe(struct platform_device *pdev)
 
        mutex_init(&imxdi->write_mutex);
 
+       imxdi->rtc = devm_rtc_allocate_device(&pdev->dev);
+       if (IS_ERR(imxdi->rtc))
+               return PTR_ERR(imxdi->rtc);
+
        imxdi->clk = devm_clk_get(&pdev->dev, NULL);
        if (IS_ERR(imxdi->clk))
                return PTR_ERR(imxdi->clk);
@@ -829,12 +833,13 @@ static int __init dryice_rtc_probe(struct platform_device *pdev)
        }
 
        platform_set_drvdata(pdev, imxdi);
-       imxdi->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
-                                 &dryice_rtc_ops, THIS_MODULE);
-       if (IS_ERR(imxdi->rtc)) {
-               rc = PTR_ERR(imxdi->rtc);
+
+       imxdi->rtc->ops = &dryice_rtc_ops;
+       imxdi->rtc->range_max = U32_MAX;
+
+       rc = rtc_register_device(imxdi->rtc);
+       if (rc)
                goto err;
-       }
 
        return 0;