rtc: ab3100: set range
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 9 Apr 2019 19:59:43 +0000 (21:59 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 11 Apr 2019 14:42:55 +0000 (16:42 +0200)
The ab3100 has a 48bit counter running at 65536 Hz (despite one of the
comment). The max value is then (2^48 - 1)/2^16 == 2^32 - 1.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-ab3100.c

index 821ff52..f73a370 100644 (file)
@@ -228,15 +228,17 @@ static int __init ab3100_rtc_probe(struct platform_device *pdev)
                /* Ignore any error on this write */
        }
 
-       rtc = devm_rtc_device_register(&pdev->dev, "ab3100-rtc",
-                                       &ab3100_rtc_ops, THIS_MODULE);
-       if (IS_ERR(rtc)) {
-               err = PTR_ERR(rtc);
-               return err;
-       }
+       rtc = devm_rtc_allocate_device(&pdev->dev);
+       if (IS_ERR(rtc))
+               return PTR_ERR(rtc);
+
+       rtc->ops = &ab3100_rtc_ops;
+       /* 48bit counter at (AB3100_RTC_CLOCK_RATE * 2) */
+       rtc->range_max = U32_MAX;
+
        platform_set_drvdata(pdev, rtc);
 
-       return 0;
+       return rtc_register_device(rtc);
 }
 
 static struct platform_driver ab3100_rtc_driver = {