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>
This commit is contained in:
Aksel Skauge Mellbye 2025-01-31 08:53:16 +01:00 committed by Benjamin Cabé
commit e338657642
5 changed files with 77 additions and 2 deletions

View file

@ -22,3 +22,5 @@ config HAS_SILABS_SISDK
config HAS_SILABS_SI32
bool
select HAS_CMSIS_CORE
rsource "*/Kconfig"

View file

@ -39,10 +39,13 @@ endfunction()
if(CONFIG_SOC_GECKO_HAS_RADIO)
zephyr_include_directories_ifdef(CONFIG_SOC_FAMILY_SILABS_S2
${RADIO_DIR}/rail_lib/plugin/pa-conversions/efr32xg${SILABS_DEVICE_FAMILY_NUMBER}/config
${RADIO_DIR}/rail_lib/chip/efr32/efr32xg2x
)
zephyr_compile_definitions(
SL_RAIL_UTIL_PA_CONFIG_HEADER="sl_rail_util_pa_config.h"
)
zephyr_include_directories(
${RADIO_DIR}/rail_lib/common
${RADIO_DIR}/rail_lib/plugin/pa-conversions

View file

@ -0,0 +1,31 @@
# Copyright (c) 2025 Silicon Laboratories Inc.
# SPDX-License-Identifier: Apache-2.0
menu "SiSDK configuration"
depends on HAS_SILABS_SISDK
config RAIL_PA_CURVE_HEADER
string "RAIL PA custom curve header file"
default "pa_curves_efr32.h"
help
Name of custom PA curve header file for use by PA initialization.
See AN1127 for information on how to create a custom PA curve.
The header file must be available on the include path.
config RAIL_PA_CURVE_TYPES_HEADER
string "RAIL PA curve types header file"
default "pa_curve_types_efr32.h"
help
Name of custom PA curve type header file for use by PA initialization.
See AN1127 for information on how to create a custom PA curve.
The header file must be available on the include path.
config RAIL_PA_ENABLE_CALIBRATION
bool "RAIL PA: apply factory calibration offset"
default y
help
Ensure that the PA power remains constant chip-to-chip by applying factory
calibration. This option is enabled by default, and is recommended for all
Series 2 devices.
endmenu

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* This configuration header is used by the HAL driver rail_util_pa from hal_silabs,
* invoked through the init function of the hci_silabs_efr32 Bluetooth driver.
* DeviceTree and Kconfig options are converted to config macros expected by the HAL driver.
*/
#ifndef SL_RAIL_UTIL_PA_CONFIG_H
#define SL_RAIL_UTIL_PA_CONFIG_H
#include <zephyr/devicetree.h>
#include "rail_types.h"
#define SL_RAIL_UTIL_PA_POWER_DECI_DBM (DT_PROP(DT_NODELABEL(radio), pa_initial_power_dbm) * 10)
#define SL_RAIL_UTIL_PA_RAMP_TIME_US DT_PROP(DT_NODELABEL(radio), pa_ramp_time_us)
#define SL_RAIL_UTIL_PA_VOLTAGE_MV DT_PROP(DT_NODELABEL(radio), pa_voltage_mv)
#if DT_NODE_HAS_PROP(DT_NODELABEL(radio), pa_2p4ghz)
#define SL_RAIL_UTIL_PA_SELECTION_2P4GHZ \
CONCAT(RAIL_TX_POWER_MODE_2P4GIG_, DT_STRING_UPPER_TOKEN(DT_NODELABEL(radio), pa_2p4ghz))
#else
#define SL_RAIL_UTIL_PA_SELECTION_2P4GHZ RAIL_TX_POWER_MODE_NONE
#endif
#if DT_NODE_HAS_PROP(DT_NODELABEL(radio), pa_subghz)
#define SL_RAIL_UTIL_PA_SELECTION_SUBGHZ \
CONCAT(RAIL_TX_POWER_MODE_SUBGIG_, DT_STRING_UPPER_TOKEN(DT_NODELABEL(radio), pa_subghz))
#else
#define SL_RAIL_UTIL_PA_SELECTION_SUBGHZ RAIL_TX_POWER_MODE_NONE
#endif
#define SL_RAIL_UTIL_PA_CURVE_HEADER CONFIG_RAIL_PA_CURVE_HEADER
#define SL_RAIL_UTIL_PA_CURVE_TYPES CONFIG_RAIL_PA_CURVE_TYPES_HEADER
#define SL_RAIL_UTIL_PA_CALIBRATION_ENABLE CONFIG_RAIL_PA_ENABLE_CALIBRATION
#endif /* SL_RAIL_UTIL_PA_CONFIG_H */

View file

@ -228,7 +228,7 @@ manifest:
groups:
- hal
- name: hal_silabs
revision: 5719804e682e9e4ba1d1f60c824af92a58ce1c2b
revision: df3414d50b321e11b5fb92f76c994aa07141239f
path: modules/hal/silabs
groups:
- hal