ath9k: fix some issues in PA predistortion (still disabled by default)
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 300-pending_work.patch
index 8c43574ee8b8e9db3043563a3f90e4d5930c16a3..33120a09031da29bea6717e2b2c5769cbbbac25d 100644 (file)
                return -EINVAL;
  
        trace_drv_add_interface(local, sdata);
                return -EINVAL;
  
        trace_drv_add_interface(local, sdata);
+--- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
+@@ -454,6 +454,8 @@ static bool create_pa_curve(u32 *data_L,
+               if (accum_cnt <= thresh_accum_cnt)
+                       continue;
++              max_index++;
++
+               /* sum(tx amplitude) */
+               accum_tx = ((data_L[i] >> 16) & 0xffff) |
+                   ((data_U[i] & 0x7ff) << 16);
+@@ -468,20 +470,21 @@ static bool create_pa_curve(u32 *data_L,
+               accum_tx <<= scale_factor;
+               accum_rx <<= scale_factor;
+-              x_est[i + 1] = (((accum_tx + accum_cnt) / accum_cnt) + 32) >>
+-                  scale_factor;
++              x_est[max_index] =
++                      (((accum_tx + accum_cnt) / accum_cnt) + 32) >>
++                      scale_factor;
+-              Y[i + 1] = ((((accum_rx + accum_cnt) / accum_cnt) + 32) >>
++              Y[max_index] =
++                      ((((accum_rx + accum_cnt) / accum_cnt) + 32) >>
+                           scale_factor) +
+-                          (1 << scale_factor) * max_index + 16;
++                      (1 << scale_factor) * i + 16;
+               if (accum_ang >= (1 << 26))
+                       accum_ang -= 1 << 27;
+-              theta[i + 1] = ((accum_ang * (1 << scale_factor)) + accum_cnt) /
+-                  accum_cnt;
+-
+-              max_index++;
++              theta[max_index] =
++                      ((accum_ang * (1 << scale_factor)) + accum_cnt) /
++                      accum_cnt;
+       }
+       /*