2019-05-23 12:04:34

by Richard Leitner

[permalink] [raw]
Subject: [PATCH v2 0/4] rtc: s35390a: uie_unsupported and minor fixes

As the s35390a does only support per-minute based alarms we have to
set the uie_unsupported flag. Otherwise it delays for 10sec and
fails afterwards with modern hwclock versions.

Furthermore some other minor changes are made.

All patches were tested on an i.MX6 platform.

CHANGES v2:
- use BIT in "clarify INT2 pin output modes"
- add "change FLAG defines to use BIT macro"

Richard Leitner (4):
rtc: s35390a: clarify INT2 pin output modes
rtc: s35390a: set uie_unsupported
rtc: s35390a: introduce struct device in probe
rtc: s35390a: change FLAG defines to use BIT macro

drivers/rtc/rtc-s35390a.c | 55 +++++++++++++++++++++------------------
1 file changed, 29 insertions(+), 26 deletions(-)

--
2.20.1


2019-05-23 12:05:41

by Richard Leitner

[permalink] [raw]
Subject: [PATCH v2 2/4] rtc: s35390a: set uie_unsupported

Alarms are only supported on a per minute basis. This is why
uie_unsupported is set. Furthermore issue a warning when a second based
alarm is requested.

Signed-off-by: Richard Leitner <[email protected]>
---
drivers/rtc/rtc-s35390a.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index fb795c454077..4ca37f281ed9 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -289,6 +289,9 @@ static int s35390a_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
alm->time.tm_min, alm->time.tm_hour, alm->time.tm_mday,
alm->time.tm_mon, alm->time.tm_year, alm->time.tm_wday);

+ if (alm->time.tm_sec != 0)
+ dev_warn(&client->dev, "Alarms are only supported on a per minute basis!\n");
+
/* disable interrupt (which deasserts the irq line) */
err = s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, &sts, sizeof(sts));
if (err < 0)
@@ -500,6 +503,9 @@ static int s35390a_probe(struct i2c_client *client,
goto exit_dummy;
}

+ /* supports per-minute alarms only, therefore set uie_unsupported */
+ s35390a->rtc->uie_unsupported = 1;
+
if (status1 & S35390A_FLAG_INT2)
rtc_update_irq(s35390a->rtc, 1, RTC_AF);

--
2.20.1

2019-05-23 12:06:01

by Richard Leitner

[permalink] [raw]
Subject: [PATCH v2 4/4] rtc: s35390a: change FLAG defines to use BIT macro

To be consistent change the S35390A_FLAG defines to use the BIT
macro (like the S35390A_INT2_MODE defines).

Signed-off-by: Richard Leitner <[email protected]>
---
drivers/rtc/rtc-s35390a.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 7293dcdea692..b18ce5610a94 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -36,14 +36,14 @@
#define S35390A_ALRM_BYTE_MINS 2

/* flags for STATUS1 */
-#define S35390A_FLAG_POC 0x01
-#define S35390A_FLAG_BLD 0x02
-#define S35390A_FLAG_INT2 0x04
-#define S35390A_FLAG_24H 0x40
-#define S35390A_FLAG_RESET 0x80
+#define S35390A_FLAG_POC BIT(0)
+#define S35390A_FLAG_BLD BIT(1)
+#define S35390A_FLAG_INT2 BIT(2)
+#define S35390A_FLAG_24H BIT(6)
+#define S35390A_FLAG_RESET BIT(7)

/* flag for STATUS2 */
-#define S35390A_FLAG_TEST 0x01
+#define S35390A_FLAG_TEST BIT(0)

/* INT2 pin output mode */
#define S35390A_INT2_MODE_MASK 0x0E
--
2.20.1

2019-05-23 16:30:52

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] rtc: s35390a: uie_unsupported and minor fixes

On 23/05/2019 13:54:47+0200, Richard Leitner wrote:
> As the s35390a does only support per-minute based alarms we have to
> set the uie_unsupported flag. Otherwise it delays for 10sec and
> fails afterwards with modern hwclock versions.
>
> Furthermore some other minor changes are made.
>
> All patches were tested on an i.MX6 platform.
>
> CHANGES v2:
> - use BIT in "clarify INT2 pin output modes"
> - add "change FLAG defines to use BIT macro"
>
> Richard Leitner (4):
> rtc: s35390a: clarify INT2 pin output modes
> rtc: s35390a: set uie_unsupported
> rtc: s35390a: introduce struct device in probe
> rtc: s35390a: change FLAG defines to use BIT macro
>
> drivers/rtc/rtc-s35390a.c | 55 +++++++++++++++++++++------------------
> 1 file changed, 29 insertions(+), 26 deletions(-)
>

Applied, thanks.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com