mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roman Fietze <roman.fietze@telemotive.de>
To: Wan ZongShun <mcuos.com@gmail.com>
Cc: rtc-linux@googlegroups.com,
	Alessandro Zummo <a.zummo@towertech.it>,
	Andrew Morton <akpm@linux-foundation.org>,
	"linux-kernel" <linux-kernel@vger.kernel.org>
Subject: [PATCH] rtc-isl12022: properly handle military hour format
Date: Wed, 14 Jul 2010 07:42:58 +0200	[thread overview]
Message-ID: <201007140742.58766.roman.fietze@telemotive.de> (raw)
In-Reply-To: <201006180727.06274.roman.fietze@telemotive.de>

Hello Wan, hello list members,

I found a bug in my rtc-isl12022. Seems I missed to test that driver
thoroughly in the afternoons.

>From 151b7d5413e189ec8f6dd578c253500d8814128e Mon Sep 17 00:00:00 2001
From: Roman Fietze <roman.fietze@telemotive.de>
Date: Wed, 14 Jul 2010 07:32:49 +0200
Subject: [PATCH] rtc-isl12022: properly handle military hour format

Mask out PM flag when reading the hour, always set MIL bit when
writing the hour.

Signed-off-by: Roman Fietze <roman.fietze@telemotive.de>
---
 drivers/rtc/rtc-isl12022.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-isl12022.c b/drivers/rtc/rtc-isl12022.c
index 293d2c1..0f300b4 100644
--- a/drivers/rtc/rtc-isl12022.c
+++ b/drivers/rtc/rtc-isl12022.c
@@ -126,7 +126,7 @@ static int isl12022_get_datetime(struct i2c_client 
*client, struct rtc_time *tm)
 
 	tm->tm_sec = bcd2bin(buf[ISL12022_REG_SC] & 0x7F);
 	tm->tm_min = bcd2bin(buf[ISL12022_REG_MN] & 0x7F);
-	tm->tm_hour = bcd2bin(buf[ISL12022_REG_HR] & 0x3F);
+	tm->tm_hour = bcd2bin(buf[ISL12022_REG_HR] & 0x1F);
 	tm->tm_mday = bcd2bin(buf[ISL12022_REG_DT] & 0x3F);
 	tm->tm_wday = buf[ISL12022_REG_DW] & 0x07;
 	tm->tm_mon = bcd2bin(buf[ISL12022_REG_MO] & 0x1F) - 1;
@@ -192,7 +192,7 @@ static int isl12022_set_datetime(struct i2c_client 
*client, struct rtc_time *tm)
 	/* hours, minutes and seconds */
 	buf[ISL12022_REG_SC] = bin2bcd(tm->tm_sec);
 	buf[ISL12022_REG_MN] = bin2bcd(tm->tm_min);
-	buf[ISL12022_REG_HR] = bin2bcd(tm->tm_hour);
+	buf[ISL12022_REG_HR] = bin2bcd(tm->tm_hour) | ISL12022_HR_MIL;
 
 	buf[ISL12022_REG_DT] = bin2bcd(tm->tm_mday);
 
-- 
1.7.1


-- 
Roman Fietze              Telemotive AG Buero Muehlhausen
Breitwiesen                             73347 Muehlhausen
Tel.: +49(0)7335/18493-45        http://www.telemotive.de

  parent reply	other threads:[~2010-07-14  5:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201006171123.31484.roman.fietze@telemotive.de>
2010-06-17 10:28 ` [rtc-linux] [PATCH] isl12022: added Intersil ISL12022 RTC Wan ZongShun
2010-06-17 12:54   ` Roman Fietze
2010-06-18  1:33     ` Wan ZongShun
2010-06-18  2:08       ` Wan ZongShun
2010-06-18  5:27         ` Roman Fietze
2010-06-18  5:33           ` Wan ZongShun
2010-06-18 23:54             ` Andrew Morton
2010-07-14  5:42           ` Roman Fietze [this message]
2010-07-14  6:54             ` [PATCH] rtc-isl12022: properly handle military hour format Wan ZongShun

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=201007140742.58766.roman.fietze@telemotive.de \
    --to=roman.fietze@telemotive.de \
    --cc=a.zummo@towertech.it \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcuos.com@gmail.com \
    --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

all inboxes | Powered by JetHome®