linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pkshih <pkshih@realtek.com>
To: "ccchiu77@gmail.com" <ccchiu77@gmail.com>
Cc: "yhchuang@realtek.com" <yhchuang@realtek.com>,
	"kvalo@codeaurora.org" <kvalo@codeaurora.org>,
	Andy Huang <tehuang@realtek.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"Larry.Finger@lwfinger.net" <Larry.Finger@lwfinger.net>,
	"reto.schneider@husqvarnagroup.com" 
	<reto.schneider@husqvarnagroup.com>,
	"kuba@kernel.org" <kuba@kernel.org>
Subject: Re: Questions for TX power get/set implementation of realtek WiFi
Date: Mon, 8 Mar 2021 13:22:18 +0000	[thread overview]
Message-ID: <1615209724.1797.11.camel@realtek.com> (raw)
In-Reply-To: <CANgQ54dyKk_uoy_VWGxxTZd++5UaC7Tdq48dUzSPdVOE6H8iGQ@mail.gmail.com>

On Mon, 2021-03-08 at 08:46 +0000, 邱名碩 wrote:
> Pkshih <pkshih@realtek.com> 於 2021年3月6日 週六 下午1:09寫道:
> >
> > On Tue, 2021-03-02 at 10:21 +0000, 邱名碩 wrote:
> > > Hi guys,
> > >     I'm planning to implement the get_txpower hook function of the
> > > struct ieee80211_ops and handle the IEEE80211_CONF_CHANGE_POWER for
> > > rtl8xxxu driver. So that users can get the information of the current
> > > tx power limit and set a new limit value with iw commands.
> > >
> > >     I found there's phy_txpwr_idx_to_dbm() of each driver in
> > > realtek/rtlwifi to translate the tx power index parsed from efuse to
> > > tx power level in dBm. Does the power level translated represent the
> > > current tx power limit in dBm? In my RTL8188CUS module, the power
> > > index of CCK/OFDM from efuse for each channel is basically 36/38, thus
> > > the translated txpower level is 11dBm. Is this the expected value for
> > > the default txpower limit value? Or do I need some other formula to
> > > compute?
> >
> > Basically, you can use a linear equation to translate power level in dBm to
> > tx power index written to hardware registers.
> >   y = ax + b
> > where,
> >   y: tx power index written to registers
> >   x: tx power level in dBm
> >   a: a constant, 2
> >   b: a constant induced by the value programmed in efuse that is used to
> >      adapt modules differences of RF characters.
> >
> Thanks so much. So it means that the txpwr_idx_to_dbm and dbm_to_idx
> functions in rtlwifi family driver are basically correct. Except they
> use the constant
> b -7 for CCK and -8 for OFDM instead of the value in efuse. I should have
> this value from efuse.

As I mentioned, the calibration value in efuse is used to output proper
power that every hardware module must be the same (with little tolerance).

I'm not sure why constant b isn't related to the value in efuse.
Maybe, you can assume the functions are correct, and configure the power
you desire.

> 
> > >
> > >     And for the handler of IEEE80211_CONF_CHANGE_POWER, can I
> > > translate the hw->conf.power_level with the phy_dbm_to_txpwr_idx
> > > functions I found in some rtlwifi family drivers, then directly set
> > > the txpower index with phy_set_txpower_index functions which write
> > > power index to bbreg for different rates (CCK and OFDM)? Are there
> > > some invalid values I should take care of because the TCP RX
> > > performance seems to be extremely low when I write the power index
> > > value translated from 20dBm to bbreg. Any suggestions for what I
> > > should handle before writing the bbreg?
> >
> > The power level you're going to set must be less or equal to original
> > one, because it's the hard limit of hardware capability. If the power
> > level is too large, the receiver can't understand the signal. Then,
> > they can't exchange data that leads low performance as you see.
> > I think the performance would be okay if you connect to a near AP and
> > power level 10dBm is adapted.
> >
> 
> Thanks for clarification. So the power index from efuse is basically the
> hard limit of the tx power for each channel (and rate)? That explains
> my performance issue while I override it with higher value. Thanks
> 

The value in efuse isn't limit but calibration value of target power.
But, yes, you can seen it as hard limit as well.

--
Ping-Ke



      reply	other threads:[~2021-03-08 13:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CANgQ54cmG4mCx42i1ErXMJpv=2OmOGjjEgv=8oy90CpKcwkpZg@mail.gmail.com>
     [not found] ` <1615007321.1826.14.camel@realtek.com>
2021-03-08  8:46   ` Questions for TX power get/set implementation of realtek WiFi 邱名碩
2021-03-08 13:22     ` Pkshih [this message]

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=1615209724.1797.11.camel@realtek.com \
    --to=pkshih@realtek.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=ccchiu77@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=reto.schneider@husqvarnagroup.com \
    --cc=tehuang@realtek.com \
    --cc=yhchuang@realtek.com \
    /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).