dts: bindings: stm32-temp*: align 'avgslope' to datasheet format

Change the STM32 Temperature Sensor bindings to accept the average slope
value in string form instead of integer. With this change, it is possible
to use the raw decimal value found in each MCU's datasheet instead of
needing to scale it (differently depending on series!). This also allows
regrouping the property in a single file to reduce duplication.

Also update all DTSI files affected by this change and the dietemp driver
to accept the property's new format.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
This commit is contained in:
Mathieu Choplain 2024-07-23 10:47:24 +02:00 committed by Alberto Escolar
parent e61b010b4c
commit 5a0775b1ab
9 changed files with 14 additions and 27 deletions

View file

@ -315,10 +315,7 @@ static const struct stm32_temp_config stm32_temp_dev_config = {
.ts_cal1_addr = (const void *)DT_INST_PROP(0, ts_cal1_addr),
.ts_cal1_temp = DT_INST_PROP(0, ts_cal1_temp),
#if defined(HAS_SINGLE_CALIBRATION)
/* DT property is premultiplied by 1000 to cope with Device Tree
* properties being integer-only. Rescale here during compile.
*/
.average_slope = ((float)DT_INST_PROP(0, avgslope) / 1000.0f),
.average_slope = ((float)DT_INST_STRING_UNQUOTED(0, avgslope)),
#else /* HAS_DUAL_CALIBRATION */
.ts_cal2_addr = (const void *)DT_INST_PROP(0, ts_cal2_addr),
.ts_cal2_temp = DT_INST_PROP(0, ts_cal2_temp),
@ -326,10 +323,7 @@ static const struct stm32_temp_config stm32_temp_dev_config = {
.calib_data_shift = (DT_INST_PROP(0, ts_cal_resolution) - CAL_RES),
.calib_vrefanalog = DT_INST_PROP(0, ts_cal_vrefanalog),
#else
/* DT property is premultiplied by 10 to cope with Device Tree
* properties being integer-only. Rescale here during compile.
*/
.average_slope = ((float)DT_INST_PROP(0, avgslope) / 10.0f),
.average_slope = ((float)DT_INST_STRING_UNQUOTED(0, avgslope)),
.v25 = DT_INST_PROP(0, v25),
#endif
.is_ntc = DT_INST_PROP_OR(0, ntc, false)

View file

@ -346,7 +346,7 @@
ts-cal1-addr = <0x1FFF7568>;
ts-cal1-temp = <30>;
ts-cal-vrefanalog = <3000>;
avgslope = <2530>;
avgslope = "2.53";
io-channels = <&adc1 9>;
status = "disabled";
};

View file

@ -16,7 +16,7 @@
ts-cal1-addr = <0x1FFFF7B8>;
ts-cal1-temp = <30>;
ts-cal-vrefanalog = <3300>;
avgslope = <4300>;
avgslope = "4.3";
io-channels = <&adc1 16>;
ntc;
status = "disabled";

View file

@ -365,7 +365,7 @@
compatible = "st,stm32-temp";
io-channels = <&adc1 16>;
status = "disabled";
avgslope = <43>;
avgslope = "4.3";
v25 = <1430>;
ntc;
};

View file

@ -707,8 +707,8 @@
compatible = "st,stm32-temp";
io-channels = <&adc1 16>;
status = "disabled";
avgslope = "2.5";
v25 = <760>;
avgslope = <25>;
};
otgfs_phy: otgfs_phy {

View file

@ -9,6 +9,7 @@ compatible: "st,stm32-temp-cal"
include:
- name: st,stm32-temp-cal-common.yaml
property-blocklist:
- avgslope
- ntc
properties:

View file

@ -8,6 +8,13 @@ properties:
required: true
description: ADC channel for temperature sensor
avgslope:
type: string
required: true
description: |
Average slope of T-V chart (in mV/°C), found in MCU datasheet
chapters "Electrical characteristics" or "Operating conditions"
ntc:
type: boolean
description: |

View file

@ -8,13 +8,6 @@ compatible: "st,stm32-temp"
include: [base.yaml, "st,stm32-temp-common.yaml"]
properties:
avgslope:
type: int
required: true
description: |
Average slope of T-V chart (in mV/°C, x10), found in MCU datasheet
chapters "Electrical characteristics" or "Operating conditions"
v25:
type: int
required: true

View file

@ -7,11 +7,3 @@ description: |
compatible: "st,stm32c0-temp-cal"
include: "st,stm32-temp-cal-common.yaml"
properties:
avgslope:
type: int
required: true
description: |
Average slope of T-V chart (in µV/°C), found in MCU datasheet
chapters "Electrical characteristics" or "Operating conditions"