2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-02 10:43:57 +08:00

PM / Domains: Allow overriding the ->xlate() callback

Allow generic power domain providers to override the ->xlate() callback
in case the default genpd_xlate_onecell() translation callback is not
good enough.

One potential use-case for this is to allow generic power domains to be
specified by an ID rather than an index.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
Thierry Reding 2017-03-29 18:34:50 +02:00
parent 2ea659a9ef
commit 408455245a
2 changed files with 8 additions and 4 deletions

View File

@ -1584,9 +1584,6 @@ EXPORT_SYMBOL_GPL(pm_genpd_remove);
#ifdef CONFIG_PM_GENERIC_DOMAINS_OF #ifdef CONFIG_PM_GENERIC_DOMAINS_OF
typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
void *data);
/* /*
* Device Tree based PM domain providers. * Device Tree based PM domain providers.
* *
@ -1742,6 +1739,9 @@ int of_genpd_add_provider_onecell(struct device_node *np,
mutex_lock(&gpd_list_lock); mutex_lock(&gpd_list_lock);
if (!data->xlate)
data->xlate = genpd_xlate_onecell;
for (i = 0; i < data->num_domains; i++) { for (i = 0; i < data->num_domains; i++) {
if (!data->domains[i]) if (!data->domains[i])
continue; continue;
@ -1752,7 +1752,7 @@ int of_genpd_add_provider_onecell(struct device_node *np,
data->domains[i]->has_provider = true; data->domains[i]->has_provider = true;
} }
ret = genpd_add_provider(np, genpd_xlate_onecell, data); ret = genpd_add_provider(np, data->xlate, data);
if (ret < 0) if (ret < 0)
goto error; goto error;

View File

@ -206,9 +206,13 @@ static inline void pm_genpd_syscore_poweron(struct device *dev) {}
/* OF PM domain providers */ /* OF PM domain providers */
struct of_device_id; struct of_device_id;
typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
void *data);
struct genpd_onecell_data { struct genpd_onecell_data {
struct generic_pm_domain **domains; struct generic_pm_domain **domains;
unsigned int num_domains; unsigned int num_domains;
genpd_xlate_t xlate;
}; };
#ifdef CONFIG_PM_GENERIC_DOMAINS_OF #ifdef CONFIG_PM_GENERIC_DOMAINS_OF