Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936532AbcKKUR7 (ORCPT ); Fri, 11 Nov 2016 15:17:59 -0500 Received: from muru.com ([72.249.23.125]:59390 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935305AbcKKUR4 (ORCPT ); Fri, 11 Nov 2016 15:17:56 -0500 Date: Fri, 11 Nov 2016 12:17:52 -0800 From: Tony Lindgren To: Brian Norris Cc: Dmitry Torokhov , "Rafael J . Wysocki" , Pavel Machek , Len Brown , Greg Kroah-Hartman , lkml , Brian Norris , "linux-pm@vger.kernel.org" , Grygorii Strashko , linux-omap@vger.kernel.org Subject: Re: [PATCH] PM / wakeirq: report wakeup events in dedicated wake-IRQs Message-ID: <20161111201751.GH7138@atomide.com> References: <1478801227-65527-1-git-send-email-briannorris@chromium.org> <20161110184910.GA135921@google.com> <20161110204911.GK27724@atomide.com> <20161110213038.GA108490@google.com> <20161111164753.GD7138@atomide.com> <20161111194041.GA111624@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161111194041.GA111624@google.com> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1733 Lines: 56 * Brian Norris [161111 11:40]: > > BTW, for context, I'm working on using dev_pm_set_dedicated_wake_irq() > for a Wifi driver which supports out-of-band (e.g., GPIO-based) wakeup. > I see it's used in the I2C core, but the I2C code never actually calls > dev_pm_enable_wake_irq(). So while I think I can use this API OK for > my Wifi driver (calling dev_pm_{en,dis}able_wake_irq() at system > suspend/resume), I'm not sure this will help the I2C case. OK it's used for that purpose with the SDIO dat1 interrupt for omaps. This allows the WLAN to stay on and connected while the SoC can hit deeper idle states. The calling of dev_pm_enable_wake_irq() happens automagically from rpm_suspend() and then it's disabled after rpm_resume(). > The more I look at this API, the more I'm confused, especially about its > seeming dependence on runtime PM. Are you talking about suspend/resume only? If so, see if the following snippet from Grygorii helps. Grygorii, care to send it with proper description and Signed-off-by if you did not yet do that? Regards, Tony 8< ---------------------- --- a/drivers/base/power/wakeirq.c +++ b/drivers/base/power/wakeirq.c @@ -256,8 +256,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->dedicated_irq) + enable_irq(wirq->irq); + enable_irq_wake(wirq->irq); + } } /** @@ -272,6 +276,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->dedicated_irq) + disable_irq_nosync(wirq->irq); + } }