diff mbox series

[v3,2/3] clk: qcom: common: Add support for power-domain attachment

Message ID 20241126-b4-linux-next-24-11-18-clock-multiple-power-domains-v3-2-836dad33521a@linaro.org
State Superseded
Headers show
Series clk: qcom: Add support for multiple power-domains for a clock controller. | expand

Commit Message

Bryan O'Donoghue Nov. 26, 2024, 11:44 p.m. UTC
Right now we support one power-domain per clock controller.
These single power-domains are switched on by the driver platform logic.

However when we have multiple power-domains attached to a clock-controller
that list of power-domains must be handled outside of driver platform
logic.

Use devm_pm_domain_attach_list() to automatically hook the list of given
power-domains in the dtsi for the clock-controller driver.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/clk/qcom/common.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Vladimir Zapolskiy Nov. 28, 2024, 12:07 p.m. UTC | #1
Hello Bryan.

On 11/27/24 01:44, Bryan O'Donoghue wrote:
> Right now we support one power-domain per clock controller.
> These single power-domains are switched on by the driver platform logic.
> 
> However when we have multiple power-domains attached to a clock-controller
> that list of power-domains must be handled outside of driver platform
> logic.
> 
> Use devm_pm_domain_attach_list() to automatically hook the list of given
> power-domains in the dtsi for the clock-controller driver.
> 
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>   drivers/clk/qcom/common.c | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
> 

Is there any particular reason why my review comment was ignored?

https://lore.kernel.org/all/8a33c0ff-0c6d-4995-b239-023d2a2c2af5@linaro.org/

There is no signs of the change improvement, unfortunately.

--
Best wishes,
Vladimir
Bryan O'Donoghue Nov. 28, 2024, 12:11 p.m. UTC | #2
On 28/11/2024 12:07, Vladimir Zapolskiy wrote:
> Hello Bryan.
> 
> On 11/27/24 01:44, Bryan O'Donoghue wrote:
>> Right now we support one power-domain per clock controller.
>> These single power-domains are switched on by the driver platform logic.
>>
>> However when we have multiple power-domains attached to a clock- 
>> controller
>> that list of power-domains must be handled outside of driver platform
>> logic.
>>
>> Use devm_pm_domain_attach_list() to automatically hook the list of given
>> power-domains in the dtsi for the clock-controller driver.
>>
>> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>> ---
>>   drivers/clk/qcom/common.c | 20 ++++++++++++++++++++
>>   1 file changed, 20 insertions(+)
>>
> 
> Is there any particular reason why my review comment was ignored?
> 
> https://lore.kernel.org/all/8a33c0ff-0c6d-4995- 
> b239-023d2a2c2af5@linaro.org/
> 
> There is no signs of the change improvement, unfortunately.
> 
> -- 
> Best wishes,
> Vladimir

In the cover letter I cover what was done and not done and why.

I made a new function because it "looks neater" to me that way.

I implemented your feedback on ret and -EEXIST.

Passing NULL instead of &pd_data doesn't work unfortunately.

Let me know what else you'd like covered or revised from the cover letter.

---
bod
diff mbox series

Patch

diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
index 33cc1f73c69d1f875a193aea0552902268dc8716..7727295c57c8f6672d46d2380e1ff5ec2ac68d42 100644
--- a/drivers/clk/qcom/common.c
+++ b/drivers/clk/qcom/common.c
@@ -22,6 +22,7 @@  struct qcom_cc {
 	struct qcom_reset_controller reset;
 	struct clk_regmap **rclks;
 	size_t num_rclks;
+	struct dev_pm_domain_list *pd_list;
 };
 
 const
@@ -283,6 +284,21 @@  static int qcom_cc_icc_register(struct device *dev,
 						     desc->num_icc_hws, icd);
 }
 
+static int qcom_cc_pds_attach(struct device *dev, struct qcom_cc *cc)
+{
+	struct dev_pm_domain_attach_data pd_data = {
+		.pd_names = 0,
+		.num_pd_names = 0,
+	};
+	int ret;
+
+	ret = devm_pm_domain_attach_list(dev, &pd_data, &cc->pd_list);
+	if (ret < 0 && ret != -EEXIST)
+		return ret;
+
+	return 0;
+}
+
 int qcom_cc_really_probe(struct device *dev,
 			 const struct qcom_cc_desc *desc, struct regmap *regmap)
 {
@@ -299,6 +315,10 @@  int qcom_cc_really_probe(struct device *dev,
 	if (!cc)
 		return -ENOMEM;
 
+	ret = qcom_cc_pds_attach(dev, cc);
+	if (ret)
+		return ret;
+
 	reset = &cc->reset;
 	reset->rcdev.of_node = dev->of_node;
 	reset->rcdev.ops = &qcom_reset_ops;