public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: arno@natisbad.org (Arnaud Ebalard)
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: ds1307: fix century bit support
Date: Thu, 14 Jul 2016 21:54:45 +0200	[thread overview]
Message-ID: <87inw8hu62.fsf@natisbad.org> (raw)
In-Reply-To: 1468370064-19255-1-git-send-email-alexandre.belloni@free-electrons.com

Hi Alexandre,

Alexandre Belloni <alexandre.belloni@free-electrons.com> writes:

> Add an option to properly support the century bit of ds1337 and compatibles
> and ds1340.
> Because the driver had a bug until now, it is not possible to switch users
> to the fixed code directly as RTCs in the field will wrongly have the
> century bit set.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
>
> Arnaud, do you mind testing that patch, I still don't have the necessary
> hardware but I think this is the proper course of action.

I did some tests w/ all patches applied (the one below and the ones in
the other series). I had to fix two errors: one pointed in the patch
below and the other one in a patch in the other series (I'll reply to
the patch).

With both RTC_DRV_DS1307 and RTC_DRV_DS1307_CENTURY enabled, this works
as expected on my side: booting on a system which had only seen an
ISL12057 driver, the time on the system at boot (or via hwclock -r) is
correct. Playing w/ -s and -w options works as expected. Booting back on
a kernel w/ ISL12057 driver, things are also ok. So, AFAICT, your
changes do the work.

One small thing though: for user which have always used RTC_DRV_ISL12057
config knob, the change will not be transparent. Would it be possible to
somehow make that old kernel config knob some kind of alias for
RTC_DRV_DS1307 and RTC_DRV_DS1307_CENTURY in Kconfig?

Cheers,

a+


> +#ifdef CONFIG_RTC_DRV_DS1307_CENTURY
> +	switch (ds1307->type) {
> +	case ds_1337:
> +	case ds_1339:
> +	case ds_3231:
> +		if (ds1307->regs[DS1307_REG_MONTH] && DS1337_BIT_CENTURY)

                                                   ^^


> +			t->tm_year += 100;
> +		break;
> +	case ds_1340:
> +		if (ds1307->regs[DS1307_REG_HOUR] && DS1340_BIT_CENTURY)

                                                  ^^

  reply	other threads:[~2016-07-14 20:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13  0:34 [PATCH] rtc: ds1307: fix century bit support Alexandre Belloni
2016-07-14 19:54 ` Arnaud Ebalard [this message]
2016-07-20 21:16   ` 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=87inw8hu62.fsf@natisbad.org \
    --to=arno@natisbad.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=linux-kernel@vger.kernel.org \
    --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