]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ath10k: fix spectral scan for QCA9984 and QCA9888 chipsets
authorKarthikeyan Periyasamy <periyasa@codeaurora.org>
Tue, 29 May 2018 11:31:13 +0000 (17:01 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 14 Jun 2018 15:09:45 +0000 (18:09 +0300)
The spectral scan has been always broken on QCA9984 and QCA9888.

Introduce a hardware parameter 'spectral_bin_offset' to resolve this issue for
QCA9984 and QCA9888 chipsets. For other chipsets, the hardware parameter
'spectral_bin_offset' is zero so that existing behaviour is retained as it is.

In QCA9984 and QCA9888 chipsets, hardware param value 'spectral_bin_discard'
is 12 bytes. This 12 bytes is derived as the sum of segment index (4 bytes),
extra bins before the actual data (4 bytes) and extra bins after the actual
data (4 bytes). Always discarding (12 bytes) happens at end of the samples and
incorrect samples got dumped, so that user can find incorrect arrangement
samples in spectral scan dump.

To fix this issue, we have to discard first 8 bytes and last 4 bytes in every
samples, so totally 12 bytes are discarded. In every sample we need to consider
the offset while taking the actual spectral data. For QCA9984, QCA9888 the
offset is 8 bytes (segment index + extra bins before actual data).

Hardware tested: QCA9984 and QCA9888
Firmware tested: 10.4-3.5.3-00053

Signed-off-by: Karthikeyan Periyasamy <periyasa@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath10k/core.c
drivers/net/wireless/ath/ath10k/hw.h
drivers/net/wireless/ath/ath10k/spectral.c

index 4cf54a7ef09a1505ef7f7231d776880c87977e62..25ecf7402984bd871d58aea5183bbf7cd79d2d42 100644 (file)
@@ -82,6 +82,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .hw_ops = &qca988x_ops,
                .decap_align_bytes = 4,
                .spectral_bin_discard = 0,
+               .spectral_bin_offset = 0,
                .vht160_mcs_rx_highest = 0,
                .vht160_mcs_tx_highest = 0,
                .n_cipher_suites = 8,
@@ -113,6 +114,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .hw_ops = &qca988x_ops,
                .decap_align_bytes = 4,
                .spectral_bin_discard = 0,
+               .spectral_bin_offset = 0,
                .vht160_mcs_rx_highest = 0,
                .vht160_mcs_tx_highest = 0,
                .n_cipher_suites = 8,
@@ -145,6 +147,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .hw_ops = &qca988x_ops,
                .decap_align_bytes = 4,
                .spectral_bin_discard = 0,
+               .spectral_bin_offset = 0,
                .vht160_mcs_rx_highest = 0,
                .vht160_mcs_tx_highest = 0,
                .n_cipher_suites = 8,
@@ -176,6 +179,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .hw_ops = &qca988x_ops,
                .decap_align_bytes = 4,
                .spectral_bin_discard = 0,
+               .spectral_bin_offset = 0,
                .vht160_mcs_rx_highest = 0,
                .vht160_mcs_tx_highest = 0,
                .n_cipher_suites = 8,
@@ -207,6 +211,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .hw_ops = &qca988x_ops,
                .decap_align_bytes = 4,
                .spectral_bin_discard = 0,
+               .spectral_bin_offset = 0,
                .vht160_mcs_rx_highest = 0,
                .vht160_mcs_tx_highest = 0,
                .n_cipher_suites = 8,
@@ -238,6 +243,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .hw_ops = &qca988x_ops,
                .decap_align_bytes = 4,
                .spectral_bin_discard = 0,
+               .spectral_bin_offset = 0,
                .vht160_mcs_rx_highest = 0,
                .vht160_mcs_tx_highest = 0,
                .n_cipher_suites = 8,
@@ -272,6 +278,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .target_cpu_freq = 176000000,
                .decap_align_bytes = 4,
                .spectral_bin_discard = 0,
+               .spectral_bin_offset = 0,
                .vht160_mcs_rx_highest = 0,
                .vht160_mcs_tx_highest = 0,
                .n_cipher_suites = 8,
@@ -309,6 +316,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .hw_ops = &qca99x0_ops,
                .decap_align_bytes = 1,
                .spectral_bin_discard = 4,
+               .spectral_bin_offset = 0,
                .vht160_mcs_rx_highest = 0,
                .vht160_mcs_tx_highest = 0,
                .n_cipher_suites = 11,
@@ -347,6 +355,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .hw_ops = &qca99x0_ops,
                .decap_align_bytes = 1,
                .spectral_bin_discard = 12,
+               .spectral_bin_offset = 8,
 
                /* Can do only 2x2 VHT160 or 80+80. 1560Mbps is 4x4 80Mhz
                 * or 2x2 160Mhz, long-guard-interval.
@@ -388,6 +397,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .hw_ops = &qca99x0_ops,
                .decap_align_bytes = 1,
                .spectral_bin_discard = 12,
+               .spectral_bin_offset = 8,
 
                /* Can do only 1x1 VHT160 or 80+80. 780Mbps is 2x2 80Mhz or
                 * 1x1 160Mhz, long-guard-interval.
@@ -423,6 +433,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .hw_ops = &qca988x_ops,
                .decap_align_bytes = 4,
                .spectral_bin_discard = 0,
+               .spectral_bin_offset = 0,
                .vht160_mcs_rx_highest = 0,
                .vht160_mcs_tx_highest = 0,
                .n_cipher_suites = 8,
@@ -456,6 +467,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .target_cpu_freq = 176000000,
                .decap_align_bytes = 4,
                .spectral_bin_discard = 0,
+               .spectral_bin_offset = 0,
                .vht160_mcs_rx_highest = 0,
                .vht160_mcs_tx_highest = 0,
                .n_cipher_suites = 8,
@@ -494,6 +506,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
                .hw_ops = &qca99x0_ops,
                .decap_align_bytes = 1,
                .spectral_bin_discard = 4,
+               .spectral_bin_offset = 0,
                .vht160_mcs_rx_highest = 0,
                .vht160_mcs_tx_highest = 0,
                .n_cipher_suites = 11,
index 23467e9fefeb012214749816d409d56e37c50b8e..a274bd809a08d55e829e98f30063a23e7a046122 100644 (file)
@@ -586,6 +586,9 @@ struct ath10k_hw_params {
 
        /* target supporting retention restore on ddr */
        bool rri_on_ddr;
+
+       /* Number of bytes to be the offset for each FFT sample */
+       int spectral_bin_offset;
 };
 
 struct htt_rx_desc;
index af6995de7e005d46b85395c2d8289377f3fe712e..653b6d01320773323affbb23ee17eabf11038ae7 100644 (file)
@@ -145,7 +145,7 @@ int ath10k_spectral_process_fft(struct ath10k *ar,
        fft_sample->noise = __cpu_to_be16(phyerr->nf_chains[chain_idx]);
 
        bins = (u8 *)fftr;
-       bins += sizeof(*fftr);
+       bins += sizeof(*fftr) + ar->hw_params.spectral_bin_offset;
 
        fft_sample->tsf = __cpu_to_be64(tsf);