Skip to content

Commit

Permalink
net: wireless: realtek: Sync rtw89 driver from linux6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
baiywt committed Feb 3, 2024
1 parent 8a0745f commit 96b2d28
Show file tree
Hide file tree
Showing 41 changed files with 37,079 additions and 838 deletions.
14 changes: 14 additions & 0 deletions drivers/net/wireless/realtek/rtw89/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ config RTW89_PCI
config RTW89_8852A
tristate

config RTW89_8852B
tristate

config RTW89_8852C
tristate

Expand All @@ -33,6 +36,17 @@ config RTW89_8852AE

802.11ax PCIe wireless network (Wi-Fi 6) adapter

config RTW89_8852BE
tristate "Realtek 8852BE PCI wireless network (Wi-Fi 6) adapter"
depends on PCI
select RTW89_CORE
select RTW89_PCI
select RTW89_8852B
help
Select this option will enable support for 8852BE chipset

802.11ax PCIe wireless network (Wi-Fi 6) adapter

config RTW89_8852CE
tristate "Realtek 8852CE PCI wireless network (Wi-Fi 6E) adapter"
depends on PCI
Expand Down
11 changes: 11 additions & 0 deletions drivers/net/wireless/realtek/rtw89/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ rtw89_core-y += core.o \
chan.o \
ser.o

rtw89_core-$(CONFIG_PM) += wow.o

obj-$(CONFIG_RTW89_8852A) += rtw89_8852a.o
rtw89_8852a-objs := rtw8852a.o \
rtw8852a_table.o \
Expand All @@ -24,6 +26,15 @@ rtw89_8852a-objs := rtw8852a.o \
obj-$(CONFIG_RTW89_8852AE) += rtw89_8852ae.o
rtw89_8852ae-objs := rtw8852ae.o

obj-$(CONFIG_RTW89_8852B) += rtw89_8852b.o
rtw89_8852b-objs := rtw8852b.o \
rtw8852b_table.o \
rtw8852b_rfk.o \
rtw8852b_rfk_table.o

obj-$(CONFIG_RTW89_8852BE) += rtw89_8852be.o
rtw89_8852be-objs := rtw8852be.o

obj-$(CONFIG_RTW89_8852C) += rtw89_8852c.o
rtw89_8852c-objs := rtw8852c.o \
rtw8852c_table.o \
Expand Down
40 changes: 36 additions & 4 deletions drivers/net/wireless/realtek/rtw89/chan.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "chan.h"
#include "debug.h"
#include "util.h"

static enum rtw89_subband rtw89_get_subband_type(enum rtw89_band band,
u8 center_chan)
Expand Down Expand Up @@ -108,8 +109,8 @@ bool rtw89_assign_entity_chan(struct rtw89_dev *rtwdev,
const struct rtw89_chan *new)
{
struct rtw89_hal *hal = &rtwdev->hal;
struct rtw89_chan *chan = &hal->chan[idx];
struct rtw89_chan_rcd *rcd = &hal->chan_rcd[idx];
struct rtw89_chan *chan = &hal->sub[idx].chan;
struct rtw89_chan_rcd *rcd = &hal->sub[idx].rcd;
bool band_changed;

rcd->prev_primary_channel = chan->primary_channel;
Expand All @@ -127,7 +128,7 @@ static void __rtw89_config_entity_chandef(struct rtw89_dev *rtwdev,
{
struct rtw89_hal *hal = &rtwdev->hal;

hal->chandef[idx] = *chandef;
hal->sub[idx].chandef = *chandef;

if (from_stack)
set_bit(idx, hal->entity_map);
Expand Down Expand Up @@ -195,6 +196,7 @@ int rtw89_chanctx_ops_add(struct rtw89_dev *rtwdev,
rtw89_config_entity_chandef(rtwdev, idx, &ctx->def);
rtw89_set_channel(rtwdev);
cfg->idx = idx;
hal->sub[idx].cfg = cfg;
return 0;
}

Expand All @@ -203,8 +205,34 @@ void rtw89_chanctx_ops_remove(struct rtw89_dev *rtwdev,
{
struct rtw89_hal *hal = &rtwdev->hal;
struct rtw89_chanctx_cfg *cfg = (struct rtw89_chanctx_cfg *)ctx->drv_priv;
struct rtw89_vif *rtwvif;
u8 drop, roll;

clear_bit(cfg->idx, hal->entity_map);
drop = cfg->idx;
if (drop != RTW89_SUB_ENTITY_0)
goto out;

roll = find_next_bit(hal->entity_map, NUM_OF_RTW89_SUB_ENTITY, drop + 1);

/* Follow rtw89_config_default_chandef() when rtw89_entity_recalc(). */
if (roll == NUM_OF_RTW89_SUB_ENTITY)
goto out;

/* RTW89_SUB_ENTITY_0 is going to release, and another exists.
* Make another roll down to RTW89_SUB_ENTITY_0 to replace.
*/
hal->sub[roll].cfg->idx = RTW89_SUB_ENTITY_0;
hal->sub[RTW89_SUB_ENTITY_0] = hal->sub[roll];

rtw89_for_each_rtwvif(rtwdev, rtwvif) {
if (rtwvif->sub_entity_idx == roll)
rtwvif->sub_entity_idx = RTW89_SUB_ENTITY_0;
}

drop = roll;

out:
clear_bit(drop, hal->entity_map);
rtw89_set_channel(rtwdev);
}

Expand All @@ -225,11 +253,15 @@ int rtw89_chanctx_ops_assign_vif(struct rtw89_dev *rtwdev,
struct rtw89_vif *rtwvif,
struct ieee80211_chanctx_conf *ctx)
{
struct rtw89_chanctx_cfg *cfg = (struct rtw89_chanctx_cfg *)ctx->drv_priv;

rtwvif->sub_entity_idx = cfg->idx;
return 0;
}

void rtw89_chanctx_ops_unassign_vif(struct rtw89_dev *rtwdev,
struct rtw89_vif *rtwvif,
struct ieee80211_chanctx_conf *ctx)
{
rtwvif->sub_entity_idx = RTW89_SUB_ENTITY_0;
}
9 changes: 7 additions & 2 deletions drivers/net/wireless/realtek/rtw89/coex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1809,13 +1809,18 @@ static void _set_rf_trx_para(struct rtw89_dev *rtwdev)
struct rtw89_btc_dm *dm = &btc->dm;
struct rtw89_btc_wl_info *wl = &btc->cx.wl;
struct rtw89_btc_bt_info *bt = &btc->cx.bt;
struct rtw89_btc_bt_link_info *b = &bt->link_info;
struct rtw89_btc_rf_trx_para para;
u32 wl_stb_chg = 0;
u8 level_id = 0;

if (!dm->freerun) {
dm->trx_para_level = 0;
chip->ops->btc_bt_aci_imp(rtwdev);
/* fix LNA2 = level-5 for BT ACI issue at BTG */
if ((btc->dm.wl_btg_rx && b->profile_cnt.now != 0) ||
dm->bt_only == 1)
dm->trx_para_level = 1;
else
dm->trx_para_level = 0;
}

level_id = (u8)dm->trx_para_level;
Expand Down

0 comments on commit 96b2d28

Please sign in to comment.