linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: Felix Fietkau <nbd@openwrt.org>
Cc: linux-wireless@vger.kernel.org, mcgrof@qca.qualcomm.com,
	felixb@qca.qualcomm.com
Subject: Re: [PATCH] ath9k_hw: fix PA predistortion miscalibration
Date: Tue, 28 May 2013 13:45:19 -0400	[thread overview]
Message-ID: <20130528174519.GH2084@tuxdriver.com> (raw)
In-Reply-To: <1369757084-50141-1-git-send-email-nbd@openwrt.org>

Is this a fix for 3.10?  Should it go to stable?

On Tue, May 28, 2013 at 06:04:44PM +0200, Felix Fietkau wrote:
> 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>
> ---
>  drivers/net/wireless/ath/ath9k/ar9003_paprd.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
> index 09c1f9d..6343cc9 100644
> --- 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, u32 *data_U, u32 *pa_table, u16 *gain)
>  		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, u32 *data_U, u32 *pa_table, u16 *gain)
>  
>  		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;
>  	}
>  
>  	/*
> -- 
> 1.8.0.2
> 
> 

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

  parent reply	other threads:[~2013-05-28 18:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-28 16:04 [PATCH] ath9k_hw: fix PA predistortion miscalibration Felix Fietkau
2013-05-28 17:37 ` Dan Williams
2013-05-28 17:45 ` John W. Linville [this message]
2013-05-28 20:21   ` Felix Fietkau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130528174519.GH2084@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=felixb@qca.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mcgrof@qca.qualcomm.com \
    --cc=nbd@openwrt.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).