From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
Christian Marangi <ansuelsmth@gmail.com>,
Ilia Lin <ilia.lin@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Subject: Re: [PATCH v3 1/1] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for no SMEM
Date: Wed, 5 Nov 2025 10:12:08 +0100 [thread overview]
Message-ID: <cb1ced66-8190-4462-99cf-72ec51da6536@oss.qualcomm.com> (raw)
In-Reply-To: <d3f2810f-7361-4a23-adb3-32a73ad50519@kernel.org>
On 11/5/25 9:05 AM, Krzysztof Kozlowski wrote:
> On 04/11/2025 15:06, 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.
>>
>> 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>
>> 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..17c79955ff2f 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);
>
> Aren't you re-implementing matching machine? Or actually - the socinfo
> driver? You are doing the matching of compatible into SOC ID second
> time. Just do it once - via socinfo driver.
The issue here is that if SMEM is absent, the socinfo driver can
not function and this is a contained workaround
Konrad
next prev parent reply other threads:[~2025-11-05 9:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 14:06 [PATCH v3 0/1] cpufreq: qcom: handle ipq806x with no SMEM Christian Marangi
2025-11-04 14:06 ` [PATCH v3 1/1] cpufreq: qcom-nvmem: add compatible fallback for ipq806x for " Christian Marangi
2025-11-04 14:15 ` Konrad Dybcio
2025-11-05 8:05 ` Krzysztof Kozlowski
2025-11-05 9:12 ` Konrad Dybcio [this message]
2025-11-05 9:28 ` Krzysztof Kozlowski
2025-11-05 10:27 ` kernel test robot
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=cb1ced66-8190-4462-99cf-72ec51da6536@oss.qualcomm.com \
--to=konrad.dybcio@oss.qualcomm.com \
--cc=ansuelsmth@gmail.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=ilia.lin@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--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