diff options
Diffstat (limited to 'drivers/rtc/rtc-ab3100.c')
-rw-r--r-- | drivers/rtc/rtc-ab3100.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c index 821ff52a2222..2ed6def90975 100644 --- a/drivers/rtc/rtc-ab3100.c +++ b/drivers/rtc/rtc-ab3100.c | |||
@@ -1,6 +1,6 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2007-2009 ST-Ericsson AB | 3 | * Copyright (C) 2007-2009 ST-Ericsson AB |
3 | * License terms: GNU General Public License (GPL) version 2 | ||
4 | * RTC clock driver for the AB3100 Analog Baseband Chip | 4 | * RTC clock driver for the AB3100 Analog Baseband Chip |
5 | * Author: Linus Walleij <linus.walleij@stericsson.com> | 5 | * Author: Linus Walleij <linus.walleij@stericsson.com> |
6 | */ | 6 | */ |
@@ -43,12 +43,12 @@ | |||
43 | /* | 43 | /* |
44 | * RTC clock functions and device struct declaration | 44 | * RTC clock functions and device struct declaration |
45 | */ | 45 | */ |
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) |
47 | { | 47 | { |
48 | u8 regs[] = {AB3100_TI0, AB3100_TI1, AB3100_TI2, | 48 | u8 regs[] = {AB3100_TI0, AB3100_TI1, AB3100_TI2, |
49 | AB3100_TI3, AB3100_TI4, AB3100_TI5}; | 49 | AB3100_TI3, AB3100_TI4, AB3100_TI5}; |
50 | unsigned char buf[6]; | 50 | 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; |
52 | int err = 0; | 52 | int err = 0; |
53 | int i; | 53 | int i; |
54 | 54 | ||
@@ -192,7 +192,7 @@ static int ab3100_rtc_irq_enable(struct device *dev, unsigned int enabled) | |||
192 | 192 | ||
193 | static const struct rtc_class_ops ab3100_rtc_ops = { | 193 | static const struct rtc_class_ops ab3100_rtc_ops = { |
194 | .read_time = ab3100_rtc_read_time, | 194 | .read_time = ab3100_rtc_read_time, |
195 | .set_mmss64 = ab3100_rtc_set_mmss, | 195 | .set_time = ab3100_rtc_set_time, |
196 | .read_alarm = ab3100_rtc_read_alarm, | 196 | .read_alarm = ab3100_rtc_read_alarm, |
197 | .set_alarm = ab3100_rtc_set_alarm, | 197 | .set_alarm = ab3100_rtc_set_alarm, |
198 | .alarm_irq_enable = ab3100_rtc_irq_enable, | 198 | .alarm_irq_enable = ab3100_rtc_irq_enable, |
@@ -228,15 +228,17 @@ static int __init ab3100_rtc_probe(struct platform_device *pdev) | |||
228 | /* Ignore any error on this write */ | 228 | /* Ignore any error on this write */ |
229 | } | 229 | } |
230 | 230 | ||
231 | rtc = devm_rtc_device_register(&pdev->dev, "ab3100-rtc", | 231 | rtc = devm_rtc_allocate_device(&pdev->dev); |
232 | &ab3100_rtc_ops, THIS_MODULE); | 232 | if (IS_ERR(rtc)) |
233 | if (IS_ERR(rtc)) { | 233 | return PTR_ERR(rtc); |
234 | err = PTR_ERR(rtc); | 234 | |
235 | return err; | 235 | rtc->ops = &ab3100_rtc_ops; |
236 | } | 236 | /* 48bit counter at (AB3100_RTC_CLOCK_RATE * 2) */ |
237 | rtc->range_max = U32_MAX; | ||
238 | |||
237 | platform_set_drvdata(pdev, rtc); | 239 | platform_set_drvdata(pdev, rtc); |
238 | 240 | ||
239 | return 0; | 241 | return rtc_register_device(rtc); |
240 | } | 242 | } |
241 | 243 | ||
242 | static struct platform_driver ab3100_rtc_driver = { | 244 | static struct platform_driver ab3100_rtc_driver = { |