From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@teamlog.com>
To: linux-kernel@vger.kernel.org
Cc: a.zummo@towertech.it
Subject: [PATCH] rtc driver rtc-pcf8563 century bit inversed
Date: Thu, 28 Sep 2006 16:19:49 +0200 [thread overview]
Message-ID: <1159453190.8837.6.camel@jb-portable> (raw)
[-- Attachment #1: Type: text/plain, Size: 292 bytes --]
The century bit PCF8563_MO_C in the month register is misinterpreted. It
is set to 1 for the 20th century and 0 for 21th, and the driver is
expecting the opposite behavior.
Here is a small patch to address this issue.
Thanks for all the good work!
Jean-Baptiste Maneyrol
Teamlog - France
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 796 bytes --]
--- linux-2.6.18/drivers/rtc/rtc-pcf8563.c 2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18_tlgate/drivers/rtc/rtc-pcf8563.c 2006-09-28 15:59:28.000000000 +0200
@@ -95,7 +95,7 @@
tm->tm_wday = buf[PCF8563_REG_DW] & 0x07;
tm->tm_mon = BCD2BIN(buf[PCF8563_REG_MO] & 0x1F) - 1; /* rtc mn 1-12 */
tm->tm_year = BCD2BIN(buf[PCF8563_REG_YR])
- + (buf[PCF8563_REG_MO] & PCF8563_MO_C ? 100 : 0);
+ + (buf[PCF8563_REG_MO] & PCF8563_MO_C ? 0 : 100);
dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, "
"mday=%d, mon=%d, year=%d, wday=%d\n",
@@ -135,7 +135,7 @@
/* year and century */
buf[PCF8563_REG_YR] = BIN2BCD(tm->tm_year % 100);
- if (tm->tm_year / 100)
+ if (tm->tm_year < 100)
buf[PCF8563_REG_MO] |= PCF8563_MO_C;
buf[PCF8563_REG_DW] = tm->tm_wday & 0x07;
next reply other threads:[~2006-09-28 14:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-28 14:19 Jean-Baptiste Maneyrol [this message]
2006-09-28 17:17 ` [PATCH] rtc driver rtc-pcf8563 century bit inversed Alessandro Zummo
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=1159453190.8837.6.camel@jb-portable \
--to=jean-baptiste.maneyrol@teamlog.com \
--cc=a.zummo@towertech.it \
--cc=linux-kernel@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