From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Hunter Subject: Re: [PATCH V5 11/14] soc: tegra: pmc: Add generic PM domain support Date: Thu, 18 Feb 2016 16:31:22 +0000 Message-ID: <56C5F1DA.2060705@nvidia.com> References: <1453998832-27383-1-git-send-email-jonathanh@nvidia.com> <1453998832-27383-12-git-send-email-jonathanh@nvidia.com> <7hh9hdzflv.fsf@baylibre.com> <56C1B62B.5060708@nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Ulf Hansson Cc: Kevin Hilman , Stephen Warren , Thierry Reding , Alexandre Courbot , "Rafael J. Wysocki" , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , "linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" List-Id: devicetree@vger.kernel.org On 18/02/16 16:00, Ulf Hansson wrote: > [...] > >>> >>> What about the pm_clk_* API which was built for tracking clocks >>> associated with devices for runtime PM. >>> >>> IOW, you could pm_clk_add(pg->pmc->dev, pg->clks[i]) and then your >>> _enable_clocks() would become pm_clk_suspend() an dyour >>> _disable_clocks() would become pm_clk_resume(). >> >> Very interesting, I was not aware of this. >> >>> I might not be following the mapping between PMC and PGs though so not >>> sure pg->pmc->dev is the right struct device, but you get the idea. >> >> Yes, so this will not work here as-is, because the pmc->dev is common to >> all pm-domains (it is the device that creates all the pm-domains). So to >> make this work, I would need to create a device for each pm-domain and >> add the clocks to that. >> >> I see that this works very well for normal drivers, but it does not feel >> so natural for pm-domains where we don't have a device struct today. By >> the way, the rockchip pm-domains implementation is very much in the same >> boat as tegra, where there are multiple clocks per pm-domain and it is >> handled by a simple list. So I am not sure if you think that we should >> be turning all pm-domains registered by pm_genpd_init() into a device >> and then we can make use of these pm_clk_XXXX() APIs? >> >> I have implemented the generic clk APIs that Ulf and I discussed for >> handling multiple clocks, but if we think that this is a better way, >> then I will hold off for now. > > I think Kevin has a point that we already have PM clocks to build upon. > Could we perhaps try to extend that API instead to suite this needs as well? We certainly could and I am not against it, however, it means that we need to create a device structure for each pm-domain. If you and Kevin are ok with me adding this to pm_genpd_init(), then I can give it a try. > I do realize that it will make this patchset more complicated. As I > stated earlier, this was just an idea I had, so to be clear I won't > hold back an ack for this patchset, if you decide to deal with this in > separate "improvement" step. Thanks Jon