diff --git a/target_if/init_deinit/inc/service_ready_param.h b/target_if/init_deinit/inc/service_ready_param.h index 8b0b721dd6..0357e8b313 100644 --- a/target_if/init_deinit/inc/service_ready_param.h +++ b/target_if/init_deinit/inc/service_ready_param.h @@ -442,6 +442,7 @@ struct wlan_psoc_host_service_ext_param { * @max_users_ul_mumimo: Max number of users per-PPDU for Uplink MU-MIMO * @twt_ack_support_cap: TWT ack capability support * @target_cap_flags: Rx peer metadata version number used by target + * @afc_dev_type: AFC deployment type */ struct wlan_psoc_host_service_ext2_param { uint8_t reg_db_version_major; @@ -459,6 +460,9 @@ struct wlan_psoc_host_service_ext2_param { uint16_t max_users_ul_mumimo; uint32_t twt_ack_support_cap:1; uint32_t target_cap_flags; +#if defined(CONFIG_AFC_SUPPORT) + enum reg_afc_dev_deploy_type afc_dev_type; +#endif }; #endif /* _SERVICE_READY_PARAM_H_*/ diff --git a/target_if/init_deinit/src/init_cmd_api.c b/target_if/init_deinit/src/init_cmd_api.c index 1d06bd11ad..1de368bc79 100644 --- a/target_if/init_deinit/src/init_cmd_api.c +++ b/target_if/init_deinit/src/init_cmd_api.c @@ -414,6 +414,47 @@ next_mac_phy_cap: } } +#if defined(CONFIG_AFC_SUPPORT) +/** + * init_deinit_derive_afc_dev_type_param() - Derive AFC init deployment param + * + * @psoc: PSOC object + * @init_param: Pointer to init param + * + * Return: void + */ +static void init_deinit_derive_afc_dev_type_param( + struct wlan_objmgr_psoc *psoc, + struct wmi_init_cmd_param *init_param) +{ + enum reg_afc_dev_deploy_type reg_afc_dev_type; + target_resource_config *tgt_cfg; + QDF_STATUS ret_val; + + tgt_cfg = init_param->res_cfg; + + ret_val = target_if_reg_get_afc_dev_type(psoc, + ®_afc_dev_type); + + if (QDF_IS_STATUS_ERROR(ret_val)) { + target_if_err("get afc dev type failed"); + return; + } + tgt_cfg->afc_indoor_support = false; + tgt_cfg->afc_outdoor_support = false; + if (reg_afc_dev_type == AFC_DEPLOYMENT_INDOOR) + tgt_cfg->afc_indoor_support = true; + else if (reg_afc_dev_type == AFC_DEPLOYMENT_OUTDOOR) + tgt_cfg->afc_outdoor_support = true; +} +#else +static inline void init_deinit_derive_afc_dev_type_param( + struct wlan_objmgr_psoc *psoc, + struct wmi_init_cmd_param *init_param) +{ +} +#endif + void init_deinit_prepare_send_init_cmd( struct wlan_objmgr_psoc *psoc, struct target_psoc_info *tgt_hdl) @@ -486,6 +527,9 @@ void init_deinit_prepare_send_init_cmd( target_if_debug("0x%x\n", info->target_caps.fw_version_1); } + if (wmi_service_enabled(wmi_handle, wmi_service_ext2_msg)) + init_deinit_derive_afc_dev_type_param(psoc, &init_param); + target_if_ext_res_cfg_enable(psoc, tgt_hdl, NULL); target_if_set_reo_shared_qref_feature(psoc, info); diff --git a/target_if/init_deinit/src/init_event_handler.c b/target_if/init_deinit/src/init_event_handler.c index bac9f7d962..413ccc4b13 100644 --- a/target_if/init_deinit/src/init_event_handler.c +++ b/target_if/init_deinit/src/init_event_handler.c @@ -483,6 +483,8 @@ static int init_deinit_service_ext2_ready_event_handler(ol_scn_t scn_handle, target_if_reg_set_disable_upper_6g_edge_ch_info(psoc); + target_if_reg_set_afc_dev_type(psoc, tgt_hdl); + /* send init command */ init_deinit_set_send_init_cmd(psoc, tgt_hdl); diff --git a/target_if/regulatory/inc/target_if_reg.h b/target_if/regulatory/inc/target_if_reg.h index 2159c57475..0d25454f5d 100644 --- a/target_if/regulatory/inc/target_if_reg.h +++ b/target_if/regulatory/inc/target_if_reg.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -132,4 +133,34 @@ target_if_reg_set_disable_upper_6g_edge_ch_info(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_FAILURE; } #endif + +#if defined(CONFIG_AFC_SUPPORT) +/** + * target_if_reg_set_afc_dev_type() - set afc device deployment type + * @psoc: psoc pointer + * @tgt_hdl: target handle + * + * Return: Success or Failure + */ +QDF_STATUS +target_if_reg_set_afc_dev_type(struct wlan_objmgr_psoc *psoc, + struct target_psoc_info *tgt_hdl); + +/** + * target_if_reg_get_afc_device_type() - get afc device deployment type + * @psoc: psoc pointer + * @reg_afc_dev_type: + * Return: Success or Failure + */ +QDF_STATUS +target_if_reg_get_afc_dev_type(struct wlan_objmgr_psoc *psoc, + enum reg_afc_dev_deploy_type *reg_afc_dev_type); +#else +static inline QDF_STATUS +target_if_reg_set_afc_dev_type(struct wlan_objmgr_psoc *psoc, + struct target_psoc_info *tgt_hdl) +{ + return QDF_STATUS_E_FAILURE; +} +#endif #endif /* __TARGET_IF_REG_H__ */ diff --git a/target_if/regulatory/src/target_if_reg.c b/target_if/regulatory/src/target_if_reg.c index a3ff3b154c..682fc90e90 100644 --- a/target_if/regulatory/src/target_if_reg.c +++ b/target_if/regulatory/src/target_if_reg.c @@ -1030,6 +1030,56 @@ tgt_if_regulatory_is_upper_6g_edge_ch_disabled(struct wlan_objmgr_psoc *psoc) } #endif +#if defined(CONFIG_AFC_SUPPORT) +QDF_STATUS +target_if_reg_set_afc_dev_type(struct wlan_objmgr_psoc *psoc, + struct target_psoc_info *tgt_hdl) +{ + struct wlan_lmac_if_reg_rx_ops *reg_rx_ops; + struct tgt_info *info; + + if (!tgt_hdl) { + target_if_err("target_psoc_info is null"); + return QDF_STATUS_E_FAILURE; + } + + reg_rx_ops = target_if_regulatory_get_rx_ops(psoc); + if (!reg_rx_ops) { + target_if_err("reg_rx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + info = (&tgt_hdl->info); + + if (reg_rx_ops->reg_set_afc_dev_type) + reg_rx_ops->reg_set_afc_dev_type( + psoc, + info->service_ext2_param.afc_dev_type); + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +target_if_reg_get_afc_dev_type(struct wlan_objmgr_psoc *psoc, + enum reg_afc_dev_deploy_type *reg_afc_dev_type) +{ + struct wlan_lmac_if_reg_rx_ops *reg_rx_ops; + + reg_rx_ops = target_if_regulatory_get_rx_ops(psoc); + if (!reg_rx_ops) { + target_if_err("reg_rx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + if (reg_rx_ops->reg_get_afc_dev_type) + reg_rx_ops->reg_get_afc_dev_type( + psoc, + reg_afc_dev_type); + + return QDF_STATUS_SUCCESS; +} +#endif + /** * tgt_if_reg_is_chip_11be_cap() - Finds out if the hardware is capable * of 11BE. The capability bit is read from mac_phy_cap populated by the diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index c9df4876f8..5b369cd816 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -5827,6 +5827,8 @@ struct wmi_host_fw_abi_ver { * inclusive of SP power mode. * @afc_timer_check_disable: Disables AFC Timer related checks in FW * @afc_req_id_check_disable: Disables AFC Request ID check in FW + * @afc_indoor_support: AFC support indoor deployment + * @afc_outdoor_support: AFC support outdoor deployment * @carrier_profile_config: Configuration for per-carrier profile * @reo_qdesc_shared_addr_table_enabled: Reo shared qref enhancement enabled */ @@ -5948,6 +5950,8 @@ typedef struct { bool is_6ghz_sp_pwrmode_supp_enabled; bool afc_timer_check_disable; bool afc_req_id_check_disable; + bool afc_indoor_support; + bool afc_outdoor_support; uint32_t carrier_profile_config; bool sawf; bool reo_qdesc_shared_addr_table_enabled; diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index db80e64e21..f3063f68bc 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -7872,6 +7872,27 @@ void wmi_set_nan_channel_support(wmi_resource_config *resource_cfg) } #endif +#if defined(CONFIG_AFC_SUPPORT) +static +void wmi_copy_afc_deployment_config(wmi_resource_config *resource_cfg, + target_resource_config *tgt_res_cfg) +{ + WMI_RSRC_CFG_HOST_SERVICE_FLAG_AFC_INDOOR_SUPPORT_CHECK_SET( + resource_cfg->host_service_flags, + tgt_res_cfg->afc_indoor_support); + + WMI_RSRC_CFG_HOST_SERVICE_FLAG_AFC_OUTDOOR_SUPPORT_CHECK_SET( + resource_cfg->host_service_flags, + tgt_res_cfg->afc_outdoor_support); +} +#else +static +void wmi_copy_afc_deployment_config(wmi_resource_config *resource_cfg, + target_resource_config *tgt_res_cfg) +{ +} +#endif + static void wmi_copy_resource_config(wmi_resource_config *resource_cfg, target_resource_config *tgt_res_cfg) @@ -8131,6 +8152,8 @@ void wmi_copy_resource_config(wmi_resource_config *resource_cfg, resource_cfg->host_service_flags, tgt_res_cfg->afc_req_id_check_disable); + wmi_copy_afc_deployment_config(resource_cfg, tgt_res_cfg); + wmi_set_nan_channel_support(resource_cfg); if (tgt_res_cfg->twt_ack_support_cap) @@ -12424,6 +12447,50 @@ static QDF_STATUS extract_service_ready_ext_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_SUCCESS; } +#if defined(CONFIG_AFC_SUPPORT) +/** + * extract_svc_rdy_ext2_afc_tlv() - extract service ready ext2 afc deployment + * type from event + * @ev: pointer to event fixed param + * @param: Pointer to hold the params + * + * Return: void + */ +static void +extract_svc_rdy_ext2_afc_tlv(wmi_service_ready_ext2_event_fixed_param *ev, + struct wlan_psoc_host_service_ext2_param *param) +{ + WMI_AFC_FEATURE_6G_DEPLOYMENT_TYPE tgt_afc_dev_type; + enum reg_afc_dev_deploy_type reg_afc_dev_type; + + tgt_afc_dev_type = ev->afc_deployment_type; + switch (tgt_afc_dev_type) { + case WMI_AFC_FEATURE_6G_DEPLOYMENT_UNSPECIFIED: + reg_afc_dev_type = AFC_DEPLOYMENT_INDOOR; + break; + case WMI_AFC_FEATURE_6G_DEPLOYMENT_INDOOR_ONLY: + reg_afc_dev_type = AFC_DEPLOYMENT_INDOOR; + break; + case WMI_AFC_FEATURE_6G_DEPLOYMENT_OUTDOOR_ONLY: + reg_afc_dev_type = AFC_DEPLOYMENT_OUTDOOR; + break; + default: + wmi_err("invalid afc deloyment %d", tgt_afc_dev_type); + reg_afc_dev_type = AFC_DEPLOYMENT_UNKNOWN; + break; + } + param->afc_dev_type = reg_afc_dev_type; + + wmi_debug("afc dev type:%d", ev->afc_deployment_type); +} +#else +static inline void +extract_svc_rdy_ext2_afc_tlv(wmi_service_ready_ext2_event_fixed_param *ev, + struct wlan_psoc_host_service_ext2_param *param) +{ +} +#endif + /** * extract_service_ready_ext2_tlv() - extract service ready ext2 params from * event @@ -12482,6 +12549,9 @@ extract_service_ready_ext2_tlv(wmi_unified_t wmi_handle, uint8_t *event, ev->max_user_per_ppdu_mumimo); param->target_cap_flags = ev->target_cap_flags; wmi_debug("htt peer data :%d", ev->target_cap_flags); + + extract_svc_rdy_ext2_afc_tlv(ev, param); + return QDF_STATUS_SUCCESS; }