From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Markus Probst <markus.probst@posteo.de>
Cc: "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Uwe Kleine-König" <uwe@kleine-koenig.org>,
"Andrew Lunn" <andrew@lunn.ch>,
"Gregory Clement" <gregory.clement@bootlin.com>,
"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
"Michael Langer" <michael.brainbug.langer@googlemail.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
linux-arm-kernel@lists.infradead.org, linux-rtc@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/5] rtc: s35390a: Fix alarm not disabling
Date: Sun, 2 Aug 2026 00:06:50 +0200 [thread overview]
Message-ID: <20260801220650361c83dd@mail.local> (raw)
In-Reply-To: <20260801-rtc_s35390a_int1-v2-3-f10c99ad1d6c@posteo.de>
On 01/08/2026 18:43:02+0000, Markus Probst wrote:
> Implement alarm_irq_enable callback to disable alarm if requested.
> On reenable restore last used alarm time.
>
> Fixes: 542dd33a4925 ("drivers/rtc/rtc-s35390a.c: add wakealarm support for rtc-s35390A rtc chip")
> Signed-off-by: Markus Probst <markus.probst@posteo.de>
> ---
> drivers/rtc/rtc-s35390a.c | 28 +++++++++++++++++++++++-----
> 1 file changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
> index 4cfe7034c516..fbf5471eb3d0 100644
> --- a/drivers/rtc/rtc-s35390a.c
> +++ b/drivers/rtc/rtc-s35390a.c
> @@ -64,6 +64,7 @@ MODULE_DEVICE_TABLE(of, s35390a_of_match);
>
> struct s35390a {
> struct i2c_client *client[8];
> + struct rtc_time tm_alarm;
> int twentyfourhour;
> };
>
> @@ -320,6 +321,9 @@ static int s35390a_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
> err = s35390a_set_reg(s35390a, S35390A_CMD_INT2_REG1, buf,
> sizeof(buf));
>
> + if (!err)
> + s35390a->tm_alarm = alm->time;
> +
> return err;
> }
>
> @@ -379,6 +383,19 @@ static int s35390a_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
> return 0;
> }
>
> +static int s35390a_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
> +{
> + struct s35390a *s35390a = dev_get_drvdata(dev);
> + struct rtc_wkalrm alm;
> +
> + alm.enabled = enabled;
> +
> + if (enabled)
> + alm.time = s35390a->tm_alarm;
> +
> + return s35390a_rtc_set_alarm(dev, &alm);
You should do the opposite, set_alarm needs to call
s35390a_rtc_alarm_irq_enable instead or simply set S35390A_CMD_STATUS2
here.
> +}
> +
> static int s35390a_rtc_ioctl(struct device *dev, unsigned int cmd,
> unsigned long arg)
> {
> @@ -410,11 +427,12 @@ static int s35390a_rtc_ioctl(struct device *dev, unsigned int cmd,
> }
>
> static const struct rtc_class_ops s35390a_rtc_ops = {
> - .read_time = s35390a_rtc_read_time,
> - .set_time = s35390a_rtc_set_time,
> - .set_alarm = s35390a_rtc_set_alarm,
> - .read_alarm = s35390a_rtc_read_alarm,
> - .ioctl = s35390a_rtc_ioctl,
> + .read_time = s35390a_rtc_read_time,
> + .set_time = s35390a_rtc_set_time,
> + .set_alarm = s35390a_rtc_set_alarm,
> + .read_alarm = s35390a_rtc_read_alarm,
> + .alarm_irq_enable = s35390a_rtc_alarm_irq_enable,
> + .ioctl = s35390a_rtc_ioctl,
> };
>
> static int s35390a_nvmem_read(void *priv, unsigned int offset, void *val,
>
> --
> 2.54.0
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2026-08-01 22:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-01 18:42 [PATCH v2 0/5] rtc: s35390a: Allow use of output pin for interrupt signal 1 for wakealarm Markus Probst
2026-08-01 18:43 ` [PATCH v2 1/5] dt-bindings: rtc: Add pinctrl for S35390A Markus Probst
2026-08-01 18:51 ` sashiko-bot
2026-08-01 18:43 ` [PATCH v2 2/5] rtc: s35390a: Add missing newline to dev_err Markus Probst
2026-08-01 18:46 ` sashiko-bot
2026-08-01 18:43 ` [PATCH v2 3/5] rtc: s35390a: Fix alarm not disabling Markus Probst
2026-08-01 18:55 ` sashiko-bot
2026-08-01 22:06 ` Alexandre Belloni [this message]
2026-08-01 18:43 ` [PATCH v2 4/5] rtc: s35390a: Add pinctrl Markus Probst
2026-08-01 18:58 ` sashiko-bot
2026-08-01 18:43 ` [PATCH v2 5/5] rtc: s35390a: Add synology quirk Markus Probst
2026-08-01 18:52 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260801220650361c83dd@mail.local \
--to=alexandre.belloni@bootlin.com \
--cc=akpm@linux-foundation.org \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregory.clement@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=markus.probst@posteo.de \
--cc=michael.brainbug.langer@googlemail.com \
--cc=robh@kernel.org \
--cc=sebastian.hesselbarth@gmail.com \
--cc=uwe@kleine-koenig.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox