Subject: [RFC PATCH 1/2] pm: Add PM domain notifications

From: [email-masked] (Sylwester Nawrocki)
Date: Thu, 11 Dec 2014 14:54:47 +0100

On 11/12/14 12:04, Tomasz Figa wrote:
...
>> > On 11/12/14 09:26, Tomasz Figa wrote:
>>> > > From: Sylwester Nawrocki <[email-masked]>
>>> > >
>>> > > This patch adds notifiers to the runtime PM/genpd subsystem. It is now
>>> > > possible to register a notifier, which will be called before and after
>>> > > the generic power domain subsystem calls the power domain's power_on
>>> > > and power_off callbacks.
>>> > >
>>> > > Signed-off-by: Sylwester Nawrocki <[email-masked]>
>>> > > [tfiga at chromium.org: rebased]
>>> > > Signed-off-by: Tomasz Figa <[email-masked]>
>> >
>> > Not sure if you've noticed it, I posted an updated version of this patch
>> > recently [1]. The notifiers list is moved to struct generic_pm_domain
>> > there and it also allows to register a notifier for selected power domain
>> > by name.
> [snip]
>> > [1] http://www.spinics.net/lists/linux-samsung-soc/msg38549.html
>
> Ah, haven't noticed, sorry. The API using devices looks the same, so I
> guess we can simply have patch 2/2 of this series applied on top of
> your patch.

Yes, that should work.

> By the way, look-up by name (presumably hardcoded somewhere?) sounds a
> bit strange to me. What was the reason for it to be added?

Yes, that might not be a very elegant approach. We initially used it
to implement power domain on/off sequence per specific domain and SoC,
since it appeared resistant to generalize.  I.e. the control register
write sequences are different per domain and per SoC (exynos).
So we named the domains in the device tree in that way:

	pm_domains: pm-domains at 10024000 {
		compatible = "samsung,exynos4415-pd";
		reg-names = "cam", "tv", "mfc", "g3d",
		            "lcd0", "isp0", "isp1";
		reg = <0x10024000 0x20>, <0x10024020 0x20>,
		      <0x10024040 0x20>, <0x10024060 0x20>,
		      <0x10024080 0x20>, <0x100240A0 0x20>,
		      <0x100240E0 0x20>;
		#power-domain-cells = <1>;
	};

and then, for example, in the exynos CMU_ISP{0, 1} (clock controller)
driver registered for notification on "isp0" and "isp1" power domains
("isp1" is a sub-domain of "isp0" and the consumer devices are normally
attached to "isp1").

We have been investigating if we could do without the notification
at the clocks driver side, then the all SoC/power domain specific code
would end up in the exynos power domain driver. But I'm afraid it's
not going to work for all SoCs. Anyway lookup by name might be not
needed.

--
Regards,
Sylwester