linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4] ath5k: Linear PCDAC code fixes
@ 2009-07-31 18:05 Nick Kossifidis
  2009-07-31 18:07 ` Luis R. Rodriguez
  2009-07-31 18:31 ` Nick Kossifidis
  0 siblings, 2 replies; 5+ messages in thread
From: Nick Kossifidis @ 2009-07-31 18:05 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless; +Cc: linville, jirislaby, me, mcgrof, nbd

 * Set correct xpd curve indices for high/low gain curves during
   rfbuffer setup on RF5112B with both calibration curves available.

 * Don't return zero min power when we have the same pcdac value
   twice because it breaks interpolation. Instead return the right
   x barrier as we do when we have equal power levels for 2 different
   pcdac values.

---
 drivers/net/wireless/ath/ath5k/phy.c |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 2075ba9..6afba98 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -740,13 +740,22 @@ int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
 						AR5K_RF_XPD_GAIN, true);
 
 		} else {
-			/* TODO: Set high and low gain bits */
-			ath5k_hw_rfb_op(ah, rf_regs,
-						ee->ee_x_gain[ee_mode],
+			u8 *pdg_curve_to_idx = ee->ee_pdc_to_idx[ee_mode];
+			if (ee->ee_pd_gains[ee_mode] > 1) {
+				ath5k_hw_rfb_op(ah, rf_regs,
+						pdg_curve_to_idx[0],
 						AR5K_RF_PD_GAIN_LO, true);
-			ath5k_hw_rfb_op(ah, rf_regs,
-						ee->ee_x_gain[ee_mode],
+				ath5k_hw_rfb_op(ah, rf_regs,
+						pdg_curve_to_idx[1],
 						AR5K_RF_PD_GAIN_HI, true);
+			} else {
+				ath5k_hw_rfb_op(ah, rf_regs,
+						pdg_curve_to_idx[0],
+						AR5K_RF_PD_GAIN_LO, true);
+				ath5k_hw_rfb_op(ah, rf_regs,
+						pdg_curve_to_idx[0],
+						AR5K_RF_PD_GAIN_HI, true);
+			}
 
 			/* Lower synth voltage on Rev 2 */
 			ath5k_hw_rfb_op(ah, rf_regs, 2,
@@ -1896,8 +1905,9 @@ ath5k_get_linear_pcdac_min(const u8 *stepL, const u8 *stepR,
 	s16 min_pwrL, min_pwrR;
 	s16 pwr_i;
 
-	if (WARN_ON(stepL[0] == stepL[1] || stepR[0] == stepR[1]))
-		return 0;
+	/* Some vendors write the same pcdac value twice !!! */
+	if (stepL[0] == stepL[1] || stepR[0] == stepR[1])
+		return max(pwrL[0], pwrR[0]);
 
 	if (pwrL[0] == pwrL[1])
 		min_pwrL = pwrL[0];

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/4] ath5k: Linear PCDAC code fixes
  2009-07-31 18:05 [PATCH 2/4] ath5k: Linear PCDAC code fixes Nick Kossifidis
@ 2009-07-31 18:07 ` Luis R. Rodriguez
  2009-07-31 18:12   ` [ath5k-devel] " Nick Kossifidis
  2009-07-31 18:31 ` Nick Kossifidis
  1 sibling, 1 reply; 5+ messages in thread
From: Luis R. Rodriguez @ 2009-07-31 18:07 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless, linville, jirislaby, me, mcgrof, nbd

On Fri, Jul 31, 2009 at 11:05 AM, Nick
Kossifidis<mick@madwifi-project.org> wrote:
>  * Set correct xpd curve indices for high/low gain curves during
>   rfbuffer setup on RF5112B with both calibration curves available.
>
>  * Don't return zero min power when we have the same pcdac value
>   twice because it breaks interpolation. Instead return the right
>   x barrier as we do when we have equal power levels for 2 different
>   pcdac values.
> ---
>  drivers/net/wireless/ath/ath5k/phy.c |   24 +++++++++++++++++-------
>  1 files changed, 17 insertions(+), 7 deletions(-)

Missing SOB

  Luis

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ath5k-devel] [PATCH 2/4] ath5k: Linear PCDAC code fixes
  2009-07-31 18:07 ` Luis R. Rodriguez
@ 2009-07-31 18:12   ` Nick Kossifidis
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Kossifidis @ 2009-07-31 18:12 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: ath5k-devel, linux-wireless, linville, jirislaby, me, nbd

2009/7/31 Luis R. Rodriguez <mcgrof@gmail.com>:
> On Fri, Jul 31, 2009 at 11:05 AM, Nick
> Kossifidis<mick@madwifi-project.org> wrote:
>>  * Set correct xpd curve indices for high/low gain curves during
>>   rfbuffer setup on RF5112B with both calibration curves available.
>>
>>  * Don't return zero min power when we have the same pcdac value
>>   twice because it breaks interpolation. Instead return the right
>>   x barrier as we do when we have equal power levels for 2 different
>>   pcdac values.
>> ---
>>  drivers/net/wireless/ath/ath5k/phy.c |   24 +++++++++++++++++-------
>>  1 files changed, 17 insertions(+), 7 deletions(-)
>
> Missing SOB
>
>  Luis

Grrr, sorry ppl, resending...


-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/4] ath5k: Linear PCDAC code fixes
  2009-07-31 18:05 [PATCH 2/4] ath5k: Linear PCDAC code fixes Nick Kossifidis
  2009-07-31 18:07 ` Luis R. Rodriguez
@ 2009-07-31 18:31 ` Nick Kossifidis
  2009-08-04 15:25   ` [ath5k-devel] " Bob Copeland
  1 sibling, 1 reply; 5+ messages in thread
From: Nick Kossifidis @ 2009-07-31 18:31 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless; +Cc: linville, jirislaby, me, mcgrof, nbd

 * Set correct xpd curve indices for high/low gain curves during
   rfbuffer setup on RF5112B with both calibration curves available.

 * Don't return zero min power when we have the same pcdac value
   twice because it breaks interpolation. Instead return the right
   x barrier as we do when we have equal power levels for 2 different
   pcdac values.

 Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

---
 drivers/net/wireless/ath/ath5k/phy.c |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 2075ba9..6afba98 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -740,13 +740,22 @@ int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
 						AR5K_RF_XPD_GAIN, true);
 
 		} else {
-			/* TODO: Set high and low gain bits */
-			ath5k_hw_rfb_op(ah, rf_regs,
-						ee->ee_x_gain[ee_mode],
+			u8 *pdg_curve_to_idx = ee->ee_pdc_to_idx[ee_mode];
+			if (ee->ee_pd_gains[ee_mode] > 1) {
+				ath5k_hw_rfb_op(ah, rf_regs,
+						pdg_curve_to_idx[0],
 						AR5K_RF_PD_GAIN_LO, true);
-			ath5k_hw_rfb_op(ah, rf_regs,
-						ee->ee_x_gain[ee_mode],
+				ath5k_hw_rfb_op(ah, rf_regs,
+						pdg_curve_to_idx[1],
 						AR5K_RF_PD_GAIN_HI, true);
+			} else {
+				ath5k_hw_rfb_op(ah, rf_regs,
+						pdg_curve_to_idx[0],
+						AR5K_RF_PD_GAIN_LO, true);
+				ath5k_hw_rfb_op(ah, rf_regs,
+						pdg_curve_to_idx[0],
+						AR5K_RF_PD_GAIN_HI, true);
+			}
 
 			/* Lower synth voltage on Rev 2 */
 			ath5k_hw_rfb_op(ah, rf_regs, 2,
@@ -1896,8 +1905,9 @@ ath5k_get_linear_pcdac_min(const u8 *stepL, const u8 *stepR,
 	s16 min_pwrL, min_pwrR;
 	s16 pwr_i;
 
-	if (WARN_ON(stepL[0] == stepL[1] || stepR[0] == stepR[1]))
-		return 0;
+	/* Some vendors write the same pcdac value twice !!! */
+	if (stepL[0] == stepL[1] || stepR[0] == stepR[1])
+		return max(pwrL[0], pwrR[0]);
 
 	if (pwrL[0] == pwrL[1])
 		min_pwrL = pwrL[0];

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [ath5k-devel] [PATCH 2/4] ath5k: Linear PCDAC code fixes
  2009-07-31 18:31 ` Nick Kossifidis
@ 2009-08-04 15:25   ` Bob Copeland
  0 siblings, 0 replies; 5+ messages in thread
From: Bob Copeland @ 2009-08-04 15:25 UTC (permalink / raw)
  To: ath5k-devel, linux-wireless, linville, jirislaby, me, mcgrof, nbd

On Fri, Jul 31, 2009 at 2:31 PM, Nick
Kossifidis<mick@madwifi-project.org> wrote:
>  * Set correct xpd curve indices for high/low gain curves during
>   rfbuffer setup on RF5112B with both calibration curves available.
>
>  * Don't return zero min power when we have the same pcdac value
>   twice because it breaks interpolation. Instead return the right
>   x barrier as we do when we have equal power levels for 2 different
>   pcdac values.
>
>  Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>

Acked-by: Bob Copeland <me@bobcopeland.com>

-- 
Bob Copeland %% www.bobcopeland.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-08-04 15:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-31 18:05 [PATCH 2/4] ath5k: Linear PCDAC code fixes Nick Kossifidis
2009-07-31 18:07 ` Luis R. Rodriguez
2009-07-31 18:12   ` [ath5k-devel] " Nick Kossifidis
2009-07-31 18:31 ` Nick Kossifidis
2009-08-04 15:25   ` [ath5k-devel] " Bob Copeland

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).