Skip to content

Commit 4ff669a

Browse files
krish2718nordicjm
authored andcommitted
[nrf fromtree] drivers: nrf_wifi: Rejig band config
nRF71 supports tri-band, so, to cater both nRF70 and nRF71, rejig the configuration and add a helper to convert from Kconfig to the interface structs. Signed-off-by: Chaitanya Tata <[email protected]> (cherry picked from commit 9a13407)
1 parent 30478c4 commit 4ff669a

File tree

3 files changed

+57
-18
lines changed

3 files changed

+57
-18
lines changed

drivers/wifi/nrf_wifi/Kconfig.nrfwifi

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -665,28 +665,27 @@ config WIFI_NRF70_SCAN_TIMEOUT_S
665665
int "Scan timeout in seconds"
666666
default 30
667667

668-
menu "nRF Wi-Fi operation band(s)"
669-
visible if !NRF70_2_4G_ONLY
668+
choice NRF_WIFI_OP_BAND
669+
prompt "nRF Wi-Fi operation bands"
670+
default NRF_WIFI_2G_BAND if NRF70_2_4G_ONLY
671+
default NRF_WIFI_ALL_BAND
672+
673+
config NRF_WIFI_ALL_BAND
674+
bool "Set operation band to all supported bands"
670675

671676
config NRF_WIFI_2G_BAND
672677
bool "Set operation band to 2.4GHz"
673-
default y if NRF70_2_4G_ONLY
674678

675679
config NRF_WIFI_5G_BAND
676680
bool "Set operation band to 5GHz"
677-
depends on !NRF70_2_4G_ONLY
678-
679-
config NRF_WIFI_OP_BAND
680-
int "Options to set operation band"
681-
default 1 if NRF_WIFI_2G_BAND
682-
default 2 if NRF_WIFI_5G_BAND
683-
default 3
684-
help
685-
Set this option to select frequency band
686-
1 - 2.4GHz
687-
2 - 5GHz
688-
3 - All ( 2.4GHz and 5GHz )
689-
endmenu
681+
if NRF71_ON_IPC
682+
config NRF_WIFI_6G_BAND
683+
bool "Set operation band to 6GHz"
684+
685+
config NRF_WIFI_DUAL_BAND
686+
bool "Set operation band to 2.4GHz and 5GHz"
687+
endif # NRF71_ON_IPC
688+
endchoice
690689

691690
config NRF_WIFI_IFACE_MTU
692691
int "MTU for Wi-Fi interface"

drivers/wifi/nrf_wifi/off_raw_tx/src/off_raw_tx_api.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,25 @@ static int bytes_from_str(uint8_t *buf, int buf_len, const char *src)
128128
}
129129
#endif /* CONFIG_WIFI_FIXED_MAC_ADDRESS_ENABLED */
130130

131+
static enum op_band get_nrf_wifi_op_band(void)
132+
{
133+
if (IS_ENABLED(CONFIG_NRF_WIFI_2G_BAND)) {
134+
return BAND_24G;
135+
}
136+
#ifdef CONFIG_NRF71_ON_IPC
137+
if (IS_ENABLED(CONFIG_NRF_WIFI_5G_BAND)) {
138+
return BAND_5G;
139+
}
140+
if (IS_ENABLED(CONFIG_NRF_WIFI_6G_BAND)) {
141+
return BAND_6G;
142+
}
143+
if (IS_ENABLED(CONFIG_NRF_WIFI_DUAL_BAND)) {
144+
return BAND_DUAL;
145+
}
146+
#endif /* CONFIG_NRF71_ON_IPC */
147+
return BAND_ALL;
148+
}
149+
131150
int nrf70_off_raw_tx_init(uint8_t *mac_addr, unsigned char *country_code)
132151
{
133152
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
@@ -138,6 +157,7 @@ int nrf70_off_raw_tx_init(uint8_t *mac_addr, unsigned char *country_code)
138157
struct nrf_wifi_board_params board_params;
139158
unsigned int fw_ver = 0;
140159
k_spinlock_key_t key;
160+
enum op_band op_band = get_nrf_wifi_op_band();
141161

142162
/* The OSAL layer needs to be initialized before any other initialization
143163
* so that other layers (like FW IF,HW IF etc) have access to OS ops
@@ -202,7 +222,7 @@ int nrf70_off_raw_tx_init(uint8_t *mac_addr, unsigned char *country_code)
202222
HW_SLEEP_ENABLE,
203223
#endif /* CONFIG_NRF_WIFI_LOW_POWER */
204224
NRF_WIFI_DEF_PHY_CALIB,
205-
CONFIG_NRF_WIFI_OP_BAND,
225+
op_band,
206226
IS_ENABLED(CONFIG_NRF_WIFI_BEAMFORMING),
207227
&ctrl_params,
208228
&ceil_params,

drivers/wifi/nrf_wifi/src/fmac_main.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,12 +587,32 @@ void configure_board_dep_params(struct nrf_wifi_board_params *board_params)
587587
}
588588
#endif /* CONFIG_NRF71_ON_IPC */
589589

590+
static enum op_band get_nrf_wifi_op_band(void)
591+
{
592+
if (IS_ENABLED(CONFIG_NRF_WIFI_2G_BAND)) {
593+
return BAND_24G;
594+
}
595+
#ifdef CONFIG_NRF71_ON_IPC
596+
if (IS_ENABLED(CONFIG_NRF_WIFI_5G_BAND)) {
597+
return BAND_5G;
598+
}
599+
600+
if (IS_ENABLED(CONFIG_NRF_WIFI_6G_BAND)) {
601+
return BAND_6G;
602+
}
603+
if (IS_ENABLED(CONFIG_NRF_WIFI_DUAL_BAND)) {
604+
return BAND_DUAL;
605+
}
606+
#endif /* CONFIG_NRF71_ON_IPC */
607+
return BAND_ALL;
608+
}
609+
590610
enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep)
591611
{
592612
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
593613
struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL;
594614
void *rpu_ctx = NULL;
595-
enum op_band op_band = CONFIG_NRF_WIFI_OP_BAND;
615+
enum op_band op_band = get_nrf_wifi_op_band();
596616
#ifdef CONFIG_NRF_WIFI_LOW_POWER
597617
int sleep_type = -1;
598618

0 commit comments

Comments
 (0)