aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-pcf50633.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-pcf50633.c')
-rw-r--r--drivers/rtc/rtc-pcf50633.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c
index f4dd87e29075..33a10c47260e 100644
--- a/drivers/rtc/rtc-pcf50633.c
+++ b/drivers/rtc/rtc-pcf50633.c
@@ -70,7 +70,7 @@ static void pcf2rtc_time(struct rtc_time *rtc, struct pcf50633_time *pcf)
70 rtc->tm_hour = bcd2bin(pcf->time[PCF50633_TI_HOUR]); 70 rtc->tm_hour = bcd2bin(pcf->time[PCF50633_TI_HOUR]);
71 rtc->tm_wday = bcd2bin(pcf->time[PCF50633_TI_WKDAY]); 71 rtc->tm_wday = bcd2bin(pcf->time[PCF50633_TI_WKDAY]);
72 rtc->tm_mday = bcd2bin(pcf->time[PCF50633_TI_DAY]); 72 rtc->tm_mday = bcd2bin(pcf->time[PCF50633_TI_DAY]);
73 rtc->tm_mon = bcd2bin(pcf->time[PCF50633_TI_MONTH]); 73 rtc->tm_mon = bcd2bin(pcf->time[PCF50633_TI_MONTH]) - 1;
74 rtc->tm_year = bcd2bin(pcf->time[PCF50633_TI_YEAR]) + 100; 74 rtc->tm_year = bcd2bin(pcf->time[PCF50633_TI_YEAR]) + 100;
75} 75}
76 76
@@ -81,7 +81,7 @@ static void rtc2pcf_time(struct pcf50633_time *pcf, struct rtc_time *rtc)
81 pcf->time[PCF50633_TI_HOUR] = bin2bcd(rtc->tm_hour); 81 pcf->time[PCF50633_TI_HOUR] = bin2bcd(rtc->tm_hour);
82 pcf->time[PCF50633_TI_WKDAY] = bin2bcd(rtc->tm_wday); 82 pcf->time[PCF50633_TI_WKDAY] = bin2bcd(rtc->tm_wday);
83 pcf->time[PCF50633_TI_DAY] = bin2bcd(rtc->tm_mday); 83 pcf->time[PCF50633_TI_DAY] = bin2bcd(rtc->tm_mday);
84 pcf->time[PCF50633_TI_MONTH] = bin2bcd(rtc->tm_mon); 84 pcf->time[PCF50633_TI_MONTH] = bin2bcd(rtc->tm_mon + 1);
85 pcf->time[PCF50633_TI_YEAR] = bin2bcd(rtc->tm_year % 100); 85 pcf->time[PCF50633_TI_YEAR] = bin2bcd(rtc->tm_year % 100);
86} 86}
87 87
@@ -245,8 +245,9 @@ static int pcf50633_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
245 ret = pcf50633_write_block(rtc->pcf, PCF50633_REG_RTCSCA, 245 ret = pcf50633_write_block(rtc->pcf, PCF50633_REG_RTCSCA,
246 PCF50633_TI_EXTENT, &pcf_tm.time[0]); 246 PCF50633_TI_EXTENT, &pcf_tm.time[0]);
247 247
248 if (!alarm_masked) 248 if (!alarm_masked || alrm->enabled)
249 pcf50633_irq_unmask(rtc->pcf, PCF50633_IRQ_ALARM); 249 pcf50633_irq_unmask(rtc->pcf, PCF50633_IRQ_ALARM);
250 rtc->alarm_enabled = alrm->enabled;
250 251
251 return ret; 252 return ret;
252} 253}