From: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Bjorn Andersson <andersson@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] clk: qcom: common: Add support for power-domain attachment
Date: Tue, 19 Nov 2024 00:17:06 +0200 [thread overview]
Message-ID: <8a33c0ff-0c6d-4995-b239-023d2a2c2af5@linaro.org> (raw)
In-Reply-To: <20241118-b4-linux-next-24-11-18-clock-multiple-power-domains-v1-1-b7a2bd82ba37@linaro.org>
On 11/18/24 04:24, Bryan O'Donoghue wrote:
> Right now we have a plethora of singleton power-domains which power clock
> controllers. These singletons are switched on by core logic when we probe
> the clocks.
>
> However when multiple power-domains are attached to a clock controller that
> list of power-domains needs to be managed outside of core logic.
>
> Use dev_pm_domain_attach_list() to automatically hook the list of given
> power-domains in the dtsi for the clock being registered in
> qcom_cc_really_probe().
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
> drivers/clk/qcom/common.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
> index 33cc1f73c69d1f875a193aea0552902268dc8716..b4377fa09f7c0ec8d3c63dfc97d04fbb8cd6e10b 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,25 @@ 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;
> +
> + /* Only one power-domain platform framework will hook it up */
> + if (dev->pm_domain)
> + return 0;
> +
> + ret = dev_pm_domain_attach_list(dev, &pd_data, &cc->pd_list);
> + if (ret < 0)
> + return ret;
> +
> + return 0;
> +}
> +
> int qcom_cc_really_probe(struct device *dev,
> const struct qcom_cc_desc *desc, struct regmap *regmap)
> {
> @@ -299,6 +319,10 @@ int qcom_cc_really_probe(struct device *dev,
> if (!cc)
> return -ENOMEM;
>
> + ret = qcom_cc_pds_attach(dev, cc);
> + if (ret)
> + return ret;
> +
ret = devm_pm_domain_attach_list(dev, NULL, &cc->pd_list);
if (ret < 0 && ret != -EEXIST)
return ret;
That's it. No need to introduce a new function, not saying about 20 LoC off.
Next, you have to call dev_pm_domain_detach_list() in your version of the
change on the error paths etc., fortunately this can be easily avoided,
if the resource management flavour of the same function is in use.
> reset = &cc->reset;
> reset->rcdev.of_node = dev->of_node;
> reset->rcdev.ops = &qcom_reset_ops;
>
--
Best wishes,
Vladimir
next prev parent reply other threads:[~2024-11-18 22:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 2:24 [PATCH 0/2] clk: qcom: Add support for multiple power-domains for a clock controller Bryan O'Donoghue
2024-11-18 2:24 ` [PATCH 1/2] clk: qcom: common: Add support for power-domain attachment Bryan O'Donoghue
2024-11-18 13:03 ` Dmitry Baryshkov
2024-11-18 13:17 ` Bryan O'Donoghue
2024-11-18 22:17 ` Vladimir Zapolskiy [this message]
2024-11-18 22:52 ` Bryan O'Donoghue
2024-11-19 15:41 ` Bjorn Andersson
2024-11-20 16:49 ` Bryan O'Donoghue
2024-11-21 21:59 ` Dmitry Baryshkov
2024-11-21 23:25 ` Bryan O'Donoghue
2024-11-18 2:24 ` [PATCH 2/2] clk: qcom: gdsc: Add pm_runtime hooks Bryan O'Donoghue
2024-11-18 13:10 ` Dmitry Baryshkov
2024-11-18 13:19 ` Bryan O'Donoghue
2024-11-18 13:39 ` Dmitry Baryshkov
2024-11-18 13:47 ` Bryan O'Donoghue
2024-11-19 15:34 ` Bjorn Andersson
2024-11-20 17:09 ` Bryan O'Donoghue
2024-11-26 17:23 ` Bjorn Andersson
2024-11-26 23:45 ` Bryan O'Donoghue
2024-11-18 13:15 ` [PATCH 0/2] clk: qcom: Add support for multiple power-domains for a clock controller Dmitry Baryshkov
2024-11-18 13:22 ` Bryan O'Donoghue
2024-11-18 13:46 ` Bryan O'Donoghue
2024-11-19 6:08 ` Taniya Das
2024-11-19 9:46 ` Bryan O'Donoghue
2024-11-19 15:28 ` Bjorn Andersson
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=8a33c0ff-0c6d-4995-b239-023d2a2c2af5@linaro.org \
--to=vladimir.zapolskiy@linaro.org \
--cc=andersson@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox