mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-20 05:13:59 +00:00
PM / Domains: Introduce option to attach a device by name to genpd
For the multiple PM domain case, let's introduce a new function called genpd_dev_pm_attach_by_name(). This allows a device to be associated with its PM domain through genpd, by using a name based lookup. Note that, genpd_dev_pm_attach_by_name() shall only be called by the driver core / PM core, similar to how the existing dev_pm_domain_attach_by_id() makes use of genpd_dev_pm_attach_by_id(). However, this is implemented by following changes on top. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Rajendra Nayak <rnayak@codeaurora.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
79a5c45199
commit
5d6be70add
2 changed files with 32 additions and 0 deletions
|
@ -2374,6 +2374,30 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(genpd_dev_pm_attach_by_id);
|
EXPORT_SYMBOL_GPL(genpd_dev_pm_attach_by_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* genpd_dev_pm_attach_by_name - Associate a device with one of its PM domains.
|
||||||
|
* @dev: The device used to lookup the PM domain.
|
||||||
|
* @name: The name of the PM domain.
|
||||||
|
*
|
||||||
|
* Parse device's OF node to find a PM domain specifier using the
|
||||||
|
* power-domain-names DT property. For further description see
|
||||||
|
* genpd_dev_pm_attach_by_id().
|
||||||
|
*/
|
||||||
|
struct device *genpd_dev_pm_attach_by_name(struct device *dev, char *name)
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
if (!dev->of_node)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
index = of_property_match_string(dev->of_node, "power-domain-names",
|
||||||
|
name);
|
||||||
|
if (index < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return genpd_dev_pm_attach_by_id(dev, index);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct of_device_id idle_state_match[] = {
|
static const struct of_device_id idle_state_match[] = {
|
||||||
{ .compatible = "domain-idle-state", },
|
{ .compatible = "domain-idle-state", },
|
||||||
{ }
|
{ }
|
||||||
|
|
|
@ -239,6 +239,8 @@ unsigned int of_genpd_opp_to_performance_state(struct device *dev,
|
||||||
int genpd_dev_pm_attach(struct device *dev);
|
int genpd_dev_pm_attach(struct device *dev);
|
||||||
struct device *genpd_dev_pm_attach_by_id(struct device *dev,
|
struct device *genpd_dev_pm_attach_by_id(struct device *dev,
|
||||||
unsigned int index);
|
unsigned int index);
|
||||||
|
struct device *genpd_dev_pm_attach_by_name(struct device *dev,
|
||||||
|
char *name);
|
||||||
#else /* !CONFIG_PM_GENERIC_DOMAINS_OF */
|
#else /* !CONFIG_PM_GENERIC_DOMAINS_OF */
|
||||||
static inline int of_genpd_add_provider_simple(struct device_node *np,
|
static inline int of_genpd_add_provider_simple(struct device_node *np,
|
||||||
struct generic_pm_domain *genpd)
|
struct generic_pm_domain *genpd)
|
||||||
|
@ -290,6 +292,12 @@ static inline struct device *genpd_dev_pm_attach_by_id(struct device *dev,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline struct device *genpd_dev_pm_attach_by_name(struct device *dev,
|
||||||
|
char *name)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
|
struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue