@@ -343,28 +343,8 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do
343343 goto err ;
344344 }
345345
346+ #ifdef CONFIG_NRF70_SCAN_ONLY
346347 if (reg_domain -> oper == WIFI_MGMT_SET ) {
347- #ifndef CONFIG_NRF70_RADIO_TEST
348- #ifdef CONFIG_NRF70_STA_MODE
349- /* Need to check if WPA supplicant is initialized or not.
350- * Must be checked when CONFIG_WIFI_NM_WPA_SUPPLICANT is enabled.
351- * Not applicable for RADIO_TEST or when
352- * CONFIG_WIFI_NM_WPA_SUPPLICANT is not enabled.
353- */
354- /* It is possbile that during supplicant initialization driver may
355- * get the command. lock will try to ensure that supplicant
356- * initialization is complete.
357- */
358- k_mutex_lock (& vif_ctx_zep -> vif_lock , K_FOREVER );
359- if ((!vif_ctx_zep -> supp_drv_if_ctx ) ||
360- (!wifi_nm_get_instance_iface (vif_ctx_zep -> zep_net_if_ctx ))) {
361- LOG_ERR ("%s: WPA supplicant initialization not complete yet" , __func__ );
362- k_mutex_unlock (& vif_ctx_zep -> vif_lock );
363- goto err ;
364- }
365- k_mutex_unlock (& vif_ctx_zep -> vif_lock );
366- #endif /* CONFIG_NRF70_STA_MODE */
367- #endif /* !CONFIG_NRF70_RADIO_TEST */
368348 memcpy (reg_domain_info .alpha2 , reg_domain -> country_code , WIFI_COUNTRY_CODE_LEN );
369349
370350 reg_domain_info .force = reg_domain -> force ;
@@ -374,36 +354,39 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do
374354 LOG_ERR ("%s: Failed to set regulatory domain" , __func__ );
375355 goto err ;
376356 }
377- } else if (reg_domain -> oper == WIFI_MGMT_GET ) {
378357
379- if (!reg_domain -> chan_info ) {
380- LOG_ERR ("%s: Invalid regulatory info (NULL)\n" , __func__ );
381- goto err ;
382- }
358+ goto err ;
359+ }
360+ #endif
361+ if (reg_domain -> oper != WIFI_MGMT_GET ) {
362+ LOG_ERR ("%s: Invalid operation: %d" , __func__ , reg_domain -> oper );
363+ goto err ;
364+ }
383365
384- status = nrf_wifi_fmac_get_reg (fmac_dev_ctx , & reg_domain_info );
385- if (status != NRF_WIFI_STATUS_SUCCESS ) {
386- LOG_ERR ("%s: Failed to get regulatory domain" , __func__ );
387- goto err ;
388- }
366+ if (!reg_domain -> chan_info ) {
367+ LOG_ERR ("%s: Invalid regulatory info (NULL)\n" , __func__ );
368+ goto err ;
369+ }
389370
390- memcpy (reg_domain -> country_code , reg_domain_info .alpha2 , WIFI_COUNTRY_CODE_LEN );
391- reg_domain -> num_channels = reg_domain_info .reg_chan_count ;
392-
393- for (chan_idx = 0 ; chan_idx < reg_domain_info .reg_chan_count ; chan_idx ++ ) {
394- chan_info = & (reg_domain -> chan_info [chan_idx ]);
395- reg_domain_chan_info = & (reg_domain_info .reg_chan_info [chan_idx ]);
396- chan_info -> center_frequency = reg_domain_chan_info -> center_frequency ;
397- chan_info -> dfs = !!reg_domain_chan_info -> dfs ;
398- chan_info -> max_power = reg_domain_chan_info -> max_power ;
399- chan_info -> passive_only = !!reg_domain_chan_info -> passive_channel ;
400- chan_info -> supported = !!reg_domain_chan_info -> supported ;
401- }
402- } else {
403- LOG_ERR ("%s: Invalid operation: %d" , __func__ , reg_domain -> oper );
371+ status = nrf_wifi_fmac_get_reg (fmac_dev_ctx , & reg_domain_info );
372+ if (status != NRF_WIFI_STATUS_SUCCESS ) {
373+ LOG_ERR ("%s: Failed to get regulatory domain" , __func__ );
404374 goto err ;
405375 }
406376
377+ memcpy (reg_domain -> country_code , reg_domain_info .alpha2 , WIFI_COUNTRY_CODE_LEN );
378+ reg_domain -> num_channels = reg_domain_info .reg_chan_count ;
379+
380+ for (chan_idx = 0 ; chan_idx < reg_domain_info .reg_chan_count ; chan_idx ++ ) {
381+ chan_info = & (reg_domain -> chan_info [chan_idx ]);
382+ reg_domain_chan_info = & (reg_domain_info .reg_chan_info [chan_idx ]);
383+ chan_info -> center_frequency = reg_domain_chan_info -> center_frequency ;
384+ chan_info -> dfs = !!reg_domain_chan_info -> dfs ;
385+ chan_info -> max_power = reg_domain_chan_info -> max_power ;
386+ chan_info -> passive_only = !!reg_domain_chan_info -> passive_channel ;
387+ chan_info -> supported = !!reg_domain_chan_info -> supported ;
388+ }
389+
407390 ret = 0 ;
408391err :
409392 k_mutex_unlock (& reg_lock );
@@ -850,7 +833,7 @@ static struct wifi_mgmt_ops nrf_wifi_mgmt_ops = {
850833 .get_power_save_config = nrf_wifi_get_power_save_config ,
851834 .set_rts_threshold = nrf_wifi_set_rts_threshold ,
852835 .get_rts_threshold = nrf_wifi_get_rts_threshold ,
853- #endif /* CONFIG_NRF70_STA_MODE */
836+ #endif
854837#ifdef CONFIG_NRF70_SYSTEM_WITH_RAW_MODES
855838 .mode = nrf_wifi_mode ,
856839#endif
@@ -883,6 +866,8 @@ static struct zep_wpa_supp_dev_ops wpa_supp_ops = {
883866 .register_frame = nrf_wifi_supp_register_frame ,
884867 .get_capa = nrf_wifi_supp_get_capa ,
885868 .get_conn_info = nrf_wifi_supp_get_conn_info ,
869+ .set_country = nrf_wifi_supp_set_country ,
870+ .get_country = nrf_wifi_supp_get_country ,
886871#ifdef CONFIG_NRF70_AP_MODE
887872 .init_ap = nrf_wifi_wpa_supp_init_ap ,
888873 .start_ap = nrf_wifi_wpa_supp_start_ap ,
0 commit comments