* [PATCH v4 0/1] cpufreq: qcom: handle ipq806x with no SMEM @ 2025-11-05 11:21 Christian Marangi 2025-11-05 11:21 ` [PATCH v4 1/1] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for " Christian Marangi 0 siblings, 1 reply; 5+ messages in thread From: Christian Marangi @ 2025-11-05 11:21 UTC (permalink / raw) To: Ilia Lin, Rafael J. Wysocki, Viresh Kumar, linux-arm-msm, linux-pm, linux-kernel Cc: Christian Marangi This small series handle a small device family of ipq806x devices (Google OnHub) that doesn't have SMEM init. We improve the SMEM driver and apply a workaround in the cpufreq driver. (I didn't add the review tag as the patch changed with the new implementation) Changes v4: - Add extra info of socinfo not usable - Add Review tag - Fix compilation warning for -Wpointer-to-int-cast Changes v3: - Drop first 2 patch as they got merged - Use of_match_node Changes v2: - Rename error macro to INIT_ERR_PTR - Return -ENODEV from smem probe - Restructure if condition in cpufreq driver Christian Marangi (1): cpufreq: qcom-nvmem: add compatible fallback for ipq806x for no SMEM drivers/cpufreq/qcom-cpufreq-nvmem.c | 35 ++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) -- 2.51.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4 1/1] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for no SMEM 2025-11-05 11:21 [PATCH v4 0/1] cpufreq: qcom: handle ipq806x with no SMEM Christian Marangi @ 2025-11-05 11:21 ` Christian Marangi 2025-11-10 10:47 ` Viresh Kumar 2025-11-18 19:10 ` Rob Herring 0 siblings, 2 replies; 5+ messages in thread From: Christian Marangi @ 2025-11-05 11:21 UTC (permalink / raw) To: Ilia Lin, Rafael J. Wysocki, Viresh Kumar, linux-arm-msm, linux-pm, linux-kernel Cc: Christian Marangi, Dmitry Baryshkov, Konrad Dybcio On some IPQ806x SoC SMEM might be not initialized by SBL. This is the case for some Google devices (the OnHub family) that can't make use of SMEM to detect the SoC ID (and socinfo can't be used either as it does depends on SMEM presence). To handle these specific case, check if the SMEM is not initialized (by checking if the qcom_smem_get_soc_id returns -ENODEV) and fallback to OF machine compatible checking to identify the SoC variant. Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> --- drivers/cpufreq/qcom-cpufreq-nvmem.c | 35 ++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c index 3a8ed723a23e..be44a8965e3a 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -252,13 +252,22 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev, return ret; } +static const struct of_device_id qcom_cpufreq_ipq806x_match_list[] = { + { .compatible = "qcom,ipq8062", .data = (const void *)QCOM_ID_IPQ8062 }, + { .compatible = "qcom,ipq8064", .data = (const void *)QCOM_ID_IPQ8064 }, + { .compatible = "qcom,ipq8065", .data = (const void *)QCOM_ID_IPQ8065 }, + { .compatible = "qcom,ipq8066", .data = (const void *)QCOM_ID_IPQ8066 }, + { .compatible = "qcom,ipq8068", .data = (const void *)QCOM_ID_IPQ8068 }, + { .compatible = "qcom,ipq8069", .data = (const void *)QCOM_ID_IPQ8069 }, +}; + static int qcom_cpufreq_ipq8064_name_version(struct device *cpu_dev, struct nvmem_cell *speedbin_nvmem, char **pvs_name, struct qcom_cpufreq_drv *drv) { + int msm_id = -1, ret = 0; int speed = 0, pvs = 0; - int msm_id, ret = 0; u8 *speedbin; size_t len; @@ -275,8 +284,30 @@ static int qcom_cpufreq_ipq8064_name_version(struct device *cpu_dev, get_krait_bin_format_a(cpu_dev, &speed, &pvs, speedbin); ret = qcom_smem_get_soc_id(&msm_id); - if (ret) + if (ret == -ENODEV) { + const struct of_device_id *match; + struct device_node *root; + + root = of_find_node_by_path("/"); + if (!root) { + ret = -ENODEV; + goto exit; + } + + /* Fallback to compatible match with no SMEM initialized */ + match = of_match_node(qcom_cpufreq_ipq806x_match_list, root); + of_node_put(root); + if (!match) { + ret = -ENODEV; + goto exit; + } + + /* We found a matching device, get the msm_id from the data entry */ + msm_id = (int)(uintptr_t)match->data; + ret = 0; + } else if (ret) { goto exit; + } switch (msm_id) { case QCOM_ID_IPQ8062: -- 2.51.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/1] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for no SMEM 2025-11-05 11:21 ` [PATCH v4 1/1] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for " Christian Marangi @ 2025-11-10 10:47 ` Viresh Kumar 2025-11-18 19:10 ` Rob Herring 1 sibling, 0 replies; 5+ messages in thread From: Viresh Kumar @ 2025-11-10 10:47 UTC (permalink / raw) To: Christian Marangi Cc: Ilia Lin, Rafael J. Wysocki, linux-arm-msm, linux-pm, linux-kernel, Dmitry Baryshkov, Konrad Dybcio On 05-11-25, 12:21, Christian Marangi wrote: > On some IPQ806x SoC SMEM might be not initialized by SBL. This is the > case for some Google devices (the OnHub family) that can't make use of > SMEM to detect the SoC ID (and socinfo can't be used either as it does > depends on SMEM presence). > > To handle these specific case, check if the SMEM is not initialized (by > checking if the qcom_smem_get_soc_id returns -ENODEV) and fallback to > OF machine compatible checking to identify the SoC variant. > > Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> > Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > --- > drivers/cpufreq/qcom-cpufreq-nvmem.c | 35 ++++++++++++++++++++++++++-- > 1 file changed, 33 insertions(+), 2 deletions(-) Applied. Thanks. -- viresh ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/1] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for no SMEM 2025-11-05 11:21 ` [PATCH v4 1/1] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for " Christian Marangi 2025-11-10 10:47 ` Viresh Kumar @ 2025-11-18 19:10 ` Rob Herring 2025-11-18 21:45 ` Christian Marangi 1 sibling, 1 reply; 5+ messages in thread From: Rob Herring @ 2025-11-18 19:10 UTC (permalink / raw) To: Christian Marangi Cc: Ilia Lin, Rafael J. Wysocki, Viresh Kumar, linux-arm-msm, linux-pm, linux-kernel, Dmitry Baryshkov, Konrad Dybcio On Wed, Nov 05, 2025 at 12:21:34PM +0100, Christian Marangi wrote: > On some IPQ806x SoC SMEM might be not initialized by SBL. This is the > case for some Google devices (the OnHub family) that can't make use of > SMEM to detect the SoC ID (and socinfo can't be used either as it does > depends on SMEM presence). > > To handle these specific case, check if the SMEM is not initialized (by > checking if the qcom_smem_get_soc_id returns -ENODEV) and fallback to > OF machine compatible checking to identify the SoC variant. > > Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> > Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > --- > drivers/cpufreq/qcom-cpufreq-nvmem.c | 35 ++++++++++++++++++++++++++-- > 1 file changed, 33 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c > index 3a8ed723a23e..be44a8965e3a 100644 > --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c > +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c > @@ -252,13 +252,22 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev, > return ret; > } > > +static const struct of_device_id qcom_cpufreq_ipq806x_match_list[] = { > + { .compatible = "qcom,ipq8062", .data = (const void *)QCOM_ID_IPQ8062 }, > + { .compatible = "qcom,ipq8064", .data = (const void *)QCOM_ID_IPQ8064 }, > + { .compatible = "qcom,ipq8065", .data = (const void *)QCOM_ID_IPQ8065 }, > + { .compatible = "qcom,ipq8066", .data = (const void *)QCOM_ID_IPQ8066 }, > + { .compatible = "qcom,ipq8068", .data = (const void *)QCOM_ID_IPQ8068 }, > + { .compatible = "qcom,ipq8069", .data = (const void *)QCOM_ID_IPQ8069 }, These are all undocumented: qcom,ipq8062 qcom,ipq8066 qcom,ipq8068 qcom,ipq8069 Rob ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 1/1] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for no SMEM 2025-11-18 19:10 ` Rob Herring @ 2025-11-18 21:45 ` Christian Marangi 0 siblings, 0 replies; 5+ messages in thread From: Christian Marangi @ 2025-11-18 21:45 UTC (permalink / raw) To: Rob Herring Cc: Ilia Lin, Rafael J. Wysocki, Viresh Kumar, linux-arm-msm, linux-pm, linux-kernel, Dmitry Baryshkov, Konrad Dybcio On Tue, Nov 18, 2025 at 01:10:18PM -0600, Rob Herring wrote: > On Wed, Nov 05, 2025 at 12:21:34PM +0100, Christian Marangi wrote: > > On some IPQ806x SoC SMEM might be not initialized by SBL. This is the > > case for some Google devices (the OnHub family) that can't make use of > > SMEM to detect the SoC ID (and socinfo can't be used either as it does > > depends on SMEM presence). > > > > To handle these specific case, check if the SMEM is not initialized (by > > checking if the qcom_smem_get_soc_id returns -ENODEV) and fallback to > > OF machine compatible checking to identify the SoC variant. > > > > Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> > > Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> > > --- > > drivers/cpufreq/qcom-cpufreq-nvmem.c | 35 ++++++++++++++++++++++++++-- > > 1 file changed, 33 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c > > index 3a8ed723a23e..be44a8965e3a 100644 > > --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c > > +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c > > @@ -252,13 +252,22 @@ static int qcom_cpufreq_krait_name_version(struct device *cpu_dev, > > return ret; > > } > > > > +static const struct of_device_id qcom_cpufreq_ipq806x_match_list[] = { > > + { .compatible = "qcom,ipq8062", .data = (const void *)QCOM_ID_IPQ8062 }, > > + { .compatible = "qcom,ipq8064", .data = (const void *)QCOM_ID_IPQ8064 }, > > + { .compatible = "qcom,ipq8065", .data = (const void *)QCOM_ID_IPQ8065 }, > > + { .compatible = "qcom,ipq8066", .data = (const void *)QCOM_ID_IPQ8066 }, > > + { .compatible = "qcom,ipq8068", .data = (const void *)QCOM_ID_IPQ8068 }, > > + { .compatible = "qcom,ipq8069", .data = (const void *)QCOM_ID_IPQ8069 }, > > These are all undocumented: > > qcom,ipq8062 > qcom,ipq8066 > qcom,ipq8068 > qcom,ipq8069 > Hi Rob, you are right, I never add these as there weren't any dts for it. I will send a Documentation patch ASAP. -- Ansuel ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-18 21:46 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-11-05 11:21 [PATCH v4 0/1] cpufreq: qcom: handle ipq806x with no SMEM Christian Marangi 2025-11-05 11:21 ` [PATCH v4 1/1] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for " Christian Marangi 2025-11-10 10:47 ` Viresh Kumar 2025-11-18 19:10 ` Rob Herring 2025-11-18 21:45 ` Christian Marangi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox