mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
166 lines
5.2 KiB
Diff
166 lines
5.2 KiB
Diff
From cc2ad7541486f1f755949c1ccd17e14a15bf1f4e Mon Sep 17 00:00:00 2001
|
|
From: Karthikeyan Periyasamy <periyasa@codeaurora.org>
|
|
Date: Fri, 24 Sep 2021 16:52:46 +0300
|
|
Subject: [PATCH 012/120] ath11k: Refactor spectral FFT bin size
|
|
|
|
In IPQ8074, actual FFT bin size is two bytes but hardware reports it
|
|
with extra pad size of two bytes for each FFT bin. So finally each FFT
|
|
bin advertise as four bytes size in the collected data. This FFT pad is
|
|
not advertised in IPQ6018 platform. To accommodate this different
|
|
behavior across the platforms, introduce the hw param fft_pad_sz and use
|
|
it in spectral process. Also group all the spectral params under the new
|
|
structure in hw param structure for scalable in future.
|
|
|
|
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01492-QCAHKSWPL_SILICONZ-1
|
|
Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.4.0.1-00330-QCAHKSWPL_SILICONZ-1
|
|
|
|
Signed-off-by: Karthikeyan Periyasamy <periyasa@codeaurora.org>
|
|
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
|
|
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
|
|
Link: https://lore.kernel.org/r/20210721180809.90960-2-jouni@codeaurora.org
|
|
---
|
|
drivers/net/wireless/ath/ath11k/core.c | 33 +++++++++++++++++++---
|
|
drivers/net/wireless/ath/ath11k/hw.h | 6 +++-
|
|
drivers/net/wireless/ath/ath11k/spectral.c | 13 ++++-----
|
|
3 files changed, 40 insertions(+), 12 deletions(-)
|
|
|
|
--- a/drivers/net/wireless/ath/ath11k/core.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/core.c
|
|
@@ -59,7 +59,14 @@ static const struct ath11k_hw_params ath
|
|
.vdev_start_delay = false,
|
|
.htt_peer_map_v2 = true,
|
|
.tcl_0_only = false,
|
|
- .spectral_fft_sz = 2,
|
|
+
|
|
+ .spectral = {
|
|
+ .fft_sz = 2,
|
|
+ /* HW bug, expected BIN size is 2 bytes but HW report as 4 bytes.
|
|
+ * so added pad size as 2 bytes to compensate the BIN size
|
|
+ */
|
|
+ .fft_pad_sz = 2,
|
|
+ },
|
|
|
|
.interface_modes = BIT(NL80211_IFTYPE_STATION) |
|
|
BIT(NL80211_IFTYPE_AP) |
|
|
@@ -100,7 +107,11 @@ static const struct ath11k_hw_params ath
|
|
.vdev_start_delay = false,
|
|
.htt_peer_map_v2 = true,
|
|
.tcl_0_only = false,
|
|
- .spectral_fft_sz = 4,
|
|
+
|
|
+ .spectral = {
|
|
+ .fft_sz = 4,
|
|
+ .fft_pad_sz = 0,
|
|
+ },
|
|
|
|
.interface_modes = BIT(NL80211_IFTYPE_STATION) |
|
|
BIT(NL80211_IFTYPE_AP) |
|
|
@@ -141,7 +152,11 @@ static const struct ath11k_hw_params ath
|
|
.vdev_start_delay = true,
|
|
.htt_peer_map_v2 = false,
|
|
.tcl_0_only = true,
|
|
- .spectral_fft_sz = 0,
|
|
+
|
|
+ .spectral = {
|
|
+ .fft_sz = 0,
|
|
+ .fft_pad_sz = 0,
|
|
+ },
|
|
|
|
.interface_modes = BIT(NL80211_IFTYPE_STATION) |
|
|
BIT(NL80211_IFTYPE_AP),
|
|
@@ -180,6 +195,12 @@ static const struct ath11k_hw_params ath
|
|
.vdev_start_delay = false,
|
|
.htt_peer_map_v2 = true,
|
|
.tcl_0_only = false,
|
|
+
|
|
+ .spectral = {
|
|
+ .fft_sz = 0,
|
|
+ .fft_pad_sz = 0,
|
|
+ },
|
|
+
|
|
.interface_modes = BIT(NL80211_IFTYPE_STATION) |
|
|
BIT(NL80211_IFTYPE_AP) |
|
|
BIT(NL80211_IFTYPE_MESH_POINT),
|
|
@@ -219,7 +240,11 @@ static const struct ath11k_hw_params ath
|
|
.vdev_start_delay = true,
|
|
.htt_peer_map_v2 = false,
|
|
.tcl_0_only = true,
|
|
- .spectral_fft_sz = 0,
|
|
+
|
|
+ .spectral = {
|
|
+ .fft_sz = 0,
|
|
+ .fft_pad_sz = 0,
|
|
+ },
|
|
|
|
.interface_modes = BIT(NL80211_IFTYPE_STATION) |
|
|
BIT(NL80211_IFTYPE_AP),
|
|
--- a/drivers/net/wireless/ath/ath11k/hw.h
|
|
+++ b/drivers/net/wireless/ath/ath11k/hw.h
|
|
@@ -153,7 +153,11 @@ struct ath11k_hw_params {
|
|
bool vdev_start_delay;
|
|
bool htt_peer_map_v2;
|
|
bool tcl_0_only;
|
|
- u8 spectral_fft_sz;
|
|
+
|
|
+ struct {
|
|
+ u8 fft_sz;
|
|
+ u8 fft_pad_sz;
|
|
+ } spectral;
|
|
|
|
u16 interface_modes;
|
|
bool supports_monitor;
|
|
--- a/drivers/net/wireless/ath/ath11k/spectral.c
|
|
+++ b/drivers/net/wireless/ath/ath11k/spectral.c
|
|
@@ -11,8 +11,6 @@
|
|
#define ATH11K_SPECTRAL_EVENT_TIMEOUT_MS 1
|
|
|
|
#define ATH11K_SPECTRAL_DWORD_SIZE 4
|
|
-/* HW bug, expected BIN size is 2 bytes but HW report as 4 bytes */
|
|
-#define ATH11K_SPECTRAL_BIN_SIZE 4
|
|
#define ATH11K_SPECTRAL_ATH11K_MIN_BINS 64
|
|
#define ATH11K_SPECTRAL_ATH11K_MIN_IB_BINS 32
|
|
#define ATH11K_SPECTRAL_ATH11K_MAX_IB_BINS 256
|
|
@@ -585,12 +583,12 @@ int ath11k_spectral_process_fft(struct a
|
|
struct spectral_tlv *tlv;
|
|
int tlv_len, bin_len, num_bins;
|
|
u16 length, freq;
|
|
- u8 chan_width_mhz;
|
|
+ u8 chan_width_mhz, bin_sz;
|
|
int ret;
|
|
|
|
lockdep_assert_held(&ar->spectral.lock);
|
|
|
|
- if (!ab->hw_params.spectral_fft_sz) {
|
|
+ if (!ab->hw_params.spectral.fft_sz) {
|
|
ath11k_warn(ab, "invalid bin size type for hw rev %d\n",
|
|
ab->hw_rev);
|
|
return -EINVAL;
|
|
@@ -608,7 +606,8 @@ int ath11k_spectral_process_fft(struct a
|
|
return -EINVAL;
|
|
}
|
|
|
|
- num_bins = bin_len / ATH11K_SPECTRAL_BIN_SIZE;
|
|
+ bin_sz = ab->hw_params.spectral.fft_sz + ab->hw_params.spectral.fft_pad_sz;
|
|
+ num_bins = bin_len / bin_sz;
|
|
/* Only In-band bins are useful to user for visualize */
|
|
num_bins >>= 1;
|
|
|
|
@@ -658,7 +657,7 @@ int ath11k_spectral_process_fft(struct a
|
|
fft_sample->freq2 = __cpu_to_be16(freq);
|
|
|
|
ath11k_spectral_parse_fft(fft_sample->data, fft_report->bins, num_bins,
|
|
- ab->hw_params.spectral_fft_sz);
|
|
+ ab->hw_params.spectral.fft_sz);
|
|
|
|
fft_sample->max_exp = ath11k_spectral_get_max_exp(fft_sample->max_index,
|
|
search.peak_mag,
|
|
@@ -966,7 +965,7 @@ int ath11k_spectral_init(struct ath11k_b
|
|
ab->wmi_ab.svc_map))
|
|
return 0;
|
|
|
|
- if (!ab->hw_params.spectral_fft_sz)
|
|
+ if (!ab->hw_params.spectral.fft_sz)
|
|
return 0;
|
|
|
|
for (i = 0; i < ab->num_radios; i++) {
|