From: Tony Chuang <yhchuang@realtek.com>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"Andy Huang" <tehuang@realtek.com>,
"bigeasy@linutronix.de" <bigeasy@linutronix.de>
Subject: RE: [PATCH v2 1/5] rtw88: 8821c: add cck pd settings
Date: Wed, 15 Jul 2020 09:29:36 +0000 [thread overview]
Message-ID: <ca638be51df9459e85d7e6b65082a56b@realtek.com> (raw)
In-Reply-To: <87r1tdb1qw.fsf@tynnyri.adurom.net>
> <yhchuang@realtek.com> writes:
>
> > From: Tzu-En Huang <tehuang@realtek.com>
> >
> > CCK PD can reduce the number of false alarm of the CCK rates.
> > It dynamically adjusts the power threshold and CS ratio.
> > The values are compared to the values of the previous level, if
> > the level is changed, set new values of power threshold and CS
> > ratio.
> >
> > Implement rtw_chip_ops::cck_pd_set() for 8821c.
> >
> > Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
> > Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
>
> [...]
>
> > --- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c
> > +++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c
> > @@ -102,6 +102,7 @@ static void rtw8821c_phy_set_param(struct rtw_dev
> *rtwdev)
> > rtwdev->chip->ch_param[2] = rtw_read32_mask(rtwdev, REG_TXFILTER,
> MASKDWORD);
> >
> > rtw_phy_init(rtwdev);
> > + rtwdev->dm_info.cck_pd_default = rtw_read8(rtwdev, REG_CSRATIO) &
> 0x1f;
> > }
> >
> > static int rtw8821c_mac_init(struct rtw_dev *rtwdev)
> > @@ -596,6 +597,29 @@ static void rtw8821c_phy_calibration(struct
> rtw_dev *rtwdev)
> > rtw8821c_do_iqk(rtwdev);
> > }
> >
> > +static void rtw8821c_phy_cck_pd_set(struct rtw_dev *rtwdev, u8 new_lvl)
> > +{
> > + struct rtw_dm_info *dm_info = &rtwdev->dm_info;
> > + u8 pd[CCK_PD_LV_MAX] = {3, 7, 13, 13, 13};
> > +
> > + if (dm_info->min_rssi > 60) {
> > + new_lvl = 4;
> > + pd[4] = 0x1d;
> > + goto set_cck_pd;
> > + }
> > +
> > + if (dm_info->cck_pd_lv[RTW_CHANNEL_WIDTH_20][RF_PATH_A] ==
> new_lvl)
> > + return;
> > +
> > + dm_info->cck_fa_avg = CCK_FA_AVG_RESET;
> > +
> > +set_cck_pd:
> > + dm_info->cck_pd_lv[RTW_CHANNEL_WIDTH_20][RF_PATH_A] = new_lvl;
> > + rtw_write32_mask(rtwdev, REG_PWRTH, 0x3f0000, pd[new_lvl]);
> > + rtw_write32_mask(rtwdev, REG_PWRTH2, 0x1f0000,
> > + dm_info->cck_pd_default + new_lvl * 2);
> > +}
>
> I'm starting to see the trend of using magic values in rtw88 on the rise
> again. Please be careful with this, the source code should not be full
> of undocument values. In some special cases (eg calibration data etc)
> using undocumented values is ok, but most of cases should have proper
> defines for documenting what's happening.
>
I'll take care of that, many thanks.
Yen-Hsuan
next prev parent reply other threads:[~2020-07-15 9:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-03 9:42 [PATCH v2 0/5] rtw88: 8821c: the rest patches to support 8821c yhchuang
2020-06-03 9:42 ` [PATCH v2 1/5] rtw88: 8821c: add cck pd settings yhchuang
2020-06-05 10:53 ` Sebastian Andrzej Siewior
2020-07-15 8:50 ` Kalle Valo
2020-07-15 9:29 ` Tony Chuang [this message]
2020-07-15 9:10 ` Kalle Valo
2020-06-03 9:42 ` [PATCH v2 2/5] rtw88: 8821c: add power tracking yhchuang
2020-06-05 14:30 ` Sebastian Andrzej Siewior
2020-06-03 9:42 ` [PATCH v2 3/5] rtw88: 8821c: add beamformee support yhchuang
2020-06-03 9:42 ` [PATCH v2 4/5] rtw88: single rf path chips don't support TX STBC yhchuang
2020-06-03 9:42 ` [PATCH v2 5/5] rtw88: 8821c: Add 8821CE to Kconfig and Makefile yhchuang
2020-06-08 19:01 ` Larry Finger
2020-06-16 11:07 ` Tony Chuang
2020-07-02 5:17 ` Kai-Heng Feng
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=ca638be51df9459e85d7e6b65082a56b@realtek.com \
--to=yhchuang@realtek.com \
--cc=bigeasy@linutronix.de \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=tehuang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.