From patchwork Mon Mar 30 16:56:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Tjernlund X-Patchwork-Id: 25323 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from mail-qy0-f161.google.com (mail-qy0-f161.google.com [209.85.221.161]) by ozlabs.org (Postfix) with ESMTP id 5C61CDDE1A for ; Tue, 31 Mar 2009 03:56:26 +1100 (EST) Received: by qyk33 with SMTP id 33so2966449qyk.29 for ; Mon, 30 Mar 2009 09:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:received:x-sender:x-apparently-to :received:received:received-spf:authentication-results:received :received:received:received:from:to:cc:subject:date:message-id :x-mailer:x-originalarrivaltime:reply-to:sender:precedence :x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; bh=zEQyy7ywwcrGxjIalUlAKdLYvsshAF/g5FW5y17KbpI=; b=zxwUCepNo36+Z3c2fcsSXEYNRbCV/l4NNosYlMio9uX+YmvUlNC0P8MG9XbfSfu17s t5fYEcKEHwhNi/DCbAC3sno3/bb/qv9EsyrvCzGNa24yb7TvyASiC5XCa51TyABUFwkW 1HwtE2eXizEFWrGN1UCyL0Om9dwTODkQlKaBA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-sender:x-apparently-to:received-spf:authentication-results:from :to:cc:subject:date:message-id:x-mailer:x-originalarrivaltime :reply-to:sender:precedence:x-google-loop:mailing-list:list-id :list-post:list-help:list-unsubscribe:x-beenthere-env:x-beenthere; b=aRsLfdSmaiw5J+noYnWM5VI8PL13VJbx5mz2ToTdZuuI49Gc3+lCBSulC/NOkdhORR 0LZy5u6EGkcpjt2BA/doYuutyBQeMjycmYobAAE+5xxaVzeyFO0dhsCxS27ahKPX7A5b Ineypec1ClFzt/JhVADCRccKG9fyC+RQy8/NM= Received: by 10.224.37.11 with SMTP id v11mr103189qad.3.1238432181440; Mon, 30 Mar 2009 09:56:21 -0700 (PDT) Received: by 10.177.2.5 with SMTP id e5gr2060yqi.0; Mon, 30 Mar 2009 09:56:21 -0700 (PDT) X-Sender: joakim.tjernlund@transmode.se X-Apparently-To: rtc-linux@googlegroups.com Received: by 10.103.192.10 with SMTP id u10mr29067mup.12.1238432179853; Mon, 30 Mar 2009 09:56:19 -0700 (PDT) Received: from gw1.transmode.se (gw1.transmode.se [213.115.205.20]) by gmr-mx.google.com with ESMTP id 5si182161fge.13.2009.03.30.09.56.19; Mon, 30 Mar 2009 09:56:19 -0700 (PDT) Received-SPF: pass (google.com: domain of joakim.tjernlund@transmode.se designates 213.115.205.20 as permitted sender) client-ip=213.115.205.20; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of joakim.tjernlund@transmode.se designates 213.115.205.20 as permitted sender) smtp.mail=joakim.tjernlund@transmode.se Received: from tmnt04.transmode.se (tmnt04.transmode.se [192.168.46.15]) by gw1.transmode.se (Postfix) with ESMTP id 675E0D0025 for ; Mon, 30 Mar 2009 18:56:19 +0200 (CEST) Received: from gentoo-jocke.transmode.se ([192.168.1.15]) by tmnt04.transmode.se over TLS secured channel with Microsoft SMTPSVC(5.0.2195.6713); Mon, 30 Mar 2009 18:56:19 +0200 Received: from gentoo-jocke.transmode.se (localhost.localdomain [127.0.0.1]) by gentoo-jocke.transmode.se (8.14.0/8.14.0) with ESMTP id n2UGuI8U022508; Mon, 30 Mar 2009 18:56:18 +0200 Received: (from jocke@localhost) by gentoo-jocke.transmode.se (8.14.0/8.14.0/Submit) id n2UGuIMm022505; Mon, 30 Mar 2009 18:56:18 +0200 From: Joakim Tjernlund To: a.zummo@towertech.it, rtc-linux@googlegroups.com Cc: Joakim Tjernlund Subject: [rtc-linux] [PATCH] RTC: add support for DS1388 Date: Mon, 30 Mar 2009 18:56:18 +0200 Message-Id: <1238432178-22471-1-git-send-email-Joakim.Tjernlund@transmode.se> X-Mailer: git-send-email 1.6.1.3 X-OriginalArrivalTime: 30 Mar 2009 16:56:19.0164 (UTC) FILETIME=[726B41C0:01C9B158] Reply-To: rtc-linux@googlegroups.com Sender: rtc-linux@googlegroups.com Precedence: bulk X-Google-Loop: groups Mailing-List: list rtc-linux@googlegroups.com; contact rtc-linux+owner@googlegroups.com List-Id: List-Post: List-Help: List-Unsubscribe: , X-BeenThere-Env: rtc-linux@googlegroups.com X-BeenThere: rtc-linux@googlegroups.com Extend the ds1307 driver to support ds1388 too. Signed-off-by: Joakim Tjernlund --- drivers/rtc/rtc-ds1307.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 7e5155e..1ef25f6 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -30,6 +30,7 @@ enum ds_type { ds_1338, ds_1339, ds_1340, + ds_1388, m41t00, // rs5c372 too? different address... }; @@ -86,6 +87,7 @@ enum ds_type { struct ds1307 { + u8 secs_addr; u8 regs[11]; enum ds_type type; unsigned long flags; @@ -124,6 +126,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 }, { } @@ -202,8 +205,8 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t) int tmp; /* read the RTC date and time registers all at once */ - tmp = i2c_smbus_read_i2c_block_data(ds1307->client, - DS1307_REG_SECS, 7, ds1307->regs); + tmp = i2c_smbus_read_i2c_block_data(ds1307->client, ds1307->secs_addr, + 7, ds1307->regs); if (tmp != 7) { dev_err(dev, "%s error %d\n", "read", tmp); return -EIO; @@ -279,7 +282,8 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t) "write", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]); - result = i2c_smbus_write_i2c_block_data(ds1307->client, 0, 7, buf); + result = i2c_smbus_write_i2c_block_data(ds1307->client, + ds1307->secs_addr, 7, buf); if (result < 0) { dev_err(dev, "%s error %d\n", "write", result); return result; @@ -547,6 +551,7 @@ static int __devinit ds1307_probe(struct i2c_client *client, i2c_set_clientdata(client, ds1307); ds1307->type = id->driver_data; buf = ds1307->regs; + ds1307->secs_addr = 0; switch (ds1307->type) { case ds_1337: @@ -589,6 +594,9 @@ static int __devinit ds1307_probe(struct i2c_client *client, dev_warn(&client->dev, "SET TIME!\n"); } break; + case ds_1388: + ds1307->secs_addr = 1; /* Seconds starts at 1 */ + break; default: break; } @@ -651,6 +659,7 @@ read_rtc: break; case ds_1337: case ds_1339: + case ds_1388: break; }