kernel: bump 4.14 to 4.14.72
[openwrt/staging/chunkeey.git] / package / kernel / mac80211 / patches / 380-0011-ath10k-fix-spectral-scan-for-QCA9984-and-QCA9888-chi.patch
1 From 2e9bcd0d73243f5e49daf92508d64cc33c30da01 Mon Sep 17 00:00:00 2001
2 From: Karthikeyan Periyasamy <periyasa@codeaurora.org>
3 Date: Tue, 29 May 2018 17:01:13 +0530
4 Subject: [PATCH] ath10k: fix spectral scan for QCA9984 and QCA9888 chipsets
5
6 The spectral scan has been always broken on QCA9984 and QCA9888.
7
8 Introduce a hardware parameter 'spectral_bin_offset' to resolve this issue for
9 QCA9984 and QCA9888 chipsets. For other chipsets, the hardware parameter
10 'spectral_bin_offset' is zero so that existing behaviour is retained as it is.
11
12 In QCA9984 and QCA9888 chipsets, hardware param value 'spectral_bin_discard'
13 is 12 bytes. This 12 bytes is derived as the sum of segment index (4 bytes),
14 extra bins before the actual data (4 bytes) and extra bins after the actual
15 data (4 bytes). Always discarding (12 bytes) happens at end of the samples and
16 incorrect samples got dumped, so that user can find incorrect arrangement
17 samples in spectral scan dump.
18
19 To fix this issue, we have to discard first 8 bytes and last 4 bytes in every
20 samples, so totally 12 bytes are discarded. In every sample we need to consider
21 the offset while taking the actual spectral data. For QCA9984, QCA9888 the
22 offset is 8 bytes (segment index + extra bins before actual data).
23
24 Hardware tested: QCA9984 and QCA9888
25 Firmware tested: 10.4-3.5.3-00053
26
27 Signed-off-by: Karthikeyan Periyasamy <periyasa@codeaurora.org>
28 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
29 ---
30 drivers/net/wireless/ath/ath10k/core.c | 13 +++++++++++++
31 drivers/net/wireless/ath/ath10k/hw.h | 3 +++
32 drivers/net/wireless/ath/ath10k/spectral.c | 2 +-
33 3 files changed, 17 insertions(+), 1 deletion(-)
34
35 --- a/drivers/net/wireless/ath/ath10k/core.c
36 +++ b/drivers/net/wireless/ath/ath10k/core.c
37 @@ -72,6 +72,7 @@ static const struct ath10k_hw_params ath
38 .hw_ops = &qca988x_ops,
39 .decap_align_bytes = 4,
40 .spectral_bin_discard = 0,
41 + .spectral_bin_offset = 0,
42 .vht160_mcs_rx_highest = 0,
43 .vht160_mcs_tx_highest = 0,
44 .n_cipher_suites = 8,
45 @@ -96,6 +97,7 @@ static const struct ath10k_hw_params ath
46 .hw_ops = &qca988x_ops,
47 .decap_align_bytes = 4,
48 .spectral_bin_discard = 0,
49 + .spectral_bin_offset = 0,
50 .vht160_mcs_rx_highest = 0,
51 .vht160_mcs_tx_highest = 0,
52 .n_cipher_suites = 8,
53 @@ -119,6 +121,7 @@ static const struct ath10k_hw_params ath
54 .hw_ops = &qca988x_ops,
55 .decap_align_bytes = 4,
56 .spectral_bin_discard = 0,
57 + .spectral_bin_offset = 0,
58 .vht160_mcs_rx_highest = 0,
59 .vht160_mcs_tx_highest = 0,
60 .n_cipher_suites = 8,
61 @@ -142,6 +145,7 @@ static const struct ath10k_hw_params ath
62 .hw_ops = &qca988x_ops,
63 .decap_align_bytes = 4,
64 .spectral_bin_discard = 0,
65 + .spectral_bin_offset = 0,
66 .vht160_mcs_rx_highest = 0,
67 .vht160_mcs_tx_highest = 0,
68 .n_cipher_suites = 8,
69 @@ -165,6 +169,8 @@ static const struct ath10k_hw_params ath
70 .hw_ops = &qca988x_ops,
71 .decap_align_bytes = 4,
72 .spectral_bin_discard = 0,
73 + .spectral_bin_offset = 0,
74 + .spectral_bin_offset = 0,
75 .vht160_mcs_rx_highest = 0,
76 .vht160_mcs_tx_highest = 0,
77 .n_cipher_suites = 8,
78 @@ -191,6 +197,7 @@ static const struct ath10k_hw_params ath
79 .target_cpu_freq = 176000000,
80 .decap_align_bytes = 4,
81 .spectral_bin_discard = 0,
82 + .spectral_bin_offset = 0,
83 .vht160_mcs_rx_highest = 0,
84 .vht160_mcs_tx_highest = 0,
85 .n_cipher_suites = 8,
86 @@ -220,6 +227,7 @@ static const struct ath10k_hw_params ath
87 .hw_ops = &qca99x0_ops,
88 .decap_align_bytes = 1,
89 .spectral_bin_discard = 4,
90 + .spectral_bin_offset = 0,
91 .vht160_mcs_rx_highest = 0,
92 .vht160_mcs_tx_highest = 0,
93 .n_cipher_suites = 11,
94 @@ -250,6 +258,7 @@ static const struct ath10k_hw_params ath
95 .hw_ops = &qca99x0_ops,
96 .decap_align_bytes = 1,
97 .spectral_bin_discard = 12,
98 + .spectral_bin_offset = 8,
99
100 /* Can do only 2x2 VHT160 or 80+80. 1560Mbps is 4x4 80Mhz
101 * or 2x2 160Mhz, long-guard-interval.
102 @@ -283,6 +292,7 @@ static const struct ath10k_hw_params ath
103 .hw_ops = &qca99x0_ops,
104 .decap_align_bytes = 1,
105 .spectral_bin_discard = 12,
106 + .spectral_bin_offset = 8,
107
108 /* Can do only 1x1 VHT160 or 80+80. 780Mbps is 2x2 80Mhz or
109 * 1x1 160Mhz, long-guard-interval.
110 @@ -310,6 +320,7 @@ static const struct ath10k_hw_params ath
111 .hw_ops = &qca988x_ops,
112 .decap_align_bytes = 4,
113 .spectral_bin_discard = 0,
114 + .spectral_bin_offset = 0,
115 .vht160_mcs_rx_highest = 0,
116 .vht160_mcs_tx_highest = 0,
117 .n_cipher_suites = 8,
118 @@ -335,6 +346,7 @@ static const struct ath10k_hw_params ath
119 .target_cpu_freq = 176000000,
120 .decap_align_bytes = 4,
121 .spectral_bin_discard = 0,
122 + .spectral_bin_offset = 0,
123 .vht160_mcs_rx_highest = 0,
124 .vht160_mcs_tx_highest = 0,
125 .n_cipher_suites = 8,
126 @@ -365,6 +377,7 @@ static const struct ath10k_hw_params ath
127 .hw_ops = &qca99x0_ops,
128 .decap_align_bytes = 1,
129 .spectral_bin_discard = 4,
130 + .spectral_bin_offset = 0,
131 .vht160_mcs_rx_highest = 0,
132 .vht160_mcs_tx_highest = 0,
133 .n_cipher_suites = 11,
134 --- a/drivers/net/wireless/ath/ath10k/hw.h
135 +++ b/drivers/net/wireless/ath/ath10k/hw.h
136 @@ -553,6 +553,9 @@ struct ath10k_hw_params {
137
138 /* Number of ciphers supported (i.e First N) in cipher_suites array */
139 int n_cipher_suites;
140 +
141 + /* Number of bytes to be the offset for each FFT sample */
142 + int spectral_bin_offset;
143 };
144
145 struct htt_rx_desc;
146 --- a/drivers/net/wireless/ath/ath10k/spectral.c
147 +++ b/drivers/net/wireless/ath/ath10k/spectral.c
148 @@ -145,7 +145,7 @@ int ath10k_spectral_process_fft(struct a
149 fft_sample->noise = __cpu_to_be16(phyerr->nf_chains[chain_idx]);
150
151 bins = (u8 *)fftr;
152 - bins += sizeof(*fftr);
153 + bins += sizeof(*fftr) + ar->hw_params.spectral_bin_offset;
154
155 fft_sample->tsf = __cpu_to_be64(tsf);
156