From patchwork Fri Feb 10 22:25:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 9567571 X-Patchwork-Delegate: rjw@sisk.pl 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 E72F0602B6 for ; Fri, 10 Feb 2017 22:25:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D732E285C0 for ; Fri, 10 Feb 2017 22:25:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC052285D2; Fri, 10 Feb 2017 22:25: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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 7BE2E285C0 for ; Fri, 10 Feb 2017 22:25:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750910AbdBJWZP (ORCPT ); Fri, 10 Feb 2017 17:25:15 -0500 Received: from muru.com ([72.249.23.125]:34578 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751767AbdBJWZO (ORCPT ); Fri, 10 Feb 2017 17:25:14 -0500 Received: from sampyla.muru.com. (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 8C97682C7; Fri, 10 Feb 2017 22:26:30 +0000 (UTC) From: Tony Lindgren To: "Rafael J . Wysocki" , Alan Stern Cc: Brian Norris , Dmitry Torokhov , Greg Kroah-Hartman , Grygorii Strashko , Len Brown , Nishanth Menon , Pavel Machek , Ulf Hansson , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, Tero Kristo Subject: [PATCH 1/2] PM / wakeirq: Enable dedicated wakeirq for suspend Date: Fri, 10 Feb 2017 14:25:00 -0800 Message-Id: <20170210222501.7948-2-tony@atomide.com> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170210222501.7948-1-tony@atomide.com> References: <20170210222501.7948-1-tony@atomide.com> 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 From: Grygorii Strashko We currently rely on runtime PM to enable dedicated wakeirq for suspend. This assumption fails in the following two cases: 1. If the consumer driver does not have runtime PM implemented, the dedicated wakeirq never gets enabled for suspend 2. If the consumer driver has runtime PM implemented, but does not idle in suspend Let's fix the issue by always enabling the dedicated wakeirq during suspend. Depends-on: bed570307ed7 ("PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend") Fixes: 4990d4fe327b ("PM / Wakeirq: Add automated device wake IRQ handling") Cc: Brian Norris Cc: Tero Kristo Reported-by: Keerthy Tested-by: Keerthy Signed-off-by: Grygorii Strashko [tony@atomide.com: updated based on bed570307ed7, added description] Tested-by: Tony Lindgren Signed-off-by: Tony Lindgren --- drivers/base/power/wakeirq.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c --- a/drivers/base/power/wakeirq.c +++ b/drivers/base/power/wakeirq.c @@ -312,8 +312,12 @@ void dev_pm_arm_wake_irq(struct wake_irq *wirq) if (!wirq) return; - if (device_may_wakeup(wirq->dev)) + if (device_may_wakeup(wirq->dev)) { + if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED) + enable_irq(wirq->irq); + enable_irq_wake(wirq->irq); + } } /** @@ -328,6 +332,10 @@ void dev_pm_disarm_wake_irq(struct wake_irq *wirq) if (!wirq) return; - if (device_may_wakeup(wirq->dev)) + if (device_may_wakeup(wirq->dev)) { disable_irq_wake(wirq->irq); + + if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED) + disable_irq_nosync(wirq->irq); + } }