Patchwork RTC: add support for DS1388

login
register
mail settings
Submitter Joakim Tjernlund
Date Feb. 12, 2009, 8 a.m.
Message ID <1234425646-4499-1-git-send-email-Joakim.Tjernlund@transmode.se>
Download mbox | patch
Permalink /patch/23004/
State Changes Requested
Headers show

Comments

Joakim Tjernlund - Feb. 12, 2009, 8 a.m.
Exstend the ds1307 driver to support ds1388 too.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---
 drivers/rtc/rtc-ds1307.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
Alessandro Zummo - Feb. 13, 2009, 6:39 p.m.
On Thu, 12 Feb 2009 09:00:46 +0100
Joakim Tjernlund <Joakim.Tjernlund@transmode.se> wrote:

> Exstend the ds1307 driver to support ds1388 too.
> 
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

 Hi,

 please patch against current git. thank you.
Joakim Tjernlund - Feb. 14, 2009, 6:56 p.m.
Alessandro Zummo <alessandro.zummo@towertech.it> wrote on 13/02/2009 
19:39:28:

> On Thu, 12 Feb 2009 09:00:46 +0100
> Joakim Tjernlund <Joakim.Tjernlund@transmode.se> wrote:
> 
> > Exstend the ds1307 driver to support ds1388 too.
> > 
> > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> 
>  Hi,
> 
>  please patch against current git. thank you.

Sory, but I am on 2.6.27 and updating it to current is too much
work ATM. I didn't realize rtc had moved that far ahead that this
patch would not apply. Hopefully it is trivial to forward port but I am
not in that position ATM. If you do and it doesn't work by the time
I get to 2.6.29, I will send you a correction.

 Jocke

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
-~----------~----~----~----~------~----~------~--~---

Patch

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index bbf97e6..d27a0bb 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -34,6 +34,7 @@  enum ds_type {
 	ds_1338,
 	ds_1339,
 	ds_1340,
+	ds_1388,
 	m41t00,
 	// rs5c372 too?  different address...
 };
@@ -126,6 +127,7 @@  static const struct i2c_device_id ds1307_id[] = {
 	{ "ds1337", ds_1337 },
 	{ "ds1338", ds_1338 },
 	{ "ds1339", ds_1339 },
+	{ "ds1388", ds_1388 },
 	{ "ds1340", ds_1340 },
 	{ "m41t00", m41t00 },
 	{ }
@@ -190,7 +192,7 @@  static int ds1307_set_time(struct device *dev, struct rtc_time *t)
 		t->tm_hour, t->tm_mday,
 		t->tm_mon, t->tm_year, t->tm_wday);
 
-	*buf++ = 0;		/* first register addr */
+	*buf++ = ds1307->reg_addr;	/* first register addr */
 	buf[DS1307_REG_SECS] = BIN2BCD(t->tm_sec);
 	buf[DS1307_REG_MIN] = BIN2BCD(t->tm_min);
 	buf[DS1307_REG_HOUR] = BIN2BCD(t->tm_hour);
@@ -379,6 +381,9 @@  static int __devinit ds1307_probe(struct i2c_client *client,
 			dev_warn(&client->dev, "SET TIME!\n");
 		}
 		break;
+	case ds_1388:
+		ds1307->reg_addr = 1; /* Seconds starts at 1 */
+		break;
 	default:
 		break;
 	}
@@ -442,6 +447,7 @@  read_rtc:
 		break;
 	case ds_1337:
 	case ds_1339:
+	case ds_1388:
 		break;
 	}