All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thara Gopinath <thara.gopinath@linaro.org>
To: rui.zhang@intel.com, ulf.hansson@linaro.org,
	daniel.lezcano@linaro.org, bjorn.andersson@linaro.org,
	agross@kernel.org, robh@kernel.org
Cc: amit.kucheria@verdurent.com, mark.rutland@arm.com,
	rjw@rjwysocki.net, linux-pm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v6 4/6] soc: qcom: Extend RPMh power controller driver to register warming devices.
Date: Wed,  3 Jun 2020 21:53:15 -0400	[thread overview]
Message-ID: <20200604015317.31389-5-thara.gopinath@linaro.org> (raw)
In-Reply-To: <20200604015317.31389-1-thara.gopinath@linaro.org>

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@linaro.org>
---

v3->v4:
	- Introduce a boolean value is_warming_dev in rpmhpd structure to
	  indicate if a generic power domain can be used as a warming
	  device or not.With this change, device tree no longer has to
	  specify which power domain inside the rpmh power domain provider
	  is a warming device.
	- Move registering of warming devices into a late initcall to
	  ensure that warming devices are registered after thermal
	  framework is initialized.

v5->v6:
	- Moved back registering of warming devices into probe since
	  Bjorn pointed out that now the driver can be initialized as
	  as a module, late_initcall will not work. Thermal framework
	  takes care of binding a cooling device to a thermal zone even
	  if the cooling device is registered before the thermal framework
	  is initialized.

 drivers/soc/qcom/rpmhpd.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/rpmhpd.c b/drivers/soc/qcom/rpmhpd.c
index a9c597143525..29e1eb4d11af 100644
--- a/drivers/soc/qcom/rpmhpd.c
+++ b/drivers/soc/qcom/rpmhpd.c
@@ -12,6 +12,7 @@
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/pm_opp.h>
+#include <linux/pd_warming.h>
 #include <soc/qcom/cmd-db.h>
 #include <soc/qcom/rpmh.h>
 #include <dt-bindings/power/qcom-rpmpd.h>
@@ -49,6 +50,7 @@ struct rpmhpd {
 	bool		enabled;
 	const char	*res_name;
 	u32		addr;
+	bool		is_warming_dev;
 };
 
 struct rpmhpd_desc {
@@ -90,6 +92,7 @@ static struct rpmhpd sdm845_mx = {
 	.pd = { .name = "mx", },
 	.peer = &sdm845_mx_ao,
 	.res_name = "mx.lvl",
+	.is_warming_dev = true,
 };
 
 static struct rpmhpd sdm845_mx_ao = {
@@ -472,7 +475,19 @@ 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;
+
+	if (!of_find_property(dev->of_node, "#cooling-cells", NULL))
+		return 0;
+
+	for (i = 0; i < num_pds; i++)
+		if (rpmhpds[i]->is_warming_dev)
+			of_pd_warming_register(rpmhpds[i]->dev, i);
+
+	return 0;
 }
 
 static struct platform_driver rpmhpd_driver = {
-- 
2.20.1


  parent reply	other threads:[~2020-06-04  1:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04  1:53 [PATCH v6 0/6] Introduce Power domain based warming device driver Thara Gopinath
2020-06-04  1:53 ` [PATCH v6 1/6] PM/Domains: Add support for retrieving genpd performance states information Thara Gopinath
2020-06-04  1:53 ` [PATCH v6 2/6] soc: qcom: rpmhpd: Introduce function to retrieve power domain performance state count Thara Gopinath
2020-06-16  9:21   ` Ulf Hansson
2020-06-16 17:19     ` Thara Gopinath
2020-06-04  1:53 ` [PATCH v6 3/6] thermal: Add generic power domain warming device driver Thara Gopinath
2020-06-16  9:21   ` Ulf Hansson
2020-07-03 10:02   ` Daniel Lezcano
2020-07-07 10:58     ` Lukasz Luba
2020-06-04  1:53 ` Thara Gopinath [this message]
2020-06-16  9:21   ` [PATCH v6 4/6] soc: qcom: Extend RPMh power controller driver to register warming devices Ulf Hansson
2020-06-04  1:53 ` [PATCH v6 5/6] dt-bindings: power: Extend RPMh power controller binding to describe thermal warming device Thara Gopinath
2020-06-16  9:21   ` Ulf Hansson
2020-06-04  1:53 ` [PATCH v6 6/6] arm64: dts: qcom: Indicate rpmhpd hosts a power domain that can be used as a " Thara Gopinath
2020-06-16 10:53 ` [PATCH v6 0/6] Introduce Power domain based warming device driver Pavel Machek
2020-06-16 17:24   ` Thara Gopinath
2020-06-17 21:14     ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200604015317.31389-5-thara.gopinath@linaro.org \
    --to=thara.gopinath@linaro.org \
    --cc=agross@kernel.org \
    --cc=amit.kucheria@verdurent.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=rjw@rjwysocki.net \
    --cc=robh@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.