Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 295247
b: refs/heads/master
c: fad0738
h: refs/heads/master
i:
  295245: 0373095
  295243: 4865f59
  295239: 7e92cb7
  295231: 47df4a3
v: v3
  • Loading branch information
Kevin Liu authored and Linus Torvalds committed Mar 23, 2012
1 parent 2305579 commit 18fe842
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0cf30bdd919685b201f715ea347dd96d590942e8
refs/heads/master: fad0738dcf6feccf601f5a24b8ccd3b26894b337
20 changes: 15 additions & 5 deletions trunk/drivers/rtc/rtc-max8925.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,17 @@ static int max8925_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
ret = max8925_reg_read(info->rtc, MAX8925_RTC_IRQ_MASK);
if (ret < 0)
goto out;
if ((ret & ALARM0_IRQ) == 0)
alrm->enabled = 1;
else
if (ret & ALARM0_IRQ) {
alrm->enabled = 0;
} else {
ret = max8925_reg_read(info->rtc, MAX8925_ALARM0_CNTL);
if (ret < 0)
goto out;
if (!ret)
alrm->enabled = 0;
else
alrm->enabled = 1;
}
ret = max8925_reg_read(info->rtc, MAX8925_RTC_STATUS);
if (ret < 0)
goto out;
Expand All @@ -221,8 +228,11 @@ static int max8925_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
ret = max8925_bulk_write(info->rtc, MAX8925_ALARM0_SEC, TIME_NUM, buf);
if (ret < 0)
goto out;
/* only enable alarm on year/month/day/hour/min/sec */
ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x77);
if (alrm->enabled)
/* only enable alarm on year/month/day/hour/min/sec */
ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x77);
else
ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x0);
if (ret < 0)
goto out;
out:
Expand Down

0 comments on commit 18fe842

Please sign in to comment.