From patchwork Fri Jul 1 00:24:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 933842 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p610NXhO023398 for ; Fri, 1 Jul 2011 00:23:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753670Ab1GAAXc (ORCPT ); Thu, 30 Jun 2011 20:23:32 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:44956 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753493Ab1GAAXb (ORCPT ); Thu, 30 Jun 2011 20:23:31 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 2B3291B3EF6; Fri, 1 Jul 2011 02:00:11 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 13576-04; Fri, 1 Jul 2011 01:59:54 +0200 (CEST) Received: from ferrari.rjw.lan (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id B90571B3E6D; Fri, 1 Jul 2011 01:59:54 +0200 (CEST) From: "Rafael J. Wysocki" To: Kevin Hilman Subject: Re: [PATCH 7/10 v6] PM / Domains: Don't stop wakeup devices during system sleep transitions Date: Fri, 1 Jul 2011 02:24:37 +0200 User-Agent: KMail/1.13.6 (Linux/3.0.0-rc5+; KDE/4.6.0; x86_64; ; ) Cc: Linux PM mailing list , "Greg Kroah-Hartman" , Magnus Damm , Paul Walmsley , Alan Stern , LKML , linux-sh@vger.kernel.org, Paul Mundt References: <201106112223.04972.rjw@sisk.pl> <201107010128.03732.rjw@sisk.pl> <8762nmc1hs.fsf@ti.com> In-Reply-To: <8762nmc1hs.fsf@ti.com> MIME-Version: 1.0 Message-Id: <201107010224.37609.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 01 Jul 2011 00:23:33 +0000 (UTC) On Friday, July 01, 2011, Kevin Hilman wrote: > "Rafael J. Wysocki" writes: ... > > So the only way forward I can see is to add a special PM domain callback, > > say .active_wakeup(), that will return "true" if the device is to be left > > active when wakeup-enabled. So the check you don't like will become > > something like: > > > > if (device_may_wakeup(dev) && genpd->active_wakeup > > && genpd->active_wakeup(dev)) > > return 0; > > > > Would that be better? > > Yes, much better. And I like the default behavior if no hooks are provided. So, what about the appended patch instead of the $subject one? Rafael Acked-by: Kevin Hilman --- From: Rafael J. Wysocki Subject: PM / Domains: Wakeup devices support for system sleep transitions There is the problem how to handle devices set up to wake up the system from sleep states during system-wide power transitions. In some cases, those devices can be turned off entirely, because the wakeup signals will be generated on their behalf anyway. In some other cases, they will generate wakeup signals if their clocks are stopped, but only if power is not removed from them. Finally, in some cases, they can only generate wakeup signals if power is not removed from them and their clocks are enabled. To allow platform-specific code to decide whether or not to put wakeup devices (and their PM domains) into low-power state during system-wide transitions, such as system suspend, introduce a new generic PM domain callback, .active_wakeup(), that will be used during the "noirq" phase of system suspend and hibernation (after image creation) to decide what to do with wakeup devices. Specifically, if this callback is present and returns "true", the generic PM domain code will not execute .stop_device() for the given wakeup device and its PM domain won't be powered off. Signed-off-by: Rafael J. Wysocki --- drivers/base/power/domain.c | 8 ++++++++ include/linux/pm_domain.h | 1 + 2 files changed, 9 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/drivers/base/power/domain.c =================================================================== --- linux-2.6.orig/drivers/base/power/domain.c +++ linux-2.6/drivers/base/power/domain.c @@ -450,6 +450,10 @@ static int pm_genpd_suspend_noirq(struct if (ret) return ret; + if (device_may_wakeup(dev) + && genpd->active_wakeup && genpd->active_wakeup(dev)) + return 0; + if (genpd->stop_device) genpd->stop_device(dev); @@ -670,6 +674,10 @@ static int pm_genpd_dev_poweroff_noirq(s if (ret) return ret; + if (device_may_wakeup(dev) + && genpd->active_wakeup && genpd->active_wakeup(dev)) + return 0; + if (genpd->stop_device) genpd->stop_device(dev); Index: linux-2.6/include/linux/pm_domain.h =================================================================== --- linux-2.6.orig/include/linux/pm_domain.h +++ linux-2.6/include/linux/pm_domain.h @@ -38,6 +38,7 @@ struct generic_pm_domain { int (*power_on)(struct generic_pm_domain *domain); int (*start_device)(struct device *dev); int (*stop_device)(struct device *dev); + bool (*active_wakeup)(struct device *dev); }; static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)