Enable ipq5210 in cpufreq/qcom-nvmem driver
Subsystems (4)
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]>
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
@@ -27,6 +27,7 @@ select: enum: - qcom,apq8064 - qcom,apq8096 + - qcom,ipq5210 - qcom,ipq5332 - qcom,ipq6018 - qcom,ipq8064
Signature · 1 line
2.34.1
Re: [PATCH 1/2] dt-bindings: cpufreq: qcom-cpufreq-nvmem: document IPQ5210
Quoted 6 lines · Varadarajan Narayanan
Document IPQ5210 compatible for Qcom NVMEM CPUFreq driver.
Signed-off-by Varadarajan Narayanan <[email protected]>--- Documentation/devicetree/bindings/cpufreq/qcom-cpufreq-nvmem.yaml | 1 + 1 file changed, 1 insertion(+)
Best regards,
Krzysztof
PATCH 2/2 cpufreq: qcom-nvmem: Add IPQ5210 support
In reply to Varadarajan NarayananIPQ5210 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
@@ -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
@@ -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
[email protected]
AI reviewRe: [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
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
Re: [PATCH 2/2] cpufreq: qcom-nvmem: Add IPQ5210 support
In reply to Varadarajan NarayananQuoted 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.
Signed-off-by Varadarajan Narayanan <[email protected]>--- 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@@ -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
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
Viresh Kumar
maintainerRe: [PATCH 2/2] cpufreq: qcom-nvmem: Add IPQ5210 support
Quoted 5 lines · Konrad Dybcio
nit: checking for == is easier to read
anyway
Reviewed-by Konrad Dybcio <[email protected]>
Applied 2/2 with this:
drivers/cpufreq/qcom-cpufreq-nvmem.c +1 -1
@@ -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