rtc: stmp3xxx: set range
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 7 Apr 2019 21:12:20 +0000 (23:12 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 11 Apr 2019 14:42:51 +0000 (16:42 +0200)
From the datasheet: "HW_RTC_SECONDS provides access to the 32-bit real-time
seconds counter."

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

index b76318fd5bb004b4fa492de45df151e9b46b9a35..a6a2963e89a518728294b4dd033d952f2dc7d773 100644 (file)
@@ -361,8 +361,7 @@ static int stmp3xxx_rtc_probe(struct platform_device *pdev)
                        STMP3XXX_RTC_CTRL_ALARM_IRQ_EN,
                rtc_data->io + STMP3XXX_RTC_CTRL + STMP_OFFSET_REG_CLR);
 
-       rtc_data->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
-                               &stmp3xxx_rtc_ops, THIS_MODULE);
+       rtc_data->rtc = devm_rtc_allocate_device(&pdev->dev);
        if (IS_ERR(rtc_data->rtc))
                return PTR_ERR(rtc_data->rtc);
 
@@ -374,6 +373,13 @@ static int stmp3xxx_rtc_probe(struct platform_device *pdev)
                return err;
        }
 
+       rtc_data->rtc->ops = &stmp3xxx_rtc_ops;
+       rtc_data->rtc->range_max = U32_MAX;
+
+       err = rtc_register_device(rtc_data->rtc);
+       if (err)
+               return err;
+
        stmp3xxx_wdt_register(pdev);
        return 0;
 }