From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Stephen Boyd <sboyd@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Taniya Das <quic_tdas@quicinc.com>,
Georgi Djakov <djakov@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
devicetree@vger.kernel.org,
Yassine Oudjana <y.oudjana@protonmail.com>,
linux-pm@vger.kernel.org
Subject: Re: [PATCH v6 2/4] interconnect: add clk-based icc provider support
Date: Sat, 13 May 2023 10:59:55 +0200 [thread overview]
Message-ID: <9c07e0a1-d3a6-03df-87a0-f2bdbac7d8f3@linaro.org> (raw)
In-Reply-To: <20230512001334.2983048-3-dmitry.baryshkov@linaro.org>
On 12.05.2023 02:13, Dmitry Baryshkov wrote:
> For some devices it is useful to export clocks as interconnect providers,
> if the clock corresponds to bus bandwidth.
>
> For example, on MSM8996 the cluster interconnect clock should be scaled
> according to the cluster frequencies. Exporting it as an interconnect
> allows one to properly describe this as the cluster bandwidth
> requirements.
>
> Tested-by: Yassine Oudjana <y.oudjana@protonmail.com>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
[...]
> +
> + for (i = 0, j = 0; i < num_clocks; i++) {
> + qp->clocks[i].clk = data[i].clk;
> +
> + node = icc_node_create(first_id + j);
> + if (IS_ERR(node)) {
> + ret = PTR_ERR(node);
> + goto err;
> + }
> +
> + node->name = devm_kasprintf(dev, GFP_KERNEL, "%s_master", data[i].name);
> + node->data = &qp->clocks[i];
> + icc_node_add(node, provider);
> + /* link to the next node, slave */
> + icc_link_create(node, first_id + j + 1);
> + onecell->nodes[j++] = node;
> +
> + node = icc_node_create(first_id + j);
> + if (IS_ERR(node)) {
> + ret = PTR_ERR(node);
> + goto err;
> + }
> +
> + node->name = devm_kasprintf(dev, GFP_KERNEL, "%s_slave", data[i].name);
> + /* no data for slave node */
> + icc_node_add(node, provider);
> + onecell->nodes[j++] = node;
I'm still not very into using 2 iterators and modifying one
on the flight, but I don't think I have any other issues with
this driver..
Some sort of a Mostly-Acked-by tag would be helpful here!
Konrad
> + }
> +
> + onecell->num_nodes = j;
> +
> + ret = icc_provider_register(provider);
> + if (ret)
> + goto err;
> +
> + return provider;
> +
> +err:
> + icc_nodes_remove(provider);
> +
> + return ERR_PTR(ret);
> +}
> +
> +/**
> + * icc_clk_unregister() - unregister a previously registered clk interconnect provider
> + * @provider: provider returned by icc_clk_register()
> + */
> +void icc_clk_unregister(struct icc_provider *provider)
> +{
> + struct icc_clk_provider *qp = container_of(provider, struct icc_clk_provider, provider);
> + int i;
> +
> + icc_provider_deregister(&qp->provider);
> + icc_nodes_remove(&qp->provider);
> +
> + for (i = 0; i < qp->num_clocks; i++) {
> + struct icc_clk_node *qn = &qp->clocks[i];
> +
> + if (qn->enabled)
> + clk_disable_unprepare(qn->clk);
> + }
> +}
> diff --git a/include/linux/interconnect-clk.h b/include/linux/interconnect-clk.h
> new file mode 100644
> index 000000000000..0cd80112bea5
> --- /dev/null
> +++ b/include/linux/interconnect-clk.h
> @@ -0,0 +1,22 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (c) 2023, Linaro Ltd.
> + */
> +
> +#ifndef __LINUX_INTERCONNECT_CLK_H
> +#define __LINUX_INTERCONNECT_CLK_H
> +
> +struct device;
> +
> +struct icc_clk_data {
> + struct clk *clk;
> + const char *name;
> +};
> +
> +struct icc_provider *icc_clk_register(struct device *dev,
> + unsigned int first_id,
> + unsigned int num_clocks,
> + const struct icc_clk_data *data);
> +void icc_clk_unregister(struct icc_provider *provider);
> +
> +#endif
next prev parent reply other threads:[~2023-05-13 9:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 0:13 [PATCH v6 0/4] clk: qcom: msm8996: add support for the CBF clock Dmitry Baryshkov
2023-05-12 0:13 ` [PATCH v6 1/4] dt-bindings: interconnect/msm8996-cbf: add defines to be used by CBF Dmitry Baryshkov
2023-05-12 0:13 ` [PATCH v6 2/4] interconnect: add clk-based icc provider support Dmitry Baryshkov
2023-05-13 8:59 ` Konrad Dybcio [this message]
2023-05-19 17:30 ` Nick Desaulniers
2023-05-19 17:32 ` Nick Desaulniers
2023-05-19 19:26 ` Dmitry Baryshkov
2023-05-12 0:13 ` [PATCH v6 3/4] clk: qcom: cbf-msm8996: scale CBF clock according to the CPUfreq Dmitry Baryshkov
2023-06-10 0:18 ` Bjorn Andersson
2023-06-10 7:26 ` Georgi Djakov
2023-05-12 0:13 ` [PATCH v6 4/4] arm64: dts: qcom: msm8996: " Dmitry Baryshkov
2023-07-14 5:33 ` (subset) " Bjorn Andersson
2023-07-14 5:33 ` (subset) [PATCH v6 0/4] clk: qcom: msm8996: add support for the CBF clock 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=9c07e0a1-d3a6-03df-87a0-f2bdbac7d8f3@linaro.org \
--to=konrad.dybcio@linaro.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=djakov@kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=quic_tdas@quicinc.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=y.oudjana@protonmail.com \
/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;
as well as URLs for NNTP newsgroup(s).