Explorar o código

qcacmn: Add target_if support for EIRP preference

Add target_if support to set EIRP as the preferred power in the
WMI_VDEV_SET_TPC_CMDID to the target.

Change-Id: I77850ce93a3561c9765b8d70ae84e940b2bbf4d4
CRs-Fixed: 3307372
Hariharan Basuthkar %!s(int64=2) %!d(string=hai) anos
pai
achega
e0e65b3efa

+ 2 - 0
target_if/init_deinit/src/init_event_handler.c

@@ -533,6 +533,8 @@ static int init_deinit_service_ext2_ready_event_handler(ol_scn_t scn_handle,
 
 	target_if_reg_set_afc_dev_type(psoc, tgt_hdl);
 
+	target_if_set_regulatory_eirp_preferred_support(psoc);
+
 	/* send init command */
 	init_deinit_set_send_init_cmd(psoc, tgt_hdl);
 

+ 15 - 0
target_if/regulatory/inc/target_if_reg.h

@@ -155,6 +155,15 @@ target_if_reg_set_afc_dev_type(struct wlan_objmgr_psoc *psoc,
 QDF_STATUS
 target_if_reg_get_afc_dev_type(struct wlan_objmgr_psoc *psoc,
 			       enum reg_afc_dev_deploy_type *reg_afc_dev_type);
+
+/**
+ * target_if_set_regulatory_eirp_preferred_support() - Set EIRP as the preferred
+ * support
+ * @psoc: psoc pointer
+ * Return: Success or Failure
+ */
+QDF_STATUS
+target_if_set_regulatory_eirp_preferred_support(struct wlan_objmgr_psoc *psoc);
 #else
 static inline QDF_STATUS
 target_if_reg_set_afc_dev_type(struct wlan_objmgr_psoc *psoc,
@@ -162,5 +171,11 @@ target_if_reg_set_afc_dev_type(struct wlan_objmgr_psoc *psoc,
 {
 	return QDF_STATUS_E_FAILURE;
 }
+
+static inline QDF_STATUS
+target_if_set_regulatory_eirp_preferred_support(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_E_FAILURE;
+}
 #endif
 #endif /* __TARGET_IF_REG_H__ */

+ 39 - 0
target_if/regulatory/src/target_if_reg.c

@@ -1095,6 +1095,45 @@ target_if_reg_get_afc_dev_type(struct wlan_objmgr_psoc *psoc,
 
 	return QDF_STATUS_SUCCESS;
 }
+
+/**
+ * tgt_if_regulatory_is_eirp_preferred_support() - Check if FW prefers EIRP
+ * support for TPC power command.
+ *
+ * @psoc: Pointer to psoc
+ *
+ * Return: true if FW prefers EIRP format for TPC, else false
+ */
+static bool
+target_if_regulatory_is_eirp_preferred_support(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_eirp_preferred_support);
+}
+
+QDF_STATUS
+target_if_set_regulatory_eirp_preferred_support(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_eirp_preferred_support)
+		reg_rx_ops->reg_set_eirp_preferred_support(
+			psoc,
+			target_if_regulatory_is_eirp_preferred_support(psoc));
+
+	return QDF_STATUS_SUCCESS;
+}
 #endif
 
 /**