Pārlūkot izejas kodu

qcacmn: WMI changes for Agile Spectral

1) Add Spectral scan mode and agile center frequency in WMI
   commands to indicate the current mode.
2) Obtain the Agile Spectral capability from the chain mask table.

CRs-Fixed: 2455967
Change-Id: I88ba6fc1ecf9b530a6b516d0c1e4ce88702c6d1f
Edayilliam Jayadev 5 gadi atpakaļ
vecāks
revīzija
97b8676b4e

+ 3 - 1
spectral/dispatcher/inc/spectral_ioctl.h

@@ -80,6 +80,8 @@ enum spectral_params {
 	SPECTRAL_PARAM_STOP,
 	SPECTRAL_PARAM_ENABLE,
 	SPECTRAL_PARAM_FREQUENCY,
+	SPECTRAL_PARAM_CHAN_FREQUENCY,
+	SPECTRAL_PARAM_CHAN_WIDTH,
 	SPECTRAL_PARAM_MAX,
 };
 
@@ -224,7 +226,7 @@ struct spectral_config {
  * @high_level_offset: high_level_offset
  * @rssi_thr: rssi_thr
  * @default_agc_max_gain: default_agc_max_gain
- * @agile_spectral_cap: agile Spectral capability
+ * @agile_spectral_cap: agile Spectral capability for 20/40/80
  * @agile_spectral_cap_160: agile Spectral capability for 160 MHz
  * @agile_spectral_cap_80p80: agile Spectral capability for 80p80
  */

+ 7 - 1
target_if/init_deinit/inc/service_ready_param.h

@@ -276,6 +276,9 @@ struct wlan_psoc_host_spectral_scaling_params {
  * @supports_chan_width_80: channel width 80 support for this chain mask.
  * @supports_chan_width_160: channel width 160 support for this chain mask.
  * @supports_chan_width_80P80: channel width 80P80 support for this chain mask.
+ * @supports_aSpectral: Agile Spectral support for this chain mask.
+ * @supports_aSpectral_160: Agile Spectral support in 160 MHz.
+ * @supports_aDFS_160: Agile DFS support in 160 MHz for this chain mask.
  * @chain_mask_2G: 2G support for this chain mask.
  * @chain_mask_5G: 5G support for this chain mask.
  * @chain_mask_tx: Tx support for this chain mask.
@@ -289,7 +292,10 @@ struct wlan_psoc_host_chainmask_capabilities {
 		 supports_chan_width_80:1,
 		 supports_chan_width_160:1,
 		 supports_chan_width_80P80:1,
-		 reserved:22,
+		 supports_aSpectral:1,
+		 supports_aSpectral_160:1,
+		 supports_aDFS_160:1,
+		 reserved:19,
 		 chain_mask_2G:1,
 		 chain_mask_5G:1,
 		 chain_mask_tx:1,

+ 30 - 3
target_if/spectral/target_if_spectral.c

@@ -89,12 +89,14 @@ target_if_spectral_get_vdev(struct target_if_spectral *spectral)
  * target_if_send_vdev_spectral_configure_cmd() - Send WMI command to configure
  * spectral parameters
  * @spectral: Pointer to Spectral target_if internal private data
+ * @smode: Spectral scan mode
  * @param: Pointer to spectral_config giving the Spectral configuration
  *
  * Return: QDF_STATUS_SUCCESS on success, negative error code on failure
  */
 static int
 target_if_send_vdev_spectral_configure_cmd(struct target_if_spectral *spectral,
+					   enum spectral_scan_mode smode,
 					   struct spectral_config *param)
 {
 	struct vdev_spectral_configure_params sparam;
@@ -134,6 +136,8 @@ target_if_send_vdev_spectral_configure_cmd(struct target_if_spectral *spectral,
 	sparam.bin_scale = param->ss_bin_scale;
 	sparam.dbm_adj = param->ss_dbm_adj;
 	sparam.chn_mask = param->ss_chn_mask;
+	sparam.mode = smode;
+	sparam.center_freq = param->ss_frequency;
 
 	return spectral->param_wmi_cmd_ops.wmi_spectral_configure_cmd_send(
 				GET_WMI_HDL_FROM_PDEV(pdev), &sparam);
@@ -143,6 +147,7 @@ target_if_send_vdev_spectral_configure_cmd(struct target_if_spectral *spectral,
  * target_if_send_vdev_spectral_enable_cmd() - Send WMI command to
  * enable/disable Spectral
  * @spectral: Pointer to Spectral target_if internal private data
+ * @smode: Spectral scan mode
  * @is_spectral_active_valid: Flag to indicate if spectral activate (trigger) is
  * valid
  * @is_spectral_active: Value of spectral activate
@@ -153,6 +158,7 @@ target_if_send_vdev_spectral_configure_cmd(struct target_if_spectral *spectral,
  */
 static int
 target_if_send_vdev_spectral_enable_cmd(struct target_if_spectral *spectral,
+					enum spectral_scan_mode smode,
 					uint8_t is_spectral_active_valid,
 					uint8_t is_spectral_active,
 					uint8_t is_spectral_enabled_valid,
@@ -181,6 +187,7 @@ target_if_send_vdev_spectral_enable_cmd(struct target_if_spectral *spectral,
 	param.enabled_valid = is_spectral_enabled_valid;
 	param.active = is_spectral_active;
 	param.enabled = is_spectral_enabled;
+	param.mode = smode;
 
 	return spectral->param_wmi_cmd_ops.wmi_spectral_enable_cmd_send(
 				GET_WMI_HDL_FROM_PDEV(pdev), &param);
@@ -736,7 +743,7 @@ target_if_spectral_info_write(
 		pval = (uint8_t *)input;
 
 		qdf_spin_lock(&info->osps_lock);
-		ret = target_if_send_vdev_spectral_enable_cmd(spectral,
+		ret = target_if_send_vdev_spectral_enable_cmd(spectral, smode,
 							      1, *pval, 0, 0);
 
 		target_if_log_write_spectral_active(
@@ -766,7 +773,7 @@ target_if_spectral_info_write(
 		pval = (uint8_t *)input;
 
 		qdf_spin_lock(&info->osps_lock);
-		ret = target_if_send_vdev_spectral_enable_cmd(spectral,
+		ret = target_if_send_vdev_spectral_enable_cmd(spectral, smode,
 							      0, 0, 1, *pval);
 
 		target_if_log_write_spectral_enabled(
@@ -797,7 +804,7 @@ target_if_spectral_info_write(
 
 		qdf_spin_lock(&info->osps_lock);
 		ret = target_if_send_vdev_spectral_configure_cmd(spectral,
-								 param);
+								 smode, param);
 
 		target_if_log_write_spectral_params(
 			param,
@@ -1377,6 +1384,11 @@ target_if_init_spectral_capability(struct target_if_spectral *spectral)
 	struct target_psoc_info *tgt_psoc_info;
 	struct wlan_psoc_host_service_ext_param *ext_svc_param;
 	struct spectral_caps *pcap = &spectral->capability;
+	struct wlan_psoc_host_mac_phy_caps *mac_phy_cap_arr = NULL;
+	struct wlan_psoc_host_mac_phy_caps *mac_phy_cap = NULL;
+	struct wlan_psoc_host_chainmask_table *table;
+	int j;
+	uint32_t table_id;
 
 	pdev = spectral->pdev_obj;
 	psoc = wlan_pdev_get_psoc(pdev);
@@ -1395,6 +1407,14 @@ target_if_init_spectral_capability(struct target_if_spectral *spectral)
 	num_bin_scaling_params = ext_svc_param->num_bin_scaling_params;
 	scaling_params = target_psoc_get_spectral_scaling_params(tgt_psoc_info);
 	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
+	mac_phy_cap_arr = target_psoc_get_mac_phy_cap(tgt_psoc_info);
+	mac_phy_cap = &mac_phy_cap_arr[pdev_id];
+	table_id = mac_phy_cap->chainmask_table_id;
+	table =  &ext_svc_param->chainmask_table[table_id];
+	if (!table) {
+		spectral_err("chainmask table not found");
+		return QDF_STATUS_E_FAILURE;
+	}
 
 	/* XXX : Workaround: Set Spectral capability */
 	pcap = &spectral->capability;
@@ -1403,6 +1423,13 @@ target_if_init_spectral_capability(struct target_if_spectral *spectral)
 	pcap->spectral_cap = 1;
 	pcap->advncd_spectral_cap = 1;
 	pcap->hw_gen = spectral->spectral_gen;
+	for (j = 0; j < table->num_valid_chainmasks; j++) {
+		pcap->agile_spectral_cap |=
+			table->cap_list[j].supports_aSpectral;
+		pcap->agile_spectral_cap_160 |=
+			table->cap_list[j].supports_aSpectral_160;
+	}
+	pcap->agile_spectral_cap_80p80 = pcap->agile_spectral_cap_160;
 
 	for (param_idx = 0; param_idx < num_bin_scaling_params; param_idx++) {
 		if (scaling_params[param_idx].pdev_id == pdev_id) {

+ 10 - 0
wmi/inc/wmi_unified_param.h

@@ -2920,6 +2920,10 @@ struct smart_ant_enable_tx_feedback_params {
  * @bin_scale: BIN scale
  * @dbm_adj: DBM adjust
  * @chn_mask: chain mask
+ * @mode: Mode
+ * @center_freq: Center frequency
+ * @chan_freq: Primary channel frequency
+ * @chan_width: Channel width
  */
 struct vdev_spectral_configure_params {
 	uint8_t vdev_id;
@@ -2941,6 +2945,10 @@ struct vdev_spectral_configure_params {
 	uint16_t bin_scale;
 	uint16_t dbm_adj;
 	uint16_t chn_mask;
+	uint16_t mode;
+	uint16_t center_freq;
+	uint16_t chan_freq;
+	uint16_t chan_width;
 };
 
 /**
@@ -2950,6 +2958,7 @@ struct vdev_spectral_configure_params {
  * @active: active
  * @enabled_valid: Enabled valid
  * @enabled: enabled
+ * @mode: Mode
  */
 struct vdev_spectral_enable_params {
 	uint8_t vdev_id;
@@ -2957,6 +2966,7 @@ struct vdev_spectral_enable_params {
 	uint8_t active;
 	uint8_t enabled_valid;
 	uint8_t enabled;
+	uint8_t mode;
 };
 
 /**

+ 42 - 44
wmi/src/wmi_unified_tlv.c

@@ -6334,6 +6334,11 @@ static QDF_STATUS send_vdev_spectral_configure_cmd_tlv(wmi_unified_t wmi_handle,
 	cmd->spectral_scan_bin_scale = param->bin_scale;
 	cmd->spectral_scan_dBm_adj = param->dbm_adj;
 	cmd->spectral_scan_chn_mask = param->chn_mask;
+	cmd->spectral_scan_mode = param->mode;
+	cmd->spectral_scan_center_freq = param->center_freq;
+	/* Not used, fill with zeros */
+	cmd->spectral_scan_chan_freq = 0;
+	cmd->spectral_scan_chan_width = 0;
 
 	wmi_mtrace(WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID, cmd->vdev_id, 0);
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
@@ -6347,44 +6352,29 @@ static QDF_STATUS send_vdev_spectral_configure_cmd_tlv(wmi_unified_t wmi_handle,
 	WMI_LOGI("%s: Sent WMI_VDEV_SPECTRAL_SCAN_CONFIGURE_CMDID",
 		 __func__);
 
-	WMI_LOGI("vdev_id = %u\n"
-		 "spectral_scan_count = %u\n"
-		 "spectral_scan_period = %u\n"
-		 "spectral_scan_priority = %u\n"
-		 "spectral_scan_fft_size = %u\n"
-		 "spectral_scan_gc_ena = %u\n"
-		 "spectral_scan_restart_ena = %u\n"
-		 "spectral_scan_noise_floor_ref = %u\n"
-		 "spectral_scan_init_delay = %u\n"
-		 "spectral_scan_nb_tone_thr = %u\n"
-		 "spectral_scan_str_bin_thr = %u\n"
-		 "spectral_scan_wb_rpt_mode = %u\n"
-		 "spectral_scan_rssi_rpt_mode = %u\n"
-		 "spectral_scan_rssi_thr = %u\n"
-		 "spectral_scan_pwr_format = %u\n"
-		 "spectral_scan_rpt_mode = %u\n"
-		 "spectral_scan_bin_scale = %u\n"
-		 "spectral_scan_dBm_adj = %u\n"
-		 "spectral_scan_chn_mask = %u",
-		 param->vdev_id,
-		 param->count,
-		 param->period,
-		 param->spectral_pri,
-		 param->fft_size,
-		 param->gc_enable,
-		 param->restart_enable,
-		 param->noise_floor_ref,
-		 param->init_delay,
-		 param->nb_tone_thr,
-		 param->str_bin_thr,
-		 param->wb_rpt_mode,
-		 param->rssi_rpt_mode,
-		 param->rssi_thr,
-		 param->pwr_format,
-		 param->rpt_mode,
-		 param->bin_scale,
-		 param->dbm_adj,
-		 param->chn_mask);
+	WMI_LOGI("vdev_id = %u", param->vdev_id);
+	WMI_LOGI("spectral_scan_count = %u", param->count);
+	WMI_LOGI("spectral_scan_period = %u", param->period);
+	WMI_LOGI("spectral_scan_priority = %u", param->spectral_pri);
+	WMI_LOGI("spectral_scan_fft_size = %u", param->fft_size);
+	WMI_LOGI("spectral_scan_gc_ena = %u", param->gc_enable);
+	WMI_LOGI("spectral_scan_restart_ena = %u", param->restart_enable);
+	WMI_LOGI("spectral_scan_noise_floor_ref = %u", param->noise_floor_ref);
+	WMI_LOGI("spectral_scan_init_delay = %u", param->init_delay);
+	WMI_LOGI("spectral_scan_nb_tone_thr = %u",  param->nb_tone_thr);
+	WMI_LOGI("spectral_scan_str_bin_thr = %u", param->str_bin_thr);
+	WMI_LOGI("spectral_scan_wb_rpt_mode = %u", param->wb_rpt_mode);
+	WMI_LOGI("spectral_scan_rssi_rpt_mode = %u", param->rssi_rpt_mode);
+	WMI_LOGI("spectral_scan_rssi_thr = %u", param->rssi_thr);
+	WMI_LOGI("spectral_scan_pwr_format = %u", param->pwr_format);
+	WMI_LOGI("spectral_scan_rpt_mode = %u", param->rpt_mode);
+	WMI_LOGI("spectral_scan_bin_scale = %u", param->bin_scale);
+	WMI_LOGI("spectral_scan_dBm_adj = %u", param->dbm_adj);
+	WMI_LOGI("spectral_scan_chn_mask = %u", param->chn_mask);
+	WMI_LOGI("spectral_scan_mode = %u", param->mode);
+	WMI_LOGI("spectral_scan_center_freq = %u", param->center_freq);
+	WMI_LOGI("spectral_scan_chan_freq = %u", param->chan_freq);
+	WMI_LOGI("spectral_scan_chan_width = %u", param->chan_width);
 	WMI_LOGI("%s: Status: %d", __func__, ret);
 
 	return ret;
@@ -6432,13 +6422,12 @@ static QDF_STATUS send_vdev_spectral_enable_cmd_tlv(wmi_unified_t wmi_handle,
 	} else {
 		cmd->enable_cmd = 0; /* 0: Ignore */
 	}
+	cmd->spectral_scan_mode = param->mode;
 
-	WMI_LOGI("vdev_id = %u\n"
-				 "trigger_cmd = %u\n"
-				 "enable_cmd = %u",
-				 cmd->vdev_id,
-				 cmd->trigger_cmd,
-				 cmd->enable_cmd);
+	WMI_LOGI("vdev_id = %u", cmd->vdev_id);
+	WMI_LOGI("trigger_cmd = %u", cmd->trigger_cmd);
+	WMI_LOGI("enable_cmd = %u", cmd->enable_cmd);
+	WMI_LOGI("spectral_scan_mode = %u", cmd->spectral_scan_mode);
 
 	wmi_mtrace(WMI_VDEV_SPECTRAL_SCAN_ENABLE_CMDID, cmd->vdev_id, 0);
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
@@ -9761,6 +9750,15 @@ static QDF_STATUS extract_chainmask_tables_tlv(wmi_unified_t wmi_handle,
 			chainmask_table[i].cap_list[j].supports_aDFS =
 				WMI_SUPPORT_CHAIN_MASK_ADFS_GET(chainmask_caps->supported_flags);
 
+			chainmask_table[i].cap_list[j].supports_aSpectral =
+				WMI_SUPPORT_AGILE_SPECTRAL_GET(chainmask_caps->supported_flags);
+
+			chainmask_table[i].cap_list[j].supports_aSpectral_160 =
+				WMI_SUPPORT_AGILE_SPECTRAL_160_GET(chainmask_caps->supported_flags);
+
+			chainmask_table[i].cap_list[j].supports_aDFS_160 =
+				WMI_SUPPORT_ADFS_160_GET(chainmask_caps->supported_flags);
+
 			wmi_nofl_debug("supported_flags: 0x%08x  chainmasks: 0x%08x",
 				       chainmask_caps->supported_flags,
 				       chainmask_caps->chainmask);