From patchwork Mon Sep 26 19:13:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 4349 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 4DAA523F57 for ; Mon, 26 Sep 2011 19:14:08 +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 39820A18AB4 for ; Mon, 26 Sep 2011 19:14:08 +0000 (UTC) Received: by fxe23 with SMTP id 23so8797872fxe.11 for ; Mon, 26 Sep 2011 12:14:08 -0700 (PDT) Received: by 10.223.94.134 with SMTP id z6mr10998631fam.8.1317064447855; Mon, 26 Sep 2011 12:14:07 -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.3.234 with SMTP id f10cs48596laf; Mon, 26 Sep 2011 12:14:07 -0700 (PDT) Received: by 10.151.108.7 with SMTP id k7mr6467345ybm.132.1317064446403; Mon, 26 Sep 2011 12:14:06 -0700 (PDT) Received: from e9.ny.us.ibm.com (e9.ny.us.ibm.com. [32.97.182.139]) by mx.google.com with ESMTPS id n8si64156ybe.79.2011.09.26.12.14.05 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Sep 2011 12:14:06 -0700 (PDT) Received-SPF: pass (google.com: domain of jstultz@us.ibm.com designates 32.97.182.139 as permitted sender) client-ip=32.97.182.139; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jstultz@us.ibm.com designates 32.97.182.139 as permitted sender) smtp.mail=jstultz@us.ibm.com Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by e9.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p8QIcg0T006578; Mon, 26 Sep 2011 14:38:42 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8QJE4dj227468; Mon, 26 Sep 2011 15:14:04 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8QJE4Zi022005; Mon, 26 Sep 2011 16:14:04 -0300 Received: from kernel.beaverton.ibm.com ([9.47.67.96]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p8QJE3Ax021864; Mon, 26 Sep 2011 16:14:03 -0300 Received: by kernel.beaverton.ibm.com (Postfix, from userid 1056) id E11461E7512; Mon, 26 Sep 2011 12:14:02 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , "Rafael J. Wysocki" , arve@android.com, markgross@thegnar.org, Alan Stern , amit.kucheria@linaro.org, farrowg@sg.ibm.com, "Dmitry Fink (Palm GBU)" , linux-pm@lists.linux-foundation.org, khilman@ti.com, Magnus Damm , mjg@redhat.com, peterz@infradead.org Subject: [PATCH 3/6] [RFC] rtc: rtc-cmos: Add pm_stay_awake/pm_relax calls around IRQ Date: Mon, 26 Sep 2011 12:13:51 -0700 Message-Id: <1317064434-1829-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.3.2.146.gca209 In-Reply-To: <1317064434-1829-1-git-send-email-john.stultz@linaro.org> References: <1317064434-1829-1-git-send-email-john.stultz@linaro.org> Flag the rtc-cmos IRQ event as a wakeup event using pm_stay_awake and pm_relax() CC: Rafael J. Wysocki CC: arve@android.com CC: markgross@thegnar.org CC: Alan Stern CC: amit.kucheria@linaro.org CC: farrowg@sg.ibm.com CC: Dmitry Fink (Palm GBU) CC: linux-pm@lists.linux-foundation.org CC: khilman@ti.com CC: Magnus Damm CC: mjg@redhat.com CC: peterz@infradead.org 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)