qcacmn: Big-endian mode changes for Beryllium Spectral
On Beryllium architecture, PHY DMA applies a 32-bit byte swap to assist in efficient Host reads when connected to a big-endian Host. This is done to avoid byte swapping at the Host. So, if the Host reads this data 32-bit word at a time, the byte order would be intact. Report headers are not a problem because as they are composed of 32-bit words. For FFT bins, read each DWORD at a time and extract FFT bins out of that DWORD. Make this change in a generic way to keep the design uniform across different chipsets and endian modes. CRs-Fixed: 3042188 Change-Id: Idff1ac7eb5e18c692c9ee8b19b9ae9e6b962d486
这个提交包含在:

提交者
Madan Koyyalamudi

父节点
b65b4ae703
当前提交
d36115b849
@@ -102,13 +102,10 @@ target_if_spectral_fill_samp_msg(struct target_if_spectral *spectral,
|
||||
struct samp_edge_extra_bin_info *lb_edge_bins;
|
||||
struct samp_edge_extra_bin_info *rb_edge_bins;
|
||||
uint8_t *bin_pwr_data;
|
||||
uint32_t *binptr_32;
|
||||
uint16_t *binptr_16;
|
||||
uint16_t pwr_16;
|
||||
size_t pwr_count;
|
||||
uint16_t num_edge_bins;
|
||||
uint16_t idx;
|
||||
uint16_t start_bin_index;
|
||||
uint32_t bytes_copied;
|
||||
|
||||
swar = &spectral->len_adj_swar;
|
||||
|
||||
@@ -160,102 +157,63 @@ target_if_spectral_fill_samp_msg(struct target_if_spectral *spectral,
|
||||
detector_info->start_bin_idx + 1;
|
||||
num_edge_bins = lb_edge_bins->num_bins +
|
||||
rb_edge_bins->num_bins;
|
||||
/*
|
||||
* To check whether FFT bin values exceed 8 bits, we add a
|
||||
* check before copying values to samp_data->bin_pwr.
|
||||
* If it crosses 8 bits, we cap the values to maximum value
|
||||
* supported by 8 bits ie. 255. This needs to be done as the
|
||||
* destination array in SAMP message is 8 bits. This is a
|
||||
* temporary solution till an array of 16 bits is used for
|
||||
* SAMP message.
|
||||
*/
|
||||
if (swar->fftbin_size_war ==
|
||||
SPECTRAL_FFTBIN_SIZE_WAR_4BYTE_TO_1BYTE) {
|
||||
binptr_32 = (uint32_t *)bin_pwr_data;
|
||||
if (lb_edge_bins->num_bins > 0) {
|
||||
for (idx = 0; idx < lb_edge_bins->num_bins;
|
||||
idx++) {
|
||||
/* Read only the first 2 bytes of the DWORD */
|
||||
pwr_16 = *((uint16_t *)binptr_32++);
|
||||
if (qdf_unlikely(pwr_16 >
|
||||
MAX_FFTBIN_VALUE))
|
||||
pwr_16 = MAX_FFTBIN_VALUE;
|
||||
spec_samp_msg->bin_pwr
|
||||
[lb_edge_bins->start_bin_idx + idx]
|
||||
= pwr_16;
|
||||
}
|
||||
|
||||
/* Copy left edge bins */
|
||||
if (lb_edge_bins->num_bins > 0) {
|
||||
ret = target_if_spectral_copy_fft_bins(
|
||||
spectral, bin_pwr_data,
|
||||
&spec_samp_msg->bin_pwr[
|
||||
lb_edge_bins->start_bin_idx],
|
||||
lb_edge_bins->num_bins,
|
||||
&bytes_copied);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(ret)) {
|
||||
qdf_spin_unlock_bh(
|
||||
&spectral->session_det_map_lock);
|
||||
spectral_err_rl("Unable to copy left edge FFT bins");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
for (idx = 0; idx < pwr_count; idx++) {
|
||||
/* Read only the first 2 bytes of the DWORD */
|
||||
pwr_16 = *((uint16_t *)binptr_32++);
|
||||
if (qdf_unlikely(pwr_16 > MAX_FFTBIN_VALUE))
|
||||
pwr_16 = MAX_FFTBIN_VALUE;
|
||||
spec_samp_msg->bin_pwr[start_bin_index + idx]
|
||||
= pwr_16;
|
||||
}
|
||||
if (rb_edge_bins->num_bins > 0) {
|
||||
for (idx = 0; idx < rb_edge_bins->num_bins;
|
||||
idx++) {
|
||||
/* Read only the first 2 bytes of the DWORD */
|
||||
pwr_16 = *((uint16_t *)binptr_32++);
|
||||
if (qdf_unlikely(pwr_16 >
|
||||
MAX_FFTBIN_VALUE))
|
||||
pwr_16 = MAX_FFTBIN_VALUE;
|
||||
spec_samp_msg->bin_pwr
|
||||
[rb_edge_bins->start_bin_idx + idx]
|
||||
= pwr_16;
|
||||
}
|
||||
}
|
||||
} else if (swar->fftbin_size_war ==
|
||||
SPECTRAL_FFTBIN_SIZE_WAR_2BYTE_TO_1BYTE) {
|
||||
binptr_16 = (uint16_t *)bin_pwr_data;
|
||||
if (lb_edge_bins->num_bins > 0) {
|
||||
for (idx = 0; idx < lb_edge_bins->num_bins;
|
||||
idx++) {
|
||||
pwr_16 = *(binptr_16++);
|
||||
if (qdf_unlikely(pwr_16 >
|
||||
MAX_FFTBIN_VALUE))
|
||||
pwr_16 = MAX_FFTBIN_VALUE;
|
||||
spec_samp_msg->bin_pwr
|
||||
[lb_edge_bins->start_bin_idx + idx]
|
||||
= pwr_16;
|
||||
}
|
||||
}
|
||||
for (idx = 0; idx < pwr_count; idx++) {
|
||||
pwr_16 = *(binptr_16++);
|
||||
if (qdf_unlikely(pwr_16 > MAX_FFTBIN_VALUE))
|
||||
pwr_16 = MAX_FFTBIN_VALUE;
|
||||
spec_samp_msg->bin_pwr[start_bin_index + idx]
|
||||
= pwr_16;
|
||||
}
|
||||
if (rb_edge_bins->num_bins > 0) {
|
||||
for (idx = 0; idx < rb_edge_bins->num_bins;
|
||||
idx++) {
|
||||
pwr_16 = *(binptr_16++);
|
||||
if (qdf_unlikely(pwr_16 >
|
||||
MAX_FFTBIN_VALUE))
|
||||
pwr_16 = MAX_FFTBIN_VALUE;
|
||||
spec_samp_msg->bin_pwr
|
||||
[rb_edge_bins->start_bin_idx + idx]
|
||||
= pwr_16;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (lb_edge_bins->num_bins > 0)
|
||||
qdf_mem_copy(&spec_samp_msg->bin_pwr
|
||||
[lb_edge_bins->start_bin_idx],
|
||||
&bin_pwr_data[0],
|
||||
lb_edge_bins->num_bins);
|
||||
qdf_mem_copy(&spec_samp_msg->bin_pwr[start_bin_index],
|
||||
&bin_pwr_data[lb_edge_bins->num_bins],
|
||||
pwr_count);
|
||||
if (rb_edge_bins->num_bins > 0)
|
||||
qdf_mem_copy(&spec_samp_msg->bin_pwr
|
||||
[rb_edge_bins->start_bin_idx],
|
||||
&bin_pwr_data[pwr_count +
|
||||
lb_edge_bins->num_bins],
|
||||
rb_edge_bins->num_bins);
|
||||
|
||||
/* Advance the fft bin pointer in the report */
|
||||
bin_pwr_data += bytes_copied;
|
||||
}
|
||||
|
||||
/* Copy the in-band and out-band bins */
|
||||
ret = target_if_spectral_copy_fft_bins(
|
||||
spectral, bin_pwr_data,
|
||||
&spec_samp_msg->bin_pwr[start_bin_index],
|
||||
pwr_count,
|
||||
&bytes_copied);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(ret)) {
|
||||
qdf_spin_unlock_bh(
|
||||
&spectral->session_det_map_lock);
|
||||
spectral_err_rl("Unable to copy in-band/out-band FFT bins");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
/* Advance the fft bin pointer in the report */
|
||||
bin_pwr_data += bytes_copied;
|
||||
|
||||
/* Copy right edge bins */
|
||||
if (rb_edge_bins->num_bins > 0) {
|
||||
ret = target_if_spectral_copy_fft_bins(
|
||||
spectral, bin_pwr_data,
|
||||
&spec_samp_msg->bin_pwr[
|
||||
rb_edge_bins->start_bin_idx],
|
||||
rb_edge_bins->num_bins,
|
||||
&bytes_copied);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(ret)) {
|
||||
qdf_spin_unlock_bh(
|
||||
&spectral->session_det_map_lock);
|
||||
spectral_err_rl("Unable to copy right edge FFT bins");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
/* Advance the fft bin pointer in the report */
|
||||
bin_pwr_data += bytes_copied;
|
||||
}
|
||||
|
||||
spec_samp_msg->bin_pwr_count += (pwr_count + num_edge_bins);
|
||||
}
|
||||
|
||||
|
在新工单中引用
屏蔽一个用户