From patchwork Sat Sep 24 01:32:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 4311 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9F30023F9E for ; Sat, 24 Sep 2011 01:33:20 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 94E04A18411 for ; Sat, 24 Sep 2011 01:33:20 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 23so6092605fxe.11 for ; Fri, 23 Sep 2011 18:33:20 -0700 (PDT) Received: by 10.223.33.19 with SMTP id f19mr5910135fad.122.1316828000497; Fri, 23 Sep 2011 18:33:20 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.18.198 with SMTP id y6cs9236lad; Fri, 23 Sep 2011 18:33:20 -0700 (PDT) Received: by 10.150.176.21 with SMTP id y21mr3939989ybe.123.1316827998632; Fri, 23 Sep 2011 18:33:18 -0700 (PDT) Received: from e33.co.us.ibm.com (e33.co.us.ibm.com. [32.97.110.151]) by mx.google.com with ESMTPS id n8si1907370ybe.24.2011.09.23.18.33.18 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Sep 2011 18:33:18 -0700 (PDT) Received-SPF: pass (google.com: domain of jstultz@us.ibm.com designates 32.97.110.151 as permitted sender) client-ip=32.97.110.151; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jstultz@us.ibm.com designates 32.97.110.151 as permitted sender) smtp.mail=jstultz@us.ibm.com Received: from /spool/local by us.ibm.com with XMail ESMTP for from ; Fri, 23 Sep 2011 19:33:17 -0600 Received: from d03relay03.boulder.ibm.com ([9.17.195.228]) by us.ibm.com ([192.168.1.133]) with XMail ESMTP; Fri, 23 Sep 2011 19:33:15 -0600 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8O1XFHY178690; Fri, 23 Sep 2011 19:33:15 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8O1XECp011732; Fri, 23 Sep 2011 19:33:14 -0600 Received: from kernel.beaverton.ibm.com ([9.47.67.96]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p8O1XEGt011707; Fri, 23 Sep 2011 19:33:14 -0600 Received: by kernel.beaverton.ibm.com (Postfix, from userid 1056) id DB2CD1E7512; Fri, 23 Sep 2011 18:33:13 -0700 (PDT) From: John Stultz To: markgross@thegnar.org Cc: John Stultz Subject: [PATCH 3/6] [RFC] rtc: rtc-cmos: Add pm_stay_awake/pm_relax calls around IRQ Date: Fri, 23 Sep 2011 18:32:40 -0700 Message-Id: <1316827963-13122-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.3.2.146.gca209 In-Reply-To: <1316827963-13122-1-git-send-email-john.stultz@linaro.org> References: <1316827963-13122-1-git-send-email-john.stultz@linaro.org> x-cbid: 11092401-2398-0000-0000-000000727BE4 Flag the rtc-cmos IRQ event as a wakeup event using pm_stay_awake and pm_relax() Signed-off-by: John Stultz --- drivers/rtc/rtc-cmos.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 05beb6c..1cc4688 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -538,11 +538,15 @@ static struct bin_attribute nvram = { static struct cmos_rtc cmos_rtc; +static struct wakeup_source *rtc_cmos_wakelock; + static irqreturn_t cmos_interrupt(int irq, void *p) { u8 irqstat; u8 rtc_control; + __pm_stay_awake(rtc_cmos_wakelock); + spin_lock(&rtc_lock); /* When the HPET interrupt handler calls us, the interrupt @@ -573,9 +577,12 @@ static irqreturn_t cmos_interrupt(int irq, void *p) if (is_intr(irqstat)) { rtc_update_irq(p, 1, irqstat); + __pm_relax(rtc_cmos_wakelock); return IRQ_HANDLED; - } else - return IRQ_NONE; + } + + __pm_relax(rtc_cmos_wakelock); + return IRQ_NONE; } #ifdef CONFIG_PNP @@ -1153,6 +1160,8 @@ static int __init cmos_init(void) { int retval = 0; + rtc_cmos_wakelock = wakeup_source_register("rtc_cmos"); + #ifdef CONFIG_PNP retval = pnp_register_driver(&cmos_pnp_driver); if (retval == 0)