mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
rtc: pcf8563: clear expired alarm at boot time
In case the card is woken up of the rtc alarm, the devm_rtc_device_register function detects it as a pending alarm about a month in the future. Fix this by clearing the alarm in module probe. Signed-off-by: Jan Kardell <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Grant Likely <[email protected]> Cc: Rob Herring <[email protected]> Cc: Vincent Donnefort <[email protected]> Cc: Dan Carpenter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
ff0bc5013a
commit
a45d528aab
1 changed files with 10 additions and 0 deletions
|
|
@ -396,6 +396,7 @@ static int pcf8563_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *tm)
|
|||
|
||||
static int pcf8563_irq_enable(struct device *dev, unsigned int enabled)
|
||||
{
|
||||
dev_dbg(dev, "%s: en=%d\n", __func__, enabled);
|
||||
return pcf8563_set_alarm_mode(to_i2c_client(dev), !!enabled);
|
||||
}
|
||||
|
||||
|
|
@ -414,6 +415,7 @@ static int pcf8563_probe(struct i2c_client *client,
|
|||
struct pcf8563 *pcf8563;
|
||||
int err;
|
||||
unsigned char buf;
|
||||
unsigned char alm_pending;
|
||||
|
||||
dev_dbg(&client->dev, "%s\n", __func__);
|
||||
|
||||
|
|
@ -439,6 +441,14 @@ static int pcf8563_probe(struct i2c_client *client,
|
|||
return err;
|
||||
}
|
||||
|
||||
err = pcf8563_get_alarm_mode(client, NULL, &alm_pending);
|
||||
if (err < 0) {
|
||||
dev_err(&client->dev, "%s: read error\n", __func__);
|
||||
return err;
|
||||
}
|
||||
if (alm_pending)
|
||||
pcf8563_set_alarm_mode(client, 0);
|
||||
|
||||
pcf8563->rtc = devm_rtc_device_register(&client->dev,
|
||||
pcf8563_driver.driver.name,
|
||||
&pcf8563_rtc_ops, THIS_MODULE);
|
||||
|
|
|
|||
Loading…
Reference in a new issue