Skip to contentSkip to conversation

RTC: Add support for RTCs on Wolfson WM831x devices

PATCH New Mark Brown 1 participant 1 message Aug 11, 2009

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 RTC: Add support for RTCs on Wolfson WM831x devices

The WM831x series of PMICs contain RTC functionality. The hardware provides a 32 bit counter incrementing at 1Hz together with a per tick interrupt and an alarm value. For simplicity the driver chooses to define the epoch for the counter as the Unix epoch - if required platform data can be used in future to customise this.

When powered on from a completely cold state the RTC reports that it has not been configured - when this happens an error is returned when attempting to read the RTC in order to avoid use of values we know to be invalid.

The hardware also provides security features which mean that it can ignore attempts to set the RTC time in certain circumstances, most notably if the RTC is written to too often. These errors are detected by verifying the written RTC value.

---

Updated with feedback from Alessandro:
- Soldier on if we can't get interrupts.
- Use mmss() rather than set_time()
- Use _byname() lookups always.
- Validate read times.
- Clean up device data.

 drivers/rtc/Kconfig      |   10 +
 drivers/rtc/Makefile     |    1 +
 drivers/rtc/rtc-wm831x.c |  524 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 535 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/rtc-wm831x.c
drivers/rtc/Kconfig +10 -0
index 139b783..f595113 100644
@@ -537,6 +537,16 @@ config RTC_DRV_V3020
 	  This driver can also be built as a module. If so, the module
 	  will be called rtc-v3020.
 
+config RTC_DRV_WM831X
+	tristate "Wolfson Microelectronics WM831x RTC"
+	depends on MFD_WM831X
+	help
+	  If you say yes here you will get support for the RTC subsystem
+	  of the Wolfson Microelectronics WM831X series PMICs.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called "rtc-wm831x".
+
 config RTC_DRV_WM8350
 	tristate "Wolfson Microelectronics WM8350 RTC"
 	depends on MFD_WM8350
drivers/rtc/Makefile +1 -0
index 2a565f8..61d5600 100644
@@ -76,6 +76,7 @@ obj-$(CONFIG_RTC_DRV_TWL4030)	+= rtc-twl4030.o
 obj-$(CONFIG_RTC_DRV_TX4939)	+= rtc-tx4939.o
 obj-$(CONFIG_RTC_DRV_V3020)	+= rtc-v3020.o
 obj-$(CONFIG_RTC_DRV_VR41XX)	+= rtc-vr41xx.o
+obj-$(CONFIG_RTC_DRV_WM831X)	+= rtc-wm831x.o
 obj-$(CONFIG_RTC_DRV_WM8350)	+= rtc-wm8350.o
 obj-$(CONFIG_RTC_DRV_X1205)	+= rtc-x1205.o
 obj-$(CONFIG_RTC_DRV_PCF50633)	+= rtc-pcf50633.o
drivers/rtc/rtc-wm831x.c new file +524 -0

524 lines not on this page · raw message

Signature · 1 line
1.6.3.3