Re: [PATCH v8 3/3] thermal/drivers/imx: Add calibration offset support

From: CHENG Haoning (BCSC/ENG1)

Date: Fri Jul 17 2026 - 02:24:02 EST


On Wed, Jul 15, 2026 at 11:06:07AM +0200, Frieder Schrempf wrote:
> On 14.07.26 12:28, Haoning CHENG via B4 Relay wrote:
> > Some boards need a small per-design correction to align the reported CPU
> > temperature with board-level measurements. Read the optional
> > fsl,temp-calibration-offset-millicelsius property from DT and apply it
> > uniformly to the i.MX6/6SX/7D calibration formulas.
>
> Sorry to chime in so late. I just want to understand what this
> calibration offset is about. Why would there be a need of a
> board-specific offset? The sensor is in the SoC and if you add a
> board-specific offset, you no longer measure the SoC core temperature,
> right?
>
> How would you determine the offset in the first place? How would I know
> what fsl,temp-calibration-offset-millicelsius should be set to? I could
> put a sensor on the SoC case and use the delta as offset, but then I
> would just account for the thermal resistance of the casing and not
> measure the SoC core temperature anymore, right?

Hi Frieder,

Thanks for pointing this out. Your understanding is correct: after
applying the offset, the reported value no longer represents the raw
SoC die or junction temperature.

For this board, the required "SoC temperature" is the package-surface
temperature. The offset was derived by comparing the TEMPMON reading
against a calibrated external sensor placed near the SoC package
surface under steady-state thermal conditions, and is used to
approximate the package-surface temperature from the internal TEMPMON
reading.

The Linux thermal framework does not require a thermal zone to use a
specific temperature reference. It only requires the reported
temperature and trip points to use the same temperature domain.

In this driver, the offset is added in get_temp() and subtracted in
set_alarm() and set_panic() when programming the hardware thresholds.
This keeps the reported temperature and trip points in the same
package-surface temperature domain. Doing this in the driver is
necessary because the hardware alarm thresholds must also be offset-
corrected; applying the offset only in userspace would cause the
TEMPMON IRQ to fire at the wrong die temperature.

I agree that "calibration offset" is misleading, since this does not
calibrate TEMPMON to a more accurate junction temperature. In the next
revision, the commit messages and DT binding have been updated to
describe this as a board-specific conversion offset from the internal
sensor reading to an estimated package-surface temperature.

Thanks,
Haoning