[PATCH 08/19] pmdomain: add support for enabling power domains later on

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When a single power domain is specified platform driver probe takes care
to enable the power domain. When there are multiple power domains
however, each Linux driver must itself enable power domains in the
correct sequence.

In Linux, this is handled by runtime PM. We don't have that in barebox,
so we add the enable function with a _genpd suffix to alert users to
this fact.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 drivers/base/power.c | 11 +++++++++++
 include/pm_domain.h  |  8 +++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power.c b/drivers/base/power.c
index 98164431aaeb..c4318fa1dfd1 100644
--- a/drivers/base/power.c
+++ b/drivers/base/power.c
@@ -289,6 +289,17 @@ static int genpd_power_on(struct generic_pm_domain *genpd)
 	return 0;
 }
 
+int pm_runtime_resume_and_get_genpd(struct device *dev)
+{
+	struct generic_pm_domain *genpd;
+
+	genpd = dev_to_genpd(dev);
+	if (IS_ERR(genpd))
+		return PTR_ERR(genpd);
+
+	return genpd_power_on(genpd);
+}
+
 static void genpd_add_device(struct generic_pm_domain *genpd, struct device *dev)
 {
 	dev->pm_domain = genpd;
diff --git a/include/pm_domain.h b/include/pm_domain.h
index b02af0d46de0..f242a05b4934 100644
--- a/include/pm_domain.h
+++ b/include/pm_domain.h
@@ -30,12 +30,13 @@ typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args,
 void genpd_activate(void);
 
 int genpd_dev_pm_attach(struct device *dev);
-
 struct device *genpd_dev_pm_attach_by_id(struct device *dev,
 					 unsigned int index);
 struct device *genpd_dev_pm_attach_by_name(struct device *dev,
 					   const char *name);
 
+int pm_runtime_resume_and_get_genpd(struct device *dev);
+
 int pm_genpd_init(struct generic_pm_domain *genpd, void *gov, bool is_off);
 
 int of_genpd_add_provider_simple(struct device_node *np,
@@ -81,6 +82,11 @@ static inline struct device *genpd_dev_pm_attach_by_name(struct device *dev,
 	return NULL;
 }
 
+static inline int pm_runtime_resume_and_get_genpd(struct device *dev)
+{
+	return 0;
+}
+
 static inline int
 of_genpd_add_provider_simple(struct device_node *np,
 			     struct generic_pm_domain *genpd)
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux