Skip to content

Commit 277504c

Browse files
Mathieu Choplaincarlescufi
authored andcommitted
soc: st: stm32wb0: support SoCs without SMPS output current limit
The STM32WB06 and STM32WB07 SoCs do not support SMPS output current limit. This makes the LL_PWR_SetSMPSPrechargeLimitCurrent function and all the LL_PWR_SMPS_PRECH_LIMIT_CUR_xxx defines not visible when one of these SoCs is selected, resulting in a build failure. Fix this by only handling SMPS current limit when the feature is available. Signed-off-by: Mathieu Choplain <[email protected]>
1 parent 0c13100 commit 277504c

File tree

1 file changed

+8
-2
lines changed
  • soc/st/stm32/stm32wb0x

1 file changed

+8
-2
lines changed

soc/st/stm32/stm32wb0x/soc.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ __used RAM_VR_TypeDef RAM_VR;
6767
(LL_PWR_SMPS_LPOPEN), \
6868
(LL_PWR_NO_SMPS_LPOPEN))
6969

70+
#if defined(PWR_CR5_SMPS_PRECH_CUR_SEL)
7071
#define SMPS_CURRENT_LIMIT \
7172
_CONCAT(LL_PWR_SMPS_PRECH_LIMIT_CUR_, \
7273
DT_STRING_UNQUOTED(PWRC, smps_current_limit))
74+
#endif /* PWR_CR5_SMPS_PRECH_CUR_SEL */
7375

7476
#define SMPS_OUTPUT_VOLTAGE \
7577
_CONCAT(LL_PWR_SMPS_OUTPUT_VOLTAGE_, \
@@ -112,11 +114,15 @@ static void configure_smps(void)
112114
}
113115

114116
if (SMPS_MODE == STM32WB0_SMPS_MODE_PRECHARGE) {
117+
#if defined(PWR_CR5_SMPS_PRECH_CUR_SEL)
115118
/**
116-
* SMPS should remain in PRECHARGE mode, but
117-
* we still have to configure the current limit.
119+
* SMPS should remain in PRECHARGE mode.
120+
* We still have to configure the output current
121+
* limit specified in Device Tree, though this
122+
* can only be done if this SoC supports it.
118123
*/
119124
LL_PWR_SetSMPSPrechargeLimitCurrent(SMPS_CURRENT_LIMIT);
125+
#endif /* PWR_CR5_SMPS_PRECH_CUR_SEL */
120126
} else {
121127
/**
122128
* SMPS mode requested is RUN mode. Configure the output

0 commit comments

Comments
 (0)