From patchwork Wed Apr 18 21:49:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 153612 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-we0-f184.google.com (mail-we0-f184.google.com [74.125.82.184]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 2C81FB6EEB for ; Thu, 19 Apr 2012 07:50:01 +1000 (EST) Received: by werf13 with SMTP id f13sf3670658wer.11 for ; Wed, 18 Apr 2012 14:49:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=mime-version:x-beenthere:received-spf:from:to:cc:subject:message-id :date:x-cloudmark-analysis:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=owtO3nDbFOOfktHRAQKtbc2ZpiGKUGjne3HwZ+b1sEo=; b=QatRhfhjYYrqKj6B53I83+gSwfEFtl4v9dYPPXPy9Lh+WfXMxP+iIVMPYJkNInD3qC 9V/7MSuWOgXb8rSqYsP2u3F4AyJ+gw0digbZ1kiDMdO1k8CZBOgu6yGeeakqzNLEo6mB fKL6L67ecXrFhDBxc+E63/bAudXkZybmraN6o= Received: by 10.180.84.132 with SMTP id z4mr593049wiy.2.1334785796592; Wed, 18 Apr 2012 14:49:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.180.7.9 with SMTP id f9ls6514056wia.2.canary; Wed, 18 Apr 2012 14:49:55 -0700 (PDT) Received: by 10.181.13.198 with SMTP id fa6mr845342wid.0.1334785795811; Wed, 18 Apr 2012 14:49:55 -0700 (PDT) Received: by 10.181.13.198 with SMTP id fa6mr845341wid.0.1334785795800; Wed, 18 Apr 2012 14:49:55 -0700 (PDT) Received: from mtaout02-winn.ispmail.ntl.com (mtaout02-winn.ispmail.ntl.com. [81.103.221.48]) by gmr-mx.google.com with ESMTP id dr4si6602574wib.3.2012.04.18.14.49.55; Wed, 18 Apr 2012 14:49:55 -0700 (PDT) Received-SPF: neutral (google.com: 81.103.221.48 is neither permitted nor denied by best guess record for domain of dsd@laptop.org) client-ip=81.103.221.48; Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20120418214955.XGJE28064.mtaout02-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com>; Wed, 18 Apr 2012 22:49:55 +0100 Received: from zog.reactivated.net ([86.14.215.141]) by aamtaout04-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20120418214955.BTRM23925.aamtaout04-winn.ispmail.ntl.com@zog.reactivated.net>; Wed, 18 Apr 2012 22:49:55 +0100 Received: by zog.reactivated.net (Postfix, from userid 1000) id E59BB9D401E; Wed, 18 Apr 2012 22:49:52 +0100 (BST) From: Daniel Drake To: a.zummo@towertech.it Cc: rtc-linux@googlegroups.com, linux-pm@vger.kernel.org, pgf@laptop.org Subject: [rtc-linux] [PATCH] rtc-cmos: report wakeup event on ACPI RTC alarm Message-Id: <20120418214952.E59BB9D401E@zog.reactivated.net> Date: Wed, 18 Apr 2012 22:49:52 +0100 (BST) X-Cloudmark-Analysis: v=1.1 cv=R50lirqlHffDPPkwUlkuVa99MrvKdVWo//yz83qex8g= c=1 sm=0 a=xQmQ3cyH9yMA:10 a=vJ1w_8FsMGIA:10 a=Op-mwl0xAAAA:8 a=Q8M_-xlsnyRVcjDb33kA:9 a=S3syBqZYhLxsLWkvylsA:7 a=d4CUUju0HPYA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Original-Sender: dsd@laptop.org X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 81.103.221.48 is neither permitted nor denied by best guess record for domain of dsd@laptop.org) smtp.mail=dsd@laptop.org Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , When the ACPI-driven RTC alarm wakes the system, report it as a wakeup event. This allows userspace to determine that the reason for system wakeup was RTC alarm. Signed-off-by: Daniel Drake --- drivers/rtc/rtc-cmos.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index d7782aa..d7ad467 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -910,14 +910,17 @@ static inline int cmos_poweroff(struct device *dev) static u32 rtc_handler(void *context) { + struct device *dev = context; + + pm_wakeup_event(dev, 0); acpi_clear_event(ACPI_EVENT_RTC); acpi_disable_event(ACPI_EVENT_RTC, 0); return ACPI_INTERRUPT_HANDLED; } -static inline void rtc_wake_setup(void) +static inline void rtc_wake_setup(struct device *dev) { - acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); + acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, dev); /* * After the RTC handler is installed, the Fixed_RTC event should * be disabled. Only when the RTC alarm is set will it be enabled. @@ -950,7 +953,7 @@ cmos_wake_setup(struct device *dev) if (acpi_disabled) return; - rtc_wake_setup(); + rtc_wake_setup(dev); acpi_rtc_info.wake_on = rtc_wake_on; acpi_rtc_info.wake_off = rtc_wake_off;