From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Yassine Oudjana <y.oudjana@protonmail.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Ilia Lin <ilia.lin@kernel.org>, Viresh Kumar <vireshk@kernel.org>,
Nishanth Menon <nm@ti.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Loic Poulain <loic.poulain@linaro.org>
Cc: Konrad Dybcio <konrad.dybcio@somainline.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@somainline.org>,
linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht,
phone-devel@vger.kernel.org
Subject: Re: [PATCH 4/8] cpufreq: qcom_cpufreq_nvmem: Simplify reading kryo speedbin
Date: Thu, 14 Oct 2021 15:25:07 +0300 [thread overview]
Message-ID: <7e8b5d31-0232-7aee-ceed-ec453b447638@linaro.org> (raw)
In-Reply-To: <20211014083016.137441-5-y.oudjana@protonmail.com>
On 14/10/2021 11:32, Yassine Oudjana wrote:
> In preparation for adding a separate device tree for MSM8996 Pro, skip reading
> msm-id from smem and just read the speedbin efuse.
It would be nice to comment, why is it possible/necessary. For example:
MSM8996 Pro has completely different set of frequencies, so it makes no
sense to have a single table covering Pro and original SoCs.
msm8996pro.dtsi would override frequency table from msm8996.dtsi.
>
> Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
> ---
> drivers/cpufreq/Kconfig.arm | 1 -
> drivers/cpufreq/qcom-cpufreq-nvmem.c | 75 +++-------------------------
> 2 files changed, 6 insertions(+), 70 deletions(-)
>
> diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
> index 954749afb5fe..7d9798bc5753 100644
> --- a/drivers/cpufreq/Kconfig.arm
> +++ b/drivers/cpufreq/Kconfig.arm
> @@ -154,7 +154,6 @@ config ARM_QCOM_CPUFREQ_NVMEM
> tristate "Qualcomm nvmem based CPUFreq"
> depends on ARCH_QCOM
> depends on QCOM_QFPROM
> - depends on QCOM_SMEM
> select PM_OPP
> help
> This adds the CPUFreq driver for Qualcomm Kryo SoC based boards.
> diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> index d1744b5d9619..909f7d97b334 100644
> --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
> +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> @@ -9,8 +9,8 @@
> * based on the silicon variant in use. Qualcomm Process Voltage Scaling Tables
> * defines the voltage and frequency value based on the msm-id in SMEM
> * and speedbin blown in the efuse combination.
> - * The qcom-cpufreq-nvmem driver reads the msm-id and efuse value from the SoC
> - * to provide the OPP framework with required information.
> + * The qcom-cpufreq-nvmem driver reads efuse value from the SoC to provide the
> + * OPP framework with required information.
> * This is used to determine the voltage and frequency value for each OPP of
> * operating-points-v2 table when it is parsed by the OPP framework.
> */
> @@ -27,22 +27,6 @@
> #include <linux/pm_domain.h>
> #include <linux/pm_opp.h>
> #include <linux/slab.h>
> -#include <linux/soc/qcom/smem.h>
> -
> -#define MSM_ID_SMEM 137
> -
> -enum _msm_id {
> - MSM8996V3 = 0xF6ul,
> - APQ8096V3 = 0x123ul,
> - MSM8996SG = 0x131ul,
> - APQ8096SG = 0x138ul,
> -};
> -
> -enum _msm8996_version {
> - MSM8996_V3,
> - MSM8996_SG,
> - NUM_OF_MSM8996_VERSIONS,
> -};
>
> struct qcom_cpufreq_drv;
>
> @@ -142,35 +126,6 @@ static void get_krait_bin_format_b(struct device *cpu_dev,
> dev_dbg(cpu_dev, "PVS version: %d\n", *pvs_ver);
> }
>
> -static enum _msm8996_version qcom_cpufreq_get_msm_id(void)
> -{
> - size_t len;
> - u32 *msm_id;
> - enum _msm8996_version version;
> -
> - msm_id = qcom_smem_get(QCOM_SMEM_HOST_ANY, MSM_ID_SMEM, &len);
> - if (IS_ERR(msm_id))
> - return NUM_OF_MSM8996_VERSIONS;
> -
> - /* The first 4 bytes are format, next to them is the actual msm-id */
> - msm_id++;
> -
> - switch ((enum _msm_id)*msm_id) {
> - case MSM8996V3:
> - case APQ8096V3:
> - version = MSM8996_V3;
> - break;
> - case MSM8996SG:
> - case APQ8096SG:
> - version = MSM8996_SG;
> - break;
> - default:
> - version = NUM_OF_MSM8996_VERSIONS;
> - }
> -
> - return version;
> -}
> -
> static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
> struct nvmem_cell *speedbin_nvmem,
> char **pvs_name,
> @@ -178,30 +133,13 @@ static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
> {
> size_t len;
> u8 *speedbin;
> - enum _msm8996_version msm8996_version;
> *pvs_name = NULL;
>
> - msm8996_version = qcom_cpufreq_get_msm_id();
> - if (NUM_OF_MSM8996_VERSIONS == msm8996_version) {
> - dev_err(cpu_dev, "Not Snapdragon 820/821!");
> - return -ENODEV;
> - }
> -
> speedbin = nvmem_cell_read(speedbin_nvmem, &len);
> if (IS_ERR(speedbin))
> return PTR_ERR(speedbin);
>
> - switch (msm8996_version) {
> - case MSM8996_V3:
> - drv->versions = 1 << (unsigned int)(*speedbin);
> - break;
> - case MSM8996_SG:
> - drv->versions = 1 << ((unsigned int)(*speedbin) + 4);
> - break;
> - default:
> - BUG();
> - break;
> - }
> + drv->versions = 1 << (unsigned int)(*speedbin);
>
> kfree(speedbin);
> return 0;
> @@ -464,10 +402,9 @@ static const struct of_device_id qcom_cpufreq_match_list[] __initconst = {
> MODULE_DEVICE_TABLE(of, qcom_cpufreq_match_list);
>
> /*
> - * Since the driver depends on smem and nvmem drivers, which may
> - * return EPROBE_DEFER, all the real activity is done in the probe,
> - * which may be defered as well. The init here is only registering
> - * the driver and the platform device.
> + * Since the driver depends on the nvmem driver, which may return EPROBE_DEFER,
> + * all the real activity is done in the probe, which may be defered as well.
> + * The init here is only registering the driver and the platform device.
> */
> static int __init qcom_cpufreq_init(void)
> {
>
--
With best wishes
Dmitry
next prev parent reply other threads:[~2021-10-14 12:25 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-14 8:30 [PATCH 0/8] Add support for MSM8996 Pro Yassine Oudjana
2021-10-14 8:31 ` [PATCH 1/8] dt-bindings: clk: qcom: msm8996-apcc: Add CBF Yassine Oudjana
2021-10-14 14:31 ` Rob Herring
2021-10-16 15:16 ` Yassine Oudjana
2021-10-26 21:08 ` Rob Herring
2021-10-14 8:32 ` [PATCH 2/8] dt-bindings: clk: qcom: msm8996-apcc: Add MSM8996 Pro compatible Yassine Oudjana
2021-10-14 14:31 ` Rob Herring
2021-10-16 15:22 ` Yassine Oudjana
2021-10-26 21:08 ` Rob Herring
2021-10-14 8:32 ` [PATCH 3/8] clk: qcom: msm8996-cpu: Add MSM8996 Pro CBF support Yassine Oudjana
2021-10-15 18:54 ` Konrad Dybcio
2021-10-24 17:30 ` Bjorn Andersson
2021-10-14 8:32 ` [PATCH 4/8] cpufreq: qcom_cpufreq_nvmem: Simplify reading kryo speedbin Yassine Oudjana
2021-10-14 12:25 ` Dmitry Baryshkov [this message]
2021-10-15 18:58 ` Konrad Dybcio
2021-10-28 18:18 ` Bjorn Andersson
2021-10-14 8:32 ` [PATCH 5/8] dt-bindings: opp: Convert qcom-nvmem-cpufreq to DT schema Yassine Oudjana
2021-10-14 14:31 ` Rob Herring
2021-10-14 15:45 ` Rob Herring
2021-11-04 11:32 ` Yassine Oudjana
2021-10-14 8:32 ` [PATCH 6/8] dt-bindings: opp: qcom-cpufreq-nvmem: Remove SMEM Yassine Oudjana
2021-10-14 8:32 ` [PATCH 7/8] arm64: dts: qcom: msm8996: Add MSM8996 Pro support Yassine Oudjana
2021-10-15 19:01 ` Konrad Dybcio
2021-10-16 14:50 ` Yassine Oudjana
2021-10-16 15:09 ` Dmitry Baryshkov
2021-10-14 11:00 ` [PATCH 8/8] arm64: dts: qcom: msm8996-xiaomi-scorpio: Include msm8996pro.dtsi Yassine Oudjana
2021-10-15 19:03 ` Konrad Dybcio
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=7e8b5d31-0232-7aee-ceed-ec453b447638@linaro.org \
--to=dmitry.baryshkov@linaro.org \
--cc=agross@kernel.org \
--cc=angelogioacchino.delregno@somainline.org \
--cc=bjorn.andersson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=ilia.lin@kernel.org \
--cc=konrad.dybcio@somainline.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=mturquette@baylibre.com \
--cc=nm@ti.com \
--cc=phone-devel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=vireshk@kernel.org \
--cc=y.oudjana@protonmail.com \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/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).