lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 8 May 2023 16:38:19 +0300
From:   Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To:     Stephan Gerhold <stephan.gerhold@...nkonzept.com>,
        Daniel Lezcano <daniel.lezcano@...aro.org>
Cc:     Amit Kucheria <amitk@...nel.org>,
        Thara Gopinath <thara.gopinath@...il.com>,
        Andy Gross <agross@...nel.org>,
        Bjorn Andersson <andersson@...nel.org>,
        Konrad Dybcio <konrad.dybcio@...aro.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Zhang Rui <rui.zhang@...el.com>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Conor Dooley <conor+dt@...nel.org>,
        linux-arm-msm@...r.kernel.org, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v4 3/6] thermal: qcom: tsens-v0_1: Add mdm9607 correction
 offsets

On 08/05/2023 16:13, Stephan Gerhold wrote:
> According to the msm-3.18 vendor kernel from Qualcomm, mdm9607 needs
> "correction factors" to adjust for additional offsets observed after the
> factory calibration values in the fuses [1, 2].
> 
> The fixed offsets should be applied unless there is a special
> calibration mode value that indicates that no offsets are needed [3].
> 
> Note that the new calibration mode values are called differently in this
> patch compared to the vendor kernel:
>    - TSENS_TWO_POINT_CALIB_N_WA        -> ONE_PT_CALIB2_NO_OFFSET
>    - TSENS_TWO_POINT_CALIB_N_OFFSET_WA -> TWO_PT_CALIB_NO_OFFSET
> This is because close inspection of the calibration function [3] reveals
> that TSENS_TWO_POINT_CALIB_N_WA is actually a "one point" calibration
> because the if statements skip all "point2" related code for it.

Indeed.

> 
> [1]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/commit/d9d2db1b82bf3f72f5de0803d55e6849eb5b671e
> [2]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/commit/d75aef53a760e8ff7bac54049d00c8b2ee1b193e
> [3]: https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/blob/LE.UM.4.3.2.r1-04200-9x07/drivers/thermal/msm-tsens.c#L2987-3136
> 
> Fixes: a2149ab815fc ("thermal/drivers/qcom/tsens-v0_1: Add support for MDM9607")
> Reviewed-by: Konrad Dybcio <konrad.dybcio@...aro.org>
> Signed-off-by: Stephan Gerhold <stephan.gerhold@...nkonzept.com>
> ---
>   drivers/thermal/qcom/tsens-v0_1.c | 11 +++++++++++
>   drivers/thermal/qcom/tsens.c      | 16 +++++++++++++++-
>   drivers/thermal/qcom/tsens.h      |  4 ++++
>   3 files changed, 30 insertions(+), 1 deletion(-)

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>

> 
> diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c
> index 1b454de3928d..e69889dd524a 100644
> --- a/drivers/thermal/qcom/tsens-v0_1.c
> +++ b/drivers/thermal/qcom/tsens-v0_1.c
> @@ -229,6 +229,17 @@ static int __init init_9607(struct tsens_priv *priv)
>   	for (i = 0; i < priv->num_sensors; ++i)
>   		priv->sensor[i].slope = 3000;
>   
> +	priv->sensor[0].p1_calib_offset = 1;
> +	priv->sensor[0].p2_calib_offset = 1;
> +	priv->sensor[1].p1_calib_offset = -4;
> +	priv->sensor[1].p2_calib_offset = -2;
> +	priv->sensor[2].p1_calib_offset = 4;
> +	priv->sensor[2].p2_calib_offset = 8;
> +	priv->sensor[3].p1_calib_offset = -3;
> +	priv->sensor[3].p2_calib_offset = -5;
> +	priv->sensor[4].p1_calib_offset = -4;
> +	priv->sensor[4].p2_calib_offset = -4;
> +
>   	return init_common(priv);
>   }

I should check if using these offsets would allow us to drop the custom 
code for 8974.

-- 
With best wishes
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ