2020-06-09 07:51:39

by Karthikeyan periyasamy

[permalink] [raw]
Subject: [PATCH] ath11k: Add support spectral scan for IPQ6018

IPQ6018 supported with 4 bytes FFT BIN size. so supported 4 bytes
parsing logic in FFT report process.

Tested-on: IPQ6018 WLAN.HK.2.1.0.1-01228-QCAHKSWPL_SILICONZ-1

Note: This is based on below patches
1. ath11k: add IPQ6018 support
2. ath11k: add support for spectral scan
3. ath11k: Add direct buffer ring support

Signed-off-by: Karthikeyan Periyasamy <[email protected]>
---
drivers/net/wireless/ath/ath11k/core.c | 2 ++
drivers/net/wireless/ath/ath11k/hw.h | 1 +
drivers/net/wireless/ath/ath11k/spectral.c | 23 +++++++++++++----------
3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 3516ea6..45bf10b 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -26,6 +26,7 @@
.board_size = IPQ8074_MAX_BOARD_DATA_SZ,
.cal_size = IPQ8074_MAX_CAL_DATA_SZ,
},
+ .spectral_fft_sz = 2,
},
{
.dev_id = ATH11K_HW_IPQ6018,
@@ -35,6 +36,7 @@
.board_size = IPQ6018_MAX_BOARD_DATA_SZ,
.cal_size = IPQ6018_MAX_CAL_DATA_SZ,
},
+ .spectral_fft_sz = 4,
},
};

diff --git a/drivers/net/wireless/ath/ath11k/hw.h b/drivers/net/wireless/ath/ath11k/hw.h
index d976533..7d2b147 100644
--- a/drivers/net/wireless/ath/ath11k/hw.h
+++ b/drivers/net/wireless/ath/ath11k/hw.h
@@ -117,6 +117,7 @@ struct ath11k_hw_params {
size_t board_size;
size_t cal_size;
} fw;
+ u8 spectral_fft_sz;
};

struct ath11k_fw_ie {
diff --git a/drivers/net/wireless/ath/ath11k/spectral.c b/drivers/net/wireless/ath/ath11k/spectral.c
index 1c5d65b..f3196a0 100644
--- a/drivers/net/wireless/ath/ath11k/spectral.c
+++ b/drivers/net/wireless/ath/ath11k/spectral.c
@@ -17,8 +17,6 @@
#define ATH11K_SPECTRAL_ATH11K_MIN_IB_BINS 32
#define ATH11K_SPECTRAL_ATH11K_MAX_IB_BINS 256

-#define ATH11K_SPECTRAL_SAMPLE_FFT_BIN_MASK 0xFF
-
#define ATH11K_SPECTRAL_SCAN_COUNT_MAX 4095

/* Max channel computed by sum of 2g and 5g band channels */
@@ -557,16 +555,16 @@ static u8 ath11k_spectral_get_max_exp(s8 max_index, u8 max_magnitude,
return max_exp;
}

-static void ath11k_spectral_parse_16bit_fft(u8 *outbins, u8 *inbins, int num_bins)
+static void ath11k_spectral_parse_fft(u8 *outbins, u8 *inbins, int num_bins, u8 fft_sz)
{
- int i;
- __le16 *data = (__le16 *)inbins;
+ int i, j;

i = 0;
+ j = 0;
while (i < num_bins) {
- outbins[i] = (__le16_to_cpu(data[i])) &
- ATH11K_SPECTRAL_SAMPLE_FFT_BIN_MASK;
+ outbins[i] = inbins[j];
i++;
+ j += fft_sz;
}
}

@@ -588,6 +586,12 @@ int ath11k_spectral_process_fft(struct ath11k *ar,

lockdep_assert_held(&ar->spectral.lock);

+ if (!ab->hw_params.spectral_fft_sz) {
+ ath11k_warn(ab, "invalid bin size type for hw rev %d\n",
+ ab->hw_rev);
+ return -EINVAL;
+ }
+
tlv = (struct spectral_tlv *)data;
tlv_len = FIELD_GET(SPECTRAL_TLV_HDR_LEN, __le32_to_cpu(tlv->header));
/* convert Dword into bytes */
@@ -649,9 +653,8 @@ int ath11k_spectral_process_fft(struct ath11k *ar,
freq = summary->meta.freq2;
fft_sample->freq2 = __cpu_to_be16(freq);

- ath11k_spectral_parse_16bit_fft(fft_sample->data,
- fft_report->bins,
- num_bins);
+ ath11k_spectral_parse_fft(fft_sample->data, fft_report->bins,
+ num_bins, ab->hw_params.spectral_fft_sz);

fft_sample->max_exp = ath11k_spectral_get_max_exp(fft_sample->max_index,
search.peak_mag,
--
1.9.1


2020-09-15 18:53:44

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] ath11k: Add support spectral scan for IPQ6018

Karthikeyan Periyasamy <[email protected]> wrote:

> IPQ6018 supported with 4 bytes FFT BIN size. so supported 4 bytes
> parsing logic in FFT report process.
>
> Tested-on: IPQ6018 WLAN.HK.2.1.0.1-01228-QCAHKSWPL_SILICONZ-1
>
> Note: This is based on below patches
> 1. ath11k: add IPQ6018 support
> 2. ath11k: add support for spectral scan
> 3. ath11k: Add direct buffer ring support
>
> Signed-off-by: Karthikeyan Periyasamy <[email protected]>

Does not apply anymore, please rebase. Also you should investigate how
it works with QCA6390.

error: patch failed: drivers/net/wireless/ath/ath11k/core.c:26
error: drivers/net/wireless/ath/ath11k/core.c: patch does not apply
error: patch failed: drivers/net/wireless/ath/ath11k/hw.h:117
error: drivers/net/wireless/ath/ath11k/hw.h: patch does not apply
stg import: Diff does not apply cleanly

Patch set to Changes Requested.

--
https://patchwork.kernel.org/patch/11594815/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches