From: Sricharan Ramabadhran <quic_srichara@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: <agross@kernel.org>, <andersson@kernel.org>,
<konrad.dybcio@linaro.org>, <srinivas.kandagatla@linaro.org>,
<robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>,
<conor+dt@kernel.org>, <thara.gopinath@gmail.com>,
<rafael@kernel.org>, <daniel.lezcano@linaro.org>,
<linux-arm-msm@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>
Subject: Re: [PATCH 3/7] thermal/drivers/qcom/tsens: Add support for IPQ5018 tsens
Date: Wed, 30 Aug 2023 07:50:22 +0530 [thread overview]
Message-ID: <ee50d097-6213-36dd-9966-bdd5b2bb953b@quicinc.com> (raw)
In-Reply-To: <CAA8EJpoHCW2H12U9wzmz5a86TriZr9mLuPi6D6h02byAWOG2mQ@mail.gmail.com>
<..>
>> +{
>> + u32 p1[10], p2[10];
>> + u32 *qfprom_cdata;
>> + int mode;
>> +
>> + qfprom_cdata = (u32 *)qfprom_read(priv->dev, "calib");
>> + if (IS_ERR(qfprom_cdata))
>> + return PTR_ERR(qfprom_cdata);
>> +
>> + mode = tsens_read_calibration_legacy(priv, &tsens_ipq5018_nvmem,
>> + p1, p2,
>> + qfprom_cdata, NULL);
>
> No, this should be used only in _legacy_ cases. Please use
> tsens_calibrate_common() / tsens_calibrate_nvmem() / etc.
>
ok.
>> +
>> + fixup_ipq5018_points(mode, p1, p2);
>> + compute_intercept_slope(priv, p1, p2, mode);
>> + kfree(qfprom_cdata);
>> +
>> + return 0;
>> +}
>> +
>> static int calibrate_v1(struct tsens_priv *priv)
>> {
>> u32 p1[10], p2[10];
>> @@ -79,6 +132,18 @@ static struct tsens_features tsens_v1_feat = {
>> .trip_max_temp = 120000,
>> };
>>
>> +static struct tsens_features tsens_v1_ipq5018_feat = {
>> + .ver_major = VER_1_X,
>> + .crit_int = 0,
>> + .combo_int = 0,
>> + .adc = 1,
>> + .srot_split = 1,
>> + .max_sensors = 11,
>> + .trip_min_temp = -40000,
>> + .trip_max_temp = 120000,
>> + .no_early_init = 1,
>> +};
>> +
>> static const struct reg_field tsens_v1_regfields[MAX_REGFIELDS] = {
>> /* ----- SROT ------ */
>> /* VERSION */
>> @@ -150,6 +215,43 @@ static int __init init_8956(struct tsens_priv *priv) {
>> return init_common(priv);
>> }
>>
>> +static int init_ipq5018(struct tsens_priv *priv)
>> +{
>> + int ret;
>> + u32 mask;
>> +
>> + init_common(priv);
>> + if (!priv->tm_map)
>> + return -ENODEV;
>> +
>> + ret = regmap_field_write(priv->rf[TSENS_SW_RST], 1);
>> + if (ret) {
>> + dev_err(priv->dev, "Reset failed\n");
>> + return ret;
>> + }
>> +
>> + mask = GENMASK(10, 0);
>
> #define this, then inline the variable. Or extract this codepiece into
> generic function which uses num_sensors to calculate the mask
>
ok.
>> + ret = regmap_field_update_bits(priv->rf[SENSOR_EN], mask, mask);
>> + if (ret) {
>> + dev_err(priv->dev, "Sensor Enable failed\n");
>> + return ret;
>> + }
>> +
>> + ret = regmap_field_write(priv->rf[TSENS_EN], 1);
>> + if (ret) {
>> + dev_err(priv->dev, "Enable failed\n");
>> + return ret;
>> + }
>> +
>> + ret = regmap_field_write(priv->rf[TSENS_SW_RST], 0);
>> + if (ret) {
>> + dev_err(priv->dev, "Reset failed\n");
>
> This error message is useless. You can not determine if it comes from
> this error or from setting the reset bit.
>
ok, will drop it.
Regards,
Sricharan
next prev parent reply other threads:[~2023-08-30 2:21 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-28 19:18 [PATCH 0/7] " Sricharan Ramabadhran
2023-08-28 19:18 ` [PATCH 1/7] dt-bindings: thermal: qcom-tsens: Add ipq5018 compatible Sricharan Ramabadhran
2023-08-28 19:21 ` Krzysztof Kozlowski
2023-08-29 5:59 ` Sricharan Ramabadhran
2023-08-28 19:18 ` [PATCH 2/7] thermal/drivers/qcom: Add new feat for soc without rpm Sricharan Ramabadhran
2023-08-28 21:17 ` Dmitry Baryshkov
2023-08-29 6:01 ` Sricharan Ramabadhran
2023-08-28 19:18 ` [PATCH 3/7] thermal/drivers/qcom/tsens: Add support for IPQ5018 tsens Sricharan Ramabadhran
2023-08-28 19:33 ` Krzysztof Kozlowski
2023-08-29 6:02 ` Sricharan Ramabadhran
2023-08-28 21:15 ` Dmitry Baryshkov
2023-08-30 2:20 ` Sricharan Ramabadhran [this message]
2023-08-28 19:18 ` [PATCH 4/7] thermal/drivers/qcom: Add IPQ5018 compatible Sricharan Ramabadhran
2023-08-28 19:33 ` Krzysztof Kozlowski
2023-08-29 6:03 ` Sricharan Ramabadhran
2023-08-28 19:18 ` [PATCH 5/7] dt-bindings: nvmem: Add compatible for IPQ5018 Sricharan Ramabadhran
2023-08-28 19:23 ` Krzysztof Kozlowski
2023-08-28 19:18 ` [PATCH 6/7] arm64: dts: qcom: ipq5018: Add tsens node Sricharan Ramabadhran
2023-08-28 19:25 ` Krzysztof Kozlowski
2023-08-29 6:04 ` Sricharan Ramabadhran
2023-08-28 21:19 ` Dmitry Baryshkov
2023-08-28 19:18 ` [PATCH 7/7] arm64: dts: qcom: ipq5018: Add thermal zones Sricharan Ramabadhran
2023-08-28 19:34 ` Krzysztof Kozlowski
2023-08-29 6:05 ` Sricharan Ramabadhran
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=ee50d097-6213-36dd-9966-bdd5b2bb953b@quicinc.com \
--to=quic_srichara@quicinc.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.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=robh+dt@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=thara.gopinath@gmail.com \
/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
all inboxes | Powered by JetHome®