From patchwork Tue Dec 21 19:45:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Sanap X-Patchwork-Id: 76293 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-pz0-f63.google.com (mail-pz0-f63.google.com [209.85.210.63]) by ozlabs.org (Postfix) with ESMTP id 2AE5FB70DA for ; Wed, 22 Dec 2010 01:21:05 +1100 (EST) Received: by pzk10 with SMTP id 10sf2166935pzk.28 for ; Tue, 21 Dec 2010 06:21:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:x-beenthere:received:received:received :received:received-spf:received:received:subject:from:to:date :message-id:mime-version:x-mailer:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=5H1gIt4gpkkovAQo/cnD5s968hnKfGjETO3/b9NZjy0=; b=7OJ7BBtZumsm9lovhurvjWpS8msuTf4dT1AUS8KnLBk8ZfmbatWsaJnJC3KebIQagn TclN1aVnu67R5RHv4hM8PLXiPcRRigwF7jqdm/dPOFzJwvwIaboomsVP3rTRvjHeBH8h W5Yf7IP9agDv0LzckIUX0R00gGdNrc7YDrNtQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:subject:from:to:date:message-id :mime-version:x-mailer:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; b=wJMLgRJ/4/rXt3MvS+8a27ZZVlx+BmSuDT1gfaGCX25ablozRrUdc+1daiWmFA0iTd rjZXsLbaGwF3U0AeuZP8z/7DrIaDYvXxS+jfTfXVeEc3fkXzoCmp0agdhLctaT1FNzu4 STU0ZC6SsDELZUx7OZGZpL8UYdR9a2sGrD6Sk= Received: by 10.142.150.13 with SMTP id x13mr276310wfd.6.1292941263480; Tue, 21 Dec 2010 06:21:03 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.142.121.31 with SMTP id t31ls5631548wfc.3.p; Tue, 21 Dec 2010 06:21:02 -0800 (PST) Received: by 10.142.134.9 with SMTP id h9mr4186396wfd.21.1292941261531; Tue, 21 Dec 2010 06:21:01 -0800 (PST) Received: by 10.142.134.9 with SMTP id h9mr4186395wfd.21.1292941261473; Tue, 21 Dec 2010 06:21:01 -0800 (PST) Received: from na3sys009aog105.obsmtp.com ([74.125.149.75]) by gmr-mx.google.com with SMTP id m3si5424120wfl.1.2010.12.21.06.21.01; Tue, 21 Dec 2010 06:21:01 -0800 (PST) Received-SPF: error (google.com: error in processing during lookup of ssanap@marvell.com: DNS timeout) client-ip=74.125.149.75; Received: from source ([65.219.4.130]) (using TLSv1) by na3sys009aob105.postini.com ([74.125.148.12]) with SMTP ID DSNKTRC3zVhYRTaCMeMCwWW3TBZVkfs6BiN9@postini.com; Tue, 21 Dec 2010 06:21:01 PST Received: from [10.31.130.98] (10.31.130.98) by sc-owa02.marvell.com (10.93.76.20) with Microsoft SMTP Server id 8.2.213.0; Tue, 21 Dec 2010 06:15:34 -0800 Subject: [rtc-linux] [PATCH] Separate Alarm from IRQ for ds1307. From: Sachin Sanap To: Date: Wed, 22 Dec 2010 01:15:53 +0530 Message-ID: <1292960753.2445.5.camel@pe-lt522.marvell.com> MIME-Version: 1.0 X-Mailer: Evolution 2.30.2 (2.30.2-1.fc13) X-Original-Sender: ssanap@marvell.com X-Original-Authentication-Results: gmr-mx.google.com; spf=temperror (google.com: error in processing during lookup of ssanap@marvell.com: DNS timeout) smtp.mail=ssanap@marvell.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Some RTC chips that support Alarm might not always be connected to IRQ. The alarm interrupt of RTC might be connected to the HOSTWAKEUP pin of the CPU, which gets CPU out of suspend to RAM state. Signed-off-by: Sachin Sanap --- drivers/rtc/rtc-ds1307.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index d827ce5..4b79bdb 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -102,7 +102,8 @@ struct ds1307 { enum ds_type type; unsigned long flags; #define HAS_NVRAM 0 /* bit 0 == sysfs file active */ -#define HAS_ALARM 1 /* bit 1 == irq claimed */ +#define HAS_ALARM 1 /* bit 1 == has alarm */ +#define HAS_IRQ 2 /* bit 2 == irq claimed */ struct i2c_client *client; struct rtc_device *rtc; struct work_struct work; @@ -271,7 +272,7 @@ static void ds1307_work(struct work_struct *work) } out: - if (test_bit(HAS_ALARM, &ds1307->flags)) + if (test_bit(HAS_IRQ, &ds1307->flags)) enable_irq(client->irq); mutex_unlock(lock); } @@ -885,10 +886,14 @@ read_rtc: } device_set_wakeup_capable(&client->dev, 1); - set_bit(HAS_ALARM, &ds1307->flags); + set_bit(HAS_IRQ, &ds1307->flags); dev_dbg(&client->dev, "got IRQ %d\n", client->irq); } + /* has Alarm? */ + if (chip->alarm) + set_bit(HAS_ALARM, &ds1307->flags); + if (chip->nvram56) { err = sysfs_create_bin_file(&client->dev.kobj, &nvram); if (err == 0) { @@ -910,7 +915,7 @@ static int __devexit ds1307_remove(struct i2c_client *client) { struct ds1307 *ds1307 = i2c_get_clientdata(client); - if (test_and_clear_bit(HAS_ALARM, &ds1307->flags)) { + if (test_and_clear_bit(HAS_IRQ, &ds1307->flags)) { free_irq(client->irq, client); cancel_work_sync(&ds1307->work); }