rtc: ab3100: set range
Alexandre Belloni
maintainerPATCH 1/3 rtc: ab3100: set range
The ab3100 has a 48bit counter running at 65536 Hz (despite one of the comment). The max value is then (2^48 - 1)/2^16 == 2^32 - 1.
--- drivers/rtc/rtc-ab3100.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/rtc/rtc-ab3100.c +9 -7
@@ -228,15 +228,17 @@ static int __init ab3100_rtc_probe(struct platform_device *pdev)/* Ignore any error on this write */ } - rtc =devm_rtc_device_register (&pdev->dev,"ab3100-rtc" , - &ab3100_rtc_ops,THIS_MODULE ); -if (IS_ERR (rtc)) { - err =PTR_ERR (rtc); -return err; - } + rtc =devm_rtc_allocate_device (&pdev->dev); +if (IS_ERR (rtc)) +return PTR_ERR (rtc); + + rtc->ops = &ab3100_rtc_ops; +/* 48bit counter at (AB3100_RTC_CLOCK_RATE * 2) */ + rtc->range_max =U32_MAX ; +platform_set_drvdata (pdev, rtc); -return 0 ; +return rtc_register_device (rtc); }static struct platform_driver ab3100_rtc_driver = {
Signature · 1 line
2.20.1
Alexandre Belloni
maintainerPATCH 2/3 rtc: ab3100: use .set_time
Use .set_time instead of the deprecated .set_mmss64.
--- drivers/rtc/rtc-ab3100.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/rtc/rtc-ab3100.c +3 -3
@@ -43,12 +43,12 @@/* * RTC clock functions and device struct declaration */ -static int ab3100_rtc_set_mmss (struct device *dev,time64_t secs) +static int ab3100_rtc_set_time (struct device *dev,struct rtc_time *tm) {u8 regs[] = {AB3100_TI0 ,AB3100_TI1 ,AB3100_TI2 ,AB3100_TI3 ,AB3100_TI4 ,AB3100_TI5 };unsigned char buf[6 ]; -u64 hw_counter = secs *AB3100_RTC_CLOCK_RATE *2 ; +u64 hw_counter =rtc_tm_to_time64 (tm) *AB3100_RTC_CLOCK_RATE *2 ;int err =0 ;int i;
@@ -192,7 +192,7 @@ static int ab3100_rtc_irq_enable(struct device *dev, unsigned int enabled)static const struct rtc_class_ops ab3100_rtc_ops = { .read_time = ab3100_rtc_read_time, - .set_mmss64 = ab3100_rtc_set_mmss, + .set_time = ab3100_rtc_set_time, .read_alarm = ab3100_rtc_read_alarm, .set_alarm = ab3100_rtc_set_alarm, .alarm_irq_enable = ab3100_rtc_irq_enable,
Signature · 1 line
2.20.1
Re: [PATCH 2/3] rtc: ab3100: use .set_time
Quoted 3 lines · Alexandre Belloni
Use .set_time instead of the deprecated .set_mmss64.
Signed-off-by Alexandre Belloni <[email protected]>
Yours,
Linus Walleij
Alexandre Belloni
maintainerPATCH 3/3 rtc: ab3100: convert to SPDX identifier
In reply to Alexandre BelloniUse SPDX-License-Identifier instead of the custom license line.
--- drivers/rtc/rtc-ab3100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-ab3100.c +1 -1
@@ -1,6 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2007-2009 ST-Ericsson AB -* License terms: GNU General Public License (GPL) version 2 * RTC clock driver for the AB3100 Analog Baseband Chip * Author: Linus Walleij <[email protected]> */
Signature · 1 line
2.20.1
Re: [PATCH 3/3] rtc: ab3100: convert to SPDX identifier
Quoted 3 lines · Alexandre Belloni
Use SPDX-License-Identifier instead of the custom license line.
Signed-off-by Alexandre Belloni <[email protected]>
Yours,
Linus Walleij
Quoted 4 lines · Alexandre Belloni
The ab3100 has a 48bit counter running at 65536 Hz (despite one of the comment). The max value is then (2^48 - 1)/2^16 == 2^32 - 1.
Signed-off-by Alexandre Belloni <[email protected]>
Ah, sweet.
Yours,
Linus Walleij