aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorJan Kardell <jan.kardell@telliq.com>2014-12-10 18:53:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-10 20:41:15 -0500
commitff0bc5013aca55004034bb366232f8d2b5c6763c (patch)
tree66ffa3fe950d17d794aac23280d3d015cb65ad00 /drivers/rtc
parent599cda555c1bf6ba9b98e28f707f7b27c8276796 (diff)
rtc: pcf8563: save battery power
According to Haoyu hym8563 datasheet this saves som power. Might be importat to battery life. And maybe it works for the NXP part as well. 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.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index ce6a11bc0fd7..1e14f609db34 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -42,6 +42,13 @@
42 42
43#define PCF8563_REG_CLKO 0x0D /* clock out */ 43#define PCF8563_REG_CLKO 0x0D /* clock out */
44#define PCF8563_REG_TMRC 0x0E /* timer control */ 44#define PCF8563_REG_TMRC 0x0E /* timer control */
45#define PCF8563_TMRC_ENABLE BIT(7)
46#define PCF8563_TMRC_4096 0
47#define PCF8563_TMRC_64 1
48#define PCF8563_TMRC_1 2
49#define PCF8563_TMRC_1_60 3
50#define PCF8563_TMRC_MASK 3
51
45#define PCF8563_REG_TMR 0x0F /* timer */ 52#define PCF8563_REG_TMR 0x0F /* timer */
46 53
47#define PCF8563_SC_LV 0x80 /* low voltage */ 54#define PCF8563_SC_LV 0x80 /* low voltage */
@@ -406,6 +413,7 @@ static int pcf8563_probe(struct i2c_client *client,
406{ 413{
407 struct pcf8563 *pcf8563; 414 struct pcf8563 *pcf8563;
408 int err; 415 int err;
416 unsigned char buf;
409 417
410 dev_dbg(&client->dev, "%s\n", __func__); 418 dev_dbg(&client->dev, "%s\n", __func__);
411 419
@@ -423,6 +431,14 @@ static int pcf8563_probe(struct i2c_client *client,
423 pcf8563->client = client; 431 pcf8563->client = client;
424 device_set_wakeup_capable(&client->dev, 1); 432 device_set_wakeup_capable(&client->dev, 1);
425 433
434 /* Set timer to lowest frequency to save power (ref Haoyu datasheet) */
435 buf = PCF8563_TMRC_1_60;
436 err = pcf8563_write_block_data(client, PCF8563_REG_TMRC, 1, &buf);
437 if (err < 0) {
438 dev_err(&client->dev, "%s: write error\n", __func__);
439 return err;
440 }
441
426 pcf8563->rtc = devm_rtc_device_register(&client->dev, 442 pcf8563->rtc = devm_rtc_device_register(&client->dev,
427 pcf8563_driver.driver.name, 443 pcf8563_driver.driver.name,
428 &pcf8563_rtc_ops, THIS_MODULE); 444 &pcf8563_rtc_ops, THIS_MODULE);