diff options
| author | Mao Jinlong <c_jmao@codeaurora.org> | 2017-08-02 16:14:19 +0800 |
|---|---|---|
| committer | Mao Jinlong <jinlmao@codeaurora.org> | 2018-09-12 11:28:56 +0530 |
| commit | 0ae1ba07da10de410d24238d6e6f4f37628fedee (patch) | |
| tree | aa0b0ddf377912b4cc022c9a9bff2d3f85292b09 /drivers/rtc | |
| parent | f7d188b0fffa1e29557d4448760db29e6fbb5b45 (diff) | |
rtc: qpnp-rtc: Read ALARM_EN and update to alarm enabled status
ALARM_EN status is retained in PMIC register after device shutdown
if poweron_alarm is enabled. Read it to make sure the driver has
consistent value with the register status.
Change-Id: Iee0a19ba5126265b36a353c1d1b249d09185564a
Signed-off-by: Mao Jinlong <c_jmao@codeaurora.org>
Diffstat (limited to 'drivers/rtc')
| -rw-r--r-- | drivers/rtc/qpnp-rtc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/rtc/qpnp-rtc.c b/drivers/rtc/qpnp-rtc.c index a2c004e0f7fd..bafcebb810de 100644 --- a/drivers/rtc/qpnp-rtc.c +++ b/drivers/rtc/qpnp-rtc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2015, 2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2015, 2017-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -374,6 +374,15 @@ qpnp_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) alarm->time.tm_sec, alarm->time.tm_mday, alarm->time.tm_mon, alarm->time.tm_year); + rc = qpnp_read_wrapper(rtc_dd, value, + rtc_dd->alarm_base + REG_OFFSET_ALARM_CTRL1, 1); + if (rc) { + dev_err(dev, "Read from ALARM CTRL1 failed\n"); + return rc; + } + + alarm->enabled = !!(value[0] & BIT_RTC_ALARM_ENABLE); + return 0; } |
