hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/rtc/rtc-ab3100.c
....@@ -1,6 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (C) 2007-2009 ST-Ericsson AB
3
- * License terms: GNU General Public License (GPL) version 2
44 * RTC clock driver for the AB3100 Analog Baseband Chip
55 * Author: Linus Walleij <linus.walleij@stericsson.com>
66 */
....@@ -43,12 +43,12 @@
4343 /*
4444 * RTC clock functions and device struct declaration
4545 */
46
-static int ab3100_rtc_set_mmss(struct device *dev, time64_t secs)
46
+static int ab3100_rtc_set_time(struct device *dev, struct rtc_time *tm)
4747 {
4848 u8 regs[] = {AB3100_TI0, AB3100_TI1, AB3100_TI2,
4949 AB3100_TI3, AB3100_TI4, AB3100_TI5};
5050 unsigned char buf[6];
51
- u64 hw_counter = secs * AB3100_RTC_CLOCK_RATE * 2;
51
+ u64 hw_counter = rtc_tm_to_time64(tm) * AB3100_RTC_CLOCK_RATE * 2;
5252 int err = 0;
5353 int i;
5454
....@@ -192,7 +192,7 @@
192192
193193 static const struct rtc_class_ops ab3100_rtc_ops = {
194194 .read_time = ab3100_rtc_read_time,
195
- .set_mmss64 = ab3100_rtc_set_mmss,
195
+ .set_time = ab3100_rtc_set_time,
196196 .read_alarm = ab3100_rtc_read_alarm,
197197 .set_alarm = ab3100_rtc_set_alarm,
198198 .alarm_irq_enable = ab3100_rtc_irq_enable,
....@@ -228,15 +228,17 @@
228228 /* Ignore any error on this write */
229229 }
230230
231
- rtc = devm_rtc_device_register(&pdev->dev, "ab3100-rtc",
232
- &ab3100_rtc_ops, THIS_MODULE);
233
- if (IS_ERR(rtc)) {
234
- err = PTR_ERR(rtc);
235
- return err;
236
- }
231
+ rtc = devm_rtc_allocate_device(&pdev->dev);
232
+ if (IS_ERR(rtc))
233
+ return PTR_ERR(rtc);
234
+
235
+ rtc->ops = &ab3100_rtc_ops;
236
+ /* 48bit counter at (AB3100_RTC_CLOCK_RATE * 2) */
237
+ rtc->range_max = U32_MAX;
238
+
237239 platform_set_drvdata(pdev, rtc);
238240
239
- return 0;
241
+ return rtc_register_device(rtc);
240242 }
241243
242244 static struct platform_driver ab3100_rtc_driver = {