Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161169AbbENVf3 (ORCPT ); Thu, 14 May 2015 17:35:29 -0400 Received: from v094114.home.net.pl ([79.96.170.134]:51227 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1161050AbbENVf1 (ORCPT ); Thu, 14 May 2015 17:35:27 -0400 From: "Rafael J. Wysocki" To: Tony Lindgren Cc: Felipe Balbi , "Rafael J. Wysocki" , Alan Stern , Andreas Fenkart , Greg Kroah-Hartman , Huiquan Zhong , Kevin Hilman , NeilBrown , Mika Westerberg , Nishanth Menon , Peter Hurley , Sebastian Andrzej Siewior , Ulf Hansson , Thomas Gleixner , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-omap@vger.kernel.org Subject: Re: [PATCH 2/5] PM / Wakeirq: Add automated device wake IRQ handling Date: Fri, 15 May 2015 00:00:40 +0200 Message-ID: <3499196.MCAcS31ICO@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.0.0+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20150514211501.GO15563@atomide.com> References: <1431560196-5722-1-git-send-email-tony@atomide.com> <20150514155945.GL15563@atomide.com> <20150514211501.GO15563@atomide.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3913 Lines: 121 On Thursday, May 14, 2015 02:15:01 PM Tony Lindgren wrote: > * Tony Lindgren [150514 09:01]: > > * Felipe Balbi [150513 19:09]: > > > > +void dev_pm_enable_wake_irq(struct device *dev) > > > > +{ > > > > + struct wake_irq *wirq = dev->power.wakeirq; > > > > + > > > > + if (wirq && wirq->manage_irq) > > > > + enable_irq(wirq->irq); > > > > +} > > > > +EXPORT_SYMBOL_GPL(dev_pm_enable_wake_irq); > > > > > > you probably want to enable dev_pm_enable_wake_irq() automatically for > > > from rpm_suspend(). According to runtime_pm documentation, wakeup should > > > always be enabled for runtime suspended devices. I didn't really look > > > through the whole thing yet to know if you did call it or not. > > > > Yes I think we can also automate that part, I've been playing with an > > additional patch doing that for pm runtime. Been still thinking if > > there's any need to manage that in the consomer driver, I guess not. > > Here's what that would roughly look and now I also remember why > I did not include it. It adds currently extra checks also for > devices not using dedicated wakeirqs. But basically this would > allow leaving out the enable/disable PM runtime calls from drivers. > > Regards, > > Tony > > 8< ------------------- > --- a/drivers/base/power/runtime.c > +++ b/drivers/base/power/runtime.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include "power.h" > > @@ -514,6 +515,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) > > callback = RPM_GET_CALLBACK(dev, runtime_suspend); > > + dev_pm_enable_wake_irq(dev); > retval = rpm_callback(callback, dev); > if (retval) > goto fail; > @@ -552,6 +554,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) > return retval; > > fail: > + dev_pm_disable_wake_irq(dev); > __update_runtime_status(dev, RPM_ACTIVE); > dev->power.deferred_resume = false; > wake_up_all(&dev->power.wait_queue); > @@ -734,10 +737,12 @@ static int rpm_resume(struct device *dev, int rpmflags) > > callback = RPM_GET_CALLBACK(dev, runtime_resume); > > + dev_pm_disable_wake_irq(dev); > retval = rpm_callback(callback, dev); > if (retval) { > __update_runtime_status(dev, RPM_SUSPENDED); > pm_runtime_cancel_pending(dev); > + dev_pm_enable_wake_irq(dev); > } else { > no_callback: > __update_runtime_status(dev, RPM_ACTIVE); > @@ -1427,6 +1432,7 @@ int pm_runtime_force_suspend(struct device *dev) > goto err; > } > > + dev_pm_enable_wake_irq(dev); Why here? This is for system suspend. > ret = callback(dev); > if (ret) > goto err; > @@ -1434,6 +1440,7 @@ int pm_runtime_force_suspend(struct device *dev) > pm_runtime_set_suspended(dev); > return 0; > err: > + dev_pm_disable_wake_irq(dev); > pm_runtime_enable(dev); > return ret; > } > @@ -1463,6 +1470,7 @@ int pm_runtime_force_resume(struct device *dev) > goto out; > } > > + dev_pm_disable_wake_irq(dev); This one too. > ret = callback(dev); > if (ret) > goto out; > @@ -1470,6 +1478,7 @@ int pm_runtime_force_resume(struct device *dev) > pm_runtime_set_active(dev); > pm_runtime_mark_last_busy(dev); > out: > + dev_pm_enable_wake_irq(dev); > pm_runtime_enable(dev); > return ret; > } > -- > To unsubscribe from this list: send the line "unsubscribe linux-pm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/