aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorUwe Kleine-König <uwe@kleine-koenig.org>2016-06-28 04:43:46 -0400
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2016-07-11 17:22:32 -0400
commitbea9db3d16d5558cdca02057390f9bd51a5bfc6c (patch)
tree72434d4fc4c69e11693abf0964518613eba6212a /drivers/rtc
parent56d86a7e799d3d893cb96f5b17b13de134af8de5 (diff)
rtc: isl12057: let the rtc core interpret the partial alarm
The rtc chip doesn't support triggering on month and year. So just don't assign the respective fields in .read_alarm and let the rtc core interpret this accordingly. Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-isl12057.c33
1 files changed, 1 insertions, 32 deletions
diff --git a/drivers/rtc/rtc-isl12057.c b/drivers/rtc/rtc-isl12057.c
index 54328d4ac0d3..0e7f0f52bfe4 100644
--- a/drivers/rtc/rtc-isl12057.c
+++ b/drivers/rtc/rtc-isl12057.c
@@ -245,8 +245,7 @@ static int isl12057_rtc_update_alarm(struct device *dev, int enable)
245static int isl12057_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) 245static int isl12057_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
246{ 246{
247 struct isl12057_rtc_data *data = dev_get_drvdata(dev); 247 struct isl12057_rtc_data *data = dev_get_drvdata(dev);
248 struct rtc_time rtc_tm, *alarm_tm = &alarm->time; 248 struct rtc_time *alarm_tm = &alarm->time;
249 unsigned long rtc_secs, alarm_secs;
250 u8 regs[ISL12057_A1_SEC_LEN]; 249 u8 regs[ISL12057_A1_SEC_LEN];
251 unsigned int ir; 250 unsigned int ir;
252 int ret; 251 int ret;
@@ -264,36 +263,6 @@ static int isl12057_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
264 alarm_tm->tm_min = bcd2bin(regs[1] & 0x7f); 263 alarm_tm->tm_min = bcd2bin(regs[1] & 0x7f);
265 alarm_tm->tm_hour = bcd2bin(regs[2] & 0x3f); 264 alarm_tm->tm_hour = bcd2bin(regs[2] & 0x3f);
266 alarm_tm->tm_mday = bcd2bin(regs[3] & 0x3f); 265 alarm_tm->tm_mday = bcd2bin(regs[3] & 0x3f);
267 alarm_tm->tm_wday = -1;
268
269 /*
270 * The alarm section does not store year/month. We use the ones in rtc
271 * section as a basis and increment month and then year if needed to get
272 * alarm after current time.
273 */
274 ret = _isl12057_rtc_read_time(dev, &rtc_tm);
275 if (ret)
276 goto err_unlock;
277
278 alarm_tm->tm_year = rtc_tm.tm_year;
279 alarm_tm->tm_mon = rtc_tm.tm_mon;
280
281 ret = rtc_tm_to_time(&rtc_tm, &rtc_secs);
282 if (ret)
283 goto err_unlock;
284
285 ret = rtc_tm_to_time(alarm_tm, &alarm_secs);
286 if (ret)
287 goto err_unlock;
288
289 if (alarm_secs < rtc_secs) {
290 if (alarm_tm->tm_mon == 11) {
291 alarm_tm->tm_mon = 0;
292 alarm_tm->tm_year += 1;
293 } else {
294 alarm_tm->tm_mon += 1;
295 }
296 }
297 266
298 ret = regmap_read(data->regmap, ISL12057_REG_INT, &ir); 267 ret = regmap_read(data->regmap, ISL12057_REG_INT, &ir);
299 if (ret) { 268 if (ret) {