From: Viresh Kumar <viresh.kumar@linaro.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Andy Gross <agross@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: Vincent Guittot <vincent.guittot@linaro.org>,
Johan Hovold <johan@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 3/4] cpufreq: qcom-cpufreq-hw: Clocks are moved to CPU nodes
Date: Wed, 13 Jul 2022 12:22:58 +0530 [thread overview]
Message-ID: <eaa5e9b4a1df82d7cbf2dbd1f267544d69690c97.1657695140.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1657695140.git.viresh.kumar@linaro.org>
The clocks are not in the cpufreq-hw node anymore, and are moved to the
respective CPU nodes. Make changes accordingly here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/qcom-cpufreq-hw.c | 43 +++++++++++++++++--------------
1 file changed, 24 insertions(+), 19 deletions(-)
diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index 0253731d6d25..05fce4a559ca 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -57,9 +57,10 @@ struct qcom_cpufreq_data {
struct cpufreq_policy *policy;
bool per_core_dcvs;
+ unsigned long cpu_hw_rate;
+ unsigned long xo_rate;
};
-static unsigned long cpu_hw_rate, xo_rate;
static bool icc_scaling_enabled;
static int qcom_cpufreq_set_bw(struct cpufreq_policy *policy,
@@ -209,9 +210,9 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
volt = FIELD_GET(LUT_VOLT, data) * 1000;
if (src)
- freq = xo_rate * lval / 1000;
+ freq = drv_data->xo_rate * lval / 1000;
else
- freq = cpu_hw_rate / 1000;
+ freq = drv_data->cpu_hw_rate / 1000;
if (freq != prev_freq && core_count != LUT_TURBO_IND) {
if (!qcom_cpufreq_update_opp(cpu_dev, freq, volt)) {
@@ -293,7 +294,7 @@ static unsigned long qcom_lmh_get_throttle_freq(struct qcom_cpufreq_data *data)
else
lval = readl_relaxed(data->base + data->soc_data->reg_domain_state) & 0xff;
- return lval * xo_rate;
+ return lval * data->xo_rate;
}
static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
@@ -480,6 +481,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
struct device_node *cpu_np;
struct device *cpu_dev;
struct resource *res;
+ struct clk *clk;
void __iomem *base;
struct qcom_cpufreq_data *data;
int ret, index;
@@ -527,6 +529,24 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
goto unmap_base;
}
+ clk = clk_get(cpu_dev, "xo");
+ if (IS_ERR(clk)) {
+ ret = PTR_ERR(clk);
+ goto error;
+ }
+
+ data->xo_rate = clk_get_rate(clk);
+ clk_put(clk);
+
+ clk = clk_get(cpu_dev, "alternate");
+ if (IS_ERR(clk)) {
+ ret = PTR_ERR(clk);
+ goto error;
+ }
+
+ data->cpu_hw_rate = clk_get_rate(clk) / CLK_HW_DIV;
+ clk_put(clk);
+
data->soc_data = of_device_get_match_data(&pdev->dev);
data->base = base;
data->res = res;
@@ -637,23 +657,8 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = {
static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
{
struct device *cpu_dev;
- struct clk *clk;
int ret;
- clk = clk_get(&pdev->dev, "xo");
- if (IS_ERR(clk))
- return PTR_ERR(clk);
-
- xo_rate = clk_get_rate(clk);
- clk_put(clk);
-
- clk = clk_get(&pdev->dev, "alternate");
- if (IS_ERR(clk))
- return PTR_ERR(clk);
-
- cpu_hw_rate = clk_get_rate(clk) / CLK_HW_DIV;
- clk_put(clk);
-
cpufreq_qcom_hw_driver.driver_data = pdev;
/* Check for optional interconnect paths on CPU0 */
--
2.31.1.272.g89b43f80a514
next prev parent reply other threads:[~2022-07-13 6:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-13 6:52 [RFC PATCH 0/4] cpufreq: qcom-hw: Move clocks to CPU node Viresh Kumar
2022-07-13 6:52 ` [RFC PATCH 1/4] dt-bindings: cpufreq-qcom-hw: Move clocks to CPU nodes Viresh Kumar
2022-07-18 20:46 ` Rob Herring
2022-07-19 4:19 ` Viresh Kumar
2022-07-13 6:52 ` Viresh Kumar [this message]
2022-07-13 6:52 ` [RFC PATCH 4/4] cpufreq: qcom-cpufreq-hw: Register config_clks helper Viresh Kumar
2022-07-15 16:09 ` [RFC PATCH 0/4] cpufreq: qcom-hw: Move clocks to CPU node Manivannan Sadhasivam
2022-07-18 1:57 ` Viresh Kumar
2022-08-01 2:37 ` Viresh Kumar
2022-08-01 5:42 ` Manivannan Sadhasivam
2022-08-30 3:24 ` Bjorn Andersson
2022-08-30 5:40 ` Viresh Kumar
2022-08-30 6:20 ` Manivannan Sadhasivam
2022-09-20 10:28 ` Viresh Kumar
2022-09-26 11:34 ` Manivannan Sadhasivam
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=eaa5e9b4a1df82d7cbf2dbd1f267544d69690c97.1657695140.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=johan@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mani@kernel.org \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=vincent.guittot@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 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).