Bladeren bron

qcacmn: Expose WMI command in tgt_if

Expose the API to send WMI_SET_TPC_POWER_CMDID within the target_if
module. Register the callback under tx_ops.

Change-Id: I1d075df717cff997e7ac85884fe587ed298cbb28
CRs-fixed: 2849695
Lincoln Tran 4 jaren geleden
bovenliggende
commit
323288debd

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

@@ -662,6 +662,19 @@ target_if_register_master_ext_handler(struct wlan_lmac_if_reg_tx_ops *reg_ops)
 }
 #endif
 
+static QDF_STATUS
+tgt_if_regulatory_set_tpc_power(struct wlan_objmgr_psoc *psoc,
+				uint8_t vdev_id,
+				struct reg_tpc_power_info *param)
+{
+	wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+
+	if (!wmi_handle)
+		return QDF_STATUS_E_FAILURE;
+
+	return wmi_unified_send_set_tpc_power_cmd(wmi_handle, vdev_id, param);
+}
+
 QDF_STATUS target_if_register_regulatory_tx_ops(
 		struct wlan_lmac_if_tx_ops *tx_ops)
 {
@@ -711,5 +724,7 @@ QDF_STATUS target_if_register_regulatory_tx_ops(
 	reg_ops->get_pdev_id_from_phy_id =
 			tgt_if_regulatory_get_pdev_id_from_phy_id;
 
+	reg_ops->set_tpc_power = tgt_if_regulatory_set_tpc_power;
+
 	return QDF_STATUS_SUCCESS;
 }

+ 4 - 0
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -822,6 +822,7 @@ struct wlan_lmac_if_ftm_rx_ops {
  * @register_11d_new_cc_handler: pointer to register 11d cc event handler
  * @unregister_11d_new_cc_handler:  pointer to unregister 11d cc event handler
  * @send_ctl_info: call-back function to send CTL info to firmware
+ * @set_tpc_power: send transmit power control info to firmware
  */
 struct wlan_lmac_if_reg_tx_ops {
 	QDF_STATUS (*register_master_handler)(struct wlan_objmgr_psoc *psoc,
@@ -861,6 +862,9 @@ struct wlan_lmac_if_reg_tx_ops {
 					      uint8_t pdev_id, uint8_t *phy_id);
 	QDF_STATUS (*get_pdev_id_from_phy_id)(struct wlan_objmgr_psoc *psoc,
 					      uint8_t phy_id, uint8_t *pdev_id);
+	QDF_STATUS (*set_tpc_power)(struct wlan_objmgr_psoc *psoc,
+				    uint8_t vdev_id,
+				    struct reg_tpc_power_info *param);
 };
 
 /**

+ 3 - 1
umac/mlme/include/wlan_vdev_mlme.h

@@ -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 above
@@ -553,6 +553,7 @@ struct vdev_mlme_ops {
  * @vdev: Pointer to vdev objmgr
  * @ops:                  VDEV MLME callback table
  * @ext_vdev_ptr:         VDEV MLME legacy pointer
+ * @reg_tpc_obj:          Regulatory transmit power info
  * @vdev_rt: VDEV response timer
  * @vdev_wakelock:  vdev wakelock sub structure
  */
@@ -570,6 +571,7 @@ struct vdev_mlme_obj {
 	struct wlan_objmgr_vdev *vdev;
 	struct vdev_mlme_ops *ops;
 	mlme_vdev_ext_t *ext_vdev_ptr;
+	struct reg_tpc_power_info reg_tpc_obj;
 };
 
 /**

+ 36 - 0
umac/regulatory/dispatcher/inc/reg_services_public_struct.h

@@ -80,6 +80,8 @@
 #define BW_160_MHZ    160
 #define BW_40_MHZ     40
 
+#define MAX_NUM_PWR_LEVEL 16
+
 /**
  * enum dfs_reg - DFS region
  * @DFS_UNINIT_REGION: un-initialized region
@@ -1313,4 +1315,38 @@ enum reg_phymode {
 	REG_PHYMODE_MAX,
 };
 
+/**
+ * struct chan_power_info - TPE containing power info per channel chunk
+ * @chan_cfreq: channel center freq (MHz)
+ * @tx_power: transmit power (dBm)
+ */
+struct chan_power_info {
+	qdf_freq_t chan_cfreq;
+	uint8_t tx_power;
+};
+
+/**
+ * struct reg_tpc_power_info - regulatory TPC power info
+ * @is_psd_power: is PSD power or not
+ * @eirp_power: Maximum EIRP power (dBm), valid only if power is PSD
+ * @power_type_6g: type of power (SP/LPI/VLP)
+ * @num_pwr_levels: number of power levels
+ * @reg_max: Array of maximum TX power (dBm) per PSD value
+ * @ap_constraint_power: AP constraint power (dBm)
+ * @frequency: Array of operating frequency
+ * @tpe: TPE values processed from TPE IE
+ * @chan_power_info: power info to send to FW
+ */
+struct reg_tpc_power_info {
+	bool is_psd_power;
+	uint8_t eirp_power;
+	uint8_t power_type_6g;
+	uint8_t num_pwr_levels;
+	uint8_t reg_max[MAX_NUM_PWR_LEVEL];
+	uint8_t ap_constraint_power;
+	qdf_freq_t frequency[MAX_NUM_PWR_LEVEL];
+	uint8_t tpe[MAX_NUM_PWR_LEVEL];
+	struct chan_power_info chan_power_info[MAX_NUM_PWR_LEVEL];
+};
+
 #endif