[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201111082138.57448.rjw@sisk.pl>
Date: Tue, 8 Nov 2011 21:38:57 +0100
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Guennadi Liakhovetski <g.liakhovetski@....de>
Cc: Linux PM list <linux-pm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
"Linux-sh list" <linux-sh@...r.kernel.org>,
Magnus Damm <magnus.damm@...il.com>,
Kevin Hilman <khilman@...com>, jean.pihet@...oldbits.com
Subject: Re: [PATCH 1/7] PM / Domains: Make it possible to use per-device start/stop routines
On Tuesday, November 08, 2011, Guennadi Liakhovetski wrote:
> Hi Rafael
>
> On Mon, 7 Nov 2011, Rafael J. Wysocki wrote:
>
> > From: Rafael J. Wysocki <rjw@...k.pl>
> >
> > The current generic PM domains code requires that the same .stop()
> > and .start() device callback routines be used for all devices in the
> > given domain, which is inflexible and may not cover some specific use
> > cases. For this reason, make it possible to use device specific
> > .start() and .stop() callback routines by adding corresponding
> > callback pointers to struct generic_pm_domain_data. Add a new helper
> > routine, pm_genpd_register_callbacks(), that can be used to populate
> > the new per-device callback pointers.
> >
> > Modify the shmobile's power domains code to allow drivers to add
> > their own code to be run during the device stop and start operations
> > with the help of the new callback pointers.
> >
> > Signed-off-by: Rafael J. Wysocki <rjw@...k.pl>
> > ---
>
> [snip]
>
> > Index: linux/drivers/base/power/domain.c
> > ===================================================================
> > --- linux.orig/drivers/base/power/domain.c
> > +++ linux/drivers/base/power/domain.c
> > @@ -29,6 +29,36 @@ static struct generic_pm_domain *dev_to_
> > return pd_to_genpd(dev->pm_domain);
> > }
> >
> > +static int genpd_stop_dev(struct generic_pm_domain *genpd, struct device *dev)
> > +{
> > + int (*stop)(struct device *dev);
> > +
> > + stop = genpd->stop_device;
> > + if (stop)
> > + return stop(dev);
> > +
> > + stop = dev_gpd_data(dev)->ops.stop;
> > + if (stop)
> > + return stop(dev);
>
> With this implementation your approach is: in your genpd_stop_dev() and
> genpd_start_dev() you first check for the pm-domain _common_ .start() and
> .stop(), and if they exist, the specific ones will not be called. Then in
> your sh7372 pm domain implementation you do the domain-common part -
> switch the PM clock on or off, and you _again_ check for device-specific
> domains, and this time you call both of them.
>
> Do you have specific reasons to think, that calling both of them from
> genpd_stop_dev() / genpd_start_dev() might not fit some PM-domain
> implementations?
Not very specific, but the current way is more flexible, because it
allows the PM domain to do something completely different from the
default thing.
Also that follows the strategy used in dd.c for .probe().
Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists