Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751476AbdCODrU (ORCPT ); Tue, 14 Mar 2017 23:47:20 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:50584 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751240AbdCODrQ (ORCPT ); Tue, 14 Mar 2017 23:47:16 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 65E6E6080B Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=rnayak@codeaurora.org Subject: Re: [RFC PATCH 0/3] PM / Domains: Add support for devices that require multiple domains To: Jon Hunter , Ulf Hansson References: <1474367287-10402-1-git-send-email-jonathanh@nvidia.com> <52493231-71f4-1b62-b325-8532e63e4229@nvidia.com> <3e88692d-613b-9c25-2554-7d399c45637a@nvidia.com> Cc: Geert Uytterhoeven , "Rafael J. Wysocki" , Kevin Hilman , Stanimir Varbanov , Stephen Boyd , Marek Szyprowski , Linux PM list , "linux-kernel@vger.kernel.org" , "linux-tegra@vger.kernel.org" , Bjorn Andersson From: "Nayak, Rajendra" Message-ID: Date: Wed, 15 Mar 2017 09:17:04 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <3e88692d-613b-9c25-2554-7d399c45637a@nvidia.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3344 Lines: 82 Hey Jon, >>> 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 ... > > 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 ... > > 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 These would also need some kind of usecounting I guess, since genpd otherwise relies on runtime PM to do the usecounting. This overall seems like a reasonable approach to solve the problem we have. While we discussed this approach at connect, we thought it would be a good idea to bring out some RFC on these lines to get the discussion going. Do you think you would be able to work on some quick RFC around these lines, else if you think you would be busy in the near term I can help with hacking up the changes as well. regards, Rajendra > > Are there any potential pitfalls of the above? > > Cheers > Jon >