Linux wireless drivers development
 help / color / mirror / Atom feed
From: Tony Chuang <yhchuang@realtek.com>
To: Chris Chiu <chiu@endlessm.com>
Cc: Kalle Valo <kvalo@codeaurora.org>,
	linux-wireless <linux-wireless@vger.kernel.org>,
	Brian Norris <briannorris@chromium.org>
Subject: RE: [PATCH 03/11] rtw88: Use secondary channel offset enumeration
Date: Tue, 24 Dec 2019 07:44:47 +0000	[thread overview]
Message-ID: <fe59ac935a9c48f5a33208a885b9d1f0@realtek.com> (raw)
In-Reply-To: <CAB4CAwcM+4toAfawgM40YZCNbHcHVOKJd0VWVJNSWki8n2PN1A@mail.gmail.com>

> On Fri, Dec 20, 2019 at 5:22 PM <yhchuang@realtek.com> wrote:
> >
> > From: Ping-Ke Shih <pkshih@realtek.com>
> >
> > The hardware value of secondary channel offset isn't very intuitive. This
> > commit adds enumeration, so we can easier to check the logic with the
> > suffix of enumeration name, likes _UPPER or _LOWER.
> >
> > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> > Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
> > ---
> >  drivers/net/wireless/realtek/rtw88/mac.c      |  6 +++---
> >  drivers/net/wireless/realtek/rtw88/main.c     | 14 +++++++-------
> >  drivers/net/wireless/realtek/rtw88/main.h     | 10 ++++++++++
> >  drivers/net/wireless/realtek/rtw88/rtw8822b.c |  2 +-
> >  drivers/net/wireless/realtek/rtw88/rtw8822c.c |  2 +-
> >  5 files changed, 22 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/net/wireless/realtek/rtw88/mac.c
> b/drivers/net/wireless/realtek/rtw88/mac.c
> > index ed9bb427ba60..94d1b179e2e1 100644
> > --- a/drivers/net/wireless/realtek/rtw88/mac.c
> > +++ b/drivers/net/wireless/realtek/rtw88/mac.c
> > @@ -17,10 +17,10 @@ void rtw_set_channel_mac(struct rtw_dev *rtwdev,
> u8 channel, u8 bw,
> >
> >         txsc20 = primary_ch_idx;
> >         if (bw == RTW_CHANNEL_WIDTH_80) {
> > -               if (txsc20 == 1 || txsc20 == 3)
> > -                       txsc40 = 9;
> > +               if (txsc20 == RTW_SC_20_UPPER || txsc20 ==
> RTW_SC_20_UPPERST)
> > +                       txsc40 = RTW_SC_40_UPPER;
> >                 else
> > -                       txsc40 = 10;
> > +                       txsc40 = RTW_SC_40_LOWER;
> >         }
> >         rtw_write8(rtwdev, REG_DATA_SC,
> >                    BIT_TXSC_20M(txsc20) | BIT_TXSC_40M(txsc40));
> > diff --git a/drivers/net/wireless/realtek/rtw88/main.c
> b/drivers/net/wireless/realtek/rtw88/main.c
> > index f369ddca953a..cc61c390226c 100644
> > --- a/drivers/net/wireless/realtek/rtw88/main.c
> > +++ b/drivers/net/wireless/realtek/rtw88/main.c
> > @@ -333,10 +333,10 @@ void rtw_get_channel_params(struct
> cfg80211_chan_def *chandef,
> >                 bandwidth = RTW_CHANNEL_WIDTH_80;
> >                 if (primary_freq > center_freq) {
> >                         if (primary_freq - center_freq == 10) {
> > -                               primary_chan_idx = 1;
> > +                               primary_chan_idx =
> RTW_SC_20_UPPER;
> >                                 center_chan -= 2;
> >                         } else {
> > -                               primary_chan_idx = 3;
> > +                               primary_chan_idx =
> RTW_SC_20_UPPERST;
> >                                 center_chan -= 6;
> >                         }
> >                         /* assign the center channel used
> > @@ -345,10 +345,10 @@ void rtw_get_channel_params(struct
> cfg80211_chan_def *chandef,
> >                         cch_by_bw[RTW_CHANNEL_WIDTH_40] =
> center_chan + 4;
> >                 } else {
> >                         if (center_freq - primary_freq == 10) {
> > -                               primary_chan_idx = 2;
> > +                               primary_chan_idx =
> RTW_SC_20_LOWER;
> >                                 center_chan += 2;
> >                         } else {
> > -                               primary_chan_idx = 4;
> > +                               primary_chan_idx =
> RTW_SC_20_LOWEST;
> >                                 center_chan += 6;
> >                         }
> >                         /* assign the center channel used
> > diff --git a/drivers/net/wireless/realtek/rtw88/main.h
> b/drivers/net/wireless/realtek/rtw88/main.h
> > index d012eefcd0da..144fbab38fd5 100644
> > --- a/drivers/net/wireless/realtek/rtw88/main.h
> > +++ b/drivers/net/wireless/realtek/rtw88/main.h
> > @@ -95,6 +95,16 @@ enum rtw_bandwidth {
> >         RTW_CHANNEL_WIDTH_10    = 6,
> >  };
> >
> > +enum rtw_sc_offset {
> > +       RTW_SC_DONT_CARE        = 0,
> > +       RTW_SC_20_UPPER         = 1,
> > +       RTW_SC_20_LOWER         = 2,
> > +       RTW_SC_20_UPPERST       = 3,
> 
> I'll suppgest RTW_SC_20_UPMOST instead or simply RTW_SC_20_UPPEREST.
> 

OK, that makes sense :)

Yan-Hsuan

  reply	other threads:[~2019-12-24  7:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20  9:21 [PATCH 00/11] rtw88: some driver fixes yhchuang
2019-12-20  9:21 ` [PATCH 01/11] rtw88: fix rate mask for 1SS chip yhchuang
2019-12-24  7:10   ` Chris Chiu
2020-01-26 15:38   ` Kalle Valo
2020-01-26 15:39     ` Kalle Valo
2019-12-20  9:21 ` [PATCH 02/11] rtw88: fix TX secondary channel offset of 40M if current bw is 20M or 40M yhchuang
2019-12-20  9:21 ` [PATCH 03/11] rtw88: Use secondary channel offset enumeration yhchuang
2019-12-24  7:18   ` Chris Chiu
2019-12-24  7:44     ` Tony Chuang [this message]
2019-12-20  9:21 ` [PATCH 04/11] rtw88: 8822c: update power sequence to v15 yhchuang
2019-12-20  9:21 ` [PATCH 05/11] rtw88: 8822c: modify rf protection setting yhchuang
2019-12-24  7:39   ` Chris Chiu
2019-12-24  7:50     ` Tony Chuang
2019-12-24  8:17       ` Chris Chiu
2019-12-20  9:21 ` [PATCH 06/11] rtw88: remove unused spinlock yhchuang
2019-12-20  9:21 ` [PATCH 07/11] rtw88: remove unused variable 'in_lps' yhchuang
2019-12-20  9:21 ` [PATCH 08/11] rtw88: remove unused vif pointer in struct rtw_vif yhchuang
2019-12-20  9:21 ` [PATCH 09/11] rtw88: use rtw_hci_stop() instead of rtwdev->hci.ops->stop() yhchuang
2019-12-20  9:21 ` [PATCH 10/11] rtw88: assign NULL to skb after being kfree()'ed yhchuang
2019-12-20  9:21 ` [PATCH 11/11] rtw88: change max_num_of_tx_queue() definition to inline in pci.h yhchuang

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=fe59ac935a9c48f5a33208a885b9d1f0@realtek.com \
    --to=yhchuang@realtek.com \
    --cc=briannorris@chromium.org \
    --cc=chiu@endlessm.com \
    --cc=kvalo@codeaurora.org \
    --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