* [PATCH] rtc: ds1307: Ensure oscillator is enabled for DS1388
@ 2020-08-16 23:57 Chris Packham
2020-08-20 22:19 ` Alexandre Belloni
0 siblings, 1 reply; 2+ messages in thread
From: Chris Packham @ 2020-08-16 23:57 UTC (permalink / raw)
To: a.zummo, alexandre.belloni; +Cc: linux-rtc, linux-kernel, Chris Packham
Similar to the other variants the DS1388 has a bit to stop the
oscillator to reduce the power consumption from VBAT. Ensure that the
oscillator is enabled when the system is up.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
drivers/rtc/rtc-ds1307.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 54c85cdd019d..2182f4e97c0a 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -153,6 +153,7 @@ enum ds_type {
#define DS1388_REG_CONTROL 0x0c
# define DS1388_BIT_RST BIT(0)
# define DS1388_BIT_WDE BIT(1)
+# define DS1388_BIT_nEOSC BIT(7)
/* negative offset step is -2.034ppm */
#define M41TXX_NEG_OFFSET_STEP_PPB 2034
@@ -1881,6 +1882,19 @@ static int ds1307_probe(struct i2c_client *client,
DS1307_REG_HOUR << 4 | 0x08, hour);
}
break;
+ case ds_1388:
+ err = regmap_read(ds1307->regmap, DS1388_REG_CONTROL, &tmp);
+ if (err) {
+ dev_dbg(ds1307->dev, "read error %d\n", err);
+ goto exit;
+ }
+
+ /* oscillator off? turn it on, so clock can tick. */
+ if (tmp & DS1388_BIT_nEOSC) {
+ tmp &= ~DS1388_BIT_nEOSC;
+ regmap_write(ds1307->regmap, DS1388_REG_CONTROL, tmp);
+ }
+ break;
default:
break;
}
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: ds1307: Ensure oscillator is enabled for DS1388
2020-08-16 23:57 [PATCH] rtc: ds1307: Ensure oscillator is enabled for DS1388 Chris Packham
@ 2020-08-20 22:19 ` Alexandre Belloni
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2020-08-20 22:19 UTC (permalink / raw)
To: a.zummo, Chris Packham; +Cc: Alexandre Belloni, linux-rtc, linux-kernel
On Mon, 17 Aug 2020 11:57:31 +1200, Chris Packham wrote:
> Similar to the other variants the DS1388 has a bit to stop the
> oscillator to reduce the power consumption from VBAT. Ensure that the
> oscillator is enabled when the system is up.
Applied, thanks!
[1/1] rtc: ds1307: Ensure oscillator is enabled for DS1388
commit: 59ed0127155201863db49f3dc5fb41316433340a
Best regards,
--
Alexandre Belloni <alexandre.belloni@bootlin.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-20 22:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-16 23:57 [PATCH] rtc: ds1307: Ensure oscillator is enabled for DS1388 Chris Packham
2020-08-20 22:19 ` Alexandre Belloni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.