Skip to content

rtc: pcf2127: add support for battery low voltage detection

Hugo Villeneuve linux-rtc lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4rtc: pcf2127: remove redundant break statement in switch-casedrivers/rtc/rtc-pcf2127.c+0 -20 replies
2/4rtc: pcf2127: add pcf2127_pwrmng_get/setdrivers/rtc/rtc-pcf2127.c+29 -131 reply
3/4rtc: add battery low voltage detection featureinclude/uapi/linux/rtc.h+6 -16 replies
4/4rtc: pcf2127: support battery low voltage detection functiondrivers/rtc/rtc-pcf2127.c+50 -101 reply

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchStefan Kerkmann
1/4
2/4R-b
3/4R-b T-b
4/4R-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] rtc: pcf2127: add support for battery low voltage detection

From: Hugo Villeneuve <[email protected]>

Hello,
this patch series adds support for battery low voltage detection configuration for RTC devicesm, with specifc changes targeted at the pcf2127/2131 devices.

The origin of this patch goes back to the initial commit to add support for the PCF2131 device. On the PCF2131, the battery low voltage detection is disabled by default at the hardware level, contrary to the PCF2127 where it is enabled by default. Because of that, a lot of people are stuck with a PCF2131 RTC device using a battery backup, but unable to use it!

A lot of people are writing to me in private emails to report this as a bug in the PCF2131 driver. Others (and me) have proposed to implement device tree properties to enable these functions, but this was rejected [1][2][3].

It is important to note that some projects do not have the luxury to modify the bootloder to enable that function at boot, and for these having a DT property that could be put in a DT overlay would simplify a lot their life. Also having to rely on a userspace application to configure the RTC is also not ideal, as some projects use stock Debian distros (for example), and adding a new application to their repository is not trivial or easy.

So as the next best thing, this patch aims to add what is missing in the driver, the ability to enable/disable the battery low voltage detection with ioctls, similarly to what is done with the BSM.

This patch has been tested on a custom board with a PCF2131 and using my userspace application:

git clone -b batlow_param [email protected]:repos/hvrtc.git

Thank you.

Hugo Villeneuve (4):
rtc: pcf2127: remove redundant break statement in switch-case
rtc: pcf2127: add pcf2127_pwrmng_get/set
rtc: add battery low voltage detection feature
rtc: pcf2127: support battery low voltage detection function

 drivers/rtc/rtc-pcf2127.c | 94 ++++++++++++++++++++++++++++++---------
 include/uapi/linux/rtc.h  |  7 ++-
 2 files changed, 80 insertions(+), 21 deletions(-)

base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f

Signature · 1 line
2.47.3