Эх сурвалжийг харах

qcacmn: Initialize Spectral scan detector list

Add sscan_detector_list struct to store the number
of detectors and detector list for a given Spectral
scan mode and channel width, based on the target type.

Initialize this struct during target_if_pdev_spectral_init.

CRs-Fixed: 2961954
Change-Id: Ia920438429579c096349a0170d15e288d46cf9a9
Jhalak Naik 4 жил өмнө
parent
commit
06764332ef

+ 72 - 0
target_if/spectral/target_if_spectral.c

@@ -2659,6 +2659,76 @@ target_if_spectral_timestamp_war_init(struct spectral_timestamp_war *twar)
 	twar->target_reset_count = 0;
 }
 
+#ifdef OPTIMIZED_SAMP_MESSAGE
+/**
+ * target_if_spectral_detector_list_init() - Initialize Spectral detector list
+ * based on target type
+ * @spectral: Pointer to Spectral target_if
+ *
+ * Function to initialize Spectral detector list for possible combinations of
+ * Spectral scan mode and channel width, based on target type.
+ *
+ * Return: Success/Failure
+ */
+static QDF_STATUS
+target_if_spectral_detector_list_init(struct target_if_spectral *spectral)
+{
+	struct sscan_detector_list *det_list;
+	enum spectral_scan_mode smode;
+	enum phy_ch_width ch_width;
+
+	if (!spectral) {
+		spectral_err_rl("Spectral LMAC object is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+	/**
+	 * We assume there are 2 detectors. The Detector ID coming first will
+	 * always be pri80 detector, and second detector for sec80.
+	 */
+	ch_width = CH_WIDTH_20MHZ;
+	for (; ch_width <= CH_WIDTH_80P80MHZ; ch_width++) {
+		/* Normal spectral scan */
+		smode = SPECTRAL_SCAN_MODE_NORMAL;
+		det_list = &spectral->detector_list[smode][ch_width];
+		det_list->num_detectors = 1;
+
+		det_list->detectors[0] = SPECTRAL_DETECTOR_ID_0;
+		if (is_ch_width_160_or_80p80(ch_width) &&
+		    spectral->rparams.fragmentation_160[smode]) {
+			det_list->num_detectors += 1;
+			det_list->detectors[1] = SPECTRAL_DETECTOR_ID_1;
+		}
+
+		/* Agile spectral scan */
+		smode = SPECTRAL_SCAN_MODE_AGILE;
+		det_list = &spectral->detector_list[smode][ch_width];
+		det_list->num_detectors = 1;
+
+		if (spectral->rparams.fragmentation_160[smode]) {
+			/**
+			 * Skip to next iteration if 160/80p80 MHz for Agile
+			 * scan. Only 20/40/80 MHz is supported on platforms
+			 * with fragmentation, as only 1 detector is available.
+			 */
+			if (is_ch_width_160_or_80p80(ch_width))
+				continue;
+			det_list->detectors[0] = SPECTRAL_DETECTOR_ID_2;
+		} else {
+			det_list->detectors[0] = SPECTRAL_DETECTOR_ID_1;
+		}
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+#else
+
+static QDF_STATUS
+target_if_spectral_detector_list_init(struct target_if_spectral *spectral)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif /* OPTIMIZED_SAMP_MESSAGE */
+
 /**
  * target_if_pdev_spectral_init() - Initialize target_if Spectral
  * functionality for the given pdev
@@ -2847,6 +2917,8 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev)
 			init_160mhz_delivery_state_machine(spectral);
 	}
 
+	target_if_spectral_detector_list_init(spectral);
+
 	return spectral;
 
 fail:

+ 16 - 0
target_if/spectral/target_if_spectral.h

@@ -1048,6 +1048,18 @@ struct per_session_report_info {
 	uint8_t num_spans;
 };
 
+/**
+ * struct sscan_detector_list - Spectral scan Detector list, for given Spectral
+ * scan mode and operating BW
+ * @detectors: List of detectors
+ * @num_detectors: Number of detectors for given spectral scan mode, BW
+ *                 and target type
+ */
+struct sscan_detector_list {
+	uint8_t detectors[SPECTRAL_DETECTOR_ID_MAX];
+	uint8_t num_detectors;
+};
+
 /**
  * struct target_if_spectral - main spectral structure
  * @pdev: Pointer to pdev
@@ -1143,6 +1155,8 @@ struct per_session_report_info {
  * @rparams: Parameters related to Spectral report structure
  * @param_min_max: Spectral parameter's minimum and maximum values
  * @finite_scan: Parameters for finite Spectral scan
+ * @detector_list: Detector list for a given Spectral scan mode and channel
+ * width, based on the target type.
  * @det_map: Map of per-session detector information keyed by the Spectral HW
  * detector id.
  * @report_info: Per session info to be filled at report level in SAMP message
@@ -1267,6 +1281,8 @@ struct target_if_spectral {
 	struct spectral_param_min_max param_min_max;
 	struct target_if_finite_spectral_scan_params
 					finite_scan[SPECTRAL_SCAN_MODE_MAX];
+	struct sscan_detector_list
+			detector_list[SPECTRAL_SCAN_MODE_MAX][CH_WIDTH_MAX];
 	struct per_session_det_map det_map[MAX_DETECTORS_PER_PDEV];
 	struct per_session_report_info report_info[SPECTRAL_SCAN_MODE_MAX];
 };