Linux wireless drivers development
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: linux-wireless <linux-wireless@vger.kernel.org>
Subject: rtl8192cu: notes on investigating power issues
Date: Sat, 14 Sep 2013 17:09:17 +0100	[thread overview]
Message-ID: <52348A2D.8000008@ilande.co.uk> (raw)

Hi Larry,

I spent some time yesterday evening adding various debugging statements 
around the driver to get a feel for what was happening, with some 
success. Included below are my notes from testing.

The key appears to be the calculation of the dig (transmitter gain?) 
value, for which the function chain looks like this:

1) rtl92c_dm_ctrl_initgain_by_rssi() sets the dig value

This value controls the power output from the transmitter and should lie 
between DM_DIG_MIN and DM_DIG_MAX (note the *higher* the number, the 
*lower* the power output). Setting the penultimate line to read 
"digtable->cur_igvalue = DM_DIG_MIN" appears to force maximum power and 
actually gives me a working connection.

Displaying various values in this function showed that the problem was 
that I had an exceptionally high value of digtable->rssi_val_min which 
was much higher than DM_DIG_MAX and so had the effect of disabling the 
radio.

2) rtl92c_dm_dynamic_bb_powersaving() sets digtable->rssi_val_min

This is actually done by a simple assignment "dm_pstable->rssi_val_min = 
rtlpriv->dm.undec_sm_pwdb".

3) _rtl92c_process_pwdb() sets rltpriv->dm.undec_sm_pwdb

This value is updated by comparing the existing value with the current 
value of pstats->rx_pwdb_all. If there is a difference, then slide the 
new value towards pstats->rx_pwdb_all and then use it to update 
rltpriv->dm.undec_sm_pwdb.

4) _rtl92c_query_rxphystatus() sets pstats->rx_pwdb_all

pstats->rx_pwdb_all was set to be a percentage conversion of the current 
antenna power read from the radio.

What was happening in my case:

1) pstats->rx_pwdb_all was mostly set to 100 (%) due to high signal strength

2) rltpriv->dm.undec_sm_pwdb would then slide towards a high value 
(around 0x40-0x4d) within a few seconds

3) Hence digtable->rssi_val_min would tend to hover at around the same level

4) digtable->cur_igvalue would be set to the same high value (> 0x3f or 
DM_DIG_MAX), therefore disabling the radio and disconnecting from the AP


Unfortunately I'm not particularly familiar with these types of power 
calculations (and there weren't many comments explaining how they 
worked), but the one thing that didn't seem right is that 
pstats->rx_pwdb_all claims to be a *percentage* and yet 
rtl92c_dm_dynamic_bb_powersaving() uses it as the basis to set the 
*value* of dm_pstable->rssi_val_min.


ATB,

Mark.

                 reply	other threads:[~2013-09-14 16:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=52348A2D.8000008@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-wireless@vger.kernel.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