From: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
To: <rtc-linux@googlegroups.com>
Cc: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Subject: [rtc-linux] [PATCH 2/2] rtc: ds1307: disable square wave output from ds1308
Date: Thu, 8 Jun 2017 12:36:55 +0200 [thread overview]
Message-ID: <20170608103655.20043-2-sean.nyekjaer@prevas.dk> (raw)
In-Reply-To: <20170608103655.20043-1-sean.nyekjaer@prevas.dk>
Disable sqw output from ds1308 in order to reduce
the power consumption by ~50%.
Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
---
drivers/rtc/rtc-ds1307.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index a4ef03ad9395..8d9f25a3c757 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -78,6 +78,7 @@ enum ds_type {
# define DS1307_BIT_OUT 0x80
# define DS1338_BIT_OSF 0x20
# define DS1307_BIT_SQWE 0x10
+# define DS1308_BIT_BBCLK 0x04
# define DS1307_BIT_RS1 0x02
# define DS1307_BIT_RS0 0x01
#define DS1337_REG_CONTROL 0x0e
@@ -1454,6 +1455,11 @@ static int ds1307_probe(struct i2c_client *client,
}
break;
case ds_1308:
+ /* disable sqw when driven from battery backup */
+ if (ds1307->regs[DS1307_REG_CONTROL] & DS1308_BIT_BBCLK)
+ i2c_smbus_write_byte_data(client, DS1307_REG_CONTROL,
+ ds1307->regs[DS1307_REG_CONTROL]
+ & ~DS1338_BIT_BBCLK);
case ds_1338:
/* clock halted? turn it on, so clock can tick. */
if (tmp & DS1307_BIT_CH)
--
2.13.0
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
next prev parent reply other threads:[~2017-06-08 10:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-08 10:36 [rtc-linux] [PATCH 1/2] rtc: ds1307: add ds1308 variant Sean Nyekjaer
2017-06-08 10:36 ` Sean Nyekjaer [this message]
2017-07-06 9:55 ` [rtc-linux] [PATCH 2/2] rtc: ds1307: disable square wave output from ds1308 Alexandre Belloni
2017-07-06 9:57 ` [rtc-linux] [PATCH 1/2] rtc: ds1307: add ds1308 variant Alexandre Belloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170608103655.20043-2-sean.nyekjaer@prevas.dk \
--to=sean.nyekjaer@prevas.dk \
--cc=rtc-linux@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox