From patchwork Fri Mar 20 14:55:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 6057471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AF71D9F314 for ; Fri, 20 Mar 2015 14:58:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC3FE2042A for ; Fri, 20 Mar 2015 14:58:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EC1F8200DC for ; Fri, 20 Mar 2015 14:58:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YYyLU-0004IW-SV; Fri, 20 Mar 2015 14:56:20 +0000 Received: from mail-la0-f49.google.com ([209.85.215.49]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YYyLP-0004DE-9f for linux-arm-kernel@lists.infradead.org; Fri, 20 Mar 2015 14:56:16 +0000 Received: by ladw1 with SMTP id w1so89005686lad.0 for ; Fri, 20 Mar 2015 07:55:51 -0700 (PDT) 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=JgB7ga8ShZgYBhSIefqliKCyDm4Di9nnduW9iJ879TA=; b=U+Ezq3iAAX97uts54eDfi19NDL1p0jzoAmovsRa/QDZzYmLVeDaOg2mHA/Ue8OxVqM 0okDUB/QkLmkqepppgegsUg9x9G8UEtd0Z+pScTfa5hs/n7d8+bPoQ7/a/1mieuvWwqF qLqTd3baC/UB8AEU+noybJ7AEGddKiOSIz2HSgvbzXcCWnJnw5XlxqK59qvqEjdJmOmk z6ntUl3GonQpKzPoWz1J9dGo4GVDJjkLNICKP54vTW2prnnhrzPKht/yBfDm2PJxoaWd jbpS1ZQixI4hZuYjsHRHzyYAtGd7dJFORDIsDurN4af4WOG2F2j4onUkn1wmxOrt2WBq me5Q== X-Gm-Message-State: ALoCoQkVJ6x0p+800efLGPBj8QpYn5OzzFSLtrVzUg4EatXVI82NVquMqjdsTbIJohehE1CsuBsF X-Received: by 10.112.13.7 with SMTP id d7mr10335597lbc.79.1426863350896; Fri, 20 Mar 2015 07:55:50 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id us1sm985728lbc.1.2015.03.20.07.55.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Mar 2015 07:55:49 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , linux-pm@vger.kernel.org Subject: [PATCH V2] PM / Domains: Sync runtime PM status with genpd after probe Date: Fri, 20 Mar 2015 15:55:12 +0100 Message-Id: <1426863312-31132-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150320_075615_528437_F50F9C2A X-CRM114-Status: GOOD ( 12.05 ) X-Spam-Score: -0.7 (/) Cc: Len Brown , Russell King , Geert Uytterhoeven , Dmitry Torokhov , Pavel Machek , Russell King , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Russell King Buses which currently supports attaching devices to their PM domains, will invoke the dev_pm_domain_attach() API from their ->probe() callbacks. During the attach procedure, genpd power up the PM domain. In those scenarios where the bus/driver don't need to access its device during probe, it may leave it in runtime PM suspended state since that's also the default state. In that way, no notifications through the runtime PM callbacks will reach the PM domain during probe. For genpd, the consequence from the above scenario means the PM domain will remain powered. Therefore, implement the struct dev_pm_domain's ->sync() callback, which is invoked from driver core after the bus/driver has probed the device. It allows genpd to power off the PM domain if it's unused. Signed-off-by: Russell King [Ulf: Updated patch according to updates in driver core] Signed-off-by: Ulf Hansson Acked-by: Kevin Hilman --- Changes in v2: - I picked up Russell's earlier patch [1] and updated it to fit the changes [2] proposed to be done to the driver core. [1]: [PATCH 3/9] pm: domains: sync runtime PM status with PM domains after probe [2]: [PATCH v3] driver core / PM: Add PM domain callbacks for device setup/cleanup http://www.spinics.net/lists/arm-kernel/msg407394.html --- drivers/base/power/domain.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 45937f8..295ff71 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2130,6 +2130,17 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off) genpd_queue_power_off_work(pd); } +static void genpd_dev_pm_sync(struct device *dev) +{ + struct generic_pm_domain *pd; + + pd = dev_to_genpd(dev); + if (IS_ERR(pd)) + return; + + genpd_queue_power_off_work(pd); +} + /** * genpd_dev_pm_attach - Attach a device to its PM domain using DT. * @dev: Device to attach. @@ -2196,6 +2207,7 @@ int genpd_dev_pm_attach(struct device *dev) } dev->pm_domain->detach = genpd_dev_pm_detach; + dev->pm_domain->sync = genpd_dev_pm_sync; pm_genpd_poweron(pd); return 0;