Re: [PATCH 3/4] rtc: add battery low voltage detection feature

Stefan Kerkmann <[email protected]>
Newsgroups org.kernel.vger.linux-rtc,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

On 3/11/26 21:02, Hugo Villeneuve wrote:
> From: Hugo Villeneuve <[email protected]>
> 
> 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 <[email protected]>
> ---
>   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
>   
>   /* 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
> +
>   #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 <[email protected]>
Tested-by: Stefan Kerkmann <[email protected]>

-- 
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    |
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.