Patchwork [1/2,RFC] rtc: Add ioctl to get/clear battery low voltage status

login
register
mail settings
Submitter Alexander Stein
Date Feb. 14, 2012, 4:13 p.m.
Message ID <1329236025-31323-1-git-send-email-alexander.stein@systec-electronic.com>
Download mbox | patch
Permalink /patch/141127/
State New
Headers show

Comments

Alexander Stein - Feb. 14, 2012, 4:13 p.m.
Currently there is no generic way to get the RTC battery status within
an application. So add an ioctl to read the status bit.
The idea is that the bit is set once a low voltage is detected. It stays
there until it is reset using the RTC_VL_CLR ioctl.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
 include/linux/rtc.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Alexander Stein - March 20, 2012, 1:16 p.m.
Any news/feedback on these patches?

Regards,
Alexander

Am Dienstag, 14. Februar 2012, 17:13:44 schrieb Alexander Stein:
> Currently there is no generic way to get the RTC battery status within
> an application. So add an ioctl to read the status bit.
> The idea is that the bit is set once a low voltage is detected. It stays
> there until it is reset using the RTC_VL_CLR ioctl.
> 
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> ---
>  include/linux/rtc.h |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/rtc.h b/include/linux/rtc.h
> index 93f4d03..1a6ec5f 100644
> --- a/include/linux/rtc.h
> +++ b/include/linux/rtc.h
> @@ -91,6 +91,9 @@ struct rtc_pll_info {
>  #define RTC_PLL_GET	_IOR('p', 0x11, struct rtc_pll_info)  /* Get PLL
> correction */ #define RTC_PLL_SET	_IOW('p', 0x12, struct rtc_pll_info)  /*
> Set PLL correction */
> 
> +#define RTC_VL_READ	_IOR('p', 0x13, int)	/* Voltage low detector */
> +#define RTC_VL_CLR	_IO('p', 0x14)		/* Clear voltage low information 
*/
> +
>  /* interrupt flags */
>  #define RTC_IRQF 0x80	/* Any of the following is active */
>  #define RTC_PF 0x40	/* Periodic interrupt */
Andrew Morton - April 4, 2012, 10:23 p.m.
On Tue, 14 Feb 2012 17:13:44 +0100
Alexander Stein <alexander.stein@systec-electronic.com> wrote:

> Currently there is no generic way to get the RTC battery status within
> an application. So add an ioctl to read the status bit.
> The idea is that the bit is set once a low voltage is detected. It stays
> there until it is reset using the RTC_VL_CLR ioctl.
> 
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> ---
>  include/linux/rtc.h |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/rtc.h b/include/linux/rtc.h
> index 93f4d03..1a6ec5f 100644
> --- a/include/linux/rtc.h
> +++ b/include/linux/rtc.h
> @@ -91,6 +91,9 @@ struct rtc_pll_info {
>  #define RTC_PLL_GET	_IOR('p', 0x11, struct rtc_pll_info)  /* Get PLL correction */
>  #define RTC_PLL_SET	_IOW('p', 0x12, struct rtc_pll_info)  /* Set PLL correction */
>  
> +#define RTC_VL_READ	_IOR('p', 0x13, int)	/* Voltage low detector */
> +#define RTC_VL_CLR	_IO('p', 0x14)		/* Clear voltage low information */
> +
>  /* interrupt flags */
>  #define RTC_IRQF 0x80	/* Any of the following is active */
>  #define RTC_PF 0x40	/* Periodic interrupt */

Looks good to me, but I'd like to hear from other RTC driver
maintainers, please.

Which other devices provide support for reading the batttery status,
and is the proposed interface suitable for their drivers?

Patch

diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 93f4d03..1a6ec5f 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -91,6 +91,9 @@  struct rtc_pll_info {
 #define RTC_PLL_GET	_IOR('p', 0x11, struct rtc_pll_info)  /* Get PLL correction */
 #define RTC_PLL_SET	_IOW('p', 0x12, struct rtc_pll_info)  /* Set PLL correction */
 
+#define RTC_VL_READ	_IOR('p', 0x13, int)	/* Voltage low detector */
+#define RTC_VL_CLR	_IO('p', 0x14)		/* Clear voltage low information */
+
 /* interrupt flags */
 #define RTC_IRQF 0x80	/* Any of the following is active */
 #define RTC_PF 0x40	/* Periodic interrupt */