diff --git a/target_if/init_deinit/src/init_event_handler.c b/target_if/init_deinit/src/init_event_handler.c index 768e82fd35ca..46da305f31b2 100644 --- a/target_if/init_deinit/src/init_event_handler.c +++ b/target_if/init_deinit/src/init_event_handler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -308,6 +308,8 @@ static int init_deinit_service_ext2_ready_event_handler(ol_scn_t scn_handle, goto exit; } + target_if_regulatory_set_ext_tpc(psoc); + /* 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 6f4b87f78f85..48f89fb959b2 100644 --- a/target_if/regulatory/inc/target_if_reg.h +++ b/target_if/regulatory/inc/target_if_reg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -72,4 +72,13 @@ QDF_STATUS target_if_reg_set_5dot9_ghz_info(struct wlan_objmgr_psoc *psoc); */ struct wlan_lmac_if_reg_rx_ops * target_if_regulatory_get_rx_ops(struct wlan_objmgr_psoc *psoc); + +/** + * target_if_regulatory_set_ext_tpc() - populate FW support of new WMI command + * for TPC + * @psoc: psoc pointer + * + * Return: Success or Failure + */ +QDF_STATUS target_if_regulatory_set_ext_tpc(struct wlan_objmgr_psoc *psoc); #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 ee7847a8c3f9..f30f4ea8b41a 100644 --- a/target_if/regulatory/src/target_if_reg.c +++ b/target_if/regulatory/src/target_if_reg.c @@ -675,6 +675,43 @@ tgt_if_regulatory_set_tpc_power(struct wlan_objmgr_psoc *psoc, return wmi_unified_send_set_tpc_power_cmd(wmi_handle, vdev_id, param); } +/** + * tgt_if_regulatory_is_ext_tpc_supported() - Check if FW supports new + * WMI command for TPC power + * + * @psoc: Pointer to psoc + * + * Return: true if FW supports new WMI command for TPC, else false + */ +static bool +tgt_if_regulatory_is_ext_tpc_supported(struct wlan_objmgr_psoc *psoc) +{ + wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); + + if (!wmi_handle) + return false; + + return wmi_service_enabled(wmi_handle, wmi_service_ext_tpc_reg_support); +} + +QDF_STATUS target_if_regulatory_set_ext_tpc(struct wlan_objmgr_psoc *psoc) +{ + 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_set_ext_tpc_supported) + reg_rx_ops->reg_set_ext_tpc_supported( + psoc, + tgt_if_regulatory_is_ext_tpc_supported(psoc)); + + return QDF_STATUS_SUCCESS; +} + QDF_STATUS target_if_register_regulatory_tx_ops( struct wlan_lmac_if_tx_ops *tx_ops) {