Skip to content

Commit e338657

Browse files
asmellbykartben
authored andcommitted
modules: hal_silabs: Apply PA configuration from device tree
Propagate device tree configuration for the power amplifier to the HAL configuration header. Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
1 parent 6002ecf commit e338657

File tree

5 files changed

+77
-2
lines changed

5 files changed

+77
-2
lines changed

modules/hal_silabs/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ config HAS_SILABS_SISDK
2222
config HAS_SILABS_SI32
2323
bool
2424
select HAS_CMSIS_CORE
25+
26+
rsource "*/Kconfig"

modules/hal_silabs/simplicity_sdk/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ endfunction()
3939

4040
if(CONFIG_SOC_GECKO_HAS_RADIO)
4141
zephyr_include_directories_ifdef(CONFIG_SOC_FAMILY_SILABS_S2
42-
${RADIO_DIR}/rail_lib/plugin/pa-conversions/efr32xg${SILABS_DEVICE_FAMILY_NUMBER}/config
4342
${RADIO_DIR}/rail_lib/chip/efr32/efr32xg2x
4443
)
4544

45+
zephyr_compile_definitions(
46+
SL_RAIL_UTIL_PA_CONFIG_HEADER="sl_rail_util_pa_config.h"
47+
)
48+
4649
zephyr_include_directories(
4750
${RADIO_DIR}/rail_lib/common
4851
${RADIO_DIR}/rail_lib/plugin/pa-conversions
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) 2025 Silicon Laboratories Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
menu "SiSDK configuration"
5+
depends on HAS_SILABS_SISDK
6+
7+
config RAIL_PA_CURVE_HEADER
8+
string "RAIL PA custom curve header file"
9+
default "pa_curves_efr32.h"
10+
help
11+
Name of custom PA curve header file for use by PA initialization.
12+
See AN1127 for information on how to create a custom PA curve.
13+
The header file must be available on the include path.
14+
15+
config RAIL_PA_CURVE_TYPES_HEADER
16+
string "RAIL PA curve types header file"
17+
default "pa_curve_types_efr32.h"
18+
help
19+
Name of custom PA curve type header file for use by PA initialization.
20+
See AN1127 for information on how to create a custom PA curve.
21+
The header file must be available on the include path.
22+
23+
config RAIL_PA_ENABLE_CALIBRATION
24+
bool "RAIL PA: apply factory calibration offset"
25+
default y
26+
help
27+
Ensure that the PA power remains constant chip-to-chip by applying factory
28+
calibration. This option is enabled by default, and is recommended for all
29+
Series 2 devices.
30+
31+
endmenu
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2025 Silicon Laboratories Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* This configuration header is used by the HAL driver rail_util_pa from hal_silabs,
7+
* invoked through the init function of the hci_silabs_efr32 Bluetooth driver.
8+
* DeviceTree and Kconfig options are converted to config macros expected by the HAL driver.
9+
*/
10+
11+
#ifndef SL_RAIL_UTIL_PA_CONFIG_H
12+
#define SL_RAIL_UTIL_PA_CONFIG_H
13+
14+
#include <zephyr/devicetree.h>
15+
#include "rail_types.h"
16+
17+
#define SL_RAIL_UTIL_PA_POWER_DECI_DBM (DT_PROP(DT_NODELABEL(radio), pa_initial_power_dbm) * 10)
18+
#define SL_RAIL_UTIL_PA_RAMP_TIME_US DT_PROP(DT_NODELABEL(radio), pa_ramp_time_us)
19+
#define SL_RAIL_UTIL_PA_VOLTAGE_MV DT_PROP(DT_NODELABEL(radio), pa_voltage_mv)
20+
21+
#if DT_NODE_HAS_PROP(DT_NODELABEL(radio), pa_2p4ghz)
22+
#define SL_RAIL_UTIL_PA_SELECTION_2P4GHZ \
23+
CONCAT(RAIL_TX_POWER_MODE_2P4GIG_, DT_STRING_UPPER_TOKEN(DT_NODELABEL(radio), pa_2p4ghz))
24+
#else
25+
#define SL_RAIL_UTIL_PA_SELECTION_2P4GHZ RAIL_TX_POWER_MODE_NONE
26+
#endif
27+
28+
#if DT_NODE_HAS_PROP(DT_NODELABEL(radio), pa_subghz)
29+
#define SL_RAIL_UTIL_PA_SELECTION_SUBGHZ \
30+
CONCAT(RAIL_TX_POWER_MODE_SUBGIG_, DT_STRING_UPPER_TOKEN(DT_NODELABEL(radio), pa_subghz))
31+
#else
32+
#define SL_RAIL_UTIL_PA_SELECTION_SUBGHZ RAIL_TX_POWER_MODE_NONE
33+
#endif
34+
35+
#define SL_RAIL_UTIL_PA_CURVE_HEADER CONFIG_RAIL_PA_CURVE_HEADER
36+
#define SL_RAIL_UTIL_PA_CURVE_TYPES CONFIG_RAIL_PA_CURVE_TYPES_HEADER
37+
#define SL_RAIL_UTIL_PA_CALIBRATION_ENABLE CONFIG_RAIL_PA_ENABLE_CALIBRATION
38+
39+
#endif /* SL_RAIL_UTIL_PA_CONFIG_H */

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ manifest:
228228
groups:
229229
- hal
230230
- name: hal_silabs
231-
revision: 5719804e682e9e4ba1d1f60c824af92a58ce1c2b
231+
revision: df3414d50b321e11b5fb92f76c994aa07141239f
232232
path: modules/hal/silabs
233233
groups:
234234
- hal

0 commit comments

Comments
 (0)