Commit 5767998d authored by Eduardo Montoya's avatar Eduardo Montoya Committed by Carles Cufi
Browse files

drivers: ieee802154: nrf: make selective tx power the default



Remove `IEEE802154_SELECTIVE_TXPOWER` option.

Cache the tx power value in nRF5 driver and make use of it on each
operation.

Signed-off-by: default avatarEduardo Montoya <eduardo.montoya@nordicsemi.no>
Signed-off-by: default avatarJędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
parent 1bbaaeff
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -182,6 +182,8 @@ Drivers and Sensors

* IEEE 802.15.4

  * Removed :kconfig:option:`CONFIG_IEEE802154_SELECTIVE_TXPOWER` Kconfig option.

* Interrupt Controller

* Input
+0 −5
Original line number Diff line number Diff line
@@ -98,11 +98,6 @@ config IEEE802154_CSL_DEBUG
	help
	  Enable support for CSL debugging by avoiding sleep state in favor of receive state.

config IEEE802154_SELECTIVE_TXPOWER
	bool "Support selective TX power setting"
	help
	  Enable support for selectively setting TX power for every transmission request.

module = IEEE802154_DRIVER
module-str = IEEE 802.15.4 driver
module-help = Sets log level for IEEE 802.15.4 Device Drivers.
+11 −13
Original line number Diff line number Diff line
@@ -375,7 +375,7 @@ static int nrf5_set_txpower(const struct device *dev, int16_t dbm)

	LOG_DBG("%d", dbm);

	nrf_802154_tx_power_set(dbm);
	nrf5_data.txpwr = dbm;

	return 0;
}
@@ -454,10 +454,8 @@ static bool nrf5_tx_immediate(struct net_pkt *pkt, uint8_t *payload, bool cca)
		},
		.cca = cca,
		.tx_power = {
			.use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER),
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
			.power = net_pkt_ieee802154_txpwr(pkt),
#endif
			.use_metadata_value = true,
			.power = nrf5_data.txpwr,
		},
	};

@@ -473,10 +471,8 @@ static bool nrf5_tx_csma_ca(struct net_pkt *pkt, uint8_t *payload)
			.dynamic_data_is_set = net_pkt_ieee802154_mac_hdr_rdy(pkt),
		},
		.tx_power = {
			.use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER),
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
			.power = net_pkt_ieee802154_txpwr(pkt),
#endif
			.use_metadata_value = true,
			.power = nrf5_data.txpwr,
		},
	};

@@ -519,10 +515,8 @@ static bool nrf5_tx_at(struct nrf5_802154_data *nrf5_radio, struct net_pkt *pkt,
		.cca = cca,
		.channel = nrf_802154_channel_get(),
		.tx_power = {
			.use_metadata_value = IS_ENABLED(CONFIG_IEEE802154_SELECTIVE_TXPOWER),
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
			.power = net_pkt_ieee802154_txpwr(pkt),
#endif
			.use_metadata_value = true,
			.power = nrf5_data.txpwr,
		},
#if defined(CONFIG_IEEE802154_NRF5_MULTIPLE_CCA)
		.extra_cca_attempts = max_extra_cca_attempts,
@@ -660,6 +654,8 @@ static int nrf5_start(const struct device *dev)
{
	ARG_UNUSED(dev);

	nrf_802154_tx_power_set(nrf5_data.txpwr);

	if (!nrf_802154_receive()) {
		LOG_ERR("Failed to enter receive state");
		return -EIO;
@@ -702,6 +698,8 @@ static int nrf5_continuous_carrier(const struct device *dev)
{
	ARG_UNUSED(dev);

	nrf_802154_tx_power_set(nrf5_data.txpwr);

	if (!nrf_802154_continuous_carrier()) {
		LOG_ERR("Failed to enter continuous carrier state");
		return -EIO;
+3 −0
Original line number Diff line number Diff line
@@ -97,6 +97,9 @@ struct nrf5_802154_data {
	uint8_t max_extra_cca_attempts;
#endif

	/* The TX power in dBm. */
	int8_t txpwr;

#if defined(CONFIG_NRF_802154_SER_HOST) && defined(CONFIG_IEEE802154_CSL_ENDPOINT)
	/* The last configured value of CSL period in units of 10 symbols. */
	uint32_t csl_period;
+0 −18
Original line number Diff line number Diff line
@@ -59,12 +59,6 @@ struct net_pkt_cb_ieee802154 {
			 */
			uint8_t rssi;
		};
#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
		/* TX packets */
		struct {
			int8_t txpwr; /* TX power in dBm. */
		};
#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */
	};

	/* Flags */
@@ -185,18 +179,6 @@ static inline void net_pkt_set_ieee802154_rssi_dbm(struct net_pkt *pkt, int16_t
	CODE_UNREACHABLE;
}

#if defined(CONFIG_IEEE802154_SELECTIVE_TXPOWER)
static inline int8_t net_pkt_ieee802154_txpwr(struct net_pkt *pkt)
{
	return net_pkt_cb_ieee802154(pkt)->txpwr;
}

static inline void net_pkt_set_ieee802154_txpwr(struct net_pkt *pkt, int8_t txpwr)
{
	net_pkt_cb_ieee802154(pkt)->txpwr = txpwr;
}
#endif /* CONFIG_IEEE802154_SELECTIVE_TXPOWER */

static inline bool net_pkt_ieee802154_ack_fpb(struct net_pkt *pkt)
{
	return net_pkt_cb_ieee802154(pkt)->ack_fpb;
Loading