From patchwork Mon Mar 13 14:09:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jon Hunter X-Patchwork-Id: 9620979 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 4A7A360414 for ; Mon, 13 Mar 2017 14:10:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D37F284F1 for ; Mon, 13 Mar 2017 14:10:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31DD4284F5; Mon, 13 Mar 2017 14:10:24 +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=ham 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 7D81D284F1 for ; Mon, 13 Mar 2017 14:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751166AbdCMOKW convert rfc822-to-8bit (ORCPT ); Mon, 13 Mar 2017 10:10:22 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:9358 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751150AbdCMOKV (ORCPT ); Mon, 13 Mar 2017 10:10:21 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com id ; Mon, 13 Mar 2017 07:09:59 -0700 Received: from HQMAIL101.nvidia.com ([172.20.13.39]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 13 Mar 2017 07:10:12 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 13 Mar 2017 07:10:12 -0700 Received: from UKMAIL101.nvidia.com (10.26.138.13) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Mon, 13 Mar 2017 14:10:12 +0000 Received: from [10.26.11.107] (10.26.11.107) by UKMAIL101.nvidia.com (10.26.138.13) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Mon, 13 Mar 2017 14:09:50 +0000 Subject: Re: [RFC PATCH 0/3] PM / Domains: Add support for devices that require multiple domains To: Ulf Hansson References: <1474367287-10402-1-git-send-email-jonathanh@nvidia.com> <52493231-71f4-1b62-b325-8532e63e4229@nvidia.com> CC: Geert Uytterhoeven , "Rafael J. Wysocki" , Kevin Hilman , Rajendra Nayak , Stanimir Varbanov , Stephen Boyd , Marek Szyprowski , Linux PM list , "linux-kernel@vger.kernel.org" , "linux-tegra@vger.kernel.org" , Bjorn Andersson From: Jon Hunter Message-ID: <3e88692d-613b-9c25-2554-7d399c45637a@nvidia.com> Date: Mon, 13 Mar 2017 14:09:34 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.26.11.107] X-ClientProxiedBy: UKMAIL102.nvidia.com (10.26.138.15) To UKMAIL101.nvidia.com (10.26.138.13) 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 Hi Ulf, On 13/03/17 11:45, Ulf Hansson wrote: > +Björn > > On 13 March 2017 at 10:37, Jon Hunter wrote: >> Hi Rafael, Kevin, Ulf, >> >> Looks like there is still some interest/needs in/for this. Any thoughts >> on how we can move this forward? > > At the Linaro Connect last week, I was talking to Björn, Rajendra and > Stephen more about these related issues. > > It definitely seems like we need to progress with this somehow, > meaning we need a solution for being able to associate a device with > more than one PM domain. In that context, I don't think genpd based on > its current design, is a good fit to solve the problem. > > Instead I think we need something entirely new (perhaps some code can > be borrowed from genpd), which is more similar to the clock/regulator > framework. In other words, what you also were suggesting in a earlier > reply. > In this way, the driver/subsystem gains full flexibility of managing > its device's PM domains, which seems like the best future-proof > solution. I agree, I think that that would give us the most flexibility to handle whatever scenario. However, I was thinking that we could still use the genpd core to register pm-domains with and control. My thought was to allow devices to have a bindings with multiple pm-domains ... dev-xyz { ... power-domains = <&domain-a>, <&domain-b>; }; Then in the genpd core we do having something like ... struct generic_pm_domain *pm_genpd_get(struct device *dev, char *name); - Use 'dev->of_node' to look-up pm-domain if populated, else uses name. struct generic_pm_domain *of_pm_genpd_get(struct device *dev, int index); void pm_genpd_put(struct generic_pm_domain *pd); int pm_genpd_power_on(struct generic_pm_domain *pd); int pm_genpd_power_off(struct generic_pm_domain *pd); - Power on/off APIs would be synchronous types Are there any potential pitfalls of the above? Cheers Jon diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index e697dec9d25b..d1ae6ddf4903 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2026,6 +2026,15 @@ int genpd_dev_pm_attach(struct device *dev) "samsung,power-domain", 0); if (!pd_args.np) return -ENOENT; + } else if (ret > 1) { + /* + * If there are more than one PM domain defined for a device, + * then these need to be manually controlled by the device + * driver because the genpd core cannot bind a device with + * more than one PM domain. + */ + dev_dbg(dev, "cannot add PM domains, %d detected!\n", ret); + return 0; } Then add some new public APIs for getting and controlling the pm-domains ...