From: Christian Marangi <ansuelsmth@gmail.com>
To: Ilia Lin <ilia.lin@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Christian Marangi <ansuelsmth@gmail.com>,
Raag Jadav <raag.jadav@intel.com>, Arnd Bergmann <arnd@arndb.de>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for no SMEM
Date: Wed, 29 Oct 2025 14:33:21 +0100 [thread overview]
Message-ID: <20251029133323.24565-3-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20251029133323.24565-1-ansuelsmth@gmail.com>
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.
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.
Notice that the checking order is important as the machine compatible
are normally defined with the specific one following the generic SoC.
(for example compatible = "qcom,ipq8065", "qcom,ipq8064")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/cpufreq/qcom-cpufreq-nvmem.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index 3a8ed723a23e..c88a79a177b1 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -257,8 +257,8 @@ static int qcom_cpufreq_ipq8064_name_version(struct device *cpu_dev,
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 +275,21 @@ 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)
- goto exit;
+ if (ret) {
+ if (ret != -ENODEV)
+ goto exit;
+
+ /* Fallback to compatible match with no SMEM initialized */
+ if (of_machine_is_compatible("qcom,ipq8062"))
+ msm_id = QCOM_ID_IPQ8062;
+ else if (of_machine_is_compatible("qcom,ipq8065") ||
+ of_machine_is_compatible("qcom,ipq8069"))
+ msm_id = QCOM_ID_IPQ8065;
+ else if (of_machine_is_compatible("qcom,ipq8064") ||
+ of_machine_is_compatible("qcom,ipq8066") ||
+ of_machine_is_compatible("qcom,ipq8068"))
+ msm_id = QCOM_ID_IPQ8064;
+ }
switch (msm_id) {
case QCOM_ID_IPQ8062:
--
2.51.0
next prev parent reply other threads:[~2025-10-29 13:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 13:33 [PATCH 1/3] err.h: add ERR_PTR_CONST macro Christian Marangi
2025-10-29 13:33 ` [PATCH 2/3] soc: qcom: smem: better track SMEM uninitialized state Christian Marangi
2025-10-29 15:27 ` Andy Shevchenko
2025-10-29 15:32 ` Christian Marangi
2025-10-29 16:11 ` Bjorn Andersson
2025-10-29 13:33 ` Christian Marangi [this message]
2025-10-29 15:30 ` [PATCH 3/3] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for no SMEM Andy Shevchenko
2025-10-30 8:56 ` Konrad Dybcio
2025-10-30 10:28 ` Christian Marangi
2025-10-30 10:54 ` Konrad Dybcio
2025-10-30 11:11 ` Christian Marangi
2025-10-30 11:16 ` Konrad Dybcio
2025-10-29 15:32 ` [PATCH 1/3] err.h: add ERR_PTR_CONST macro Andy Shevchenko
2025-10-29 15:38 ` Christian Marangi
2025-10-30 8:27 ` Andy Shevchenko
2025-10-30 8:37 ` Andy Shevchenko
2025-10-30 10:22 ` Christian Marangi
2025-10-30 14:00 ` Andy Shevchenko
2025-10-30 14:15 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251029133323.24565-3-ansuelsmth@gmail.com \
--to=ansuelsmth@gmail.com \
--cc=andersson@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=ilia.lin@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=raag.jadav@intel.com \
--cc=rafael@kernel.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).