iio: adc: stm32: describe the STM32H7 temperature sensor calibration
Subsystems (3)
cover iio: adc: stm32: describe the STM32H7 temperature sensor calibration
The STM32 ADC binding lets an ADC take the factory calibration of its internal voltage reference (VREFINT_CAL) as an nvmem cell, but not the two calibration points of the internal temperature sensor (TS_CAL1 and TS_CAL2), although the STM32F4 and STM32MP1 device trees already describe those cells.
This series adds the two temperature sensor calibration cells to the binding, and describes the factory calibration area of the STM32H7 in system memory, passing its cells to ADC3, which the temperature sensor and VREFINT are connected to.
PebbleOS uses these bindings, including the new cells, to describe the STM32H747 and read its temperature sensor.
Gerard Marull-Paretas (2):
dt-bindings: iio: adc: st,stm32-adc: add temperature sensor
calibration cells
ARM: dts: stm32: add the factory calibration data to stm32h743
.../bindings/iio/adc/st,stm32-adc.yaml | 10 +++++++++ arch/arm/boot/dts/st/stm32h743.dtsi | 21 +++++++++++++++++++ 2 files changed, 31 insertions(+)
base-commit: 8d7fe9885c62fc9a95bf55d9db244d9672a8aadc
Signature · 1 line
2.45.2
PATCH 1/2 dt-bindings: iio: adc: st,stm32-adc: add temperature sensor calibration cells
The internal temperature sensor of STM32 ADCs is calibrated in the factory at two temperatures, and its calibration data (TS_CAL1 and TS_CAL2) is stored in a read-only area, along with the internal voltage reference calibration (VREFINT_CAL). On STM32H7, the temperature sensor is connected to ADC3.
Only the vrefint calibration can be passed to an ADC today. Allow the two temperature sensor calibration points to be passed as nvmem cells as well, so the ADC the temperature sensor is connected to can convert its readings.
--- .../devicetree/bindings/iio/adc/st,stm32-adc.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/iio/adc/st,stm32-adc.yaml +10 -0
@@ -337,12 +337,22 @@ patternProperties: deprecated: true nvmem-cells: + minItems: 1 items: - description: Phandle to the calibration vrefint data provided by otp + - description: + Temperature sensor calibration data at the first calibration + temperature (TS_CAL1) + - description: + Temperature sensor calibration data at the second calibration + temperature (TS_CAL2) nvmem-cell-names: + minItems: 1 items: - const: vrefint + - const: ts-cal1 + - const: ts-cal2 patternProperties: "^channel@([0-9]|1[0-9])$":
Signature · 1 line
2.45.2
Re: [PATCH 1/2] dt-bindings: iio: adc: st,stm32-adc: add temperature sensor calibration cells
Quoted 5 lines · Gerard Marull-Paretas
The internal temperature sensor of STM32 ADCs is calibrated in the factory at two temperatures, and its calibration data (
TS_CAL1andTS_CAL2) is stored in a read-only area, along with the internal voltage reference calibration (VREFINT_CAL). On STM32H7, the temperature sensor is connected to ADC3.
Hi Gerard,
Nitpicking: could rather mention this is present on stm32h7, stm32mp13 and stm32mp15. ADC3 connection on STM32H7 doesn't really matter talking about the calibration cells.
Quoted 8 lines
Only the vrefint calibration can be passed to an ADC today. Allow the two temperature sensor calibration points to be passed as nvmem cells as well, so the ADC the temperature sensor is connected to can convert its readings.
Signed-off-by Gerard Marull-Paretas <[email protected]>---
As suggested by Jonathan on the cover-letter, could add some background information, for DT maintainers.
Thanks,
Best Regards,
Fabrice
Quoted 30 lines
.../devicetree/bindings/iio/adc/st,stm32-adc.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+)Documentation/devicetree/bindings/iio/adc/st,stm32-adc.yaml +10
-0@@ -337,12 +337,22 @@ patternProperties: deprecated: true nvmem-cells: + minItems: 1 items: - description: Phandle to the calibration vrefint data provided by otp + - description: + Temperature sensor calibration data at the first calibration + temperature (TS_CAL1) + - description: + Temperature sensor calibration data at the second calibration + temperature (TS_CAL2) nvmem-cell-names: + minItems: 1 items: - const: vrefint + - const: ts-cal1 + - const: ts-cal2 patternProperties: "^channel@([0-9]|1[0-9])$":
PATCH 2/2 ARM: dts: stm32: add the factory calibration data to stm32h743
In reply to Gerard Marull-ParetasThe temperature sensor and internal voltage reference calibration data of the STM32H7 are stored in system memory, at 0x1ff1e820 (TS_CAL1), 0x1ff1e840 (TS_CAL2) and 0x1ff1e860 (VREFINT_CAL).
Describe this area as STM32 factory-programmed data, and pass the calibration cells to ADC3, which the temperature sensor and VREFINT are connected to.
--- arch/arm/boot/dts/st/stm32h743.dtsi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
arch/arm/boot/dts/st/stm32h743.dtsi +21 -0
@@ -70,6 +70,25 @@ clk_i2s: i2s_ckin { }; soc { + romem: efuse@1ff1e800 { + compatible = "st,stm32f4-otp"; + reg = <0x1ff1e800 0x100>; + #address-cells = <1>; + #size-cells = <1>; + + ts_cal1: calib@20 { + reg = <0x20 0x2>; + }; + + ts_cal2: calib@40 { + reg = <0x40 0x2>; + }; + + vrefint: calib@60 { + reg = <0x60 0x2>; + }; + }; + timer5: timer@40000c00 { compatible = "st,stm32-timer"; reg = <0x40000c00 0x400>;
@@ -572,6 +591,8 @@ adc3: adc@0 { reg = <0x0>; interrupt-parent = <&adc_3>; interrupts = <0>; + nvmem-cells = <&vrefint>, <&ts_cal1>, <&ts_cal2>; + nvmem-cell-names = "vrefint", "ts-cal1", "ts-cal2"; status = "disabled"; }; };
Signature · 1 line
2.45.2
Quoted 14 lines · Gerard Marull-Paretas
The STM32 ADC binding lets an ADC take the factory calibration of its internal voltage reference (
VREFINT_CAL) as an nvmem cell, but not the two calibration points of the internal temperature sensor (TS_CAL1andTS_CAL2), although the STM32F4 and STM32MP1 device trees already describe those cells.This series adds the two temperature sensor calibration cells to the binding, and describes the factory calibration area of the STM32H7 in system memory, passing its cells to ADC3, which the temperature sensor and VREFINT are connected to.
PebbleOS uses these bindings, including the new cells, to describe the STM32H747 and read its temperature sensor.
Quoted 7 lines
Gerard Marull-Paretas (2):
dt-bindings: iio: adc: st,stm32-adc: add temperature sensor
calibration cells
ARM: dts: stm32: add the factory calibration data to stm32h743.../bindings/iio/adc/st,stm32-adc.yaml | 10 +++++++++ arch/arm/boot/dts/st/stm32h743.dtsi | 21 +++++++++++++++++++
Hi Gerald,
The DT is deprecated and are going to be removed [1].
[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
So I'm not sure the dt-bindings update is useful.
Best Regards,
Fabrice
Quoted 4 lines
2 files changed, 31 insertions(+)base-commit:
8d7fe9885c62fc9a95bf55d9db244d9672a8aadc
Quoted 5 lines · Fabrice Gasnier
The DT is deprecated and are going to be removed [1].
[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
So I'm not sure the dt-bindings update is useful.
Hi Fabrice,
Thanks, I wasn't aware of the removal. I'll drop the dtsi patch then.
The binding itself stays, as it covers the STM32MP1 ADCs too, and it is used outside Linux: PebbleOS describes the STM32H747 with it, so the temperature sensor calibration cells would still be useful there. Would you be fine taking patch 1 alone? If so I'll send a v2 with just the binding.
Best regards,
Gerard
Quoted 5 lines · Gerard Marull-Paretas
Quoted 4 lines · Fabrice Gasnier
The DT is deprecated and are going to be removed [1].
[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
Quoted 7 lines
Quoted 1 line
So I'm not sure the dt-bindings update is useful.
Hi Fabrice,
Thanks, I wasn't aware of the removal. I'll drop the dtsi patch then.
The binding itself stays, as it covers the STM32MP1 ADCs too, and it is
Hi Gerard,
Yes,
Well, on STM32MP1x, there's a dedicated "Digital temperature sensor (DTS)", used in Linux for thermal protection. Hence the ADC based temperature sensor has not been pushed/supported here, as ADCs are usually kept for other usage. I don't know of usage for it in Linux currently, I think it's quite unlikely.
That why I wonder on this is useful or not, w.r.t. stm32h7 dts removal.
Quoted 1 line
used outside Linux: PebbleOS describes the STM32H747 with it, so the
I don't know PebbleOS. Just for my own understanding, I guess you're using kernel dt-bindings to validate the external h7 dts ?
Quoted 3 lines
temperature sensor calibration cells would still be useful there. Would you be fine taking patch 1 alone? If so I'll send a v2 with just the binding.
The binding (patch 1) seems correct to me, also regarding STM32MP1x. Just as mentioned above, I think it's unlikely going to be used here.
I hope others can comment, on taking patch 1 ?
Best Regards,
Fabrice
Quoted 3 lines
Best regards,
Gerard
Jonathan Cameron
maintainerQuoted 30 lines · On Wed, 25 Nov 2026 17:13:35 +0100 Fabrice Gasnier…
Quoted 5 lines · Gerard Marull-Paretas
Quoted 4 lines · Fabrice Gasnier
The DT is deprecated and are going to be removed [1].
[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
Quoted 7 lines
Quoted 1 line
So I'm not sure the dt-bindings update is useful.
Hi Fabrice,
Thanks, I wasn't aware of the removal. I'll drop the dtsi patch then.
The binding itself stays, as it covers the STM32MP1 ADCs too, and it is
Hi Gerard,
Yes,
Well, on STM32MP1x, there's a dedicated "Digital temperature sensor (DTS)", used in Linux for thermal protection. Hence the ADC based temperature sensor has not been pushed/supported here, as ADCs are usually kept for other usage. I don't know of usage for it in Linux currently, I think it's quite unlikely.
That why I wonder on this is useful or not, w.r.t. stm32h7 dts removal.
Quoted 1 line
used outside Linux: PebbleOS describes the STM32H747 with it, so the
I don't know PebbleOS. Just for my own understanding, I guess you're using kernel dt-bindings to validate the external h7 dts ?
Quoted 9 lines
Quoted 3 lines
temperature sensor calibration cells would still be useful there. Would you be fine taking patch 1 alone? If so I'll send a v2 with just the binding.
The binding (patch 1) seems correct to me, also regarding STM32MP1x. Just as mentioned above, I think it's unlikely going to be used here.
I hope others can comment, on taking patch 1 ?
I'm fine with carrying that. Perhaps a little bit more info from this discussion is useful though. So send a v2 with just that and the additional background and we'll see what dt maintainers think.
Jonathan
Quoted 8 lines
Best Regards,
FabriceQuoted 3 lines
Best regards,
Gerard
Quoted 1 line · Fabrice Gasnier
On 11/24/26 21:22, Gerard Marull-Paretas wrote:
...
Quoted 5 lines
The DT is deprecated and are going to be removed [1].
[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
So I'm not sure the dt-bindings update is useful.
But as long as the code supporting old DT is in kernel, the update needs to those versions, no?
Signature · 2 lines
With Best Regards, Andy Shevchenko