* [PATCH v4 1/6] dt-bindings: opp: opp-v2-kryo-cpu: support Qualcomm Krait SoCs
2023-08-27 3:27 [PATCH v4 0/6] cpufreq: qcom-nvmem: support apq8064 cpufreq scaling Dmitry Baryshkov
@ 2023-08-27 3:27 ` Dmitry Baryshkov
2023-08-27 3:27 ` [PATCH v4 2/6] cpufreq: qcom-nvmem: create L2 cache device Dmitry Baryshkov
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-27 3:27 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Ilia Lin, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Michael Turquette,
Rafael J. Wysocki, Georgi Djakov
Cc: linux-arm-msm, devicetree, linux-pm, linux-clk, Christian Marangi,
Stephan Gerhold, Rob Herring
Exted the opp-v2-kryo-cpu.yaml to support defining OPP tables for the
previous generation of Qualcomm CPUs, 32-bit Krait-based platforms.
It makes no sense to use 'operating-points-v2-kryo-cpu' compatibility
node for the Krait cores. Add support for the Krait-specific
'operating-points-v2-krait-cpu' compatibility string and the relevant
opp-microvolt subclasses properties.
The listed opp-supported-hw values are applicable only to msm8996 /
msm8996pro platforms. Remove the enum as other platforms will use other
bit values. It makes little sense to list all possible values for all
the platforms here.
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
.../devicetree/bindings/opp/opp-v2-kryo-cpu.yaml | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml b/Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml
index bbbad31ae4ca..4e84d06d5ff9 100644
--- a/Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml
+++ b/Documentation/devicetree/bindings/opp/opp-v2-kryo-cpu.yaml
@@ -26,7 +26,9 @@ description: |
properties:
compatible:
- const: operating-points-v2-kryo-cpu
+ enum:
+ - operating-points-v2-krait-cpu
+ - operating-points-v2-kryo-cpu
nvmem-cells:
description: |
@@ -63,14 +65,16 @@ patternProperties:
5: MSM8996SG, speedbin 1
6: MSM8996SG, speedbin 2
7-31: unused
- enum: [0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7,
- 0x9, 0xd, 0xe, 0xf,
- 0x10, 0x20, 0x30, 0x70]
+
+ Other platforms use bits directly corresponding to speedbin index.
clock-latency-ns: true
required-opps: true
+ patternProperties:
+ '^opp-microvolt-speed[0-9]+-pvs[0-9]+$': true
+
required:
- opp-hz
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v4 2/6] cpufreq: qcom-nvmem: create L2 cache device
2023-08-27 3:27 [PATCH v4 0/6] cpufreq: qcom-nvmem: support apq8064 cpufreq scaling Dmitry Baryshkov
2023-08-27 3:27 ` [PATCH v4 1/6] dt-bindings: opp: opp-v2-kryo-cpu: support Qualcomm Krait SoCs Dmitry Baryshkov
@ 2023-08-27 3:27 ` Dmitry Baryshkov
2023-08-28 11:07 ` Konrad Dybcio
2023-08-27 3:28 ` [PATCH v4 3/6] cpufreq: qcom-nvmem: also accept operating-points-v2-krait-cpu Dmitry Baryshkov
` (4 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-27 3:27 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Ilia Lin, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Michael Turquette,
Rafael J. Wysocki, Georgi Djakov
Cc: linux-arm-msm, devicetree, linux-pm, linux-clk, Christian Marangi,
Stephan Gerhold
Scaling the frequencies on some of Qualcomm Krait platforms (e.g.
APQ8064) also requires scaling of the L2 cache frequency. As the
l2-cache device node is places under /cpus/ path, it is not created by
default by the OF code. Create corresponding device here.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/cpufreq/qcom-cpufreq-nvmem.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index 84d7033e5efe..f4c196ba4432 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -22,6 +22,7 @@
#include <linux/module.h>
#include <linux/nvmem-consumer.h>
#include <linux/of.h>
+#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <linux/pm_opp.h>
@@ -377,6 +378,7 @@ static int __init qcom_cpufreq_init(void)
{
struct device_node *np = of_find_node_by_path("/");
const struct of_device_id *match;
+ unsigned int cpu;
int ret;
if (!np)
@@ -387,6 +389,25 @@ static int __init qcom_cpufreq_init(void)
if (!match)
return -ENODEV;
+ for_each_possible_cpu(cpu) {
+ struct device *dev = get_cpu_device(cpu);
+ struct device_node *cache;
+ struct platform_device *pdev;
+
+ cache = of_find_next_cache_node(dev->of_node);
+ if (!cache)
+ continue;
+
+ if (of_device_is_compatible(cache, "qcom,krait-l2-cache")) {
+ pdev = of_platform_device_create(cache, NULL, NULL);
+ if (IS_ERR(pdev))
+ pr_err("%s: %pe, failed to create L2 cache node\n", __func__, pdev);
+ /* the error is not fatal */
+ }
+
+ of_node_put(cache);
+ }
+
ret = platform_driver_register(&qcom_cpufreq_driver);
if (unlikely(ret < 0))
return ret;
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v4 2/6] cpufreq: qcom-nvmem: create L2 cache device
2023-08-27 3:27 ` [PATCH v4 2/6] cpufreq: qcom-nvmem: create L2 cache device Dmitry Baryshkov
@ 2023-08-28 11:07 ` Konrad Dybcio
0 siblings, 0 replies; 12+ messages in thread
From: Konrad Dybcio @ 2023-08-28 11:07 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andy Gross, Bjorn Andersson, Ilia Lin, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Michael Turquette,
Rafael J. Wysocki, Georgi Djakov
Cc: linux-arm-msm, devicetree, linux-pm, linux-clk, Christian Marangi,
Stephan Gerhold
On 27.08.2023 05:27, Dmitry Baryshkov wrote:
> Scaling the frequencies on some of Qualcomm Krait platforms (e.g.
> APQ8064) also requires scaling of the L2 cache frequency. As the
> l2-cache device node is places under /cpus/ path, it is not created by
> default by the OF code. Create corresponding device here.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/cpufreq/qcom-cpufreq-nvmem.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> index 84d7033e5efe..f4c196ba4432 100644
> --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
> +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> @@ -22,6 +22,7 @@
> #include <linux/module.h>
> #include <linux/nvmem-consumer.h>
> #include <linux/of.h>
> +#include <linux/of_platform.h>
> #include <linux/platform_device.h>
> #include <linux/pm_domain.h>
> #include <linux/pm_opp.h>
> @@ -377,6 +378,7 @@ static int __init qcom_cpufreq_init(void)
> {
> struct device_node *np = of_find_node_by_path("/");
> const struct of_device_id *match;
> + unsigned int cpu;
> int ret;
>
> if (!np)
> @@ -387,6 +389,25 @@ static int __init qcom_cpufreq_init(void)
> if (!match)
> return -ENODEV;
>
> + for_each_possible_cpu(cpu) {
> + struct device *dev = get_cpu_device(cpu);
> + struct device_node *cache;
> + struct platform_device *pdev;
Aaaalmost reverse-Christmas-tree :D
> +
> + cache = of_find_next_cache_node(dev->of_node);
> + if (!cache)
> + continue;
> +
> + if (of_device_is_compatible(cache, "qcom,krait-l2-cache")) {
> + pdev = of_platform_device_create(cache, NULL, NULL);
> + if (IS_ERR(pdev))
> + pr_err("%s: %pe, failed to create L2 cache node\n", __func__, pdev);
The return value should be null-checked instead
> + /* the error is not fatal */
"This error"?
Konrad
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v4 3/6] cpufreq: qcom-nvmem: also accept operating-points-v2-krait-cpu
2023-08-27 3:27 [PATCH v4 0/6] cpufreq: qcom-nvmem: support apq8064 cpufreq scaling Dmitry Baryshkov
2023-08-27 3:27 ` [PATCH v4 1/6] dt-bindings: opp: opp-v2-kryo-cpu: support Qualcomm Krait SoCs Dmitry Baryshkov
2023-08-27 3:27 ` [PATCH v4 2/6] cpufreq: qcom-nvmem: create L2 cache device Dmitry Baryshkov
@ 2023-08-27 3:28 ` Dmitry Baryshkov
2023-08-27 3:28 ` [PATCH v4 4/6] cpufreq: qcom-nvmem: drop pvs_ver for format a fuses Dmitry Baryshkov
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-27 3:28 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Ilia Lin, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Michael Turquette,
Rafael J. Wysocki, Georgi Djakov
Cc: linux-arm-msm, devicetree, linux-pm, linux-clk, Christian Marangi,
Stephan Gerhold
the qcom-cpufreq-nvmem driver attempts to support both Qualcomm Kryo
(newer 64-bit ARMv8 cores) and Krait (older 32-bit ARMv7 cores). It
makes no sense to use 'operating-points-v2-kryo-cpu' compatibility node
for the Krait cores. Add support for 'operating-points-v2-krait-cpu'
compatibility string.
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/cpufreq/qcom-cpufreq-nvmem.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index f4c196ba4432..04329ef61150 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -238,7 +238,8 @@ static int qcom_cpufreq_probe(struct platform_device *pdev)
if (!np)
return -ENOENT;
- ret = of_device_is_compatible(np, "operating-points-v2-kryo-cpu");
+ ret = of_device_is_compatible(np, "operating-points-v2-kryo-cpu") ||
+ of_device_is_compatible(np, "operating-points-v2-krait-cpu");
if (!ret) {
of_node_put(np);
return -ENOENT;
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v4 4/6] cpufreq: qcom-nvmem: drop pvs_ver for format a fuses
2023-08-27 3:27 [PATCH v4 0/6] cpufreq: qcom-nvmem: support apq8064 cpufreq scaling Dmitry Baryshkov
` (2 preceding siblings ...)
2023-08-27 3:28 ` [PATCH v4 3/6] cpufreq: qcom-nvmem: also accept operating-points-v2-krait-cpu Dmitry Baryshkov
@ 2023-08-27 3:28 ` Dmitry Baryshkov
2023-08-27 3:28 ` [PATCH v4 5/6] cpufreq: qcom-nvmem: provide separate configuration data for apq8064 Dmitry Baryshkov
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-27 3:28 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Ilia Lin, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Michael Turquette,
Rafael J. Wysocki, Georgi Djakov
Cc: linux-arm-msm, devicetree, linux-pm, linux-clk, Christian Marangi,
Stephan Gerhold
The fuses used on msm8960 / apq8064 / ipq806x families of devices do not
have the pvs version. Drop this argument from parsing function.
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/cpufreq/qcom-cpufreq-nvmem.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index 04329ef61150..81c080b854fe 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -50,7 +50,7 @@ struct qcom_cpufreq_drv {
static struct platform_device *cpufreq_dt_pdev, *cpufreq_pdev;
static void get_krait_bin_format_a(struct device *cpu_dev,
- int *speed, int *pvs, int *pvs_ver,
+ int *speed, int *pvs,
u8 *buf)
{
u32 pte_efuse;
@@ -181,8 +181,7 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev,
switch (len) {
case 4:
- get_krait_bin_format_a(cpu_dev, &speed, &pvs, &pvs_ver,
- speedbin);
+ get_krait_bin_format_a(cpu_dev, &speed, &pvs, speedbin);
break;
case 8:
get_krait_bin_format_b(cpu_dev, &speed, &pvs, &pvs_ver,
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v4 5/6] cpufreq: qcom-nvmem: provide separate configuration data for apq8064
2023-08-27 3:27 [PATCH v4 0/6] cpufreq: qcom-nvmem: support apq8064 cpufreq scaling Dmitry Baryshkov
` (3 preceding siblings ...)
2023-08-27 3:28 ` [PATCH v4 4/6] cpufreq: qcom-nvmem: drop pvs_ver for format a fuses Dmitry Baryshkov
@ 2023-08-27 3:28 ` Dmitry Baryshkov
2023-08-28 11:04 ` Konrad Dybcio
2023-08-27 3:28 ` [PATCH v4 6/6] cpufreq: qcom-nvmem: enable core voltage scaling for MSM8960 Dmitry Baryshkov
2023-08-28 9:43 ` [PATCH v4 0/6] cpufreq: qcom-nvmem: support apq8064 cpufreq scaling Konrad Dybcio
6 siblings, 1 reply; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-27 3:28 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Ilia Lin, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Michael Turquette,
Rafael J. Wysocki, Georgi Djakov
Cc: linux-arm-msm, devicetree, linux-pm, linux-clk, Christian Marangi,
Stephan Gerhold
APQ8064 can scale core voltage according to the frequency needs. Rather
than reusing the A/B format multiplexer, use a simple fuse parsing
function and configure required regulator.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/cpufreq/qcom-cpufreq-nvmem.c | 49 ++++++++++++++++++++++++++--
1 file changed, 47 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index 81c080b854fe..35e2610c9526 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -26,6 +26,7 @@
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <linux/pm_opp.h>
+#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/soc/qcom/smem.h>
@@ -39,6 +40,7 @@ struct qcom_cpufreq_match_data {
char **pvs_name,
struct qcom_cpufreq_drv *drv);
const char **genpd_names;
+ const char * const *regulator_names;
};
struct qcom_cpufreq_drv {
@@ -203,6 +205,34 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev,
return ret;
}
+static int qcom_cpufreq_apq8064_name_version(struct device *cpu_dev,
+ struct nvmem_cell *speedbin_nvmem,
+ char **pvs_name,
+ struct qcom_cpufreq_drv *drv)
+{
+ int speed = 0, pvs = 0;
+ u8 *speedbin;
+ size_t len;
+ int ret = 0;
+
+ speedbin = nvmem_cell_read(speedbin_nvmem, &len);
+ if (IS_ERR(speedbin))
+ return PTR_ERR(speedbin);
+
+ if (len != 4)
+ return -EINVAL;
+
+ get_krait_bin_format_a(cpu_dev, &speed, &pvs, speedbin);
+
+ snprintf(*pvs_name, sizeof("speedXX-pvsXX"), "speed%d-pvs%d",
+ speed, pvs);
+
+ drv->versions = (1 << speed);
+
+ kfree(speedbin);
+ return ret;
+}
+
static const struct qcom_cpufreq_match_data match_data_kryo = {
.get_version = qcom_cpufreq_kryo_name_version,
};
@@ -217,6 +247,16 @@ static const struct qcom_cpufreq_match_data match_data_qcs404 = {
.genpd_names = qcs404_genpd_names,
};
+static const char * apq8064_regulator_names[] = {
+ "vdd-core",
+ NULL
+};
+
+static const struct qcom_cpufreq_match_data match_data_apq8064 = {
+ .get_version = qcom_cpufreq_apq8064_name_version,
+ .regulator_names = apq8064_regulator_names,
+};
+
static int qcom_cpufreq_probe(struct platform_device *pdev)
{
struct qcom_cpufreq_drv *drv;
@@ -304,7 +344,12 @@ static int qcom_cpufreq_probe(struct platform_device *pdev)
config.virt_devs = NULL;
}
- if (config.supported_hw || config.genpd_names) {
+ if (drv->data->regulator_names)
+ config.regulator_names = drv->data->regulator_names;
+
+ if (config.supported_hw ||
+ config.genpd_names ||
+ config.regulator_names) {
drv->opp_tokens[cpu] = dev_pm_opp_set_config(cpu_dev, &config);
if (drv->opp_tokens[cpu] < 0) {
ret = drv->opp_tokens[cpu];
@@ -361,7 +406,7 @@ static const struct of_device_id qcom_cpufreq_match_list[] __initconst = {
{ .compatible = "qcom,msm8996", .data = &match_data_kryo },
{ .compatible = "qcom,qcs404", .data = &match_data_qcs404 },
{ .compatible = "qcom,ipq8064", .data = &match_data_krait },
- { .compatible = "qcom,apq8064", .data = &match_data_krait },
+ { .compatible = "qcom,apq8064", .data = &match_data_apq8064 },
{ .compatible = "qcom,msm8974", .data = &match_data_krait },
{ .compatible = "qcom,msm8960", .data = &match_data_krait },
{},
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v4 5/6] cpufreq: qcom-nvmem: provide separate configuration data for apq8064
2023-08-27 3:28 ` [PATCH v4 5/6] cpufreq: qcom-nvmem: provide separate configuration data for apq8064 Dmitry Baryshkov
@ 2023-08-28 11:04 ` Konrad Dybcio
2023-10-02 18:59 ` Dmitry Baryshkov
0 siblings, 1 reply; 12+ messages in thread
From: Konrad Dybcio @ 2023-08-28 11:04 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andy Gross, Bjorn Andersson, Ilia Lin, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Michael Turquette,
Rafael J. Wysocki, Georgi Djakov
Cc: linux-arm-msm, devicetree, linux-pm, linux-clk, Christian Marangi,
Stephan Gerhold
On 27.08.2023 05:28, Dmitry Baryshkov wrote:
> APQ8064 can scale core voltage according to the frequency needs. Rather
> than reusing the A/B format multiplexer, use a simple fuse parsing
> function and configure required regulator.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/cpufreq/qcom-cpufreq-nvmem.c | 49 ++++++++++++++++++++++++++--
> 1 file changed, 47 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> index 81c080b854fe..35e2610c9526 100644
> --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
> +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> @@ -26,6 +26,7 @@
> #include <linux/platform_device.h>
> #include <linux/pm_domain.h>
> #include <linux/pm_opp.h>
> +#include <linux/regulator/consumer.h>
> #include <linux/slab.h>
> #include <linux/soc/qcom/smem.h>
>
> @@ -39,6 +40,7 @@ struct qcom_cpufreq_match_data {
> char **pvs_name,
> struct qcom_cpufreq_drv *drv);
> const char **genpd_names;
> + const char * const *regulator_names;
> };
>
> struct qcom_cpufreq_drv {
> @@ -203,6 +205,34 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev,
> return ret;
> }
>
> +static int qcom_cpufreq_apq8064_name_version(struct device *cpu_dev,
> + struct nvmem_cell *speedbin_nvmem,
> + char **pvs_name,
> + struct qcom_cpufreq_drv *drv)
> +{
> + int speed = 0, pvs = 0;
> + u8 *speedbin;
> + size_t len;
> + int ret = 0;
Unused, just return 0
> +
> + speedbin = nvmem_cell_read(speedbin_nvmem, &len);
> + if (IS_ERR(speedbin))
> + return PTR_ERR(speedbin);
> +
> + if (len != 4)
> + return -EINVAL;
> +
> + get_krait_bin_format_a(cpu_dev, &speed, &pvs, speedbin);
> +
> + snprintf(*pvs_name, sizeof("speedXX-pvsXX"), "speed%d-pvs%d",
> + speed, pvs);
speed and pvs are both one hex digit long at best (see masking in
get_krait_bin_format_a)
Konrad
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 5/6] cpufreq: qcom-nvmem: provide separate configuration data for apq8064
2023-08-28 11:04 ` Konrad Dybcio
@ 2023-10-02 18:59 ` Dmitry Baryshkov
0 siblings, 0 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-10-02 18:59 UTC (permalink / raw)
To: Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andy Gross, Bjorn Andersson, Ilia Lin, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Michael Turquette,
Rafael J. Wysocki, Georgi Djakov
Cc: linux-arm-msm, devicetree, linux-pm, linux-clk, Christian Marangi,
Stephan Gerhold
On 28/08/2023 14:04, Konrad Dybcio wrote:
> On 27.08.2023 05:28, Dmitry Baryshkov wrote:
>> APQ8064 can scale core voltage according to the frequency needs. Rather
>> than reusing the A/B format multiplexer, use a simple fuse parsing
>> function and configure required regulator.
>>
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> ---
>> drivers/cpufreq/qcom-cpufreq-nvmem.c | 49 ++++++++++++++++++++++++++--
>> 1 file changed, 47 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
>> index 81c080b854fe..35e2610c9526 100644
>> --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
>> +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
>> @@ -26,6 +26,7 @@
>> #include <linux/platform_device.h>
>> #include <linux/pm_domain.h>
>> #include <linux/pm_opp.h>
>> +#include <linux/regulator/consumer.h>
>> #include <linux/slab.h>
>> #include <linux/soc/qcom/smem.h>
>>
>> @@ -39,6 +40,7 @@ struct qcom_cpufreq_match_data {
>> char **pvs_name,
>> struct qcom_cpufreq_drv *drv);
>> const char **genpd_names;
>> + const char * const *regulator_names;
>> };
>>
>> struct qcom_cpufreq_drv {
>> @@ -203,6 +205,34 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev,
>> return ret;
>> }
>>
>> +static int qcom_cpufreq_apq8064_name_version(struct device *cpu_dev,
>> + struct nvmem_cell *speedbin_nvmem,
>> + char **pvs_name,
>> + struct qcom_cpufreq_drv *drv)
>> +{
>> + int speed = 0, pvs = 0;
>> + u8 *speedbin;
>> + size_t len;
>> + int ret = 0;
> Unused, just return 0
>
>> +
>> + speedbin = nvmem_cell_read(speedbin_nvmem, &len);
>> + if (IS_ERR(speedbin))
>> + return PTR_ERR(speedbin);
>> +
>> + if (len != 4)
>> + return -EINVAL;
>> +
>> + get_krait_bin_format_a(cpu_dev, &speed, &pvs, speedbin);
>> +
>> + snprintf(*pvs_name, sizeof("speedXX-pvsXX"), "speed%d-pvs%d",
>> + speed, pvs);
> speed and pvs are both one hex digit long at best (see masking in
> get_krait_bin_format_a)
One hex translates to two decimal digits (0xf = 15).
>
> Konrad
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v4 6/6] cpufreq: qcom-nvmem: enable core voltage scaling for MSM8960
2023-08-27 3:27 [PATCH v4 0/6] cpufreq: qcom-nvmem: support apq8064 cpufreq scaling Dmitry Baryshkov
` (4 preceding siblings ...)
2023-08-27 3:28 ` [PATCH v4 5/6] cpufreq: qcom-nvmem: provide separate configuration data for apq8064 Dmitry Baryshkov
@ 2023-08-27 3:28 ` Dmitry Baryshkov
2023-08-28 9:43 ` [PATCH v4 0/6] cpufreq: qcom-nvmem: support apq8064 cpufreq scaling Konrad Dybcio
6 siblings, 0 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-27 3:28 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
Bjorn Andersson, Konrad Dybcio, Ilia Lin, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Michael Turquette,
Rafael J. Wysocki, Georgi Djakov
Cc: linux-arm-msm, devicetree, linux-pm, linux-clk, Christian Marangi,
Stephan Gerhold
Reuse APQ8064 config for MSM8960 to enable core voltage scaling.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/cpufreq/qcom-cpufreq-nvmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index 35e2610c9526..2590c673cd3b 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -408,7 +408,7 @@ static const struct of_device_id qcom_cpufreq_match_list[] __initconst = {
{ .compatible = "qcom,ipq8064", .data = &match_data_krait },
{ .compatible = "qcom,apq8064", .data = &match_data_apq8064 },
{ .compatible = "qcom,msm8974", .data = &match_data_krait },
- { .compatible = "qcom,msm8960", .data = &match_data_krait },
+ { .compatible = "qcom,msm8960", .data = &match_data_apq8064 },
{},
};
MODULE_DEVICE_TABLE(of, qcom_cpufreq_match_list);
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v4 0/6] cpufreq: qcom-nvmem: support apq8064 cpufreq scaling
2023-08-27 3:27 [PATCH v4 0/6] cpufreq: qcom-nvmem: support apq8064 cpufreq scaling Dmitry Baryshkov
` (5 preceding siblings ...)
2023-08-27 3:28 ` [PATCH v4 6/6] cpufreq: qcom-nvmem: enable core voltage scaling for MSM8960 Dmitry Baryshkov
@ 2023-08-28 9:43 ` Konrad Dybcio
2023-08-28 9:51 ` Dmitry Baryshkov
6 siblings, 1 reply; 12+ messages in thread
From: Konrad Dybcio @ 2023-08-28 9:43 UTC (permalink / raw)
To: Dmitry Baryshkov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andy Gross, Bjorn Andersson, Ilia Lin, Viresh Kumar,
Nishanth Menon, Stephen Boyd, Michael Turquette,
Rafael J. Wysocki, Georgi Djakov
Cc: linux-arm-msm, devicetree, linux-pm, linux-clk, Christian Marangi,
Stephan Gerhold
On 27.08.2023 05:27, Dmitry Baryshkov wrote:
> This is a split of APQ8064 cpufreq series, as requested by Viresh. This
> series includes only opp and cpufreq parts, with the DT and soc parts
> being split to a separate patchset.
>
> Each core has independent power and frequency control. Additionally the
> L2 cache is scaled to follow the CPU frequencies (failure to do so
> results in strange semi-random crashes).
>
> Core voltage is controlled through the SAW2 devices, one for each core.
> The L2 has two regulators, vdd-mem and vdd-dig.
>
No changelog?
Konrad
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 0/6] cpufreq: qcom-nvmem: support apq8064 cpufreq scaling
2023-08-28 9:43 ` [PATCH v4 0/6] cpufreq: qcom-nvmem: support apq8064 cpufreq scaling Konrad Dybcio
@ 2023-08-28 9:51 ` Dmitry Baryshkov
0 siblings, 0 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-28 9:51 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross,
Bjorn Andersson, Ilia Lin, Viresh Kumar, Nishanth Menon,
Stephen Boyd, Michael Turquette, Rafael J. Wysocki, Georgi Djakov,
linux-arm-msm, devicetree, linux-pm, linux-clk, Christian Marangi,
Stephan Gerhold
On Mon, 28 Aug 2023 at 12:43, Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>
> On 27.08.2023 05:27, Dmitry Baryshkov wrote:
> > This is a split of APQ8064 cpufreq series, as requested by Viresh. This
> > series includes only opp and cpufreq parts, with the DT and soc parts
> > being split to a separate patchset.
> >
> > Each core has independent power and frequency control. Additionally the
> > L2 cache is scaled to follow the CPU frequencies (failure to do so
> > results in strange semi-random crashes).
> >
> > Core voltage is controlled through the SAW2 devices, one for each core.
> > The L2 has two regulators, vdd-mem and vdd-dig.
> >
> No changelog?
Missed it while performing the split.
Changes since v3:
- Unrolled loops in krait_l2_config_regulators() (Konrad)
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 12+ messages in thread