mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-21 22:03:58 +00:00
PM / Domains: Introduce dev_pm_domain_attach_by_name()
For the multiple PM domain case, let's introduce a new API called dev_pm_domain_attach_by_name(). This allows a consumer driver to associate its device with one of its PM domains, by using a name based lookup. Do note that, currently it's only genpd that supports multiple PM domains per device, but dev_pm_domain_attach_by_name() can easily by extended to cover other PM domain types, if/when needed. 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
5d6be70add
commit
27dceb81f4
2 changed files with 24 additions and 0 deletions
|
@ -152,6 +152,23 @@ struct device *dev_pm_domain_attach_by_id(struct device *dev,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(dev_pm_domain_attach_by_id);
|
EXPORT_SYMBOL_GPL(dev_pm_domain_attach_by_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dev_pm_domain_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.
|
||||||
|
*
|
||||||
|
* For a detailed function description, see dev_pm_domain_attach_by_id().
|
||||||
|
*/
|
||||||
|
struct device *dev_pm_domain_attach_by_name(struct device *dev,
|
||||||
|
char *name)
|
||||||
|
{
|
||||||
|
if (dev->pm_domain)
|
||||||
|
return ERR_PTR(-EEXIST);
|
||||||
|
|
||||||
|
return genpd_dev_pm_attach_by_name(dev, name);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(dev_pm_domain_attach_by_name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dev_pm_domain_detach - Detach a device from its PM domain.
|
* dev_pm_domain_detach - Detach a device from its PM domain.
|
||||||
* @dev: Device to detach.
|
* @dev: Device to detach.
|
||||||
|
|
|
@ -309,6 +309,8 @@ struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
|
||||||
int dev_pm_domain_attach(struct device *dev, bool power_on);
|
int dev_pm_domain_attach(struct device *dev, bool power_on);
|
||||||
struct device *dev_pm_domain_attach_by_id(struct device *dev,
|
struct device *dev_pm_domain_attach_by_id(struct device *dev,
|
||||||
unsigned int index);
|
unsigned int index);
|
||||||
|
struct device *dev_pm_domain_attach_by_name(struct device *dev,
|
||||||
|
char *name);
|
||||||
void dev_pm_domain_detach(struct device *dev, bool power_off);
|
void dev_pm_domain_detach(struct device *dev, bool power_off);
|
||||||
void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd);
|
void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd);
|
||||||
#else
|
#else
|
||||||
|
@ -321,6 +323,11 @@ static inline struct device *dev_pm_domain_attach_by_id(struct device *dev,
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
static inline struct device *dev_pm_domain_attach_by_name(struct device *dev,
|
||||||
|
char *name)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {}
|
static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {}
|
||||||
static inline void dev_pm_domain_set(struct device *dev,
|
static inline void dev_pm_domain_set(struct device *dev,
|
||||||
struct dev_pm_domain *pd) {}
|
struct dev_pm_domain *pd) {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue