linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] rtc: ab3100: set range
@ 2019-04-09 19:59 Alexandre Belloni
  2019-04-09 19:59 ` [PATCH 2/3] rtc: ab3100: use .set_time Alexandre Belloni
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexandre Belloni @ 2019-04-09 19:59 UTC (permalink / raw)
  To: linux-rtc
  Cc: Linus Walleij, linux-arm-kernel, linux-kernel, 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 <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-ab3100.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c
index 821ff52a2222..f73a3707b897 100644
--- a/drivers/rtc/rtc-ab3100.c
+++ b/drivers/rtc/rtc-ab3100.c
@@ -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 = {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] rtc: ab3100: use .set_time
  2019-04-09 19:59 [PATCH 1/3] rtc: ab3100: set range Alexandre Belloni
@ 2019-04-09 19:59 ` Alexandre Belloni
  2019-04-11 13:38   ` Linus Walleij
  2019-04-09 19:59 ` [PATCH 3/3] rtc: ab3100: convert to SPDX identifier Alexandre Belloni
  2019-04-11 13:38 ` [PATCH 1/3] rtc: ab3100: set range Linus Walleij
  2 siblings, 1 reply; 6+ messages in thread
From: Alexandre Belloni @ 2019-04-09 19:59 UTC (permalink / raw)
  To: linux-rtc
  Cc: Linus Walleij, linux-arm-kernel, linux-kernel, Alexandre Belloni

Use .set_time instead of the deprecated .set_mmss64.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-ab3100.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c
index f73a3707b897..ecf3f1494c13 100644
--- a/drivers/rtc/rtc-ab3100.c
+++ b/drivers/rtc/rtc-ab3100.c
@@ -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,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] rtc: ab3100: convert to SPDX identifier
  2019-04-09 19:59 [PATCH 1/3] rtc: ab3100: set range Alexandre Belloni
  2019-04-09 19:59 ` [PATCH 2/3] rtc: ab3100: use .set_time Alexandre Belloni
@ 2019-04-09 19:59 ` Alexandre Belloni
  2019-04-11 13:38   ` Linus Walleij
  2019-04-11 13:38 ` [PATCH 1/3] rtc: ab3100: set range Linus Walleij
  2 siblings, 1 reply; 6+ messages in thread
From: Alexandre Belloni @ 2019-04-09 19:59 UTC (permalink / raw)
  To: linux-rtc
  Cc: Linus Walleij, linux-arm-kernel, linux-kernel, Alexandre Belloni

Use SPDX-License-Identifier instead of the custom license line.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-ab3100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c
index ecf3f1494c13..2ed6def90975 100644
--- a/drivers/rtc/rtc-ab3100.c
+++ b/drivers/rtc/rtc-ab3100.c
@@ -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 <linus.walleij@stericsson.com>
  */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] rtc: ab3100: set range
  2019-04-09 19:59 [PATCH 1/3] rtc: ab3100: set range Alexandre Belloni
  2019-04-09 19:59 ` [PATCH 2/3] rtc: ab3100: use .set_time Alexandre Belloni
  2019-04-09 19:59 ` [PATCH 3/3] rtc: ab3100: convert to SPDX identifier Alexandre Belloni
@ 2019-04-11 13:38 ` Linus Walleij
  2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2019-04-11 13:38 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: linux-rtc, Linus Walleij, Linux ARM, linux-kernel

On Tue, Apr 9, 2019 at 9:59 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:

> 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 <alexandre.belloni@bootlin.com>

Ah, sweet.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] rtc: ab3100: use .set_time
  2019-04-09 19:59 ` [PATCH 2/3] rtc: ab3100: use .set_time Alexandre Belloni
@ 2019-04-11 13:38   ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2019-04-11 13:38 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: linux-rtc, Linus Walleij, Linux ARM, linux-kernel

On Tue, Apr 9, 2019 at 10:00 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:

> Use .set_time instead of the deprecated .set_mmss64.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] rtc: ab3100: convert to SPDX identifier
  2019-04-09 19:59 ` [PATCH 3/3] rtc: ab3100: convert to SPDX identifier Alexandre Belloni
@ 2019-04-11 13:38   ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2019-04-11 13:38 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: linux-rtc, Linus Walleij, Linux ARM, linux-kernel

On Tue, Apr 9, 2019 at 10:00 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:

> Use SPDX-License-Identifier instead of the custom license line.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-04-11 13:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09 19:59 [PATCH 1/3] rtc: ab3100: set range Alexandre Belloni
2019-04-09 19:59 ` [PATCH 2/3] rtc: ab3100: use .set_time Alexandre Belloni
2019-04-11 13:38   ` Linus Walleij
2019-04-09 19:59 ` [PATCH 3/3] rtc: ab3100: convert to SPDX identifier Alexandre Belloni
2019-04-11 13:38   ` Linus Walleij
2019-04-11 13:38 ` [PATCH 1/3] rtc: ab3100: set range Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).