From patchwork Tue Mar 28 14:14:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Hunter X-Patchwork-Id: 9649779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 831E96034B for ; Tue, 28 Mar 2017 14:16:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6936B283E8 for ; Tue, 28 Mar 2017 14:16:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E15827C0B; Tue, 28 Mar 2017 14:16:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 427B3283E1 for ; Tue, 28 Mar 2017 14:16:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752146AbdC1OQB (ORCPT ); Tue, 28 Mar 2017 10:16:01 -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 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com id ; Tue, 28 Mar 2017 07:14:57 -0700 Received: from HQMAIL106.nvidia.com ([172.20.13.39]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 28 Mar 2017 07:15:18 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 28 Mar 2017 07:15:18 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL106.nvidia.com (172.18.146.12) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 28 Mar 2017 14:15:17 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 28 Mar 2017 14:15:17 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server id 15.0.1263.5 via Frontend Transport; Tue, 28 Mar 2017 14:15:17 +0000 Received: from goldfinger.nvidia.com (Not Verified[10.21.132.162]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7, 5, 5, 8150) id ; Tue, 28 Mar 2017 07:15:17 -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 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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) {