From e4bc45cf245a3e49ba1e6263791d332197529597 Mon Sep 17 00:00:00 2001 From: Gururaj Pandurangi Date: Tue, 9 Feb 2021 01:26:40 -0800 Subject: [PATCH] qcacmn: Add service bit to support backward compatibility The host will send TPC power to FW via the new WMI cmd WMI_VDEV_SET_TPC_POWER_CMDID going forward instead of WMI_VDEV_PARAM_TX_PWRLIMIT to accommodate 6GHz channels. But, to support backward compatibility for New Host+old FW the TPC power will be sent to FW via legacy WMI cmds WMI_VDEV_SET_PARAM_CMDID (during initial connection) or WMI_VDEV_PARAM_TX_PWRLIMIT (power value change during RRM req/bcn processing from connected AP) with the help of a service bit WMI_SERVICE_EXT_TPC_REG_SUPPORT. Change-Id: I22e11ff847cd384fac8ea0061e5df42cea0c8de8 CRs-Fixed: 2874245 --- .../init_deinit/src/init_event_handler.c | 4 +- target_if/regulatory/inc/target_if_reg.h | 11 +++++- target_if/regulatory/src/target_if_reg.c | 37 +++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) 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) {