drivers: lora: Add ability to force enable LDRO

Allows Enabling LDRO all the time via DTS

Signed-off-by: Camille BAUD <mail@massdriver.space>
This commit is contained in:
Camille BAUD
2025-12-13 01:08:12 +01:00
committed by Fabio Baltieri
parent cd65845ba2
commit bc07d91cca
6 changed files with 17 additions and 1 deletions

View File

@@ -81,7 +81,8 @@ int lbm_lora_config(const struct device *dev, struct lora_modem_config *lora_con
.mod_params = {
.sf = lora_config->datarate,
.cr = lora_config->coding_rate,
.ldro = LORA_LDRO(lora_config->datarate, lora_config->bandwidth),
.ldro = config->force_ldro ? 1 : LORA_LDRO(lora_config->datarate,
lora_config->bandwidth),
},
.pkt_params = {
.preamble_len_in_symb = lora_config->preamble_len,

View File

@@ -34,6 +34,7 @@ enum lbm_modem_mode {
struct lbm_lora_config_common {
/* LBM radio abstration layer structure */
ralf_t ralf;
bool force_ldro;
};
/* Common LBM modem data, must be first element of device data */

View File

@@ -574,6 +574,7 @@ static int sx126x_init(const struct device *dev)
#define SX126X_DEFINE(node_id, sx_variant) \
static const struct lbm_sx126x_config config_##node_id = { \
.lbm_common.ralf = RALF_SX126X_INSTANTIATE(DEVICE_DT_GET(node_id)), \
.lbm_common.force_ldro = DT_PROP(node_id, force_ldro), \
.spi = SPI_DT_SPEC_GET( \
node_id, SPI_WORD_SET(8) | SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB), \
.reset = GPIO_DT_SPEC_GET(node_id, reset_gpios), \

View File

@@ -467,6 +467,7 @@ static int sx127x_driver_init(const struct device *dev)
static struct lbm_sx127x_data data_##node_id; \
static const struct lbm_sx127x_config config_##node_id = { \
.lbm_common.ralf = RALF_SX127X_INSTANTIATE(&data_##node_id.radio), \
.lbm_common.force_ldro = DT_PROP(node_id, force_ldro), \
.spi = SPI_DT_SPEC_GET( \
node_id, SPI_WORD_SET(8) | SPI_OP_MODE_MASTER | SPI_TRANSFER_MSB), \
.reset = GPIO_DT_SPEC_GET(node_id, reset_gpios), \

View File

@@ -70,3 +70,9 @@ properties:
type: boolean
description: |
Use the internal LDO instead of the internal DCDC. Increases power consumption.
force-ldro:
type: boolean
description: |
Force usage of Low Data Rate Optimization even in cases where the symbol time is shorter than
16.38ms. Useful for designs using no TCXO or with bad heat dissipation.

View File

@@ -61,3 +61,9 @@ properties:
type: int
description: |
Delay which has to be applied after enabling TCXO power.
force-ldro:
type: boolean
description: |
Force usage of Low Data Rate Optimization even in cases where the symbol time is shorter than
16.38ms. Useful for designs using no TCXO or with bad heat dissipation.