linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Bastian Krause <bst@pengutronix.de>, linux-rtc@vger.kernel.org
Cc: Arnaud Ebalard <arno@natisbad.org>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	kernel@pengutronix.de
Subject: Re: [PATCH] rtc: ds1307: Enable battery backup on RX8130
Date: Thu, 5 Sep 2019 15:00:58 +0200	[thread overview]
Message-ID: <d15d2a30-fea7-bc34-1623-37ca122a3a47@denx.de> (raw)
In-Reply-To: <acf967d9-cd5e-abf5-803d-4038b8ff3c51@pengutronix.de>

On 8/30/19 12:42 PM, Bastian Krause wrote:
> Hi Marek,

Hi,

> On 6/28/19 2:21 AM, Marek Vasut wrote:
>> The battery backup can be disabled on this RTC, e.g. if populated right
>> out of production. Force the battery backup bit on to enable it.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Arnaud Ebalard <arno@natisbad.org>
>> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>> ---
>>  drivers/rtc/rtc-ds1307.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
>> index 1f7e8aefc1eb..4af00cac1eff 100644
>> --- a/drivers/rtc/rtc-ds1307.c
>> +++ b/drivers/rtc/rtc-ds1307.c
>> @@ -121,6 +121,8 @@ enum ds_type {
>>  #define RX8130_REG_FLAG_AF		BIT(3)
>>  #define RX8130_REG_CONTROL0		0x1e
>>  #define RX8130_REG_CONTROL0_AIE		BIT(3)
>> +#define RX8130_REG_CONTROL1		0x0f
> 
> I think it is surprising that RX8130_REG_CONTROL0 is defined absolute
> and RX8130_REG_CONTROL1 must be used with chip offset. Having this
> defined consistently would be nice.

It's because this old patch was rebased from before the regmap changes
were even in.

>> +#define RX8130_REG_CONTROL1_INIEN	BIT(4)
>>  
>>  #define MCP794XX_REG_CONTROL		0x07
>>  #	define MCP794XX_BIT_ALM0_EN	0x10
>> @@ -1750,6 +1752,11 @@ static int ds1307_probe(struct i2c_client *client,
>>  				     DS1307_REG_HOUR << 4 | 0x08, hour);
>>  		}
>>  		break;
>> +	case rx_8130:
>> +		/* make sure that the backup battery is enabled */
>> +		regmap_write(ds1307->regmap, chip->offset + RX8130_REG_CONTROL1,
>> +			     RX8130_REG_CONTROL1_INIEN);
>> +		break;
> 
> Quick note: if a rechargeable battery or supercap is used the CHGEN bit
> must be set also.

By rechargable battery, you mean coin cell one ?

-- 
Best regards,
Marek Vasut

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-56 Email: marex@denx.de

  reply	other threads:[~2019-09-05 13:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28  0:21 [PATCH] rtc: ds1307: Enable battery backup on RX8130 Marek Vasut
2019-08-07 11:12 ` Marek Vasut
2019-08-30 10:42 ` Bastian Krause
2019-09-05 13:00   ` Marek Vasut [this message]
2019-09-09 13:33     ` Bastian Krause

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=d15d2a30-fea7-bc34-1623-37ca122a3a47@denx.de \
    --to=marex@denx.de \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=arno@natisbad.org \
    --cc=bst@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-rtc@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).