This function will be called from the upcoming bfetch command to
determine whether the running barebox has GENPD support.

Signed-off-by: Ahmad Fatoum <a.fat...@barebox.org>
---
 drivers/base/power.c | 5 +++++
 include/pm_domain.h  | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/drivers/base/power.c b/drivers/base/power.c
index f7629f554a72..d60a00f5735e 100644
--- a/drivers/base/power.c
+++ b/drivers/base/power.c
@@ -349,6 +349,11 @@ void genpd_activate(void)
        have_genpd_providers = true;
 }
 
+bool genpd_is_active(void)
+{
+       return have_genpd_providers && !list_empty(&gpd_list);
+}
+
 static struct bus_type genpd_bus_type = {
        .name           = "genpd",
 };
diff --git a/include/pm_domain.h b/include/pm_domain.h
index 4b7b07b0e43d..3678deb9a76c 100644
--- a/include/pm_domain.h
+++ b/include/pm_domain.h
@@ -28,6 +28,7 @@ typedef struct generic_pm_domain *(*genpd_xlate_t)(struct 
of_phandle_args *args,
 #ifdef CONFIG_PM_GENERIC_DOMAINS
 
 void genpd_activate(void);
+bool genpd_is_active(void);
 
 int genpd_dev_pm_attach(struct device *dev);
 struct device *genpd_dev_pm_attach_by_id(struct device *dev,
@@ -63,6 +64,11 @@ static inline void genpd_activate(void)
 {
 }
 
+static inline bool genpd_is_active(void)
+{
+       return false;
+}
+
 static inline int pm_genpd_init(struct generic_pm_domain *genpd,
                                void *gov, bool is_off)
 {
-- 
2.39.5


Reply via email to