rtc: max77663: Set Alarm wday to its reset value
Daniel Fu [Thu, 23 Aug 2012 11:40:08 +0000 (19:40 +0800)]
The wday is configured only when disabled alarm.
When enable alarm, set it to its default reset value 0x01,
and not enable it, to prevent an error happened when re-read the
alarm value into the virtualized generic layer at boot up in
reading alarm setting of RTC.

Bug 1034871

Change-Id: I8bfa997653edaaa286cf768c1827b5ab986f52cc
Signed-off-by: Daniel Fu <danifu@nvidia.com>
Reviewed-on: http://git-master/r/129398
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: Jinyoung Park <jinyoungp@nvidia.com>

drivers/rtc/rtc-max77663.c

index 13d8062..a84dcc7 100644 (file)
@@ -227,9 +227,10 @@ static inline int max77663_rtc_tm_to_reg(struct max77663_rtc *rtc, u8 *buf,
        /* The wday is configured only when disabled alarm. */
        if (!alarm)
                buf[RTC_WEEKDAY] = (1 << tm->tm_wday);
-       else
-               buf[RTC_WEEKDAY] = 0;
-
+       else {
+       /* Configure its default reset value 0x01, and not enable it. */
+               buf[RTC_WEEKDAY] = 0x01;
+       }
        return 0;
 }