Hello support member,
Sorry but I can't understand what are you saying.
I hope to know why is it use fixed value 15423 and 4148468 in imx_thermal.c?
I think that it must calculate from the fuse value for 25C and HOT_TEMP (factory provided).
I add following dev_info message to output OCOTP_ANA1 and TEMPMON_TEMPSENSE0 register value to imx_thermal.c.
In function imx_init_calib()
n1 = ocotp_ana1 >> 20;
temp64 = 10000000; /* use 10^7 as fixed point constant for values in formula */
temp64 *= 1000; /* to get result in °mC */
do_div(temp64, 15423 * n1 - 4148468);
data->c1 = temp64;
data->c2 = n1 * data->c1 + 28581;
#ifdef TEMPMON_DEBUGOUT
dev_info(&pdev->dev, " ocotp_ana1=0x%08x data C1=%d, C2=%d\n", ocotp_ana1, data->c1, data->c2);
#endif
In function imx_get_temp()
/* See imx_init_calib() for formula derivation */
if (data->socdata->version == TEMPMON_IMX7D)
*temp = (n_meas - data->c1 + 25) * 1000;
else
*temp = data->c2 - n_meas * data->c1;
dev_info(&tz->device, "TEMPMON0=0x%08x TEMP_CNT=0x%04x TEMP=%d\n", val, n_meas, *temp);
And OCOTP_ANA1 message log as following.
[ 3.719692] imx_thermal 20c8000.anatop:tempmon: ocotp_ana1=0x5724cd7d data C1=576, C2=831525
thermal_zone0/temp value as following.
$ cat /sys/class/thermal/thermal_zone0/temp
[ 29.159066] thermal thermal_zone0: TEMPMON0=0x4db56106 TEMP_CNT=0x0561 TEMP=38373
38373
In this time,
TEMPMON_TEMPSENSE0 = 0x4db56106
n_meas=0x0561=1377
OCOTP_ANA1 = 0x5724cd7d
n1 = 0x572 = 1394
Best regards,
Ishii.