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: 46145 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F2FBA21418 for ; Fri, 20 Mar 2015 14:55:52 +0000 (UTC) Received: by lbdu14 with SMTP id u14sf1655576lbd.3 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:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=JgB7ga8ShZgYBhSIefqliKCyDm4Di9nnduW9iJ879TA=; b=XmZXrv1nPASWowSKXzay9CZEf4Kr/kA9FhtKK4WIK5Tf05ypOrU8WuAQ4MYIWaUJiM h1ukYF7kb8JCzTvPylzqNBZwQrBjb4550uirpUXE++tHp9lZo7FpPjLCv59gO0bt1JJn WpzvFKVdfjTcJpVgfj/6CEfCs+2lpi7czTyU6uC31eip4qlK2CwHvxVTFrTLifz8MKZB xQMQ3Qrv0g2W2kXyOqI3uvG5EAaZli8WnrsTr6r0+Wel88kXgD/0FY1ZKlk+RB/XOL+w F6XmhkmiYofDSRvuw1cPpe1QMQrIR2CIOc2/5yaVdjv2evm/HWMith5evBbBN3Dye8NM rkQQ== X-Gm-Message-State: ALoCoQmhye+QukyJPFrmyg+wasYA1XT3EeN7whg10OkPk8EGW9ItqUrp+0BGdQiJ4q7gfUFs/T++ X-Received: by 10.180.182.201 with SMTP id eg9mr727265wic.3.1426863351914; Fri, 20 Mar 2015 07:55:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.197.2 with SMTP id iq2ls439758lac.100.gmail; Fri, 20 Mar 2015 07:55:51 -0700 (PDT) X-Received: by 10.112.139.99 with SMTP id qx3mr28080753lbb.44.1426863351754; Fri, 20 Mar 2015 07:55:51 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id qm5si3347768lbb.81.2015.03.20.07.55.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Mar 2015 07:55:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbcgn8 with SMTP id gn8so77083030lbc.2 for ; Fri, 20 Mar 2015 07:55:51 -0700 (PDT) X-Received: by 10.152.28.5 with SMTP id x5mr72125774lag.112.1426863351617; Fri, 20 Mar 2015 07:55:51 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.35.133 with SMTP id h5csp98777lbj; Fri, 20 Mar 2015 07:55:51 -0700 (PDT) X-Received: by 10.152.121.33 with SMTP id lh1mr73542307lab.86.1426863351080; Fri, 20 Mar 2015 07:55:51 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id zg6si3295368lbb.169.2015.03.20.07.55.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Mar 2015 07:55:51 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbbrr9 with SMTP id rr9so12683385lbb.0 for ; Fri, 20 Mar 2015 07:55:51 -0700 (PDT) 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 Cc: Len Brown , Pavel Machek , Geert Uytterhoeven , Dmitry Torokhov , Russell King , linux-arm-kernel@lists.infradead.org, Russell King 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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;