On Sat, Mar 18, 2023 at 03:02:35PM +0100, Konrad Dybcio wrote: > On 15.03.2023 11:39, 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. > > > > [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 > > > > Cc: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx> > > Fixes: a2149ab815fc ("thermal/drivers/qcom/tsens-v0_1: Add support for MDM9607") > > Signed-off-by: Stephan Gerhold <stephan.gerhold@xxxxxxxxxxxxxxx> > > --- > Reviewed-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx> > > BTW, did you notice some crazy readouts or would this have gone > unnoticed had you not dug in the code? > I'm afraid it would likely have remained unnoticed. I think these offsets only make a small difference but it's still good to have them for slightly more accurate readings. In v1 of this series I had the offsets for MSM8909 already (hardcoded into the old calibration function with all the bit shifts/masks etc). It was more coincidence that I checked MDM9607 for v2 because I had to make the code more generic with the new per-sensor nvmem cells. ;) Thanks, Stephan