I need more accurate temperature reporting for the imx8mm processor. Empirical data taken using the linux source code currently does NOT use the factory calibration values for the TMU.
The driver source code is located here:
https://github.com/nxp-imx/linux-imx/blob/lf-6.1.y/drivers/thermal/imx8mm_thermal.c
[..]
static int imx8mm_tmu_get_temp(void *data, int *temp)
{
struct tmu_sensor *sensor = data;
struct imx8mm_tmu *tmu = sensor->priv;
u32 val;
val = readl_relaxed(tmu->base + TRITSR) & TRITSR_TEMP0_VAL_MASK;
/*
* Do not validate against the V bit (bit 31) due to errata
* ERR051272: TMU: Bit 31 of registers TMU_TSCR/TMU_TRITSR/TMU_TRATSR invalid
*/
*temp = val * 1000;
if (*temp < VER1_TEMP_LOW_LIMIT || *temp > VER2_TEMP_HIGH_LIMIT)
return -EAGAIN;
return 0;
}
[..]
Q1. Is there driver source that implements the following formula stated in IMX8MMRM section
5.4.5 Temperature Sensor Error Correction Method.

, where Tsense=readl_relaxed(tmu->base + TRITSR) & TRITSR_TEMP0_VAL_MASK;
The following forum post "if more accurate calibration is required, it should be implemented in the driver(imx8mm_thermal.c) using the equation described in RM"
Q2. The IMXMMRM.pdf section 6.3.4 OCOTP Memory Map/Register Definition does not define the TE2 and TE1 values..
Can you please confirm these are the locations?
-or- Different location?
0x3035_04F0[7:0] TSENSOR_VALUE_RT[7:0] (room temp)
0x3035_04F0[15:8] TSENSOR_VALUE_HT[7:0] (high temp)
Q3. Does the IMX8MM mini TSENSOR_RES_EXT (J24) pin require 100K resistor to ground for end-user deployed hardware configuration?
-or- In other words is the 100K resistor only required during a calibration procedure?
On a related note, is there a different resistor value required for industrial temperature grade imx8mm mini part?
Following forum post did not clearly answer..
Q4. Section 5.4 Thermal Monitoring Unit (TMU) makes several references to TMR[ ], suggesting this is a register somewhere.. Can you please where I can locate a full definition of TMR ?
Specifically, I'd like the following ref manual references to TMR fields TMR[ALPF], TMR[CE], TMR[MSITE].
Q5. Can you please clarify the maximum invalid value error in the temperature reading due to ERR051272?
For example, The temperature is reported with an "invalid value" but is high AND still within bounds of VER1_TEMP_LOW_LIMIT and VER1_TEMP_HIGH_LIMIT. Since the invalid value was received, I'm concerned the kernel will unexpectedly shutdown.
Would it be better to read the TMU register multiple times with algorithm to better weed out invalid values?
ERR051272: TMU: Bit 31 of registers TMU_TSCR/TMU_TRITSR/TMU_TRATSR invalid Description: Bit 31 of registers TMU_TSCR/TMU_TRITSR/TMU_TRATSR might be set as invalid value when the temperature varies in range.
Workaround: Do not use Bit 31 of registers TMU_TSCR/TMU_TRITSR/TMU_TRATSR. Suggest to read TMU value and use 1 point calibration to justify if the temperature is in range.