Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ath9k_hw: fix PA predistortion miscalibration

If any bins from the training data are skipped (i != max_index), the
calculated compensation curve gets distorted, and the signal will be
wildly overamplified. This may be the cause of the reported hardware
damage that was caused by PA predistortion (because of which PAPRD was
disabled by default).

When calculating the x_est, Y, theta values, the use of max_index and i
was reversed. i points to the bin index whereas max_index refers to the
index of the calculated arrays.

Note that PA predistortion is still disabled, it will be re-enabled
after it has been properly validated.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Felix Fietkau and committed by
John W. Linville
9c8426fc b338f74e

+11 -8
+11 -8
drivers/net/wireless/ath/ath9k/ar9003_paprd.c
··· 454 454 if (accum_cnt <= thresh_accum_cnt) 455 455 continue; 456 456 457 + max_index++; 458 + 457 459 /* sum(tx amplitude) */ 458 460 accum_tx = ((data_L[i] >> 16) & 0xffff) | 459 461 ((data_U[i] & 0x7ff) << 16); ··· 470 468 471 469 accum_tx <<= scale_factor; 472 470 accum_rx <<= scale_factor; 473 - x_est[i + 1] = (((accum_tx + accum_cnt) / accum_cnt) + 32) >> 474 - scale_factor; 471 + x_est[max_index] = 472 + (((accum_tx + accum_cnt) / accum_cnt) + 32) >> 473 + scale_factor; 475 474 476 - Y[i + 1] = ((((accum_rx + accum_cnt) / accum_cnt) + 32) >> 475 + Y[max_index] = 476 + ((((accum_rx + accum_cnt) / accum_cnt) + 32) >> 477 477 scale_factor) + 478 - (1 << scale_factor) * max_index + 16; 478 + (1 << scale_factor) * i + 16; 479 479 480 480 if (accum_ang >= (1 << 26)) 481 481 accum_ang -= 1 << 27; 482 482 483 - theta[i + 1] = ((accum_ang * (1 << scale_factor)) + accum_cnt) / 484 - accum_cnt; 485 - 486 - max_index++; 483 + theta[max_index] = 484 + ((accum_ang * (1 << scale_factor)) + accum_cnt) / 485 + accum_cnt; 487 486 } 488 487 489 488 /*