* [PATCH] rtc driver rtc-pcf8563 century bit inversed
@ 2006-09-28 14:19 Jean-Baptiste Maneyrol
2006-09-28 17:17 ` Alessandro Zummo
0 siblings, 1 reply; 2+ messages in thread
From: Jean-Baptiste Maneyrol @ 2006-09-28 14:19 UTC (permalink / raw)
To: linux-kernel; +Cc: a.zummo
[-- 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;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc driver rtc-pcf8563 century bit inversed
2006-09-28 14:19 [PATCH] rtc driver rtc-pcf8563 century bit inversed Jean-Baptiste Maneyrol
@ 2006-09-28 17:17 ` Alessandro Zummo
0 siblings, 0 replies; 2+ messages in thread
From: Alessandro Zummo @ 2006-09-28 17:17 UTC (permalink / raw)
To: Jean-Baptiste Maneyrol; +Cc: linux-kernel
On Thu, 28 Sep 2006 16:19:49 +0200
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@teamlog.com> wrote:
> 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!
Thanks for spotting this, please fwd to
akpm for inclusion in -mm .
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
--
Best regards,
Alessandro Zummo,
Tower Technologies - Turin, Italy
http://www.towertech.it
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-09-28 17:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-28 14:19 [PATCH] rtc driver rtc-pcf8563 century bit inversed Jean-Baptiste Maneyrol
2006-09-28 17:17 ` Alessandro Zummo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox