Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755102AbdC1OQC (ORCPT ); Tue, 28 Mar 2017 10:16:02 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:16132 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752859AbdC1OP7 (ORCPT ); Tue, 28 Mar 2017 10:15:59 -0400 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 28 Mar 2017 07:15:18 -0700 From: Jon Hunter To: "Rafael J . Wysocki" , Kevin Hilman , Ulf Hansson , , CC: , , Marek Szyprowski , , , , Jon Hunter Subject: [RFC PATCH 1/4] PM / Domains: Prepare for supporting explicit PM domain control Date: Tue, 28 Mar 2017 15:14:00 +0100 Message-ID: <1490710443-27425-2-git-send-email-jonathanh@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490710443-27425-1-git-send-email-jonathanh@nvidia.com> References: <1490710443-27425-1-git-send-email-jonathanh@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1299 Lines: 35 The generic PM domain framework only supports consumers that require a single PM domain. In order to extend the framework so that consumers can explicitly control more than one PM domain, detect if the consumers specifies more than one PM domain and if it does then don't automatically bind the device with any of the PM domains and (leap of faith!) assume the consumer knows what to do! Signed-off-by: Jon Hunter --- drivers/base/power/domain.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index e697dec9d25b..0eb75954c087 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2011,6 +2011,16 @@ int genpd_dev_pm_attach(struct device *dev) if (dev->pm_domain) return -EEXIST; + /* + * If there are more than one PM domain defined for a device, + * then these need to be manually controlled by the driver + * that device, because the genpd core cannot bind a device + * with more than one PM domain. + */ + if (of_count_phandle_with_args(dev->of_node, "power-domains", + "#power-domain-cells") > 1) + return 0; + ret = of_parse_phandle_with_args(dev->of_node, "power-domains", "#power-domain-cells", 0, &pd_args); if (ret < 0) { -- 2.7.4