From patchwork Thu Nov 10 18:07:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9421877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AE9B9601C0 for ; Thu, 10 Nov 2016 18:07:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE80E297F6 for ; Thu, 10 Nov 2016 18:07:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2ED3297FA; Thu, 10 Nov 2016 18:07:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16E1E297F6 for ; Thu, 10 Nov 2016 18:07:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754177AbcKJSHl (ORCPT ); Thu, 10 Nov 2016 13:07:41 -0500 Received: from mail-pf0-f177.google.com ([209.85.192.177]:36712 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754089AbcKJSHl (ORCPT ); Thu, 10 Nov 2016 13:07:41 -0500 Received: by mail-pf0-f177.google.com with SMTP id 189so150437392pfz.3 for ; Thu, 10 Nov 2016 10:07:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=A6cnfPjcRZX0vwSdtK/HTNf3gXZVI6wkcYU+BCjZYaA=; b=mi9crMn8W8XRvvlZwebW5hDrADQR6vU9zcvE21oNE82EMxHJDq5VPTCQDl9goR8c+M pKKl7WsrwAb/3Roz8Oi1x9gsnoEqp2w+by9YZhEp9edl0f8LTdeNs0UWjyrtlg2De5BZ D8WX3dkUKMscq3l0FlMWbISUXgyDgbvPhUZGg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=A6cnfPjcRZX0vwSdtK/HTNf3gXZVI6wkcYU+BCjZYaA=; b=eTqPVk/2plg9PJcx2+ySUKpr5C/Q7k58K9eAQRtI2IwHJJ+HAOki3B1RzGhihwST19 XNSDT7W2vAusC4FTlL1o6mw91pHHeZJV2VvHfmuVfkVYy9ZaitRzaMmk6UL0bQLat1Bm 4K7eWezGcDrmyUzwgW9oamwDtA0eKXrV133qbhkdf5HocgxZue9EMHZYSI8YEmfMjAkD YKW2IG9hiwvJtMMTT9Bpor8fzgIrap0Wfu+3puHwil/UOORbI+my03jO+G+VIjHwZ4cf XvZoSdnfpO9ifVNQm9mMaEbOHirGgwUr8LTveulS2/bEo/Ij2706ajHorUyuDSaMr4RH sRLg== X-Gm-Message-State: ABUngvfiZDWCu2ii8IiZNxdFqHB8V9GlhzX2KyY51r5ctoy6ySYQ98ZB9U7iFrufmDni93LO X-Received: by 10.98.7.151 with SMTP id 23mr12308488pfh.5.1478801259979; Thu, 10 Nov 2016 10:07:39 -0800 (PST) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id uh10sm8916197pab.5.2016.11.10.10.07.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Nov 2016 10:07:39 -0800 (PST) From: Brian Norris To: "Rafael J . Wysocki" , Pavel Machek , Len Brown , Greg Kroah-Hartman Cc: , Brian Norris , linux-pm@vger.kernel.org, Tony Lindgren , Dmitry Torokhov , Brian Norris Subject: [PATCH] PM / wakeirq: report wakeup events in dedicated wake-IRQs Date: Thu, 10 Nov 2016 10:07:07 -0800 Message-Id: <1478801227-65527-1-git-send-email-briannorris@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's important that user space can figure out what device woke the system from suspend -- e.g., for debugging, or for implementing conditional wake behavior. Dedicated wakeup IRQs don't currently do that. Let's report the event (pm_wakeup_event()) and also allow drivers to synchronize with these events in their resume path (hence, disable_irq() instead of disable_irq_nosync()). Signed-off-by: Brian Norris --- drivers/base/power/wakeirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c index 0d77cd6fd8d1..c35b2db1194c 100644 --- a/drivers/base/power/wakeirq.c +++ b/drivers/base/power/wakeirq.c @@ -139,6 +139,8 @@ static irqreturn_t handle_threaded_wake_irq(int irq, void *_wirq) struct wake_irq *wirq = _wirq; int res; + pm_wakeup_event(wirq->dev, 0); + /* We don't want RPM_ASYNC or RPM_NOWAIT here */ res = pm_runtime_resume(wirq->dev); if (res < 0) @@ -240,7 +242,7 @@ void dev_pm_disable_wake_irq(struct device *dev) struct wake_irq *wirq = dev->power.wakeirq; if (wirq && wirq->dedicated_irq) - disable_irq_nosync(wirq->irq); + disable_irq(wirq->irq); } EXPORT_SYMBOL_GPL(dev_pm_disable_wake_irq);