mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
rtc: rtc-pm8xxx: 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: Ie0c5ce67cf6ee39ee6f156d8b7a4a81c624adec1 Signed-off-by: Guixiong Wei <guixiong@codeaurora.org>
This commit is contained in:
parent
4141c87590
commit
2df5fff695
1 changed files with 10 additions and 1 deletions
|
|
@ -20,7 +20,7 @@
|
|||
/* RTC_CTRL register bit fields */
|
||||
#define PM8xxx_RTC_ENABLE BIT(7)
|
||||
#define PM8xxx_RTC_ALARM_CLEAR BIT(0)
|
||||
|
||||
#define PM8xxx_RTC_ALARM_ENABLE BIT(7)
|
||||
#define NUM_8_BIT_RTC_REGS 0x4
|
||||
|
||||
/**
|
||||
|
|
@ -265,6 +265,7 @@ rtc_rw_fail:
|
|||
static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
|
||||
{
|
||||
int rc;
|
||||
unsigned int ctrl_reg;
|
||||
u8 value[NUM_8_BIT_RTC_REGS];
|
||||
unsigned long secs;
|
||||
struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev);
|
||||
|
|
@ -288,6 +289,14 @@ static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
|
|||
return rc;
|
||||
}
|
||||
|
||||
rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl, &ctrl_reg);
|
||||
if (rc) {
|
||||
dev_err(dev, "Read from RTC alarm control register failed\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
alarm->enabled = !!(ctrl_reg & PM8xxx_RTC_ALARM_ENABLE);
|
||||
|
||||
dev_dbg(dev, "Alarm set for - h:m:s=%ptRt, y-m-d=%ptRdr\n",
|
||||
&alarm->time, &alarm->time);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue