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: 6057441 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-pm@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 D60839F314 for ; Fri, 20 Mar 2015 14:55:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B087320520 for ; Fri, 20 Mar 2015 14:55:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9E0920483 for ; Fri, 20 Mar 2015 14:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752037AbbCTOzx (ORCPT ); Fri, 20 Mar 2015 10:55:53 -0400 Received: from mail-la0-f54.google.com ([209.85.215.54]:36296 "EHLO mail-la0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752062AbbCTOzw (ORCPT ); Fri, 20 Mar 2015 10:55:52 -0400 Received: by labe2 with SMTP id e2so13660187lab.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:from:to:cc:subject:date:message-id; bh=JgB7ga8ShZgYBhSIefqliKCyDm4Di9nnduW9iJ879TA=; b=I2fDCEFJijls0aVN29jxABkU2t1kVESY/i4k5munInrcExLsLoPyiJMKQ/MSX2hhMf PnF/eTuykPH6X6XIC1lmmr4us4vutRsUsDaadSdRhPZkXUoqfAM2QF0v3k/GwTLMRxFW i4zeHyCvVOZZcofpxvXYbx7Z12Z6P5d/c2c0gGoVqX6f2ejKinJ4E6Z2NFV71UDC5OFr 4Z3K3Slgg/Y3hRavKEb6NjBUtODvPSPMR6XbjrKukpfxdLBv6ieZWIj+2TMXGzkqPBP2 FMuTPZ0SfswCBeoik6nqiV24w57m7pCPjtqdP3UVsqZy+MQEkbz4WJCqAkI3yki9S8Mr PgXQ== X-Gm-Message-State: ALoCoQn4o/NLlCAKjg7UKre22Yr+86N9640SBZrQnYyBkVRFAxmX0egFyZMBxqZ9mUhxqkL0dDSn 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 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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;