2010-12-03 04:21:21

by Nick Kossifidis

[permalink] [raw]
Subject: [PATCH 1/6] ath5k: Always write tx powertable on hw

* By skipping tx power table calibration we also skip setting
tx power table on hw. Make sure we always write tx power table
on hw since it gets cleared on reset.

Signed-off-by: Nick Kossifidis <[email protected]>

---
drivers/net/wireless/ath/ath5k/phy.c | 33 +++++++++++++++++++++------------
1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index df5cd0f..f84afb4 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -2742,10 +2742,12 @@ ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah,

/* Write PDADC values on hw */
static void
-ath5k_setup_pwr_to_pdadc_table(struct ath5k_hw *ah,
- u8 pdcurves, u8 *pdg_to_idx)
+ath5k_setup_pwr_to_pdadc_table(struct ath5k_hw *ah, u8 ee_mode)
{
+ struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
u8 *pdadc_out = ah->ah_txpower.txp_pd_table;
+ u8 *pdg_to_idx = ee->ee_pdc_to_idx[ee_mode];
+ u8 pdcurves = ee->ee_pd_gains[ee_mode];
u32 reg;
u8 i;

@@ -2992,7 +2994,7 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah,
ee->ee_pd_gains[ee_mode]);

/* Write settings on hw */
- ath5k_setup_pwr_to_pdadc_table(ah, pdg, pdg_curve_to_idx);
+ ath5k_setup_pwr_to_pdadc_table(ah, ee_mode);

/* Set txp.offset, note that table_min
* can be negative */
@@ -3114,12 +3116,6 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
return -EINVAL;
}

- /* Reset TX power values */
- memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
- ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
- ah->ah_txpower.txp_min_pwr = 0;
- ah->ah_txpower.txp_max_pwr = AR5K_TUNE_MAX_TXPOWER;
-
/* Initialize TX power table */
switch (ah->ah_radio) {
case AR5K_RF5110:
@@ -3146,11 +3142,24 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
* so there is no need to recalculate the powertable, we 'll
* just use the cached one */
if (!fast) {
+ /* Reset TX power values */
+ memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
+ ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
+ ah->ah_txpower.txp_min_pwr = 0;
+ ah->ah_txpower.txp_max_pwr = AR5K_TUNE_MAX_TXPOWER;
+
+ /* Calculate the powertable */
ret = ath5k_setup_channel_powertable(ah, channel,
ee_mode, type);
- if (ret)
- return ret;
- }
+ if (ret)
+ return ret;
+ /* Write cached table on hw */
+ } else if (type == AR5K_PWRTABLE_PWR_TO_PDADC)
+ ath5k_setup_pwr_to_pdadc_table(ah, ee_mode);
+ else
+ ath5k_setup_pcdac_table(ah);
+
+

/* Limit max power if we have a CTL available */
ath5k_get_max_ctl_power(ah, channel);


2010-12-29 21:02:30

by Bob Copeland

[permalink] [raw]
Subject: Re: [ath5k-devel] [PATCH 1/6] ath5k: Always write tx powertable on hw

On Thu, Dec 2, 2010 at 11:03 PM, Nick Kossifidis <[email protected]> wrote:
> ?* By skipping tx power table calibration we also skip setting
> ?tx power table on hw. Make sure we always write tx power table
> ?on hw since it gets cleared on reset.
>
> ?Signed-off-by: Nick Kossifidis <[email protected]>

Just a very late heads-up, this patch seems to be causing problems
for me.

Seems a bit weird given the content, but the symptom is that
when I bring up the device none of my probe requests are actually
getting sent, according to wireshark captures from another device.
Reverting just this patch helps, so my power table must be broken
at start up.

I saw that Bruno had a later series that touched this area, so I'll
try them next.

--
Bob Copeland %% http://www.bobcopeland.com

2010-12-03 06:34:25

by Sedat Dilek

[permalink] [raw]
Subject: Re: [PATCH 1/6] ath5k: Always write tx powertable on hw

Tested-by: Sedat Dilek <[email protected]>

On Fri, Dec 3, 2010 at 5:03 AM, Nick Kossifidis <[email protected]> wrote:
>  * By skipping tx power table calibration we also skip setting
>  tx power table on hw. Make sure we always write tx power table
>  on hw since it gets cleared on reset.
>
>  Signed-off-by: Nick Kossifidis <[email protected]>
>
> ---
>  drivers/net/wireless/ath/ath5k/phy.c |   33 +++++++++++++++++++++------------
>  1 files changed, 21 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
> index df5cd0f..f84afb4 100644
> --- a/drivers/net/wireless/ath/ath5k/phy.c
> +++ b/drivers/net/wireless/ath/ath5k/phy.c
> @@ -2742,10 +2742,12 @@ ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah,
>
>  /* Write PDADC values on hw */
>  static void
> -ath5k_setup_pwr_to_pdadc_table(struct ath5k_hw *ah,
> -                       u8 pdcurves, u8 *pdg_to_idx)
> +ath5k_setup_pwr_to_pdadc_table(struct ath5k_hw *ah, u8 ee_mode)
>  {
> +       struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
>        u8 *pdadc_out = ah->ah_txpower.txp_pd_table;
> +       u8 *pdg_to_idx = ee->ee_pdc_to_idx[ee_mode];
> +       u8 pdcurves = ee->ee_pd_gains[ee_mode];
>        u32 reg;
>        u8 i;
>
> @@ -2992,7 +2994,7 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah,
>                                                ee->ee_pd_gains[ee_mode]);
>
>                /* Write settings on hw */
> -               ath5k_setup_pwr_to_pdadc_table(ah, pdg, pdg_curve_to_idx);
> +               ath5k_setup_pwr_to_pdadc_table(ah, ee_mode);
>
>                /* Set txp.offset, note that table_min
>                 * can be negative */
> @@ -3114,12 +3116,6 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
>                return -EINVAL;
>        }
>
> -       /* Reset TX power values */
> -       memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
> -       ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
> -       ah->ah_txpower.txp_min_pwr = 0;
> -       ah->ah_txpower.txp_max_pwr = AR5K_TUNE_MAX_TXPOWER;
> -
>        /* Initialize TX power table */
>        switch (ah->ah_radio) {
>        case AR5K_RF5110:
> @@ -3146,11 +3142,24 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
>         * so there is no need to recalculate the powertable, we 'll
>         * just use the cached one */
>        if (!fast) {
> +               /* Reset TX power values */
> +               memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
> +               ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
> +               ah->ah_txpower.txp_min_pwr = 0;
> +               ah->ah_txpower.txp_max_pwr = AR5K_TUNE_MAX_TXPOWER;
> +
> +               /* Calculate the powertable */
>                ret = ath5k_setup_channel_powertable(ah, channel,
>                                                        ee_mode, type);
> -                       if (ret)
> -                               return ret;
> -       }
> +               if (ret)
> +                       return ret;
> +       /* Write cached table on hw */
> +       } else if (type == AR5K_PWRTABLE_PWR_TO_PDADC)
> +               ath5k_setup_pwr_to_pdadc_table(ah, ee_mode);
> +       else
> +               ath5k_setup_pcdac_table(ah);
> +
> +
>
>        /* Limit max power if we have a CTL available */
>        ath5k_get_max_ctl_power(ah, channel);
>

2010-12-04 21:37:38

by Nick Kossifidis

[permalink] [raw]
Subject: Re: [PATCH 1/6] ath5k: Always write tx powertable on hw

2010/12/4 Bob Copeland <[email protected]>:
> On Fri, Dec 3, 2010 at 9:55 AM, John W. Linville <[email protected]> wrote:
>> On Fri, Dec 03, 2010 at 06:03:00AM +0200, Nick Kossifidis wrote:
>>>  * By skipping tx power table calibration we also skip setting
>>>  tx power table on hw. Make sure we always write tx power table
>>>  on hw since it gets cleared on reset.
>>>
>>>  Signed-off-by: Nick Kossifidis <[email protected]>
>>
>> Hey, Nick -- just a process note...
>>
>> All your patches have " Signed-off-by..." (notice the leading space),
>> which looks a bit funny.  Could you figure-out why this is happening
>> and change it to remove the leading space?
>
> Also the "*" thing is a bit weird as kernel commit messages go.
>

Sorry, bad habits, will change that next time ;-)


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

2010-12-03 15:00:11

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH 1/6] ath5k: Always write tx powertable on hw

On Fri, Dec 03, 2010 at 06:03:00AM +0200, Nick Kossifidis wrote:
> * By skipping tx power table calibration we also skip setting
> tx power table on hw. Make sure we always write tx power table
> on hw since it gets cleared on reset.
>
> Signed-off-by: Nick Kossifidis <[email protected]>

Hey, Nick -- just a process note...

All your patches have " Signed-off-by..." (notice the leading space),
which looks a bit funny. Could you figure-out why this is happening
and change it to remove the leading space?

Thanks,

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2010-12-03 22:23:06

by Bob Copeland

[permalink] [raw]
Subject: Re: [PATCH 1/6] ath5k: Always write tx powertable on hw

On Fri, Dec 3, 2010 at 9:55 AM, John W. Linville <[email protected]> wrote:
> On Fri, Dec 03, 2010 at 06:03:00AM +0200, Nick Kossifidis wrote:
>> ?* By skipping tx power table calibration we also skip setting
>> ?tx power table on hw. Make sure we always write tx power table
>> ?on hw since it gets cleared on reset.
>>
>> ?Signed-off-by: Nick Kossifidis <[email protected]>
>
> Hey, Nick -- just a process note...
>
> All your patches have " Signed-off-by..." (notice the leading space),
> which looks a bit funny. ?Could you figure-out why this is happening
> and change it to remove the leading space?

Also the "*" thing is a bit weird as kernel commit messages go.

--
Bob Copeland %% http://www.bobcopeland.com

2011-01-02 18:24:01

by Bob Copeland

[permalink] [raw]
Subject: Re: [ath5k-devel] [PATCH 1/6] ath5k: Always write tx powertable on hw

On Sat, Jan 01, 2011 at 11:51:07PM +0900, Bruno Randolf wrote:
> > Reverting just this patch helps, so my power table must be broken
> > at start up.
> >
> > I saw that Bruno had a later series that touched this area, so I'll
> > try them next.
>
> Yep, they should fix that problem. Please try them and report if they don't.

Indeed, applied first 3 patches and problem is resolved (and now I see
you pointed it out in patch 3). Thanks!

--
Bob Copeland %% http://www.bobcopeland.com


2011-01-01 14:51:12

by Bruno Randolf

[permalink] [raw]
Subject: Re: [ath5k-devel] [PATCH 1/6] ath5k: Always write tx powertable on hw

On Thursday 30 December 2010 06:02:29 Bob Copeland wrote:
> On Thu, Dec 2, 2010 at 11:03 PM, Nick Kossifidis <[email protected]>
wrote:
> > * By skipping tx power table calibration we also skip setting
> > tx power table on hw. Make sure we always write tx power table
> > on hw since it gets cleared on reset.
> >
> > Signed-off-by: Nick Kossifidis <[email protected]>
>
> Just a very late heads-up, this patch seems to be causing problems
> for me.
>
> Seems a bit weird given the content, but the symptom is that
> when I bring up the device none of my probe requests are actually
> getting sent, according to wireshark captures from another device.
> Reverting just this patch helps, so my power table must be broken
> at start up.
>
> I saw that Bruno had a later series that touched this area, so I'll
> try them next.

Yep, they should fix that problem. Please try them and report if they don't.

Bruno