Skip to contentSkip to conversation

Enable ipq5210 in cpufreq/qcom-nvmem driver

PATCH In review Varadarajan Narayanan 5 participants 7 messages Jul 1 – Jul 3

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

cover Enable ipq5210 in cpufreq/qcom-nvmem driver

Document IPQ5210 compatible for Qcom nvmem cpufreq driver. Add speed bin identification and match data for ipq5210.

---
Varadarajan Narayanan (2):
dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ5210
cpufreq: qcom-nvmem: Add IPQ5210 support

 Documentation/devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml | 1 +
 drivers/cpufreq/cpufreq-dt-platdev.c                              | 1 +
 drivers/cpufreq/qcom-cpufreq-nvmem.c                              | 8 ++++++++
 3 files changed, 10 insertions(+)

---
base-commit: 533704f3c28c3f5f9e2542aa3a6a326c32e6f5c0
change-id: 20260625-cpufreq-4e017fc09de5

Best regards,

Signature · 1 line
Varadarajan Narayanan <[email protected]>
#1 lore raw

PATCH 1/2 dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ5210

Document IPQ5210 compatible for Qcom NVMEM CPUFreq driver.

---
 Documentation/devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml +1 -0
index 547265b8b118..2f5dbb59034c 100644
@@ -27,6 +27,7 @@ select:
         enum:
           - qcom,apq8064
           - qcom,apq8096
+          - qcom,ipq5210
           - qcom,ipq5332
           - qcom,ipq6018
           - qcom,ipq8064
Signature · 1 line
2.34.1
#3 lore raw

PATCH 2/2 cpufreq: qcom-nvmem: Add IPQ5210 support

In reply to Varadarajan Narayanan

IPQ5210 SoCs expose CPU frequency limits through an eFuse speed bin, and the valid CPU OPPs depend on the SoC variant.

Add IPQ5210 support to the Qualcomm NVMEM cpufreq driver so the supported OPPs can be selected at runtime using the eFuse value and the opp- supported-hw OPP property. Also block the generic cpufreq-dt platform device for IPQ5210 so the NVMEM-based driver is used.

---
 drivers/cpufreq/cpufreq-dt-platdev.c | 1 +
 drivers/cpufreq/qcom-cpufreq-nvmem.c | 8 ++++++++
 2 files changed, 9 insertions(+)
drivers/cpufreq/cpufreq-dt-platdev.c +1 -0
index ff1204c666b1..284eece9e230 100644
@@ -200,6 +200,7 @@ static const struct of_device_id blocklist[] __initconst = {
 	{ .compatible = "ti,am62l3", },
 	{ .compatible = "ti,am62p5", },
 
+	{ .compatible = "qcom,ipq5210", },
 	{ .compatible = "qcom,ipq5332", },
 	{ .compatible = "qcom,ipq5424", },
 	{ .compatible = "qcom,ipq6018", },
drivers/cpufreq/qcom-cpufreq-nvmem.c +8 -0
index e6d28d162442..b2aeda7c564a 100644
@@ -200,6 +200,13 @@ static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
 	case QCOM_ID_IPQ9574:
 		drv->versions = 1 << (unsigned int)(*speedbin);
 		break;
+	case QCOM_ID_IPQ5200:
+	case QCOM_ID_IPQ5210:
+	case QCOM_ID_QCF2200:
+	case QCOM_ID_QCF3200:
+	case QCOM_ID_QCF3210:
+		drv->versions = (*speedbin != 0xcd) ? BIT(0) : BIT(1);
+		break;
 	case QCOM_ID_IPQ5424:
 	case QCOM_ID_IPQ5404:
 		drv->versions = (*speedbin == 0x3b) ? BIT(1) : BIT(0);
@@ -618,6 +625,7 @@ static const struct of_device_id qcom_cpufreq_match_list[] __initconst __maybe_u
 	{ .compatible = "qcom,msm8909", .data = &match_data_msm8909 },
 	{ .compatible = "qcom,msm8996", .data = &match_data_kryo },
 	{ .compatible = "qcom,qcs404", .data = &match_data_qcs404 },
+	{ .compatible = "qcom,ipq5210", .data = &match_data_kryo },
 	{ .compatible = "qcom,ipq5332", .data = &match_data_kryo },
 	{ .compatible = "qcom,ipq5424", .data = &match_data_kryo },
 	{ .compatible = "qcom,ipq6018", .data = &match_data_ipq6018 },
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH 2/2] cpufreq: qcom-nvmem: Add IPQ5210 support

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the function qcom_cpufreq_kryo_name_version() triggers a kernel BUG() panic when the SMEM SoC ID is not recognized, rather than gracefully failing. --

commit efa443e3ef471a943647c359a1a0b9da9950bda0
Author: Varadarajan Narayanan <[email protected]>

cpufreq: qcom-nvmem: Add IPQ5210 support

IPQ5210 SoCs expose CPU frequency limits through an eFuse speed bin, and the valid CPU OPPs depend on the SoC variant. This patch adds IPQ5210 support to the Qualcomm NVMEM cpufreq driver and blocks the generic cpufreq-dt platform device.

[ ... ]

Quoted 5 lines
drivers/cpufreq/qcom-cpufreq-nvmem.c +0 -0
index e6d28d162442a..b2aeda7c564a9 100644

drivers/cpufreq/qcom-cpufreq-nvmem.c static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev, · line 209

Quoted 10 lines
drivers/cpufreq/qcom-cpufreq-nvmem.c +7 -0
@@ -200,6 +200,13 @@ static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
 	case QCOM_ID_IPQ9574:
 		drv->versions = 1 << (unsigned int)(*speedbin);
 		break;
+	case QCOM_ID_IPQ5200:
+	case QCOM_ID_IPQ5210:
+	case QCOM_ID_QCF2200:
+	case QCOM_ID_QCF3200:
+	case QCOM_ID_QCF3210:
+		drv->versions = (*speedbin != 0xcd) ? BIT(0) : BIT(1);
+		break;

[Severity: High]
This is a pre-existing issue, but should the default case for this switch statement continue to use BUG() when an unhandled msm_id is encountered?

If a device tree successfully matches the driver, but the SMEM SoC ID returned by qcom_smem_get_soc_id() is unexpected (such as from a mismatched device tree, firmware issue, or prototype hardware), qcom_cpufreq_kryo_name_version() will hit the default case:

        default:
                BUG();
                break;

Would it be safer to return an error code like -ENODEV here instead of triggering an immediate kernel panic during device probe?

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] cpufreq: qcom-nvmem: Add IPQ5210 support

In reply to Varadarajan Narayanan
Quoted 31 lines · Varadarajan Narayanan

IPQ5210 SoCs expose CPU frequency limits through an eFuse speed bin, and the valid CPU OPPs depend on the SoC variant.

Add IPQ5210 support to the Qualcomm NVMEM cpufreq driver so the supported OPPs can be selected at runtime using the eFuse value and the opp- supported-hw OPP property. Also block the generic cpufreq-dt platform device for IPQ5210 so the NVMEM-based driver is used.

---
 drivers/cpufreq/cpufreq-dt-platdev.c | 1 +
 drivers/cpufreq/qcom-cpufreq-nvmem.c | 8 ++++++++
 2 files changed, 9 insertions(+)
drivers/cpufreq/cpufreq-dt-platdev.c +1 -0
index ff1204c666b1..284eece9e230 100644
@@ -200,6 +200,7 @@ static const struct of_device_id blocklist[] __initconst = {
 	{ .compatible = "ti,am62l3", },
 	{ .compatible = "ti,am62p5", },
 
+	{ .compatible = "qcom,ipq5210", },
 	{ .compatible = "qcom,ipq5332", },
 	{ .compatible = "qcom,ipq5424", },
 	{ .compatible = "qcom,ipq6018", },
drivers/cpufreq/qcom-cpufreq-nvmem.c +0 -0
index e6d28d162442..b2aeda7c564a 100644

drivers/cpufreq/qcom-cpufreq-nvmem.c static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev, · line 208

Quoted 9 lines
drivers/cpufreq/qcom-cpufreq-nvmem.c +6 -0
@@ -200,6 +200,13 @@ static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
 	case QCOM_ID_IPQ9574:
 		drv->versions = 1 << (unsigned int)(*speedbin);
 		break;
+	case QCOM_ID_IPQ5200:
+	case QCOM_ID_IPQ5210:
+	case QCOM_ID_QCF2200:
+	case QCOM_ID_QCF3200:
+	case QCOM_ID_QCF3210:
+		drv->versions = (*speedbin != 0xcd) ? BIT(0) : BIT(1);

nit: checking for == is easier to read

anyway

Konrad

maintainer
#6 lore raw

Re: [PATCH 2/2] cpufreq: qcom-nvmem: Add IPQ5210 support

Quoted 5 lines · Konrad Dybcio

nit: checking for == is easier to read

anyway

Applied 2/2 with this:

drivers/cpufreq/qcom-cpufreq-nvmem.c +1 -1
index b2aeda7c564a..efa766e98d86 100644
@@ -205,7 +205,7 @@ static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
        case QCOM_ID_QCF2200:
        case QCOM_ID_QCF3200:
        case QCOM_ID_QCF3210:
-               drv->versions = (*speedbin != 0xcd) ? BIT(0) : BIT(1);
+               drv->versions = (*speedbin == 0xcd) ? BIT(1) : BIT(0);
                break;
        case QCOM_ID_IPQ5424:
        case QCOM_ID_IPQ5404:
Signature · 1 line
viresh