Skip to content

Commit 8946187

Browse files
Niklas Söderlunddlezcano
authored andcommitted
thermal/drivers/rcar_gen3_thermal: Fix coefficient calculations
The fixed value of 157 used in the calculations are only correct for M3-W, on other Gen3 SoC it should be 167. The constant can be derived correctly from the static TJ_3 constant and the SoC specific TJ_1 value. Update the calculation be correct on all Gen3 SoCs. Fixes: 4eb39f7 ("thermal: rcar_gen3_thermal: Update value of Tj_1") Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20210605085211.564909-1-niklas.soderlund+renesas@ragnatech.se
1 parent d753926 commit 8946187

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/thermal/rcar_gen3_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc,
143143
* Division is not scaled in BSP and if scaled it might overflow
144144
* the dividend (4095 * 4095 << 14 > INT_MAX) so keep it unscaled
145145
*/
146-
tsc->tj_t = (FIXPT_INT((ptat[1] - ptat[2]) * 157)
146+
tsc->tj_t = (FIXPT_INT((ptat[1] - ptat[2]) * (ths_tj_1 - TJ_3))
147147
/ (ptat[0] - ptat[2])) + FIXPT_INT(TJ_3);
148148

149149
tsc->coef.a1 = FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[2]),

0 commit comments

Comments
 (0)