From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
Stephen Boyd <sboyd@kernel.org>, Niklas Cassel <nks@flawful.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>
Cc: Robert Marko <robimarko@gmail.com>,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@somainline.org>
Subject: Re: [PATCH v10 4/6] soc: qcom: cpr: Move common functions to new file
Date: Sat, 3 Jun 2023 10:49:22 +0200 [thread overview]
Message-ID: <dc78e4b3-975b-6fc8-3906-8fa935bde625@linaro.org> (raw)
In-Reply-To: <94c18cc3-4b1a-440b-3bd8-3c81ddffc148@linaro.org>
On 27.02.2023 04:09, Dmitry Baryshkov wrote:
> On 17/02/2023 13:08, Konrad Dybcio wrote:
>> From: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
>>
>> In preparation for implementing a new driver that will be handling
>> CPRv3, CPRv4 and CPR-Hardened, format out common functions to a new
>> file.
>>
>> Update cpr_get_fuses in preparation for CPR3 implementation, change
>> parameters where necessary to not take cpr.c private data structures.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
>> [Konrad: rebase, apply review comments, don't break backwards compat, improve msg]
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>> ---
>> drivers/soc/qcom/Makefile | 2 +-
>> drivers/soc/qcom/cpr-common.c | 363 +++++++++++++++++++++++++++++++++++++++
>> drivers/soc/qcom/cpr-common.h | 108 ++++++++++++
>> drivers/soc/qcom/cpr.c | 386 +++---------------------------------------
>> 4 files changed, 494 insertions(+), 365 deletions(-)
>>
>
> [skipped]
>
>> diff --git a/drivers/soc/qcom/cpr-common.h b/drivers/soc/qcom/cpr-common.h
>> new file mode 100644
>> index 000000000000..2cd15f7eac90
>> --- /dev/null
>> +++ b/drivers/soc/qcom/cpr-common.h
>> @@ -0,0 +1,108 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +
>> +#include <linux/clk.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/pm_opp.h>
>> +#include <linux/regulator/consumer.h>
>> +
>> +enum voltage_change_dir {
>> + NO_CHANGE,
>> + DOWN,
>> + UP,
>> +};
>> +
>> +struct fuse_corner_data {
>> + int ref_uV;
>> + int max_uV;
>> + int min_uV;
>> + int range_uV;
>> + /* fuse volt: closed/open loop */
>> + int volt_cloop_adjust;
>> + int volt_oloop_adjust;
>
> For CPR3 these values are per-fusing-rev.
> (for 8996 tables list per-fusing-rev values for min_uV, volt_cloop_adjust and volt_oloop_adjust)
Yes they are per-fuse-rev on other SoCs as well.. Angelo didn't implement
this in the original revision of the driver and I think it'd be good to
add it incrementally since we already consume the necessary fuse..
Otherwise -ETOOFAT!
>
> Another option, of course, might be to have a per-SoC code that uses fusing_rev to update the fuse_corner_data, but it would mean making it non-const.
Hm.. a const array sounds better to me..
>
>> + int max_volt_scale;
>> + int max_quot_scale;
>
> Any reason for these limitations?
I'd assume that's a safety feature Qualcomm implemented to avoid
burning chips if cosmic rays poke at DRAM or some chips are fused
incorrectly.. Preferably, I'd keep it!
>
>> + /* fuse quot */
>> + int quot_offset;
>> + int quot_scale;
>> + int quot_adjust;
>
> I see that quot_offset/quot_scale/quot_adjust are set to 0/1/0 for all the platforms I can assess at this moment (8996/8998/sdm660). Can we drop them? If we need them later, we can readd them later.
I was about to do it, but noticed 8956 sets scaling to 10..
Guess we can leave it since it's already there!
Konrad
>
>> + /* fuse quot_offset */
>> + int quot_offset_scale;
>> + int quot_offset_adjust;
>> +};
>> +
>> +struct cpr_fuse {
>> + char *ring_osc;
>> + char *init_voltage;
>> + char *quotient;
>> + char *quotient_offset;
>> +};
>> +
>> +struct fuse_corner {
>> + int min_uV;
>> + int max_uV;
>> + int uV;
>> + int quot;
>> + int step_quot;
>> + const struct reg_sequence *accs;
>> + int num_accs;
>> + unsigned long max_freq;
>> + u8 ring_osc_idx;
>> +};
>> +
>> +struct corner {
>> + int min_uV;
>> + int max_uV;
>> + int uV;
>> + int last_uV;
>> + int quot_adjust;
>> + u32 save_ctl;
>> + u32 save_irq;
>> + unsigned long freq;
>> + bool is_open_loop;
>> + struct fuse_corner *fuse_corner;
>> +};
>> +
>> +struct corner_data {
>> + unsigned int fuse_corner;
>> + unsigned long freq;
>> +};
>> +
>> +struct acc_desc {
>> + unsigned int enable_reg;
>> + u32 enable_mask;
>> +
>> + struct reg_sequence *config;
>> + struct reg_sequence *settings;
>> + int num_regs_per_fuse;
>> +};
>> +
>> +struct cpr_acc_desc {
>> + const struct cpr_desc *cpr_desc;
>> + const struct acc_desc *acc_desc;
>> +};
>> +
>
> [skipped the rest]
>
next prev parent reply other threads:[~2023-06-03 8:49 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 11:08 [PATCH v10 0/6] Add support for Core Power Reduction v3, v4 and Hardened Konrad Dybcio
2023-02-17 11:08 ` [PATCH v10 1/6] MAINTAINERS: Add entry for Qualcomm CPRv3/v4/Hardened driver Konrad Dybcio
2023-02-17 11:08 ` [PATCH v10 2/6] dt-bindings: opp: v2-qcom-level: Document CPR3 open/closed loop volt adjustment Konrad Dybcio
2023-02-17 23:13 ` Rob Herring
2023-02-18 0:26 ` Konrad Dybcio
2023-02-20 11:27 ` AngeloGioacchino Del Regno
2023-02-20 13:10 ` Konrad Dybcio
2023-02-17 11:08 ` [PATCH v10 3/6] dt-bindings: soc: qcom: cpr3: Add bindings for CPR3 driver Konrad Dybcio
2023-02-17 13:47 ` Rob Herring
2023-02-17 14:09 ` Konrad Dybcio
2023-02-20 22:01 ` Rob Herring
2023-02-17 11:08 ` [PATCH v10 4/6] soc: qcom: cpr: Move common functions to new file Konrad Dybcio
2023-02-27 3:09 ` Dmitry Baryshkov
2023-06-03 8:49 ` Konrad Dybcio [this message]
2023-02-17 11:08 ` [PATCH v10 5/6] soc: qcom: Add support for Core Power Reduction v3, v4 and Hardened Konrad Dybcio
2023-02-27 2:55 ` Dmitry Baryshkov
2023-02-27 9:13 ` AngeloGioacchino Del Regno
2023-02-27 12:01 ` Dmitry Baryshkov
2023-02-27 13:06 ` AngeloGioacchino Del Regno
2023-02-27 13:20 ` Dmitry Baryshkov
2023-02-28 8:19 ` AngeloGioacchino Del Regno
2023-02-28 13:01 ` Konrad Dybcio
2023-02-17 11:08 ` [PATCH v10 6/6] arm64: dts: qcom: msm8998: Configure CPRh Konrad Dybcio
2023-02-17 14:29 ` 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=dc78e4b3-975b-6fc8-3906-8fa935bde625@linaro.org \
--to=konrad.dybcio@linaro.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=angelogioacchino.delregno@somainline.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nks@flawful.org \
--cc=nm@ti.com \
--cc=robh+dt@kernel.org \
--cc=robimarko@gmail.com \
--cc=sboyd@kernel.org \
--cc=vireshk@kernel.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).