feat(llcc68): add configurable RF switch modes

Add an explicit rf-switch-mode devicetree property for LLCC68 instances, covering no switch handling, TXEN/RXEN complementary GPIO control, and DIO2 single-pin control for PE4259-style RF switches. Preserve the existing default behavior with an auto Kconfig default that only enables complementary GPIO handling when both TXEN and RXEN GPIOs are present.

Resolve the RF switch mode into llcc68_config at build time and validate incompatible devicetree combinations with BUILD_ASSERT checks. Configure optional RXEN GPIO handling for DIO2 single-pin mode and keep DIO2 RF switch control disabled unless that mode is selected.

Replace the old fire-and-forget TX/RX GPIO helper with a result-returning mode-aware RF switch state helper, and apply it across standby, sleep, CAD, TX, RX, continuous wave, infinite preamble, and modem init paths.

Add SetRxDutyCycle support with explicit raw 24-bit LLCC68 period units, plus helpers and a millisecond wrapper for callers that work in time units. Select the RX RF path before issuing the duty-cycle command so RXEN stays valid for duty-cycle listen windows.
This commit is contained in:
2026-06-01 18:05:31 +08:00
parent 4fb41a3211
commit 1c3626d58b
7 changed files with 250 additions and 25 deletions
+34 -2
View File
@@ -1,9 +1,9 @@
DT_COMPAT_SEMTECH_LLCC68 := "semtech,llcc68"
DT_COMPAT_SEMTECH_LLCC68_WEIHUA := "semtech,llcc68-weihua"
config LLCC68
bool "Semtech LLCC68 LoRa Radio Driver"
depends on SPI && GPIO
default $(dt_compat_enabled,$(DT_COMPAT_SEMTECH_LLCC68))
default $(dt_compat_enabled,$(DT_COMPAT_SEMTECH_LLCC68_WEIHUA))
help
Enable the Semtech LLCC68 LoRa Radio Driver.
@@ -32,6 +32,38 @@ config LLCC68_ALWAYS_USE_SX1262_HIGH_PA
When enabled, the LLCC68/SX1262/SX1261 driver always chooses high
power amplifier settings instead of selecting them from chip version.
choice LLCC68_RF_SWITCH_DEFAULT
prompt "Default LLCC68 RF switch mode"
default LLCC68_RF_SWITCH_DEFAULT_AUTO
help
Default RF switch mode for LLCC68 devicetree nodes that do not set
rf-switch-mode.
config LLCC68_RF_SWITCH_DEFAULT_AUTO
bool "Auto"
help
Preserve legacy behavior: use complementary GPIO control when both
tx-enable-gpios and rx-enable-gpios are present, otherwise disable RF
switch control.
config LLCC68_RF_SWITCH_DEFAULT_NONE
bool "None"
help
Disable RF switch control unless rf-switch-mode is set in devicetree.
config LLCC68_RF_SWITCH_DEFAULT_GPIO_COMPLEMENTARY
bool "TXEN/RXEN complementary GPIO"
help
Use MCU GPIOs for complementary TXEN/RXEN RF switch control by default.
config LLCC68_RF_SWITCH_DEFAULT_DIO2_SINGLE
bool "DIO2 single-pin"
help
Use LLCC68 DIO2 RF switch control by default. DIO2 drives TXEN, while
RXEN is held active externally or by rx-enable-gpios.
endchoice
module = LLCC68
module-str = llcc68