[PATCH v3 5/7] soc: qcom: Extend RPMh power controller driver to register warming devices.

From: Thara Gopinath
Date: Wed Oct 16 2019 - 15:37:45 EST


RPMh power control hosts power domains that can be used as
thermal warming devices. Register these power domains
with the generic power domain warming device thermal framework.

Signed-off-by: Thara Gopinath <thara.gopinath@xxxxxxxxxx>
---
drivers/soc/qcom/rpmhpd.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/rpmhpd.c b/drivers/soc/qcom/rpmhpd.c
index 9d37534..88ba615 100644
--- a/drivers/soc/qcom/rpmhpd.c
+++ b/drivers/soc/qcom/rpmhpd.c
@@ -11,6 +11,7 @@
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm_opp.h>
+#include <linux/pwr_domain_warming.h>
#include <soc/qcom/cmd-db.h>
#include <soc/qcom/rpmh.h>
#include <dt-bindings/power/qcom-rpmpd.h>
@@ -333,6 +334,7 @@ static int rpmhpd_probe(struct platform_device *pdev)
struct genpd_onecell_data *data;
struct rpmhpd **rpmhpds;
const struct rpmhpd_desc *desc;
+ struct device_node *child;

desc = of_device_get_match_data(dev);
if (!desc)
@@ -396,7 +398,24 @@ static int rpmhpd_probe(struct platform_device *pdev)
&rpmhpds[i]->pd);
}

- return of_genpd_add_provider_onecell(pdev->dev.of_node, data);
+ ret = of_genpd_add_provider_onecell(pdev->dev.of_node, data);
+
+ if (ret)
+ return ret;
+
+ for_each_available_child_of_node(dev->of_node, child) {
+ if (!of_find_property(child, "#cooling-cells", NULL))
+ continue;
+
+ for (i = 0; i < num_pds; i++)
+ if (strcmp(child->name, rpmhpds[i]->pd.name) == 0)
+ break;
+ if (i == num_pds)
+ continue;
+ pwr_domain_warming_register(child, &rpmhpds[i]->pd);
+ }
+
+ return 0;
}

static struct platform_driver rpmhpd_driver = {
--
2.1.4