diff --git a/target_if/spectral/target_if_spectral.c b/target_if/spectral/target_if_spectral.c index 70ae22a771d8..638b7aee8e6b 100644 --- a/target_if/spectral/target_if_spectral.c +++ b/target_if/spectral/target_if_spectral.c @@ -2013,8 +2013,6 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) 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 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) /* 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 @@ target_if_spectral_scan_enable_params(struct target_if_spectral *spectral, 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 e718b817eb1f..bf56bb587bb0 100644 --- a/target_if/spectral/target_if_spectral.h +++ b/target_if/spectral/target_if_spectral.h @@ -911,8 +911,8 @@ struct target_if_spectral { 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 997c23f58a4c..79e258486eb8 100644 --- a/target_if/spectral/target_if_spectral_phyerr.c +++ b/target_if/spectral/target_if_spectral_phyerr.c @@ -1654,12 +1654,22 @@ target_if_consume_spectral_report_gen3( } 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) {