dts: enum_macros: make sure that they are lowercase

DT_ENUM_HAS_VALUE_BY_IDX states, that the value
must be lowercase-and-underscores, this makes sure,
that they can match.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit is contained in:
Fin Maaß 2025-04-28 13:55:34 +02:00 committed by Benjamin Cabé
commit f7153012ef
3 changed files with 7 additions and 4 deletions

View file

@ -17,16 +17,16 @@
_CONCAT(COMP_NRF_COMP_REFSEL_, DT_INST_STRING_TOKEN(inst, refsel))
#define SHIM_NRF_COMP_DT_INST_REFSEL_IS_AREF(inst) \
DT_INST_ENUM_HAS_VALUE(inst, refsel, AREF)
DT_INST_ENUM_HAS_VALUE(inst, refsel, aref)
#define SHIM_NRF_COMP_DT_INST_EXTREFSEL(inst) \
_CONCAT(COMP_NRF_COMP_EXTREFSEL_, DT_INST_STRING_TOKEN(inst, extrefsel))
#define SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_SE(inst) \
DT_INST_ENUM_HAS_VALUE(inst, main_mode, SE)
DT_INST_ENUM_HAS_VALUE(inst, main_mode, se)
#define SHIM_NRF_COMP_DT_INST_MAIN_MODE_IS_DIFF(inst) \
DT_INST_ENUM_HAS_VALUE(inst, main_mode, DIFF)
DT_INST_ENUM_HAS_VALUE(inst, main_mode, diff)
#define SHIM_NRF_COMP_DT_INST_TH_DOWN(inst) \
DT_INST_PROP(inst, th_down)

View file

@ -19,7 +19,7 @@
_CONCAT(COMP_NRF_LPCOMP_REFSEL_, DT_INST_STRING_TOKEN(inst, refsel))
#define SHIM_NRF_LPCOMP_DT_INST_REFSEL_IS_AREF(inst) \
DT_INST_ENUM_HAS_VALUE(inst, refsel, AREF)
DT_INST_ENUM_HAS_VALUE(inst, refsel, aref)
#define SHIM_NRF_LPCOMP_DT_INST_EXTREFSEL(inst) \
_CONCAT(COMP_NRF_LPCOMP_EXTREFSEL_, DT_INST_STRING_TOKEN(inst, extrefsel))

View file

@ -679,6 +679,9 @@ def enum_macros(prop: edtlib.Property, macro: str):
val = prop.val_as_tokens if spec.enum_tokenizable else (prop.val if isinstance(prop.val, list) else [prop.val])
for i, subval in enumerate(val):
# make sure the subval is a formated right.
if isinstance(subval, str):
subval = str2ident(subval)
# DT_N_<node-id>_P_<prop-id>_IDX_<i>_EXISTS
ret[f"{macro}_IDX_{i}_EXISTS"] = 1
# DT_N_<node-id>_P_<prop-id>_IDX_<i>_ENUM_VAL_<val>_EXISTS 1