qcacmn: Clamp the FFT bin values before filling SAMP message

Each FFT bin value is represented as an 8 bit integer
in SAMP message. But depending on the configuration,
the FFT bin value reported by HW might exceed 8 bits.
Clamp the FFT bin value between the min and max value
which can be represented by 8 bits. For linear mode,
min and max FFT bin value which can be represented by
8 bit is 0 and U8_MAX respectively. For dBm mode,  min
and max FFT bin value which can be represented by 8 bit
is S8_MIN and S8_MAX respectively.

CRs-Fixed: 3056458
Change-Id: I9ec75f781a130d3ed0d0d9393975fd5874961ce0
此提交包含在:
Edayilliam Jayadev
2021-10-20 14:03:24 +05:30
提交者 Madan Koyyalamudi
父節點 b94a1425ae
當前提交 31da41ae4e
共有 4 個檔案被更改,包括 76 行新增19 行删除

查看文件

@@ -40,6 +40,7 @@ target_if_spectral_fill_samp_msg(struct target_if_spectral *spectral,
QDF_STATUS ret;
uint16_t dest_det_idx;
enum spectral_scan_mode spectral_mode;
uint16_t pwr_format;
if (!spectral) {
spectral_err_rl("Spectral LMAC object is null");
@@ -71,6 +72,8 @@ target_if_spectral_fill_samp_msg(struct target_if_spectral *spectral,
return QDF_STATUS_E_FAILURE;
}
pwr_format = spectral->params[spectral_mode].ss_pwr_format;
qdf_spin_lock_bh(&spectral->session_det_map_lock);
if (!spectral->det_map[params->hw_detector_id].det_map_valid) {
@@ -165,7 +168,7 @@ target_if_spectral_fill_samp_msg(struct target_if_spectral *spectral,
&spec_samp_msg->bin_pwr[
lb_edge_bins->start_bin_idx],
lb_edge_bins->num_bins,
&bytes_copied);
&bytes_copied, pwr_format);
if (QDF_IS_STATUS_ERROR(ret)) {
qdf_spin_unlock_bh(
@@ -183,7 +186,7 @@ target_if_spectral_fill_samp_msg(struct target_if_spectral *spectral,
spectral, bin_pwr_data,
&spec_samp_msg->bin_pwr[start_bin_index],
pwr_count,
&bytes_copied);
&bytes_copied, pwr_format);
if (QDF_IS_STATUS_ERROR(ret)) {
qdf_spin_unlock_bh(
@@ -201,7 +204,7 @@ target_if_spectral_fill_samp_msg(struct target_if_spectral *spectral,
&spec_samp_msg->bin_pwr[
rb_edge_bins->start_bin_idx],
rb_edge_bins->num_bins,
&bytes_copied);
&bytes_copied, pwr_format);
if (QDF_IS_STATUS_ERROR(ret)) {
qdf_spin_unlock_bh(