History

rtc: da9063: set range

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

Alexandre Belloni committed 7 years ago

Commit 5ff404d1 parent 64bef022 files · +7 −3Browse files

Unified · Split

2 files
  1. drivers/rtc/rtc-da9063.c +6 −3
  2. include/linux/rtc.h +1 −0
drivers/rtc/rtc-da9063.c+6−3
@@ -464,11 +464,14 @@ static int da9063_rtc_probe(struct platform_device *pdev) · 463 unmodified lines
464464
465465 platform_set_drvdata(pdev, rtc);
466466
467− rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, DA9063_DRVNAME_RTC,
468− &da9063_rtc_ops, THIS_MODULE);
467+ rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
469468 if (IS_ERR(rtc->rtc_dev))
470469 return PTR_ERR(rtc->rtc_dev);
471470
471+ rtc->rtc_dev->ops = &da9063_rtc_ops;
472+ rtc->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_2000;
473+ rtc->rtc_dev->range_max = RTC_TIMESTAMP_END_2063;
474+
472475 da9063_data_to_tm(data, &rtc->alarm_time, rtc);
473476 rtc->rtc_sync = false;
474477
@@ -481,7 +484,7 @@ static int da9063_rtc_probe(struct platform_device *pdev) · 6 unmodified lines
481484 dev_err(&pdev->dev, "Failed to request ALARM IRQ %d: %d\n",
482485 irq_alarm, ret);
483486
484− return ret;
487+ return rtc_register_device(rtc->rtc_dev);
485488 }
486489
487490 static struct platform_driver da9063_rtc_driver = {
include/linux/rtc.h+1−0
@@ -164,6 +164,7 @@ struct rtc_device { · 163 unmodified lines
164164 /* useful timestamps */
165165 #define RTC_TIMESTAMP_BEGIN_1900 -2208989361LL /* 1900-01-01 00:00:00 */
166166 #define RTC_TIMESTAMP_BEGIN_2000 946684800LL /* 2000-01-01 00:00:00 */
167+#define RTC_TIMESTAMP_END_2063 2966371199LL /* 2063-12-31 23:59:59 */
167168 #define RTC_TIMESTAMP_END_2099 4102444799LL /* 2099-12-31 23:59:59 */
168169 #define RTC_TIMESTAMP_END_9999 253402300799LL /* 9999-12-31 23:59:59 */
169170

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t