1 /*
2  * Copyright (c) 2024 Silicon Laboratories Inc.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * This configuration header is used by the HAL driver device_init_dcdc from hal_silabs,
7  * invoked through the soc_early_init hook. DeviceTree options are converted to config macros
8  * expected by the HAL driver.
9  */
10 
11 #ifndef SL_DEVICE_INIT_DCDC_CONFIG_H
12 #define SL_DEVICE_INIT_DCDC_CONFIG_H
13 
14 #include <zephyr/devicetree.h>
15 
16 #if DT_HAS_COMPAT_STATUS_OKAY(silabs_series2_dcdc)
17 
18 #define DCDC_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(silabs_series2_dcdc)
19 
20 #define SL_DEVICE_INIT_DCDC_ENABLE DT_PROP(DCDC_NODE, regulator_boot_on)
21 #define SL_DEVICE_INIT_DCDC_BYPASS DT_PROP(DCDC_NODE, regulator_allow_bypass)
22 
23 #define SL_DEVICE_INIT_DCDC_TYPE DT_PROP_OR(DCDC_NODE, regulator_initial_mode, 0)
24 
25 #define SL_DEVICE_INIT_DCDC_BOOST_OUTPUT DT_ENUM_IDX(DCDC_NODE, regulator_init_microvolt)
26 
27 #define SL_DEVICE_INIT_DCDC_PFMX_IPKVAL_OVERRIDE                                                   \
28 	DT_NODE_HAS_PROP(DCDC_NODE, silabs_pfmx_peak_current_milliamp)
29 
30 #define SL_DEVICE_INIT_DCDC_PFMX_IPKVAL                                                            \
31 	(DT_ENUM_IDX(DCDC_NODE, silabs_pfmx_peak_current_milliamp) + 3)
32 
33 #endif /* DT_HAS_COMPAT_STATUS_OKAY */
34 
35 #endif /* SL_DEVICE_INIT_DCDC_CONFIG_H */
36