.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Real time clock driver for DA9052 |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright(c) 2012 Dialog Semiconductor Ltd. |
---|
5 | 6 | * |
---|
6 | 7 | * Author: Dajun Dajun Chen <dajun.chen@diasemi.com> |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License as published by |
---|
10 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
11 | | - * (at your option) any later version. |
---|
12 | | - * |
---|
13 | 8 | */ |
---|
14 | 9 | |
---|
15 | 10 | #include <linux/module.h> |
---|
.. | .. |
---|
108 | 103 | int ret; |
---|
109 | 104 | uint8_t v[3]; |
---|
110 | 105 | |
---|
111 | | - ret = rtc_tm_to_time(rtc_tm, &alm_time); |
---|
112 | | - if (ret != 0) |
---|
113 | | - return ret; |
---|
| 106 | + alm_time = rtc_tm_to_time64(rtc_tm); |
---|
114 | 107 | |
---|
115 | 108 | if (rtc_tm->tm_sec > 0) { |
---|
116 | 109 | alm_time += 60 - rtc_tm->tm_sec; |
---|
117 | | - rtc_time_to_tm(alm_time, rtc_tm); |
---|
| 110 | + rtc_time64_to_tm(alm_time, rtc_tm); |
---|
118 | 111 | } |
---|
119 | 112 | BUG_ON(rtc_tm->tm_sec); /* it will cause repeated irqs if not zero */ |
---|
120 | 113 | |
---|
.. | .. |
---|
303 | 296 | rtc_err(rtc, "Failed to disable TICKS: %d\n", ret); |
---|
304 | 297 | |
---|
305 | 298 | device_init_wakeup(&pdev->dev, true); |
---|
306 | | - rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
---|
307 | | - &da9052_rtc_ops, THIS_MODULE); |
---|
308 | | - |
---|
| 299 | + rtc->rtc = devm_rtc_allocate_device(&pdev->dev); |
---|
309 | 300 | if (IS_ERR(rtc->rtc)) |
---|
310 | 301 | return PTR_ERR(rtc->rtc); |
---|
311 | 302 | |
---|
| 303 | + rtc->rtc->ops = &da9052_rtc_ops; |
---|
| 304 | + rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; |
---|
| 305 | + rtc->rtc->range_max = RTC_TIMESTAMP_END_2063; |
---|
| 306 | + |
---|
| 307 | + ret = rtc_register_device(rtc->rtc); |
---|
| 308 | + if (ret) |
---|
| 309 | + return ret; |
---|
| 310 | + |
---|
312 | 311 | ret = da9052_request_irq(rtc->da9052, DA9052_IRQ_ALARM, "ALM", |
---|
313 | 312 | da9052_rtc_irq, rtc); |
---|
314 | 313 | if (ret != 0) { |
---|