qcacmn: Extend timestamp WAR for agile mode

Target will be sharing the time taken for reset in the
first Spectral report after reset. The reset delay value
is common for all the Spectral modes. Host updates
the timestamp WAR offset variable for all the Spectral modes.

CRs-Fixed: 2504798
Change-Id: If7d47a434054f220b0717f7d8939f9f8922af30f
diff --git a/target_if/spectral/target_if_spectral.c b/target_if/spectral/target_if_spectral.c
index 70ae22a..638b7ae 100644
--- a/target_if/spectral/target_if_spectral.c
+++ b/target_if/spectral/target_if_spectral.c
@@ -2013,8 +2013,6 @@
 		spectral->inband_fftbin_size_adj = 0;
 		spectral->null_fftbin_adj = 0;
 	}
-	spectral->last_fft_timestamp = 0;
-	spectral->timestamp_war_offset = 0;
 
 	if ((target_type == TARGET_TYPE_QCA8074) ||
 	    (target_type == TARGET_TYPE_QCA8074V2) ||
@@ -2053,6 +2051,8 @@
 
 	/* Spectral mode specific init */
 	for (; smode < SPECTRAL_SCAN_MODE_MAX; smode++) {
+		spectral->last_fft_timestamp[smode] = 0;
+		spectral->timestamp_war_offset[smode] = 0;
 		spectral->params_valid[smode] = false;
 		qdf_spinlock_create(&spectral->param_info[smode].osps_lock);
 		spectral->param_info[smode].osps_cache.osc_is_valid = 0;
@@ -2655,9 +2655,8 @@
 	if (!p_sops->is_spectral_active(spectral, smode)) {
 		p_sops->configure_spectral(spectral, spectral_params, smode);
 		p_sops->start_spectral_scan(spectral, smode, err);
-		spectral->timestamp_war_offset = 0;
-		spectral->last_fft_timestamp = 0;
-	} else {
+		spectral->timestamp_war_offset[smode] = 0;
+		spectral->last_fft_timestamp[smode] = 0;
 	}
 
 	/* get current spectral configuration */
diff --git a/target_if/spectral/target_if_spectral.h b/target_if/spectral/target_if_spectral.h
index e718b81..bf56bb5 100644
--- a/target_if/spectral/target_if_spectral.h
+++ b/target_if/spectral/target_if_spectral.h
@@ -911,8 +911,8 @@
 	u_int8_t                               null_fftbin_adj;
 	enum spectral_160mhz_report_delivery_state state_160mhz_delivery;
 	void *spectral_report_cache;
-	uint32_t last_fft_timestamp;
-	uint32_t timestamp_war_offset;
+	uint32_t last_fft_timestamp[SPECTRAL_SCAN_MODE_MAX];
+	uint32_t timestamp_war_offset[SPECTRAL_SCAN_MODE_MAX];
 	uint16_t fft_size_min;
 	uint16_t fft_size_max;
 };
diff --git a/target_if/spectral/target_if_spectral_phyerr.c b/target_if/spectral/target_if_spectral_phyerr.c
index 997c23f..79e2584 100644
--- a/target_if/spectral/target_if_spectral_phyerr.c
+++ b/target_if/spectral/target_if_spectral_phyerr.c
@@ -1654,12 +1654,22 @@
 		}
 
 		if (report->reset_delay) {
-			spectral->timestamp_war_offset += (report->reset_delay +
-					spectral->last_fft_timestamp);
+			enum spectral_scan_mode mode =
+						SPECTRAL_SCAN_MODE_NORMAL;
+
+			/* Adjust the offset for all the Spectral modes.
+			 * Target will be sending the non zero reset delay for
+			 * the first Spectral report after reset. This delay is
+			 * common for all the Spectral modes.
+			 */
+			for (; mode < SPECTRAL_SCAN_MODE_MAX; mode++)
+				spectral->timestamp_war_offset[mode] +=
+					(report->reset_delay +
+					 spectral->last_fft_timestamp[mode]);
 		}
 		tsf64 = p_sfft->timestamp;
-		spectral->last_fft_timestamp = p_sfft->timestamp;
-		tsf64 += spectral->timestamp_war_offset;
+		spectral->last_fft_timestamp[params.smode] = p_sfft->timestamp;
+		tsf64 += spectral->timestamp_war_offset[params.smode];
 
 		/* Take care of state transitions for 160 MHz and 80p80 */
 		if (spectral->ch_width == CH_WIDTH_160MHZ) {