From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Stefan Kerkmann <s.kerkmann@pengutronix.de>
Cc: Hugo Villeneuve <hugo@hugovil.com>,
linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
bruno.thomsen@gmail.com, giampiero@sferalabs.cc,
p.rosenberger@kunbus.com, antonio@amsobr.com,
Hugo Villeneuve <hvilleneuve@dimonoff.com>
Subject: Re: [PATCH 3/4] rtc: add battery low voltage detection feature
Date: Fri, 20 Nov 2026 14:40:46 +0100 [thread overview]
Message-ID: <2026112013404685aba5df@mail.local> (raw)
In-Reply-To: <eeff2fb8-889a-4884-81d8-e4cda7ac5e9e@pengutronix.de>
Hello,
On 06/08/2026 14:55:00+0200, Stefan Kerkmann wrote:
>
>
> On 3/11/26 21:02, Hugo Villeneuve wrote:
> > From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> >
> > Some RTCs have a battery low voltage detection function. Add new feature
> > so that it can be enabled, disabled or queried at runtime.
> >
> > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > ---
> > include/uapi/linux/rtc.h | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/uapi/linux/rtc.h b/include/uapi/linux/rtc.h
> > index 97aca4503a6a3..596eec119bb3a 100644
> > --- a/include/uapi/linux/rtc.h
> > +++ b/include/uapi/linux/rtc.h
> > @@ -134,18 +134,23 @@ struct rtc_param {
> > #define RTC_FEATURE_CORRECTION 5
> > #define RTC_FEATURE_BACKUP_SWITCH_MODE 6
> > #define RTC_FEATURE_ALARM_WAKEUP_ONLY 7
> > -#define RTC_FEATURE_CNT 8
> > +#define RTC_FEATURE_BATTERY_LOW_DETECT 8
> > +#define RTC_FEATURE_CNT 9
This is adding a new ABI and it took me a while to find enough time to
review the datasheet for the RTCs we support and others. What we need
instead of a boolean is a voltage threshold. So maybe this should be
better named something like RTC_FEATURE_BATTERY_LOW_THRES_MV
> > /* parameter list */
> > #define RTC_PARAM_FEATURES 0
> > #define RTC_PARAM_CORRECTION 1
> > #define RTC_PARAM_BACKUP_SWITCH_MODE 2
> > +#define RTC_PARAM_BATTERY_LOW_DETECT 3
> > #define RTC_BSM_DISABLED 0
> > #define RTC_BSM_DIRECT 1
> > #define RTC_BSM_LEVEL 2
> > #define RTC_BSM_STANDBY 3
> > +#define RTC_BATTERY_LOW_DETECT_DISABLED 0
> > +#define RTC_BATTERY_LOW_DETECT_ENABLED 1
And so those wouldn't be needed.
> > +
> > #define RTC_MAX_FREQ 8192
>
> I have opened a PR against util-linux to add support and tested the patchset
> with the extended hwclock binary.
>
> See: https://github.com/util-linux/util-linux/pull/4513
>
> Reviewed-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>
> Tested-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>
>
> --
> Pengutronix e.K. | Stefan Kerkmann |
> Steuerwalder Str. 21 | https://www.pengutronix.de/ |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-128 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2026-11-20 13:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 20:02 [PATCH 0/4] rtc: pcf2127: add support for battery low voltage detection Hugo Villeneuve
2026-03-11 20:02 ` [PATCH 1/4] rtc: pcf2127: remove redundant break statement in switch-case Hugo Villeneuve
2026-03-11 20:02 ` [PATCH 2/4] rtc: pcf2127: add pcf2127_pwrmng_get/set Hugo Villeneuve
2026-08-06 12:53 ` Stefan Kerkmann
2026-03-11 20:02 ` [PATCH 3/4] rtc: add battery low voltage detection feature Hugo Villeneuve
2026-08-06 12:55 ` Stefan Kerkmann
2026-11-20 13:40 ` Alexandre Belloni [this message]
2026-11-20 16:12 ` Alexandre Belloni
2026-03-11 20:02 ` [PATCH 4/4] rtc: pcf2127: support battery low voltage detection function Hugo Villeneuve
2026-08-06 12:55 ` Stefan Kerkmann
2026-07-29 15:18 ` [PATCH 0/4] rtc: pcf2127: add support for battery low voltage detection Stefan Kerkmann
2026-08-25 12:59 ` Hugo Villeneuve
2026-08-25 7:31 ` Marc Kleine-Budde
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=2026112013404685aba5df@mail.local \
--to=alexandre.belloni@bootlin.com \
--cc=antonio@amsobr.com \
--cc=bruno.thomsen@gmail.com \
--cc=giampiero@sferalabs.cc \
--cc=hugo@hugovil.com \
--cc=hvilleneuve@dimonoff.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=p.rosenberger@kunbus.com \
--cc=s.kerkmann@pengutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.