Skip to contentSkip to conversation

rtc: max8997: Add driver for max8997 rtc.

PATCH In review Jonghwa Lee 2 participants 3 messages Feb 7, 2013 – Feb 8, 2013 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 rtc: max8997: Add driver for max8997 rtc.

This patch adds rtc driver for Maxim 8997 multifunction chip. Max8997 has rtc module in it. and it can be used for timekeeping clock and system alarm. It provide various operational mode those are BCD/binary, 24/12hour, am/pm. Driver sets binary/24/ for default. Maxim 8997 also supports SMPL(Sudden Momentary Power Loss), WTSR (Watchdog Timeout and Software Reset).

---
v2
- Add module parameter to enable/disable WTSR, SMPL fuction.
- Add unregister_rtc_device() for accidental exit in probing.

 drivers/rtc/Kconfig       |   10 +
 drivers/rtc/Makefile      |    1 +
 drivers/rtc/rtc-max8997.c |  553 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 564 insertions(+)
 create mode 100644 drivers/rtc/rtc-max8997.c
drivers/rtc/Kconfig +10 -0
index fc382af..43619c3 100644
@@ -233,6 +233,16 @@ config RTC_DRV_MAX8998
 	  This driver can also be built as a module. If so, the module
 	  will be called rtc-max8998.
 
+config RTC_DRV_MAX8997
+	tristate "Maxim MAX8997"
+	depends on MFD_MAX8997
+	help
+	  If you say yes here you will get support for the
+	  RTC of Maxim MAX8997 PMIC.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-max8997.
+
 config RTC_DRV_MAX77686
 	tristate "Maxim MAX77686"
 	depends on MFD_MAX77686
drivers/rtc/Makefile +1 -0
index 97e7967..6b0513b 100644
@@ -69,6 +69,7 @@ obj-$(CONFIG_RTC_DRV_MAX6900)	+= rtc-max6900.o
 obj-$(CONFIG_RTC_DRV_MAX8907)	+= rtc-max8907.o
 obj-$(CONFIG_RTC_DRV_MAX8925)	+= rtc-max8925.o
 obj-$(CONFIG_RTC_DRV_MAX8998)	+= rtc-max8998.o
+obj-$(CONFIG_RTC_DRV_MAX8997)	+= rtc-max8997.o
 obj-$(CONFIG_RTC_DRV_MAX6902)	+= rtc-max6902.o
 obj-$(CONFIG_RTC_DRV_MAX77686)	+= rtc-max77686.o
 obj-$(CONFIG_RTC_DRV_MC13XXX)	+= rtc-mc13xxx.o
drivers/rtc/rtc-max8997.c new file +553 -0

553 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 15 lines · On Thu, 07 Feb 2013 20:01:27 +0900 Jonghwa Lee <[email protected]> wrote:

This patch adds rtc driver for Maxim 8997 multifunction chip. Max8997 has rtc module in it. and it can be used for timekeeping clock and system alarm. It provide various operational mode those are BCD/binary, 24/12hour, am/pm. Driver sets binary/24/ for default. Maxim 8997 also supports SMPL(Sudden Momentary Power Loss), WTSR (Watchdog Timeout and Software Reset).

---
v2
- Add module parameter to enable/disable WTSR, SMPL fuction.
- Add unregister_rtc_device() for accidental exit in probing.

...

drivers/rtc/rtc-max8997.c line 31

Quoted 8 lines
drivers/rtc/rtc-max8997.c new file +8 -0
+/* Module parameter for WTSR function control */
+static int wtsr_en = 1;
+module_param(wtsr_en, int, 0444);
+MODULE_PARM_DESC(wtsr_en, "Wachdog Timeout & Sofware Reset (default=on)");
+/* Module parameter for SMPL function control */
+static int smpl_en = 1;
+module_param(smpl_en, int, 0444);
+MODULE_PARM_DESC(smpl_en, "Sudden Momentary Power Loss (default=on)");

"default=on" is interesting. For what reasons would a user ever want to set this "off"? Can we just remove the options and leave these things enabled all the time for everyone?

#2 lore raw
Quoted 18 lines · Andrew Morton
Quoted 15 lines · On Thu, 07 Feb 2013 20:01:27 +0900 Jonghwa Lee <[email protected]> wrote:

This patch adds rtc driver for Maxim 8997 multifunction chip. Max8997 has rtc module in it. and it can be used for timekeeping clock and system alarm. It provide various operational mode those are BCD/binary, 24/12hour, am/pm. Driver sets binary/24/ for default. Maxim 8997 also supports SMPL(Sudden Momentary Power Loss), WTSR (Watchdog Timeout and Software Reset).

---
v2
- Add module parameter to enable/disable WTSR, SMPL fuction.
- Add unregister_rtc_device() for accidental exit in probing.

...

Quoted 13 lines

drivers/rtc/rtc-max8997.c line 31

Quoted 8 lines
drivers/rtc/rtc-max8997.c new file +8 -0
+/* Module parameter for WTSR function control */
+static int wtsr_en = 1;
+module_param(wtsr_en, int, 0444);
+MODULE_PARM_DESC(wtsr_en, "Wachdog Timeout & Sofware Reset (default=on)");
+/* Module parameter for SMPL function control */
+static int smpl_en = 1;
+module_param(smpl_en, int, 0444);
+MODULE_PARM_DESC(smpl_en, "Sudden Momentary Power Loss (default=on)");

"default=on" is interesting. For what reasons would a user ever want to set this "off"? Can we just remove the options and leave these things enabled all the time for everyone?

System with WTSR will be postponed to reset more than 58.6ms(250 ~ 1000ms) even if AP sends POWERHOLD signal low. (By default(without WTSR) it keeps PMIC on 58.6ms , then re-check the POWERHOLD signal to determine whether it needs PMIC off)
And with SMPL option enabled, system will be automatically re-boot when power has been recovered before SMPL's timer is expired.

Those all functions are just optional not significant. And someone may not want to them, so I think the better idea is leave it selectable. If you don't thinks so, I remove options and keep it enabled for all.

Thanks,
Jonghwa.

Quoted 1 line