Hi,
We have following hardware setup am3352B series processor with external PCF8523 rtc chip, kernel version is linux-3.12.10-ti2013.12.01, and TI-SDK v7.
We are setting rtc alarm from an user space application using RTC_SET_ALARM ioctl. We could successfully set for MIN_ALARM, HOUR_ALARM and DAY_ALARM, and the these alarms works properly. But the WEEKDAY_ALARM is not working properly. We observe that the value we write for WEEK_ALARM does not reflects in the corresponding RTC register, on read back we get different value.
Probably we are missing something here as to what value needs to be passed from the user space to the driver for setting the week alarm (the valid values are 0 - 6). For example, to set alarm for 7hr 58min 3rd of current month, and for weekday Monday, we set the tm.tm_min=58, tm.tm_hour=7, tm.tm_mday=26 tm.tm_wday=1.
In this case, we could see the alarm registers are properly set for min, hour, and mday. But the wday register was not set with the value we gave, instead it was set to some other value, ex: 3.
Further debugging, we found the week_day alarm value was changed in the following function during the RTC_SET_ALARM ioctl processing.
void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); //drivers/rtc/rtc-lib.c
----------
void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
{
unsigned int month, year;
int days;
days = time / 86400;
time -= (unsigned int) days * 86400;
/* day of the week, 1970-01-01 was a Thursday */
tm->tm_wday = (days + 4) % 7
----------
Here we can observe the weekday value is different that what we are setting, and this value only set to the rtc register for weekday alarm field.
So we are not sure whether we are passing wrong value for setting the weekday alarm or if the weekday alarm itself is not supported in rtc alarm functionality.
Can you please clarify on this?
Thanks,
Venkat