linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] rtc: da9063: set range
@ 2019-03-21 10:15 Alexandre Belloni
  2019-03-21 10:15 ` [PATCH 2/2] rtc: da9063: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Alexandre Belloni @ 2019-03-21 10:15 UTC (permalink / raw)
  To: linux-rtc
  Cc: linux-kernel, Wolfram Sang, Support Opensource,
	linux-renesas-soc, Alexandre Belloni

The DA9062 and DA9063 have a year register that can go up to 0x3F.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-da9063.c | 9 ++++++---
 include/linux/rtc.h      | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-da9063.c b/drivers/rtc/rtc-da9063.c
index 73b38d207d7e..b7052156e851 100644
--- a/drivers/rtc/rtc-da9063.c
+++ b/drivers/rtc/rtc-da9063.c
@@ -464,11 +464,14 @@ static int da9063_rtc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, rtc);
 
-	rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, DA9063_DRVNAME_RTC,
-					   &da9063_rtc_ops, THIS_MODULE);
+	rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
 	if (IS_ERR(rtc->rtc_dev))
 		return PTR_ERR(rtc->rtc_dev);
 
+	rtc->rtc_dev->ops = &da9063_rtc_ops;
+	rtc->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_2000;
+	rtc->rtc_dev->range_max = RTC_TIMESTAMP_END_2063;
+
 	da9063_data_to_tm(data, &rtc->alarm_time, rtc);
 	rtc->rtc_sync = false;
 
@@ -481,7 +484,7 @@ static int da9063_rtc_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "Failed to request ALARM IRQ %d: %d\n",
 			irq_alarm, ret);
 
-	return ret;
+	return rtc_register_device(rtc->rtc_dev);
 }
 
 static struct platform_driver da9063_rtc_driver = {
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 588120ba372c..09fb4af5edab 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -164,6 +164,7 @@ struct rtc_device {
 /* useful timestamps */
 #define RTC_TIMESTAMP_BEGIN_1900	-2208989361LL /* 1900-01-01 00:00:00 */
 #define RTC_TIMESTAMP_BEGIN_2000	946684800LL /* 2000-01-01 00:00:00 */
+#define RTC_TIMESTAMP_END_2063		2966371199LL /* 2063-12-31 23:59:59 */
 #define RTC_TIMESTAMP_END_2099		4102444799LL /* 2099-12-31 23:59:59 */
 #define RTC_TIMESTAMP_END_9999		253402300799LL /* 9999-12-31 23:59:59 */
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2019-04-02 11:52 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21 10:15 [PATCH 1/2] rtc: da9063: set range Alexandre Belloni
2019-03-21 10:15 ` [PATCH 2/2] rtc: da9063: switch to rtc_time64_to_tm/rtc_tm_to_time64 Alexandre Belloni
2019-03-22 15:28   ` Steve Twiss
2019-04-01  8:43   ` Wolfram Sang
2019-04-01 12:42     ` Steve Twiss
2019-03-22 15:16 ` [PATCH 1/2] rtc: da9063: set range Steve Twiss
2019-04-01  8:41 ` Wolfram Sang
2019-04-01  8:59   ` Geert Uytterhoeven
2019-04-01 12:39     ` Steve Twiss
2019-04-01 12:42       ` Geert Uytterhoeven
2019-04-01 13:00         ` Steve Twiss
2019-04-01 13:21         ` Wolfram Sang
2019-04-01 13:39           ` Geert Uytterhoeven
2019-04-01 15:07             ` Wolfram Sang
2019-04-01 15:16               ` Alexandre Belloni
2019-04-01 15:52                 ` Wolfram Sang
2019-04-01 18:53                   ` Alexandre Belloni
2019-04-01 19:34                     ` Wolfram Sang
2019-04-02  8:53                       ` Alexandre Belloni
2019-04-02  9:33                         ` Wolfram Sang
2019-04-02  9:51                           ` Alexandre Belloni
2019-04-02 10:33                             ` Steve Twiss
2019-04-02 10:42                               ` Alexandre Belloni
2019-04-02 11:14                                 ` Wolfram Sang
2019-04-02 11:52                                   ` Steve Twiss
2019-04-02  9:37                         ` Steve Twiss
2019-04-02 10:30                           ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).