Skip to contentSkip to conversation

cpufreq: qcom-nvmem: add support for IPQ8074

PATCH Applied Robert Marko 3 participants 9 messages Oct 13, 2023 – Oct 16, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 cpufreq: qcom-nvmem: add support for IPQ8074

IPQ8074 comes in 3 families:
* IPQ8070A/IPQ8071A (Acorn) up to 1.4GHz
* IPQ8172/IPQ8173/IPQ8174 (Oak) up to 1.4GHz
* IPQ8072A/IPQ8074A/IPQ8076A/IPQ8078A (Hawkeye) up to 2.2GHz

So, in order to be able to share one OPP table lets add support for IPQ8074 family based of SMEM SoC ID-s as speedbin fuse is always 0 on IPQ8074.

IPQ8074 compatible is blacklisted from DT platdev as the cpufreq device will get created by NVMEM CPUFreq driver.

---
Changes in v6:
* Split IPQ8074 from the IPQ8064 as IPQ8064 has additional dependencies.

Changes in v4:
* Add support for IPQ8174 (Oak) family

Changes in v3:
* Use enum for SoC versions

Changes in v2:
* Print an error if SMEM ID is not part of the IPQ8074 family and restrict the speed to Acorn variant (1.4GHz)

 drivers/cpufreq/cpufreq-dt-platdev.c |  1 +
 drivers/cpufreq/qcom-cpufreq-nvmem.c | 48 ++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
drivers/cpufreq/cpufreq-dt-platdev.c +1 -0
index 0b3776f558db..675da7f36846 100644
@@ -181,6 +181,7 @@ static const struct of_device_id blocklist[] __initconst = {
 	{ .compatible = "ti,am62p5", },
 
 	{ .compatible = "qcom,ipq8064", },
+	{ .compatible = "qcom,ipq8074", },
 	{ .compatible = "qcom,apq8064", },
 	{ .compatible = "qcom,msm8974", },
 	{ .compatible = "qcom,msm8960", },
drivers/cpufreq/qcom-cpufreq-nvmem.c +48 -0

72 lines not on this page · raw message

Signature · 1 line
2.41.0
#1 lore raw
Quoted 9 lines · Robert Marko

IPQ8074 comes in 3 families:
* IPQ8070A/IPQ8071A (Acorn) up to 1.4GHz
* IPQ8172/IPQ8173/IPQ8174 (Oak) up to 1.4GHz
* IPQ8072A/IPQ8074A/IPQ8076A/IPQ8078A (Hawkeye) up to 2.2GHz

So, in order to be able to share one OPP table lets add support for IPQ8074 family based of SMEM SoC ID-s as speedbin fuse is always 0 on IPQ8074.

Quoted 8 lines

IPQ8074 compatible is blacklisted from DT platdev as the cpufreq device will get created by NVMEM CPUFreq driver.

---
Changes in v6:
* Split IPQ8074 from the IPQ8064 as IPQ8064 has additional dependencies.

I discussed this with Christian and we decided to split out IPQ8074 as it is much simpler
than IPQ8064 and has no additional dependencies so it makes sense split it out.

Regards,
Robert

Quoted 110 lines

Changes in v4:
* Add support for IPQ8174 (Oak) family

Changes in v3:
* Use enum for SoC versions

Changes in v2:
* Print an error if SMEM ID is not part of the IPQ8074 family and restrict the speed to Acorn variant (1.4GHz)

 drivers/cpufreq/cpufreq-dt-platdev.c |  1 +
 drivers/cpufreq/qcom-cpufreq-nvmem.c | 48 ++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
drivers/cpufreq/cpufreq-dt-platdev.c +1 -0
index 0b3776f558db..675da7f36846 100644
@@ -181,6 +181,7 @@ static const struct of_device_id blocklist[] __initconst = {
        { .compatible = "ti,am62p5", },
 
        { .compatible = "qcom,ipq8064", },
+       { .compatible = "qcom,ipq8074", },
        { .compatible = "qcom,apq8064", },
        { .compatible = "qcom,msm8974", },
        { .compatible = "qcom,msm8960", },
drivers/cpufreq/qcom-cpufreq-nvmem.c +48 -1
index 84d7033e5efe..3fa12648ceb6 100644
@@ -30,6 +30,11 @@
 
 #include <dt-bindings/arm/qcom,ids.h>
 
+enum ipq8074_versions {
+       IPQ8074_HAWKEYE_VERSION = 0,
+       IPQ8074_ACORN_VERSION,
+};
+
 struct qcom_cpufreq_drv;
 
 struct qcom_cpufreq_match_data {
@@ -203,6 +208,44 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev,
        return ret;
 }
 
+static int qcom_cpufreq_ipq8074_name_version(struct device *cpu_dev,
+                                            struct nvmem_cell *speedbin_nvmem,
+                                            char **pvs_name,
+                                            struct qcom_cpufreq_drv *drv)
+{
+       u32 msm_id;
+       int ret;
+       *pvs_name = NULL;
+
+       ret = qcom_smem_get_soc_id(&msm_id);
+       if (ret)
+               return ret;
+
+       switch (msm_id) {
+       case QCOM_ID_IPQ8070A:
+       case QCOM_ID_IPQ8071A:
+       case QCOM_ID_IPQ8172:
+       case QCOM_ID_IPQ8173:
+       case QCOM_ID_IPQ8174:
+               drv->versions = BIT(IPQ8074_ACORN_VERSION);
+               break;
+       case QCOM_ID_IPQ8072A:
+       case QCOM_ID_IPQ8074A:
+       case QCOM_ID_IPQ8076A:
+       case QCOM_ID_IPQ8078A:
+               drv->versions = BIT(IPQ8074_HAWKEYE_VERSION);
+               break;
+       default:
+               dev_err(cpu_dev,
+                       "SoC ID %u is not part of IPQ8074 family, limiting to 1.4GHz!\n",
+                       msm_id);
+               drv->versions = BIT(IPQ8074_ACORN_VERSION);
+               break;
+       }
+
+       return 0;
+}
+
 static const struct qcom_cpufreq_match_data match_data_kryo = {
        .get_version = qcom_cpufreq_kryo_name_version,
 };
@@ -217,6 +260,10 @@ static const struct qcom_cpufreq_match_data match_data_qcs404 = {
        .genpd_names = qcs404_genpd_names,
 };
 
+static const struct qcom_cpufreq_match_data match_data_ipq8074 = {
+       .get_version = qcom_cpufreq_ipq8074_name_version,
+};
+
 static int qcom_cpufreq_probe(struct platform_device *pdev)
 {
        struct qcom_cpufreq_drv *drv;
@@ -360,6 +407,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,ipq8074", .data = &match_data_ipq8074 },
        { .compatible = "qcom,apq8064", .data = &match_data_krait },
        { .compatible = "qcom,msm8974", .data = &match_data_krait },
        { .compatible = "qcom,msm8960", .data = &match_data_krait },
--

2.41.0

maintainer Applied
#2 lore raw
In reply to Robert Marko
Quoted 8 lines · Robert Marko

IPQ8074 comes in 3 families:
* IPQ8070A/IPQ8071A (Acorn) up to 1.4GHz
* IPQ8172/IPQ8173/IPQ8174 (Oak) up to 1.4GHz
* IPQ8072A/IPQ8074A/IPQ8076A/IPQ8078A (Hawkeye) up to 2.2GHz

So, in order to be able to share one OPP table lets add support for IPQ8074 family based of SMEM SoC ID-s as speedbin fuse is always 0 on IPQ8074.

Quoted 8 lines

IPQ8074 compatible is blacklisted from DT platdev as the cpufreq device will get created by NVMEM CPUFreq driver.

---
Changes in v6:
* Split IPQ8074 from the IPQ8064 as IPQ8064 has additional dependencies.

Applied. Thanks.

Signature · 1 line
viresh
maintainer
#3 lore raw
Quoted 12 lines · Viresh Kumar
Quoted 11 lines · Robert Marko

IPQ8074 comes in 3 families:
* IPQ8070A/IPQ8071A (Acorn) up to 1.4GHz
* IPQ8172/IPQ8173/IPQ8174 (Oak) up to 1.4GHz
* IPQ8072A/IPQ8074A/IPQ8076A/IPQ8078A (Hawkeye) up to 2.2GHz

So, in order to be able to share one OPP table lets add support for IPQ8074 family based of SMEM SoC ID-s as speedbin fuse is always 0 on IPQ8074.

IPQ8074 compatible is blacklisted from DT platdev as the cpufreq device will get created by NVMEM CPUFreq driver.

Quoted 7 lines
Quoted 5 lines

---
Changes in v6:
* Split IPQ8074 from the IPQ8064 as IPQ8064 has additional dependencies.

Applied. Thanks.

And it failed to build, please fix it. Dropped from my tree now.

Signature · 1 line
viresh
#4 lore raw
Quoted 20 lines · Viresh Kumar
Quoted 18 lines · Viresh Kumar
Quoted 16 lines · Robert Marko

IPQ8074 comes in 3 families:
* IPQ8070A/IPQ8071A (Acorn) up to 1.4GHz
* IPQ8172/IPQ8173/IPQ8174 (Oak) up to 1.4GHz
* IPQ8072A/IPQ8074A/IPQ8076A/IPQ8078A (Hawkeye) up to 2.2GHz

So, in order to be able to share one OPP table lets add support for IPQ8074 family based of SMEM SoC ID-s as speedbin fuse is always 0 on IPQ8074.

IPQ8074 compatible is blacklisted from DT platdev as the cpufreq device will get created by NVMEM CPUFreq driver.

---
Changes in v6:
* Split IPQ8074 from the IPQ8064 as IPQ8064 has additional dependencies.

Quoted 3 lines
Quoted 1 line

Applied. Thanks.

And it failed to build, please fix it. Dropped from my tree now.

I am looking at the error and it should not happen as the ID-s have been in linux-next for a month now:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/include/dt-bindings/arm/qcom,ids.h?h=next-20231016&id=b8c889bef9797a58b8b5aad23875cc4d04b3efd3

They are also part of Bjorns 6.7 driver PR:
https://lore.kernel.org/all/[email protected]/T/

Regards,
Robert

Quoted 3 lines

--
viresh

#5 lore raw
Quoted 24 lines · Robert Marko
Quoted 22 lines · Viresh Kumar
Quoted 19 lines · Viresh Kumar
Quoted 8 lines · Robert Marko

IPQ8074 comes in 3 families:
* IPQ8070A/IPQ8071A (Acorn) up to 1.4GHz
* IPQ8172/IPQ8173/IPQ8174 (Oak) up to 1.4GHz
* IPQ8072A/IPQ8074A/IPQ8076A/IPQ8078A (Hawkeye) up to 2.2GHz

So, in order to be able to share one OPP table lets add support for IPQ8074 family based of SMEM SoC ID-s as speedbin fuse is always 0 on IPQ8074.

Quoted 8 lines

IPQ8074 compatible is blacklisted from DT platdev as the cpufreq device will get created by NVMEM CPUFreq driver.

---
Changes in v6:
* Split IPQ8074 from the IPQ8064 as IPQ8064 has additional dependencies.

Applied. Thanks.

Quoted 8 lines
Quoted 1 line

And it failed to build, please fix it. Dropped from my tree now.

I am looking at the error and it should not happen as the ID-s have been in linux-next for a month now:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/include/dt-bindings/arm/qcom,ids.h?h=next-20231016&id=b8c889bef9797a58b8b5aad23875cc4d04b3efd3

They are also part of Bjorns 6.7 driver PR:
https://lore.kernel.org/all/[email protected]/T/

But Bjorn's tree isn't a part of the cpufreq tree. In such cases it is typical to ask first maintainer to create an immutable branch / tag, which can later be also merged into another tree without going into troubles of merging the whole tree of the irrelevant subsystem.

Signature · 2 lines
With best wishes
Dmitry
#6 lore raw
Quoted 32 lines · Dmitry Baryshkov
Quoted 30 lines · Robert Marko
Quoted 20 lines · Viresh Kumar
Quoted 18 lines · Viresh Kumar
Quoted 16 lines · Robert Marko

IPQ8074 comes in 3 families:
* IPQ8070A/IPQ8071A (Acorn) up to 1.4GHz
* IPQ8172/IPQ8173/IPQ8174 (Oak) up to 1.4GHz
* IPQ8072A/IPQ8074A/IPQ8076A/IPQ8078A (Hawkeye) up to 2.2GHz

So, in order to be able to share one OPP table lets add support for IPQ8074 family based of SMEM SoC ID-s as speedbin fuse is always 0 on IPQ8074.

IPQ8074 compatible is blacklisted from DT platdev as the cpufreq device will get created by NVMEM CPUFreq driver.

---
Changes in v6:
* Split IPQ8074 from the IPQ8064 as IPQ8064 has additional dependencies.

Quoted 3 lines
Quoted 1 line

Applied. Thanks.

And it failed to build, please fix it. Dropped from my tree now.

I am looking at the error and it should not happen as the ID-s have been in linux-next for a month now:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/include/dt-bindings/arm/qcom,ids.h?h=next-20231016&id=b8c889bef9797a58b8b5aad23875cc4d04b3efd3

Quoted 7 lines
Quoted 2 lines

They are also part of Bjorns 6.7 driver PR:
https://lore.kernel.org/all/[email protected]/T/

But Bjorn's tree isn't a part of the cpufreq tree. In such cases it is typical to ask first maintainer to create an immutable branch / tag, which can later be also merged into another tree without going into troubles of merging the whole tree of the irrelevant subsystem.

Ok, I understand now, the thing is that the ID-s were added for socinfo initially but recently
I finally had somebody with access to the Oak HW so I added them to cpufreq as well.

What can I do to help this get resolved?

Regards,
Robert

Quoted 5 lines

--
With best wishes
Dmitry

maintainer
#7 lore raw
Quoted 6 lines · Robert Marko

Ok, I understand now, the thing is that the ID-s were added for socinfo initially but recently
I finally had somebody with access to the Oak HW so I added them to cpufreq as well.

What can I do to help this get resolved?

Rebased over Bjorn's commit (which he already sent in his Arm SoC pull request) and applied your patch again.

Signature · 1 line
viresh
#8 lore raw
Quoted 11 lines · Viresh Kumar
Quoted 6 lines · Robert Marko

Ok, I understand now, the thing is that the ID-s were added for socinfo initially but recently
I finally had somebody with access to the Oak HW so I added them to cpufreq as well.

What can I do to help this get resolved?

Rebased over Bjorn's commit (which he already sent in his Arm SoC pull request) and applied your patch again.

Thank you for your understanding, I will watch out for possible cases like these in the future.

Regards,
Robert

Quoted 3 lines

--
viresh