[RFC PATCH 5/9] PM: domains: Add of_genpd_add_provider_simple_noclk()

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

 



This is analogous to of_genpd_add_provider_simple(), but calls
dev_pm_opp_of_add_table_noclk() instead of dev_pm_opp_of_add_table().

Signed-off-by: Hector Martin <marcan@xxxxxxxxx>
---
 drivers/base/power/domain.c | 39 +++++++++++++++++++++++++++++--------
 include/linux/pm_domain.h   |  8 ++++++++
 2 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 5db704f02e71..3377b9dd514c 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2227,13 +2227,9 @@ static bool genpd_present(const struct generic_pm_domain *genpd)
 	return ret;
 }
 
-/**
- * of_genpd_add_provider_simple() - Register a simple PM domain provider
- * @np: Device node pointer associated with the PM domain provider.
- * @genpd: Pointer to PM domain associated with the PM domain provider.
- */
-int of_genpd_add_provider_simple(struct device_node *np,
-				 struct generic_pm_domain *genpd)
+static int _of_genpd_add_provider_simple(struct device_node *np,
+					 struct generic_pm_domain *genpd,
+					 bool getclk)
 {
 	int ret;
 
@@ -2247,7 +2243,10 @@ int of_genpd_add_provider_simple(struct device_node *np,
 
 	/* Parse genpd OPP table */
 	if (genpd->set_performance_state) {
-		ret = dev_pm_opp_of_add_table(&genpd->dev);
+		if (getclk)
+			ret = dev_pm_opp_of_add_table(&genpd->dev);
+		else
+			ret = dev_pm_opp_of_add_table_noclk(&genpd->dev, 0);
 		if (ret) {
 			if (ret != -EPROBE_DEFER)
 				dev_err(&genpd->dev, "Failed to add OPP table: %d\n",
@@ -2278,8 +2277,32 @@ int of_genpd_add_provider_simple(struct device_node *np,
 
 	return 0;
 }
+
+/**
+ * of_genpd_add_provider_simple() - Register a simple PM domain provider
+ * @np: Device node pointer associated with the PM domain provider.
+ * @genpd: Pointer to PM domain associated with the PM domain provider.
+ */
+int of_genpd_add_provider_simple(struct device_node *np,
+				 struct generic_pm_domain *genpd)
+{
+	return _of_genpd_add_provider_simple(np, genpd, true);
+}
 EXPORT_SYMBOL_GPL(of_genpd_add_provider_simple);
 
+/**
+ * of_genpd_add_provider_simple_noclk() - Register a simple clockless
+ *   PM domain provider
+ * @np: Device node pointer associated with the PM domain provider.
+ * @genpd: Pointer to PM domain associated with the PM domain provider.
+ */
+int of_genpd_add_provider_simple_noclk(struct device_node *np,
+				       struct generic_pm_domain *genpd)
+{
+	return _of_genpd_add_provider_simple(np, genpd, false);
+}
+EXPORT_SYMBOL_GPL(of_genpd_add_provider_simple_noclk);
+
 /**
  * of_genpd_add_provider_onecell() - Register a onecell PM domain provider
  * @np: Device node pointer associated with the PM domain provider.
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 67017c9390c8..db3f75612512 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -316,6 +316,8 @@ struct genpd_onecell_data {
 #ifdef CONFIG_PM_GENERIC_DOMAINS_OF
 int of_genpd_add_provider_simple(struct device_node *np,
 				 struct generic_pm_domain *genpd);
+int of_genpd_add_provider_simple_noclk(struct device_node *np,
+				       struct generic_pm_domain *genpd);
 int of_genpd_add_provider_onecell(struct device_node *np,
 				  struct genpd_onecell_data *data);
 void of_genpd_del_provider(struct device_node *np);
@@ -342,6 +344,12 @@ static inline int of_genpd_add_provider_simple(struct device_node *np,
 	return -EOPNOTSUPP;
 }
 
+static inline int of_genpd_add_provider_simple_noclk(struct device_node *np,
+					struct generic_pm_domain *genpd)
+{
+	return -EOPNOTSUPP;
+}
+
 static inline int of_genpd_add_provider_onecell(struct device_node *np,
 					struct genpd_onecell_data *data)
 {
-- 
2.33.0




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux