aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJan Kardell <jan.kardell@telliq.com>2014-12-10 18:53:46 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 20:41:15 -0500
commita45d528aab8bcde68476b99403311422c91dc20a (patch)
treea571537cb102aa6b803d69fe4ddd4711ac1a4056 /drivers/rtc
parentff0bc5013aca55004034bb366232f8d2b5c6763c (diff)
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 <jan.kardell@telliq.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Vincent Donnefort <vdonnefort@gmail.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-pcf8563.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index 1e14f609db34..96fb32e7d6f8 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -396,6 +396,7 @@ static int pcf8563_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *tm)
396 396
397static int pcf8563_irq_enable(struct device *dev, unsigned int enabled) 397static int pcf8563_irq_enable(struct device *dev, unsigned int enabled)
398{ 398{
399 dev_dbg(dev, "%s: en=%d\n", __func__, enabled);
399 return pcf8563_set_alarm_mode(to_i2c_client(dev), !!enabled); 400 return pcf8563_set_alarm_mode(to_i2c_client(dev), !!enabled);
400} 401}
401 402
@@ -414,6 +415,7 @@ static int pcf8563_probe(struct i2c_client *client,
414 struct pcf8563 *pcf8563; 415 struct pcf8563 *pcf8563;
415 int err; 416 int err;
416 unsigned char buf; 417 unsigned char buf;
418 unsigned char alm_pending;
417 419
418 dev_dbg(&client->dev, "%s\n", __func__); 420 dev_dbg(&client->dev, "%s\n", __func__);
419 421
@@ -439,6 +441,14 @@ static int pcf8563_probe(struct i2c_client *client,
439 return err; 441 return err;
440 } 442 }
441 443
444 err = pcf8563_get_alarm_mode(client, NULL, &alm_pending);
445 if (err < 0) {
446 dev_err(&client->dev, "%s: read error\n", __func__);
447 return err;
448 }
449 if (alm_pending)
450 pcf8563_set_alarm_mode(client, 0);
451
442 pcf8563->rtc = devm_rtc_device_register(&client->dev, 452 pcf8563->rtc = devm_rtc_device_register(&client->dev,
443 pcf8563_driver.driver.name, 453 pcf8563_driver.driver.name,
444 &pcf8563_rtc_ops, THIS_MODULE); 454 &pcf8563_rtc_ops, THIS_MODULE);