You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
Add rtw89 8852be/ce support from linux-6.2 (orangepi5-plus default wifi6 pcie card) coming from xunlong commit-id: 96b2d2827a3f1e4719ebdfcac0b2108e8cbae932
This commit is contained in:
committed by
Mecid Urganci
parent
70628e9958
commit
e012c69c6a
@@ -19,6 +19,9 @@ config RTW89_PCI
|
||||
config RTW89_8852A
|
||||
tristate
|
||||
|
||||
config RTW89_8852B
|
||||
tristate
|
||||
|
||||
config RTW89_8852C
|
||||
tristate
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 \
|
||||
@@ -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 \
|
||||
|
||||
@@ -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)
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -225,6 +253,9 @@ 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;
|
||||
}
|
||||
|
||||
@@ -232,4 +263,5 @@ 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -171,7 +171,7 @@ bool rtw89_ra_report_to_bitrate(struct rtw89_dev *rtwdev, u8 rpt_rate, u16 *bitr
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct ieee80211_supported_band rtw89_sband_2ghz = {
|
||||
static const struct ieee80211_supported_band rtw89_sband_2ghz = {
|
||||
.band = NL80211_BAND_2GHZ,
|
||||
.channels = rtw89_channels_2ghz,
|
||||
.n_channels = ARRAY_SIZE(rtw89_channels_2ghz),
|
||||
@@ -181,7 +181,7 @@ static struct ieee80211_supported_band rtw89_sband_2ghz = {
|
||||
.vht_cap = {0},
|
||||
};
|
||||
|
||||
static struct ieee80211_supported_band rtw89_sband_5ghz = {
|
||||
static const struct ieee80211_supported_band rtw89_sband_5ghz = {
|
||||
.band = NL80211_BAND_5GHZ,
|
||||
.channels = rtw89_channels_5ghz,
|
||||
.n_channels = ARRAY_SIZE(rtw89_channels_5ghz),
|
||||
@@ -193,7 +193,7 @@ static struct ieee80211_supported_band rtw89_sband_5ghz = {
|
||||
.vht_cap = {0},
|
||||
};
|
||||
|
||||
static struct ieee80211_supported_band rtw89_sband_6ghz = {
|
||||
static const struct ieee80211_supported_band rtw89_sband_6ghz = {
|
||||
.band = NL80211_BAND_6GHZ,
|
||||
.channels = rtw89_channels_6ghz,
|
||||
.n_channels = ARRAY_SIZE(rtw89_channels_6ghz),
|
||||
@@ -1196,7 +1196,11 @@ static void rtw89_core_parse_phy_status_ie01(struct rtw89_dev *rtwdev, u8 *addr,
|
||||
if (phy_ppdu->rate < RTW89_HW_RATE_OFDM6)
|
||||
return;
|
||||
/* sign conversion for S(12,2) */
|
||||
cfo = sign_extend32(RTW89_GET_PHY_STS_IE01_CFO(addr), 11);
|
||||
if (rtwdev->chip->cfo_src_fd)
|
||||
cfo = sign_extend32(RTW89_GET_PHY_STS_IE01_FD_CFO(addr), 11);
|
||||
else
|
||||
cfo = sign_extend32(RTW89_GET_PHY_STS_IE01_PREMB_CFO(addr), 11);
|
||||
|
||||
rtw89_phy_cfo_parse(rtwdev, cfo, phy_ppdu);
|
||||
}
|
||||
|
||||
@@ -1255,6 +1259,9 @@ static int rtw89_core_rx_parse_phy_sts(struct rtw89_dev *rtwdev,
|
||||
if (phy_ppdu->ie < RTW89_CCK_PKT)
|
||||
return -EINVAL;
|
||||
|
||||
if (!phy_ppdu->to_self)
|
||||
return 0;
|
||||
|
||||
pos = (u8 *)phy_ppdu->buf + PHY_STS_HDR_LEN;
|
||||
end = (u8 *)phy_ppdu->buf + phy_ppdu->len;
|
||||
while (pos < end) {
|
||||
@@ -1398,6 +1405,9 @@ static void rtw89_vif_rx_stats_iter(void *data, u8 *mac,
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||
const u8 *bssid = iter_data->bssid;
|
||||
|
||||
if (!vif->bss_conf.bssid)
|
||||
return;
|
||||
|
||||
if (ieee80211_is_trigger(hdr->frame_control)) {
|
||||
rtw89_stats_trigger_frame(rtwdev, vif, skb);
|
||||
return;
|
||||
@@ -1470,6 +1480,27 @@ static void rtw89_core_hw_to_sband_rate(struct ieee80211_rx_status *rx_status)
|
||||
rx_status->rate_idx -= 4;
|
||||
}
|
||||
|
||||
static void rtw89_core_update_radiotap(struct rtw89_dev *rtwdev,
|
||||
struct sk_buff *skb,
|
||||
struct ieee80211_rx_status *rx_status)
|
||||
{
|
||||
static const struct ieee80211_radiotap_he known_he = {
|
||||
.data1 = cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN |
|
||||
IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN),
|
||||
.data2 = cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_GI_KNOWN),
|
||||
};
|
||||
struct ieee80211_radiotap_he *he;
|
||||
|
||||
if (!(rtwdev->hw->conf.flags & IEEE80211_CONF_MONITOR))
|
||||
return;
|
||||
|
||||
if (rx_status->encoding == RX_ENC_HE) {
|
||||
rx_status->flag |= RX_FLAG_RADIOTAP_HE;
|
||||
he = skb_push(skb, sizeof(*he));
|
||||
*he = known_he;
|
||||
}
|
||||
}
|
||||
|
||||
static void rtw89_core_rx_to_mac80211(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_rx_phy_ppdu *phy_ppdu,
|
||||
struct rtw89_rx_desc_info *desc_info,
|
||||
@@ -1484,6 +1515,7 @@ static void rtw89_core_rx_to_mac80211(struct rtw89_dev *rtwdev,
|
||||
|
||||
rtw89_core_hw_to_sband_rate(rx_status);
|
||||
rtw89_core_rx_stats(rtwdev, phy_ppdu, desc_info, skb_ppdu);
|
||||
rtw89_core_update_radiotap(rtwdev, skb_ppdu, rx_status);
|
||||
/* In low power mode, it does RX in thread context. */
|
||||
local_bh_disable();
|
||||
ieee80211_rx_napi(rtwdev->hw, NULL, skb_ppdu, napi);
|
||||
@@ -2201,6 +2233,9 @@ static void rtw89_track_work(struct work_struct *work)
|
||||
track_work.work);
|
||||
bool tfc_changed;
|
||||
|
||||
if (test_bit(RTW89_FLAG_FORBIDDEN_TRACK_WROK, rtwdev->flags))
|
||||
return;
|
||||
|
||||
mutex_lock(&rtwdev->mutex);
|
||||
|
||||
if (!test_bit(RTW89_FLAG_RUNNING, rtwdev->flags))
|
||||
@@ -2227,6 +2262,7 @@ static void rtw89_track_work(struct work_struct *work)
|
||||
rtw89_phy_ra_update(rtwdev);
|
||||
rtw89_phy_cfo_track(rtwdev);
|
||||
rtw89_phy_tx_path_div_track(rtwdev);
|
||||
rtw89_phy_ul_tb_ctrl_track(rtwdev);
|
||||
|
||||
if (rtwdev->lps_enabled && !rtwdev->btc.lps)
|
||||
rtw89_enter_lps_track(rtwdev);
|
||||
@@ -2375,6 +2411,8 @@ void rtw89_vif_type_mapping(struct ieee80211_vif *vif, bool assoc)
|
||||
rtwvif->self_role = RTW89_SELF_ROLE_CLIENT;
|
||||
rtwvif->addr_cam.sec_ent_mode = RTW89_ADDR_CAM_SEC_NORMAL;
|
||||
break;
|
||||
case NL80211_IFTYPE_MONITOR:
|
||||
break;
|
||||
default:
|
||||
WARN_ON(1);
|
||||
break;
|
||||
@@ -2410,6 +2448,8 @@ int rtw89_core_sta_add(struct rtw89_dev *rtwdev,
|
||||
} else if (vif->type == NL80211_IFTYPE_AP || sta->tdls) {
|
||||
rtwsta->mac_id = rtw89_core_acquire_bit_map(rtwdev->mac_id_map,
|
||||
RTW89_MAX_MAC_ID_NUM);
|
||||
if (rtwsta->mac_id == RTW89_MAX_MAC_ID_NUM)
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -2548,6 +2588,7 @@ int rtw89_core_sta_assoc(struct rtw89_dev *rtwdev,
|
||||
rtw89_btc_ntfy_role_info(rtwdev, rtwvif, rtwsta,
|
||||
BTC_ROLE_MSTS_STA_CONN_END);
|
||||
rtw89_core_get_no_ul_ofdma_htc(rtwdev, &rtwsta->htc_template);
|
||||
rtw89_phy_ul_tb_assoc(rtwdev, rtwvif);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -2933,6 +2974,41 @@ void rtw89_core_update_beacon_work(struct work_struct *work)
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
}
|
||||
|
||||
int rtw89_wait_for_cond(struct rtw89_wait_info *wait, unsigned int cond)
|
||||
{
|
||||
struct completion *cmpl = &wait->completion;
|
||||
unsigned long timeout;
|
||||
unsigned int cur;
|
||||
|
||||
cur = atomic_cmpxchg(&wait->cond, RTW89_WAIT_COND_IDLE, cond);
|
||||
if (cur != RTW89_WAIT_COND_IDLE)
|
||||
return -EBUSY;
|
||||
|
||||
timeout = wait_for_completion_timeout(cmpl, RTW89_WAIT_FOR_COND_TIMEOUT);
|
||||
if (timeout == 0) {
|
||||
atomic_set(&wait->cond, RTW89_WAIT_COND_IDLE);
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
if (wait->data.err)
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rtw89_complete_cond(struct rtw89_wait_info *wait, unsigned int cond,
|
||||
const struct rtw89_completion_data *data)
|
||||
{
|
||||
unsigned int cur;
|
||||
|
||||
cur = atomic_cmpxchg(&wait->cond, cond, RTW89_WAIT_COND_IDLE);
|
||||
if (cur != cond)
|
||||
return;
|
||||
|
||||
wait->data = *data;
|
||||
complete(&wait->completion);
|
||||
}
|
||||
|
||||
int rtw89_core_start(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
int ret;
|
||||
@@ -2957,7 +3033,7 @@ int rtw89_core_start(struct rtw89_dev *rtwdev)
|
||||
return ret;
|
||||
|
||||
rtw89_phy_init_bb_reg(rtwdev);
|
||||
rtw89_phy_init_rf_reg(rtwdev);
|
||||
rtw89_phy_init_rf_reg(rtwdev, false);
|
||||
|
||||
rtw89_btc_ntfy_init(rtwdev, BTC_MODE_NORMAL);
|
||||
|
||||
@@ -3037,6 +3113,7 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
|
||||
continue;
|
||||
INIT_LIST_HEAD(&rtwdev->scan_info.pkt_list[band]);
|
||||
}
|
||||
INIT_LIST_HEAD(&rtwdev->wow.pkt_list);
|
||||
INIT_WORK(&rtwdev->ba_work, rtw89_core_ba_work);
|
||||
INIT_WORK(&rtwdev->txq_work, rtw89_core_txq_work);
|
||||
INIT_DELAYED_WORK(&rtwdev->txq_reinvoke_work, rtw89_core_txq_reinvoke_work);
|
||||
@@ -3055,6 +3132,8 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
|
||||
mutex_init(&rtwdev->rf_mutex);
|
||||
rtwdev->total_sta_assoc = 0;
|
||||
|
||||
rtw89_init_wait(&rtwdev->mcc.wait);
|
||||
|
||||
INIT_WORK(&rtwdev->c2h_work, rtw89_fw_c2h_work);
|
||||
INIT_WORK(&rtwdev->ips_work, rtw89_ips_work);
|
||||
skb_queue_head_init(&rtwdev->c2h_queue);
|
||||
@@ -3254,6 +3333,7 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)
|
||||
ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
|
||||
ieee80211_hw_set(hw, SINGLE_SCAN_ON_ALL_BANDS);
|
||||
ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
|
||||
ieee80211_hw_set(hw, WANT_MONITOR_VIF);
|
||||
|
||||
hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
|
||||
BIT(NL80211_IFTYPE_AP) |
|
||||
@@ -3271,6 +3351,10 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)
|
||||
hw->wiphy->max_scan_ssids = RTW89_SCANOFLD_MAX_SSID;
|
||||
hw->wiphy->max_scan_ie_len = RTW89_SCANOFLD_MAX_IE_LEN;
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
hw->wiphy->wowlan = rtwdev->chip->wowlan_stub;
|
||||
#endif
|
||||
|
||||
hw->wiphy->tid_config_support.vif |= BIT(NL80211_TID_CONFIG_ATTR_AMPDU_CTRL);
|
||||
hw->wiphy->tid_config_support.peer |= BIT(NL80211_TID_CONFIG_ATTR_AMPDU_CTRL);
|
||||
hw->wiphy->tid_config_support.vif |= BIT(NL80211_TID_CONFIG_ATTR_AMSDU_CTRL);
|
||||
@@ -3343,6 +3427,7 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
|
||||
u32 bus_data_size,
|
||||
const struct rtw89_chip_info *chip)
|
||||
{
|
||||
const struct firmware *firmware;
|
||||
struct ieee80211_hw *hw;
|
||||
struct rtw89_dev *rtwdev;
|
||||
struct ieee80211_ops *ops;
|
||||
@@ -3350,7 +3435,7 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
|
||||
u32 early_feat_map = 0;
|
||||
bool no_chanctx;
|
||||
|
||||
rtw89_early_fw_feature_recognize(device, chip, &early_feat_map);
|
||||
firmware = rtw89_early_fw_feature_recognize(device, chip, &early_feat_map);
|
||||
|
||||
ops = kmemdup(&rtw89_ops, sizeof(rtw89_ops), GFP_KERNEL);
|
||||
if (!ops)
|
||||
@@ -3377,6 +3462,7 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
|
||||
rtwdev->dev = device;
|
||||
rtwdev->ops = ops;
|
||||
rtwdev->chip = chip;
|
||||
rtwdev->fw.firmware = firmware;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_FW, "probe driver %s chanctx\n",
|
||||
no_chanctx ? "without" : "with");
|
||||
@@ -3385,6 +3471,7 @@ struct rtw89_dev *rtw89_alloc_ieee80211_hw(struct device *device,
|
||||
|
||||
err:
|
||||
kfree(ops);
|
||||
release_firmware(firmware);
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_alloc_ieee80211_hw);
|
||||
@@ -3392,6 +3479,7 @@ EXPORT_SYMBOL(rtw89_alloc_ieee80211_hw);
|
||||
void rtw89_free_ieee80211_hw(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
kfree(rtwdev->ops);
|
||||
release_firmware(rtwdev->fw.firmware);
|
||||
ieee80211_free_hw(rtwdev->hw);
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_free_ieee80211_hw);
|
||||
|
||||
@@ -35,6 +35,7 @@ extern const struct ieee80211_ops rtw89_ops;
|
||||
#define RSSI_FACTOR 1
|
||||
#define RTW89_RSSI_RAW_TO_DBM(rssi) ((s8)((rssi) >> RSSI_FACTOR) - MAX_RSSI)
|
||||
#define RTW89_TX_DIV_RSSI_RAW_TH (2 << RSSI_FACTOR)
|
||||
#define RTW89_RADIOTAP_ROOM ALIGN(sizeof(struct ieee80211_radiotap_he), 64)
|
||||
|
||||
#define RTW89_HTC_MASK_VARIANT GENMASK(1, 0)
|
||||
#define RTW89_HTC_VARIANT_HE 3
|
||||
@@ -84,6 +85,7 @@ enum rtw89_subband {
|
||||
RTW89_CH_6G_BAND_IDX7, /* Ultra-high */
|
||||
|
||||
RTW89_SUBBAND_NR,
|
||||
RTW89_SUBBAND_2GHZ_5GHZ_NR = RTW89_CH_5G_BAND_4 + 1,
|
||||
};
|
||||
|
||||
enum rtw89_gain_offset {
|
||||
@@ -177,7 +179,9 @@ enum rtw89_upd_mode {
|
||||
RTW89_ROLE_REMOVE,
|
||||
RTW89_ROLE_TYPE_CHANGE,
|
||||
RTW89_ROLE_INFO_CHANGE,
|
||||
RTW89_ROLE_CON_DISCONN
|
||||
RTW89_ROLE_CON_DISCONN,
|
||||
RTW89_ROLE_BAND_SW,
|
||||
RTW89_ROLE_FW_RESTORE,
|
||||
};
|
||||
|
||||
enum rtw89_self_role {
|
||||
@@ -476,6 +480,20 @@ enum rtw89_regulation_type {
|
||||
RTW89_REGD_NUM,
|
||||
};
|
||||
|
||||
enum rtw89_fw_pkt_ofld_type {
|
||||
RTW89_PKT_OFLD_TYPE_PROBE_RSP = 0,
|
||||
RTW89_PKT_OFLD_TYPE_PS_POLL = 1,
|
||||
RTW89_PKT_OFLD_TYPE_NULL_DATA = 2,
|
||||
RTW89_PKT_OFLD_TYPE_QOS_NULL = 3,
|
||||
RTW89_PKT_OFLD_TYPE_CTS2SELF = 4,
|
||||
RTW89_PKT_OFLD_TYPE_ARP_RSP = 5,
|
||||
RTW89_PKT_OFLD_TYPE_NDP = 6,
|
||||
RTW89_PKT_OFLD_TYPE_EAPOL_KEY = 7,
|
||||
RTW89_PKT_OFLD_TYPE_SA_QUERY = 8,
|
||||
RTW89_PKT_OFLD_TYPE_PROBE_REQ = 12,
|
||||
RTW89_PKT_OFLD_TYPE_NUM,
|
||||
};
|
||||
|
||||
struct rtw89_txpwr_byrate {
|
||||
s8 cck[RTW89_RATE_CCK_MAX];
|
||||
s8 ofdm[RTW89_RATE_OFDM_MAX];
|
||||
@@ -490,6 +508,8 @@ enum rtw89_bandwidth_section_num {
|
||||
RTW89_BW80_SEC_NUM = 2,
|
||||
};
|
||||
|
||||
#define RTW89_TXPWR_LMT_PAGE_SIZE 40
|
||||
|
||||
struct rtw89_txpwr_limit {
|
||||
s8 cck_20m[RTW89_BF_NUM];
|
||||
s8 cck_40m[RTW89_BF_NUM];
|
||||
@@ -504,6 +524,8 @@ struct rtw89_txpwr_limit {
|
||||
|
||||
#define RTW89_RU_SEC_NUM 8
|
||||
|
||||
#define RTW89_TXPWR_LMT_RU_PAGE_SIZE 24
|
||||
|
||||
struct rtw89_txpwr_limit_ru {
|
||||
s8 ru26[RTW89_RU_SEC_NUM];
|
||||
s8 ru52[RTW89_RU_SEC_NUM];
|
||||
@@ -631,6 +653,13 @@ enum rtw89_sc_offset {
|
||||
RTW89_SC_40_LOWER = 10,
|
||||
};
|
||||
|
||||
enum rtw89_wow_flags {
|
||||
RTW89_WOW_FLAG_EN_MAGIC_PKT,
|
||||
RTW89_WOW_FLAG_EN_REKEY_PKT,
|
||||
RTW89_WOW_FLAG_EN_DISCONNECT,
|
||||
RTW89_WOW_FLAG_NUM,
|
||||
};
|
||||
|
||||
struct rtw89_chan {
|
||||
u8 channel;
|
||||
u8 primary_channel;
|
||||
@@ -2192,6 +2221,7 @@ struct rtw89_sta {
|
||||
|
||||
struct rtw89_efuse {
|
||||
bool valid;
|
||||
bool power_k_valid;
|
||||
u8 xtal_cap;
|
||||
u8 addr[ETH_ALEN];
|
||||
u8 rfe_type;
|
||||
@@ -2210,6 +2240,8 @@ struct rtw89_phy_rate_pattern {
|
||||
struct rtw89_vif {
|
||||
struct list_head list;
|
||||
struct rtw89_dev *rtwdev;
|
||||
enum rtw89_sub_entity_idx sub_entity_idx;
|
||||
|
||||
u8 mac_id;
|
||||
u8 port;
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
@@ -2232,6 +2264,8 @@ struct rtw89_vif {
|
||||
bool wowlan_magic;
|
||||
bool is_hesta;
|
||||
bool last_a_ctrl;
|
||||
bool dyn_tb_bedge_en;
|
||||
u8 def_tri_idx;
|
||||
struct work_struct update_beacon_work;
|
||||
struct rtw89_addr_cam_entry addr_cam;
|
||||
struct rtw89_bssid_cam_entry bssid_cam;
|
||||
@@ -2280,6 +2314,16 @@ struct rtw89_hci_ops {
|
||||
*/
|
||||
void (*recovery_start)(struct rtw89_dev *rtwdev);
|
||||
void (*recovery_complete)(struct rtw89_dev *rtwdev);
|
||||
|
||||
void (*ctrl_txdma_ch)(struct rtw89_dev *rtwdev, bool enable);
|
||||
void (*ctrl_txdma_fw_ch)(struct rtw89_dev *rtwdev, bool enable);
|
||||
void (*ctrl_trxhci)(struct rtw89_dev *rtwdev, bool enable);
|
||||
int (*poll_txdma_ch)(struct rtw89_dev *rtwdev);
|
||||
void (*clr_idx_all)(struct rtw89_dev *rtwdev);
|
||||
void (*clear)(struct rtw89_dev *rtwdev, struct pci_dev *pdev);
|
||||
void (*disable_intr)(struct rtw89_dev *rtwdev);
|
||||
void (*enable_intr)(struct rtw89_dev *rtwdev);
|
||||
int (*rst_bdram)(struct rtw89_dev *rtwdev);
|
||||
};
|
||||
|
||||
struct rtw89_hci_info {
|
||||
@@ -2357,7 +2401,6 @@ struct rtw89_chip_ops {
|
||||
void (*btc_set_wl_pri)(struct rtw89_dev *rtwdev, u8 map, bool state);
|
||||
void (*btc_set_wl_txpwr_ctrl)(struct rtw89_dev *rtwdev, u32 txpwr_val);
|
||||
s8 (*btc_get_bt_rssi)(struct rtw89_dev *rtwdev, s8 val);
|
||||
void (*btc_bt_aci_imp)(struct rtw89_dev *rtwdev);
|
||||
void (*btc_update_bt_cnt)(struct rtw89_dev *rtwdev);
|
||||
void (*btc_wl_s1_standby)(struct rtw89_dev *rtwdev, bool state);
|
||||
void (*btc_set_policy)(struct rtw89_dev *rtwdev, u16 policy_type);
|
||||
@@ -2384,6 +2427,7 @@ enum rtw89_dma_ch {
|
||||
enum rtw89_qta_mode {
|
||||
RTW89_QTA_SCC,
|
||||
RTW89_QTA_DLFW,
|
||||
RTW89_QTA_WOW,
|
||||
|
||||
/* keep last */
|
||||
RTW89_QTA_INVALID,
|
||||
@@ -2607,6 +2651,11 @@ struct rtw89_dig_regs {
|
||||
struct rtw89_reg_def p1_s20_pagcugc_en;
|
||||
};
|
||||
|
||||
struct rtw89_phy_ul_tb_info {
|
||||
bool dyn_tb_tri_en;
|
||||
u8 def_if_bandedge;
|
||||
};
|
||||
|
||||
struct rtw89_chip_info {
|
||||
enum rtw89_core_chip_id chip_id;
|
||||
const struct rtw89_chip_ops *ops;
|
||||
@@ -2618,10 +2667,13 @@ struct rtw89_chip_info {
|
||||
u32 rsvd_ple_ofst;
|
||||
const struct rtw89_hfc_param_ini *hfc_param_ini;
|
||||
const struct rtw89_dle_mem *dle_mem;
|
||||
u8 wde_qempty_acq_num;
|
||||
u8 wde_qempty_mgq_sel;
|
||||
u32 rf_base_addr[2];
|
||||
u8 support_chanctx_num;
|
||||
u8 support_bands;
|
||||
bool support_bw160;
|
||||
bool support_ul_tb_ctrl;
|
||||
bool hw_sec_hdr;
|
||||
u8 rf_path_num;
|
||||
u8 tx_nss;
|
||||
@@ -2714,11 +2766,13 @@ struct rtw89_chip_info {
|
||||
u32 c2h_ctrl_reg;
|
||||
const u32 *c2h_regs;
|
||||
const struct rtw89_page_regs *page_regs;
|
||||
bool cfo_src_fd;
|
||||
const struct rtw89_reg_def *dcfo_comp;
|
||||
u8 dcfo_comp_sft;
|
||||
const struct rtw89_imr_info *imr_info;
|
||||
const struct rtw89_rrsr_cfgs *rrsr_cfgs;
|
||||
u32 dma_ch_mask;
|
||||
const struct wiphy_wowlan_support *wowlan_stub;
|
||||
};
|
||||
|
||||
union rtw89_bus_info {
|
||||
@@ -2760,6 +2814,28 @@ struct rtw89_mac_info {
|
||||
u8 cpwm_seq_num;
|
||||
};
|
||||
|
||||
#define RTW89_COMPLETION_BUF_SIZE 24
|
||||
#define RTW89_WAIT_COND_IDLE UINT_MAX
|
||||
|
||||
struct rtw89_completion_data {
|
||||
bool err;
|
||||
u8 buf[RTW89_COMPLETION_BUF_SIZE];
|
||||
};
|
||||
|
||||
struct rtw89_wait_info {
|
||||
atomic_t cond;
|
||||
struct completion completion;
|
||||
struct rtw89_completion_data data;
|
||||
};
|
||||
|
||||
#define RTW89_WAIT_FOR_COND_TIMEOUT msecs_to_jiffies(100)
|
||||
|
||||
static inline void rtw89_init_wait(struct rtw89_wait_info *wait)
|
||||
{
|
||||
init_completion(&wait->completion);
|
||||
atomic_set(&wait->cond, RTW89_WAIT_COND_IDLE);
|
||||
}
|
||||
|
||||
enum rtw89_fw_type {
|
||||
RTW89_FW_NORMAL = 1,
|
||||
RTW89_FW_WOWLAN = 3,
|
||||
@@ -2879,6 +2955,13 @@ enum rtw89_entity_mode {
|
||||
RTW89_ENTITY_MODE_SCC,
|
||||
};
|
||||
|
||||
struct rtw89_sub_entity {
|
||||
struct cfg80211_chan_def chandef;
|
||||
struct rtw89_chan chan;
|
||||
struct rtw89_chan_rcd rcd;
|
||||
struct rtw89_chanctx_cfg *cfg;
|
||||
};
|
||||
|
||||
struct rtw89_hal {
|
||||
u32 rx_fltr;
|
||||
u8 cv;
|
||||
@@ -2892,13 +2975,10 @@ struct rtw89_hal {
|
||||
bool support_igi;
|
||||
|
||||
DECLARE_BITMAP(entity_map, NUM_OF_RTW89_SUB_ENTITY);
|
||||
struct cfg80211_chan_def chandef[NUM_OF_RTW89_SUB_ENTITY];
|
||||
struct rtw89_sub_entity sub[NUM_OF_RTW89_SUB_ENTITY];
|
||||
|
||||
bool entity_active;
|
||||
enum rtw89_entity_mode entity_mode;
|
||||
|
||||
struct rtw89_chan chan[NUM_OF_RTW89_SUB_ENTITY];
|
||||
struct rtw89_chan_rcd chan_rcd[NUM_OF_RTW89_SUB_ENTITY];
|
||||
};
|
||||
|
||||
#define RTW89_MAX_MAC_ID_NUM 128
|
||||
@@ -2915,6 +2995,9 @@ enum rtw89_flags {
|
||||
RTW89_FLAG_LOW_POWER_MODE,
|
||||
RTW89_FLAG_INACTIVE_PS,
|
||||
RTW89_FLAG_CRASH_SIMULATING,
|
||||
RTW89_FLAG_WOWLAN,
|
||||
RTW89_FLAG_FORBIDDEN_TRACK_WROK,
|
||||
RTW89_FLAG_CHANGING_INTERFACE,
|
||||
|
||||
NUM_OF_RTW89_FLAGS,
|
||||
};
|
||||
@@ -2943,6 +3026,7 @@ struct rtw89_pkt_drop_params {
|
||||
u8 port;
|
||||
u8 mbssid;
|
||||
bool tf_trs;
|
||||
u32 macid_band_sel[4];
|
||||
};
|
||||
|
||||
struct rtw89_pkt_stat {
|
||||
@@ -2976,7 +3060,7 @@ struct rtw89_dack_info {
|
||||
#define RTW89_IQK_CHS_NR 2
|
||||
#define RTW89_IQK_PATH_NR 4
|
||||
|
||||
struct rtw89_mcc_info {
|
||||
struct rtw89_rfk_mcc_info {
|
||||
u8 ch[RTW89_IQK_CHS_NR];
|
||||
u8 band[RTW89_IQK_CHS_NR];
|
||||
u8 table_idx;
|
||||
@@ -3044,6 +3128,7 @@ struct rtw89_dpk_bkup_para {
|
||||
struct rtw89_dpk_info {
|
||||
bool is_dpk_enable;
|
||||
bool is_dpk_reload_en;
|
||||
u8 dpk_gs[RTW89_PHY_MAX];
|
||||
u16 dc_i[RTW89_DPK_RF_PATH][RTW89_DPK_BKUP_NUM];
|
||||
u16 dc_q[RTW89_DPK_RF_PATH][RTW89_DPK_BKUP_NUM];
|
||||
u8 corr_val[RTW89_DPK_RF_PATH][RTW89_DPK_BKUP_NUM];
|
||||
@@ -3159,6 +3244,14 @@ struct rtw89_cfo_tracking_info {
|
||||
u8 lock_cnt;
|
||||
};
|
||||
|
||||
enum rtw89_tssi_alimk_band {
|
||||
TSSI_ALIMK_2G = 0,
|
||||
TSSI_ALIMK_5GL,
|
||||
TSSI_ALIMK_5GM,
|
||||
TSSI_ALIMK_5GH,
|
||||
TSSI_ALIMK_MAX
|
||||
};
|
||||
|
||||
/* 2GL, 2GH, 5GL1, 5GH1, 5GM1, 5GM2, 5GH1, 5GH2 */
|
||||
#define TSSI_TRIM_CH_GROUP_NUM 8
|
||||
#define TSSI_TRIM_CH_GROUP_NUM_6G 16
|
||||
@@ -3169,6 +3262,8 @@ struct rtw89_cfo_tracking_info {
|
||||
#define TSSI_MCS_6G_CH_GROUP_NUM 32
|
||||
#define TSSI_MCS_CH_GROUP_NUM \
|
||||
(TSSI_MCS_2G_CH_GROUP_NUM + TSSI_MCS_5G_CH_GROUP_NUM)
|
||||
#define TSSI_MAX_CH_NUM 67
|
||||
#define TSSI_ALIMK_VALUE_NUM 8
|
||||
|
||||
struct rtw89_tssi_info {
|
||||
u8 thermal[RF_PATH_MAX];
|
||||
@@ -3181,6 +3276,11 @@ struct rtw89_tssi_info {
|
||||
bool tssi_tracking_check[RF_PATH_MAX];
|
||||
u8 default_txagc_offset[RF_PATH_MAX];
|
||||
u32 base_thermal[RF_PATH_MAX];
|
||||
bool check_backup_aligmk[RF_PATH_MAX][TSSI_MAX_CH_NUM];
|
||||
u32 alignment_backup_by_ch[RF_PATH_MAX][TSSI_MAX_CH_NUM][TSSI_ALIMK_VALUE_NUM];
|
||||
u32 alignment_value[RF_PATH_MAX][TSSI_ALIMK_MAX][TSSI_ALIMK_VALUE_NUM];
|
||||
bool alignment_done[RF_PATH_MAX][TSSI_ALIMK_MAX];
|
||||
u32 tssi_alimk_time;
|
||||
};
|
||||
|
||||
struct rtw89_power_trim_info {
|
||||
@@ -3421,8 +3521,40 @@ struct rtw89_phy_bb_gain_info {
|
||||
|
||||
struct rtw89_phy_efuse_gain {
|
||||
bool offset_valid;
|
||||
bool comp_valid;
|
||||
s8 offset[RF_PATH_MAX][RTW89_GAIN_OFFSET_NR]; /* S(8, 0) */
|
||||
s8 offset_base[RTW89_PHY_MAX]; /* S(8, 4) */
|
||||
s8 rssi_base[RTW89_PHY_MAX]; /* S(8, 4) */
|
||||
s8 comp[RF_PATH_MAX][RTW89_SUBBAND_NR]; /* S(8, 0) */
|
||||
};
|
||||
|
||||
#define RTW89_MAX_PATTERN_NUM 18
|
||||
#define RTW89_MAX_PATTERN_MASK_SIZE 4
|
||||
#define RTW89_MAX_PATTERN_SIZE 128
|
||||
|
||||
struct rtw89_wow_cam_info {
|
||||
bool r_w;
|
||||
u8 idx;
|
||||
u32 mask[RTW89_MAX_PATTERN_MASK_SIZE];
|
||||
u16 crc;
|
||||
bool negative_pattern_match;
|
||||
bool skip_mac_hdr;
|
||||
bool uc;
|
||||
bool mc;
|
||||
bool bc;
|
||||
bool valid;
|
||||
};
|
||||
|
||||
struct rtw89_wow_param {
|
||||
struct ieee80211_vif *wow_vif;
|
||||
DECLARE_BITMAP(flags, RTW89_WOW_FLAG_NUM);
|
||||
struct rtw89_wow_cam_info patterns[RTW89_MAX_PATTERN_NUM];
|
||||
u8 pattern_cnt;
|
||||
struct list_head pkt_list;
|
||||
};
|
||||
|
||||
struct rtw89_mcc_info {
|
||||
struct rtw89_wait_info wait;
|
||||
};
|
||||
|
||||
struct rtw89_dev {
|
||||
@@ -3435,6 +3567,7 @@ struct rtw89_dev {
|
||||
const struct rtw89_chip_info *chip;
|
||||
const struct rtw89_pci_info *pci_info;
|
||||
struct rtw89_hal hal;
|
||||
struct rtw89_mcc_info mcc;
|
||||
struct rtw89_mac_info mac;
|
||||
struct rtw89_fw_info fw;
|
||||
struct rtw89_hci_info hci;
|
||||
@@ -3478,7 +3611,7 @@ struct rtw89_dev {
|
||||
struct rtw89_dack_info dack;
|
||||
struct rtw89_iqk_info iqk;
|
||||
struct rtw89_dpk_info dpk;
|
||||
struct rtw89_mcc_info mcc;
|
||||
struct rtw89_rfk_mcc_info rfk_mcc;
|
||||
struct rtw89_lck_info lck;
|
||||
struct rtw89_rx_dck_info rx_dck;
|
||||
bool is_tssi_mode[RF_PATH_MAX];
|
||||
@@ -3495,6 +3628,7 @@ struct rtw89_dev {
|
||||
struct rtw89_phy_ch_info ch_info;
|
||||
struct rtw89_phy_bb_gain_info bb_gain;
|
||||
struct rtw89_phy_efuse_gain efuse_gain;
|
||||
struct rtw89_phy_ul_tb_info ul_tb_info;
|
||||
|
||||
struct delayed_work track_work;
|
||||
struct delayed_work coex_act1_work;
|
||||
@@ -3513,6 +3647,8 @@ struct rtw89_dev {
|
||||
enum rtw89_ps_mode ps_mode;
|
||||
bool lps_enabled;
|
||||
|
||||
struct rtw89_wow_param wow;
|
||||
|
||||
/* napi structure */
|
||||
struct net_device netdev;
|
||||
struct napi_struct napi;
|
||||
@@ -3595,6 +3731,66 @@ static inline void rtw89_hci_recovery_complete(struct rtw89_dev *rtwdev)
|
||||
rtwdev->hci.ops->recovery_complete(rtwdev);
|
||||
}
|
||||
|
||||
static inline void rtw89_hci_enable_intr(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
if (rtwdev->hci.ops->enable_intr)
|
||||
rtwdev->hci.ops->enable_intr(rtwdev);
|
||||
}
|
||||
|
||||
static inline void rtw89_hci_disable_intr(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
if (rtwdev->hci.ops->disable_intr)
|
||||
rtwdev->hci.ops->disable_intr(rtwdev);
|
||||
}
|
||||
|
||||
static inline void rtw89_hci_ctrl_txdma_ch(struct rtw89_dev *rtwdev, bool enable)
|
||||
{
|
||||
if (rtwdev->hci.ops->ctrl_txdma_ch)
|
||||
rtwdev->hci.ops->ctrl_txdma_ch(rtwdev, enable);
|
||||
}
|
||||
|
||||
static inline void rtw89_hci_ctrl_txdma_fw_ch(struct rtw89_dev *rtwdev, bool enable)
|
||||
{
|
||||
if (rtwdev->hci.ops->ctrl_txdma_fw_ch)
|
||||
rtwdev->hci.ops->ctrl_txdma_fw_ch(rtwdev, enable);
|
||||
}
|
||||
|
||||
static inline void rtw89_hci_ctrl_trxhci(struct rtw89_dev *rtwdev, bool enable)
|
||||
{
|
||||
if (rtwdev->hci.ops->ctrl_trxhci)
|
||||
rtwdev->hci.ops->ctrl_trxhci(rtwdev, enable);
|
||||
}
|
||||
|
||||
static inline int rtw89_hci_poll_txdma_ch(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (rtwdev->hci.ops->poll_txdma_ch)
|
||||
ret = rtwdev->hci.ops->poll_txdma_ch(rtwdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void rtw89_hci_clr_idx_all(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
if (rtwdev->hci.ops->clr_idx_all)
|
||||
rtwdev->hci.ops->clr_idx_all(rtwdev);
|
||||
}
|
||||
|
||||
static inline int rtw89_hci_rst_bdram(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (rtwdev->hci.ops->rst_bdram)
|
||||
ret = rtwdev->hci.ops->rst_bdram(rtwdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void rtw89_hci_clear(struct rtw89_dev *rtwdev, struct pci_dev *pdev)
|
||||
{
|
||||
if (rtwdev->hci.ops->clear)
|
||||
rtwdev->hci.ops->clear(rtwdev, pdev);
|
||||
}
|
||||
|
||||
static inline u8 rtw89_read8(struct rtw89_dev *rtwdev, u32 addr)
|
||||
{
|
||||
return rtwdev->hci.ops->read8(rtwdev, addr);
|
||||
@@ -3948,7 +4144,7 @@ const struct cfg80211_chan_def *rtw89_chandef_get(struct rtw89_dev *rtwdev,
|
||||
{
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
|
||||
return &hal->chandef[idx];
|
||||
return &hal->sub[idx].chandef;
|
||||
}
|
||||
|
||||
static inline
|
||||
@@ -3957,7 +4153,7 @@ const struct rtw89_chan *rtw89_chan_get(struct rtw89_dev *rtwdev,
|
||||
{
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
|
||||
return &hal->chan[idx];
|
||||
return &hal->sub[idx].chan;
|
||||
}
|
||||
|
||||
static inline
|
||||
@@ -3966,7 +4162,7 @@ const struct rtw89_chan_rcd *rtw89_chan_rcd_get(struct rtw89_dev *rtwdev,
|
||||
{
|
||||
struct rtw89_hal *hal = &rtwdev->hal;
|
||||
|
||||
return &hal->chan_rcd[idx];
|
||||
return &hal->sub[idx].rcd;
|
||||
}
|
||||
|
||||
static inline void rtw89_chip_fem_setup(struct rtw89_dev *rtwdev)
|
||||
@@ -4221,6 +4417,23 @@ static inline struct rtw89_fw_suit *rtw89_fw_suit_get(struct rtw89_dev *rtwdev,
|
||||
return &fw_info->normal;
|
||||
}
|
||||
|
||||
static inline struct sk_buff *rtw89_alloc_skb_for_rx(struct rtw89_dev *rtwdev,
|
||||
unsigned int length)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
|
||||
if (rtwdev->hw->conf.flags & IEEE80211_CONF_MONITOR) {
|
||||
skb = dev_alloc_skb(length + RTW89_RADIOTAP_ROOM);
|
||||
if (!skb)
|
||||
return NULL;
|
||||
|
||||
skb_reserve(skb, RTW89_RADIOTAP_ROOM);
|
||||
return skb;
|
||||
}
|
||||
|
||||
return dev_alloc_skb(length);
|
||||
}
|
||||
|
||||
int rtw89_core_tx_write(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
|
||||
struct ieee80211_sta *sta, struct sk_buff *skb, int *qsel);
|
||||
int rtw89_h2c_tx(struct rtw89_dev *rtwdev,
|
||||
@@ -4289,6 +4502,9 @@ int rtw89_regd_init(struct rtw89_dev *rtwdev,
|
||||
void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request);
|
||||
void rtw89_traffic_stats_init(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_traffic_stats *stats);
|
||||
int rtw89_wait_for_cond(struct rtw89_wait_info *wait, unsigned int cond);
|
||||
void rtw89_complete_cond(struct rtw89_wait_info *wait, unsigned int cond,
|
||||
const struct rtw89_completion_data *data);
|
||||
int rtw89_core_start(struct rtw89_dev *rtwdev);
|
||||
void rtw89_core_stop(struct rtw89_dev *rtwdev);
|
||||
void rtw89_core_update_beacon_work(struct work_struct *work);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,8 @@ enum rtw89_debug_mask {
|
||||
RTW89_DBG_HW_SCAN = BIT(15),
|
||||
RTW89_DBG_SAR = BIT(16),
|
||||
RTW89_DBG_STATE = BIT(17),
|
||||
RTW89_DBG_WOW = BIT(18),
|
||||
RTW89_DBG_UL_TB = BIT(19),
|
||||
|
||||
RTW89_DBG_UNEXP = BIT(31),
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -168,6 +168,8 @@ enum rtw89_mac_ax_l0_to_l1_event {
|
||||
MAC_AX_L0_TO_L1_EVENT_MAX = 15,
|
||||
};
|
||||
|
||||
#define RTW89_PORT_OFFSET_MS_TO_32US(n, shift_ms) ((n) * (shift_ms) * 1000 / 32)
|
||||
|
||||
enum rtw89_mac_dbg_port_sel {
|
||||
/* CMAC 0 related */
|
||||
RTW89_DBG_PORT_SEL_PTCL_C0 = 0,
|
||||
@@ -211,6 +213,51 @@ enum rtw89_mac_dbg_port_sel {
|
||||
RTW89_DBG_PORT_SEL_PLE_QUEMGN_QLNKTBL,
|
||||
RTW89_DBG_PORT_SEL_PLE_QUEMGN_QEMPTY,
|
||||
RTW89_DBG_PORT_SEL_PKTINFO,
|
||||
/* DISPATCHER related */
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TX0,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TX1,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TX2,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TX3,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TX4,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TX5,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TX6,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TX7,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TX8,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TX9,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TXA,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TXB,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TXC,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TXD,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TXE,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_TXF,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_TX0,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_TX1,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_TX3,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_TX4,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_TX5,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_TX6,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_TX7,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_TX8,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_TX9,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_TXA,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_TXB,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_TXC,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_RX0,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_RX1,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_RX2,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_RX3,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_RX4,
|
||||
RTW89_DBG_PORT_SEL_DSPT_HDT_RX5,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P0,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P0_0,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P0_1,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P0_2,
|
||||
RTW89_DBG_PORT_SEL_DSPT_CDT_RX_P1,
|
||||
RTW89_DBG_PORT_SEL_DSPT_STF_CTRL,
|
||||
RTW89_DBG_PORT_SEL_DSPT_ADDR_CTRL,
|
||||
RTW89_DBG_PORT_SEL_DSPT_WDE_INTF,
|
||||
RTW89_DBG_PORT_SEL_DSPT_PLE_INTF,
|
||||
RTW89_DBG_PORT_SEL_DSPT_FLOW_CTRL,
|
||||
/* PCIE related */
|
||||
RTW89_DBG_PORT_SEL_PCIE_TXDMA,
|
||||
RTW89_DBG_PORT_SEL_PCIE_RXDMA,
|
||||
@@ -245,6 +292,8 @@ enum rtw89_mac_dbg_port_sel {
|
||||
#define BCN_IE_CAM1_BASE_ADDR 0x188A0000
|
||||
#define TXD_FIFO_0_BASE_ADDR 0x18856200
|
||||
#define TXD_FIFO_1_BASE_ADDR 0x188A1080
|
||||
#define TXD_FIFO_0_BASE_ADDR_V1 0x18856400 /* for 8852C */
|
||||
#define TXD_FIFO_1_BASE_ADDR_V1 0x188A1080 /* for 8852C */
|
||||
#define TXDATA_FIFO_0_BASE_ADDR 0x18856000
|
||||
#define TXDATA_FIFO_1_BASE_ADDR 0x188A1000
|
||||
#define CPU_LOCAL_BASE_ADDR 0x18003000
|
||||
@@ -271,6 +320,8 @@ enum rtw89_mac_mem_sel {
|
||||
RTW89_MAC_MEM_TXDATA_FIFO_1,
|
||||
RTW89_MAC_MEM_CPU_LOCAL,
|
||||
RTW89_MAC_MEM_BSSID_CAM,
|
||||
RTW89_MAC_MEM_TXD_FIFO_0_V1,
|
||||
RTW89_MAC_MEM_TXD_FIFO_1_V1,
|
||||
|
||||
/* keep last */
|
||||
RTW89_MAC_MEM_NUM,
|
||||
@@ -319,6 +370,15 @@ enum rtw89_mac_c2h_info_func {
|
||||
RTW89_MAC_C2H_FUNC_INFO_MAX,
|
||||
};
|
||||
|
||||
enum rtw89_mac_c2h_mcc_func {
|
||||
RTW89_MAC_C2H_FUNC_MCC_RCV_ACK = 0,
|
||||
RTW89_MAC_C2H_FUNC_MCC_REQ_ACK = 1,
|
||||
RTW89_MAC_C2H_FUNC_MCC_TSF_RPT = 2,
|
||||
RTW89_MAC_C2H_FUNC_MCC_STATUS_RPT = 3,
|
||||
|
||||
NUM_OF_RTW89_MAC_C2H_FUNC_MCC,
|
||||
};
|
||||
|
||||
enum rtw89_mac_c2h_class {
|
||||
RTW89_MAC_C2H_CLASS_INFO,
|
||||
RTW89_MAC_C2H_CLASS_OFLD,
|
||||
@@ -329,6 +389,31 @@ enum rtw89_mac_c2h_class {
|
||||
RTW89_MAC_C2H_CLASS_MAX,
|
||||
};
|
||||
|
||||
enum rtw89_mac_mcc_status {
|
||||
RTW89_MAC_MCC_ADD_ROLE_OK = 0,
|
||||
RTW89_MAC_MCC_START_GROUP_OK = 1,
|
||||
RTW89_MAC_MCC_STOP_GROUP_OK = 2,
|
||||
RTW89_MAC_MCC_DEL_GROUP_OK = 3,
|
||||
RTW89_MAC_MCC_RESET_GROUP_OK = 4,
|
||||
RTW89_MAC_MCC_SWITCH_CH_OK = 5,
|
||||
RTW89_MAC_MCC_TXNULL0_OK = 6,
|
||||
RTW89_MAC_MCC_TXNULL1_OK = 7,
|
||||
|
||||
RTW89_MAC_MCC_SWITCH_EARLY = 10,
|
||||
RTW89_MAC_MCC_TBTT = 11,
|
||||
RTW89_MAC_MCC_DURATION_START = 12,
|
||||
RTW89_MAC_MCC_DURATION_END = 13,
|
||||
|
||||
RTW89_MAC_MCC_ADD_ROLE_FAIL = 20,
|
||||
RTW89_MAC_MCC_START_GROUP_FAIL = 21,
|
||||
RTW89_MAC_MCC_STOP_GROUP_FAIL = 22,
|
||||
RTW89_MAC_MCC_DEL_GROUP_FAIL = 23,
|
||||
RTW89_MAC_MCC_RESET_GROUP_FAIL = 24,
|
||||
RTW89_MAC_MCC_SWITCH_CH_FAIL = 25,
|
||||
RTW89_MAC_MCC_TXNULL0_FAIL = 26,
|
||||
RTW89_MAC_MCC_TXNULL1_FAIL = 27,
|
||||
};
|
||||
|
||||
struct rtw89_mac_ax_coex {
|
||||
#define RTW89_MAC_AX_COEX_RTK_MODE 0
|
||||
#define RTW89_MAC_AX_COEX_CSR_MODE 1
|
||||
@@ -391,6 +476,7 @@ enum rtw89_mac_bf_rrsc_rate {
|
||||
#define ACCESS_CMAC(_addr) \
|
||||
({typeof(_addr) __addr = (_addr); \
|
||||
__addr >= R_AX_CMAC_REG_START && __addr <= R_AX_CMAC_REG_END; })
|
||||
#define RTW89_MAC_AX_BAND_REG_OFFSET 0x2000
|
||||
|
||||
#define PTCL_IDLE_POLL_CNT 10000
|
||||
#define SW_CVR_DUR_US 8
|
||||
@@ -416,6 +502,17 @@ enum rtw89_mac_bf_rrsc_rate {
|
||||
#define S_AX_PLE_PAGE_SEL_128 1
|
||||
#define S_AX_PLE_PAGE_SEL_256 2
|
||||
|
||||
#define B_CMAC0_MGQ_NORMAL BIT(2)
|
||||
#define B_CMAC0_MGQ_NO_PWRSAV BIT(3)
|
||||
#define B_CMAC0_CPUMGQ BIT(4)
|
||||
#define B_CMAC1_MGQ_NORMAL BIT(10)
|
||||
#define B_CMAC1_MGQ_NO_PWRSAV BIT(11)
|
||||
#define B_CMAC1_CPUMGQ BIT(12)
|
||||
|
||||
#define QEMP_ACQ_GRP_MACID_NUM 8
|
||||
#define QEMP_ACQ_GRP_QSEL_SH 4
|
||||
#define QEMP_ACQ_GRP_QSEL_MASK 0xF
|
||||
|
||||
#define SDIO_LOCAL_BASE_ADDR 0x80000000
|
||||
|
||||
#define PWR_CMD_WRITE 0
|
||||
@@ -715,6 +812,7 @@ struct rtw89_mac_size_set {
|
||||
const struct rtw89_ple_quota ple_qt46;
|
||||
const struct rtw89_ple_quota ple_qt47;
|
||||
const struct rtw89_ple_quota ple_qt58;
|
||||
const struct rtw89_ple_quota ple_qt_52a_wow;
|
||||
};
|
||||
|
||||
extern const struct rtw89_mac_size_set rtw89_mac_size;
|
||||
@@ -810,7 +908,10 @@ int rtw89_mac_add_vif(struct rtw89_dev *rtwdev, struct rtw89_vif *vif);
|
||||
int rtw89_mac_port_update(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
|
||||
void rtw89_mac_set_he_obss_narrow_bw_ru(struct rtw89_dev *rtwdev,
|
||||
struct ieee80211_vif *vif);
|
||||
void rtw89_mac_stop_ap(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
|
||||
int rtw89_mac_remove_vif(struct rtw89_dev *rtwdev, struct rtw89_vif *vif);
|
||||
void rtw89_mac_disable_cpu(struct rtw89_dev *rtwdev);
|
||||
int rtw89_mac_enable_cpu(struct rtw89_dev *rtwdev, u8 boot_reason, bool dlfw);
|
||||
int rtw89_mac_enable_bb_rf(struct rtw89_dev *rtwdev);
|
||||
int rtw89_mac_disable_bb_rf(struct rtw89_dev *rtwdev);
|
||||
|
||||
@@ -830,6 +931,7 @@ static inline int rtw89_chip_disable_bb_rf(struct rtw89_dev *rtwdev)
|
||||
|
||||
u32 rtw89_mac_get_err_status(struct rtw89_dev *rtwdev);
|
||||
int rtw89_mac_set_err_status(struct rtw89_dev *rtwdev, u32 err);
|
||||
bool rtw89_mac_c2h_chk_atomic(struct rtw89_dev *rtwdev, u8 class, u8 func);
|
||||
void rtw89_mac_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,
|
||||
u32 len, u8 class, u8 func);
|
||||
int rtw89_mac_setup_phycap(struct rtw89_dev *rtwdev);
|
||||
@@ -962,6 +1064,16 @@ static inline void rtw89_mac_ctrl_hci_dma_trx(struct rtw89_dev *rtwdev,
|
||||
B_AX_HCI_TXDMA_EN | B_AX_HCI_RXDMA_EN);
|
||||
}
|
||||
|
||||
static inline bool rtw89_mac_get_power_state(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
val = rtw89_read32_mask(rtwdev, R_AX_IC_PWR_STATE,
|
||||
B_AX_WLMAC_PWR_STE_MASK);
|
||||
|
||||
return !!val;
|
||||
}
|
||||
|
||||
int rtw89_mac_set_tx_time(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta,
|
||||
bool resume, u32 tx_time);
|
||||
int rtw89_mac_get_tx_time(struct rtw89_dev *rtwdev, struct rtw89_sta *rtwsta,
|
||||
@@ -1010,6 +1122,7 @@ enum rtw89_mac_xtal_si_offset {
|
||||
#define XTAL_SI_PON_EI BIT(1)
|
||||
#define XTAL_SI_PON_WEI BIT(0)
|
||||
XTAL_SI_SRAM_CTRL = 0xA1,
|
||||
#define XTAL_SI_SRAM_DIS BIT(1)
|
||||
#define FULL_BIT_MASK GENMASK(7, 0)
|
||||
};
|
||||
|
||||
@@ -1019,5 +1132,12 @@ void rtw89_mac_pkt_drop_vif(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
|
||||
u16 rtw89_mac_dle_buf_req(struct rtw89_dev *rtwdev, u16 buf_len, bool wd);
|
||||
int rtw89_mac_set_cpuio(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_cpuio_ctrl *ctrl_para, bool wd);
|
||||
int rtw89_mac_typ_fltr_opt(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_machdr_frame_type type,
|
||||
enum rtw89_mac_fwd_target fwd_target, u8 mac_idx);
|
||||
int rtw89_mac_resize_ple_rx_quota(struct rtw89_dev *rtwdev, bool wow);
|
||||
int rtw89_mac_ptk_drop_by_band_and_wait(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_mac_idx band);
|
||||
void rtw89_mac_hw_mgnt_sec(struct rtw89_dev *rtwdev, bool wow);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "sar.h"
|
||||
#include "ser.h"
|
||||
#include "util.h"
|
||||
#include "wow.h"
|
||||
|
||||
static void rtw89_ops_tx(struct ieee80211_hw *hw,
|
||||
struct ieee80211_tx_control *control,
|
||||
@@ -78,6 +79,15 @@ static int rtw89_ops_config(struct ieee80211_hw *hw, u32 changed)
|
||||
!(hw->conf.flags & IEEE80211_CONF_IDLE))
|
||||
rtw89_leave_ips(rtwdev);
|
||||
|
||||
if (changed & IEEE80211_CONF_CHANGE_PS) {
|
||||
if (hw->conf.flags & IEEE80211_CONF_PS) {
|
||||
rtwdev->lps_enabled = true;
|
||||
} else {
|
||||
rtw89_leave_lps(rtwdev);
|
||||
rtwdev->lps_enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
|
||||
rtw89_config_entity_chandef(rtwdev, RTW89_SUB_ENTITY_0,
|
||||
&hw->conf.chandef);
|
||||
@@ -115,26 +125,27 @@ static int rtw89_ops_add_interface(struct ieee80211_hw *hw,
|
||||
RTW89_PORT_NUM);
|
||||
if (rtwvif->port == RTW89_PORT_NUM) {
|
||||
ret = -ENOSPC;
|
||||
list_del_init(&rtwvif->list);
|
||||
goto out;
|
||||
}
|
||||
|
||||
rtwvif->bcn_hit_cond = 0;
|
||||
rtwvif->mac_idx = RTW89_MAC_0;
|
||||
rtwvif->phy_idx = RTW89_PHY_0;
|
||||
rtwvif->sub_entity_idx = RTW89_SUB_ENTITY_0;
|
||||
rtwvif->hit_rule = 0;
|
||||
ether_addr_copy(rtwvif->mac_addr, vif->addr);
|
||||
|
||||
ret = rtw89_mac_add_vif(rtwdev, rtwvif);
|
||||
if (ret) {
|
||||
rtw89_core_release_bit_map(rtwdev->hw_port, rtwvif->port);
|
||||
list_del_init(&rtwvif->list);
|
||||
goto out;
|
||||
}
|
||||
|
||||
rtw89_core_txq_init(rtwdev, vif->txq);
|
||||
|
||||
rtw89_btc_ntfy_role_info(rtwdev, rtwvif, NULL, BTC_ROLE_START);
|
||||
|
||||
rtw89_recalc_lps(rtwdev);
|
||||
out:
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
|
||||
@@ -158,8 +169,6 @@ static void rtw89_ops_remove_interface(struct ieee80211_hw *hw,
|
||||
rtw89_mac_remove_vif(rtwdev, rtwvif);
|
||||
rtw89_core_release_bit_map(rtwdev->hw_port, rtwvif->port);
|
||||
list_del_init(&rtwvif->list);
|
||||
rtw89_recalc_lps(rtwdev);
|
||||
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
}
|
||||
|
||||
@@ -168,6 +177,9 @@ static int rtw89_ops_change_interface(struct ieee80211_hw *hw,
|
||||
enum nl80211_iftype type, bool p2p)
|
||||
{
|
||||
struct rtw89_dev *rtwdev = hw->priv;
|
||||
int ret;
|
||||
|
||||
set_bit(RTW89_FLAG_CHANGING_INTERFACE, rtwdev->flags);
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_STATE, "change vif %pM (%d)->(%d), p2p (%d)->(%d)\n",
|
||||
vif->addr, vif->type, type, vif->p2p, p2p);
|
||||
@@ -177,7 +189,13 @@ static int rtw89_ops_change_interface(struct ieee80211_hw *hw,
|
||||
vif->type = type;
|
||||
vif->p2p = p2p;
|
||||
|
||||
return rtw89_ops_add_interface(hw, vif);
|
||||
ret = rtw89_ops_add_interface(hw, vif);
|
||||
if (ret)
|
||||
rtw89_warn(rtwdev, "failed to change interface %d\n", ret);
|
||||
|
||||
clear_bit(RTW89_FLAG_CHANGING_INTERFACE, rtwdev->flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void rtw89_ops_configure_filter(struct ieee80211_hw *hw,
|
||||
@@ -406,9 +424,6 @@ static void rtw89_ops_bss_info_changed(struct ieee80211_hw *hw,
|
||||
if (changed & BSS_CHANGED_P2P_PS)
|
||||
rtw89_process_p2p_ps(rtwdev, vif);
|
||||
|
||||
if (changed & BSS_CHANGED_PS)
|
||||
rtw89_recalc_lps(rtwdev);
|
||||
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
}
|
||||
|
||||
@@ -441,6 +456,7 @@ void rtw89_ops_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;
|
||||
|
||||
mutex_lock(&rtwdev->mutex);
|
||||
rtw89_mac_stop_ap(rtwdev, rtwvif);
|
||||
rtw89_fw_h2c_assoc_cmac_tbl(rtwdev, vif, NULL);
|
||||
rtw89_fw_h2c_join_info(rtwdev, rtwvif, NULL, true);
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
@@ -914,6 +930,55 @@ static int rtw89_ops_set_tid_config(struct ieee80211_hw *hw,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int rtw89_ops_suspend(struct ieee80211_hw *hw,
|
||||
struct cfg80211_wowlan *wowlan)
|
||||
{
|
||||
struct rtw89_dev *rtwdev = hw->priv;
|
||||
int ret;
|
||||
|
||||
set_bit(RTW89_FLAG_FORBIDDEN_TRACK_WROK, rtwdev->flags);
|
||||
cancel_delayed_work_sync(&rtwdev->track_work);
|
||||
|
||||
mutex_lock(&rtwdev->mutex);
|
||||
ret = rtw89_wow_suspend(rtwdev, wowlan);
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
|
||||
if (ret) {
|
||||
rtw89_warn(rtwdev, "failed to suspend for wow %d\n", ret);
|
||||
clear_bit(RTW89_FLAG_FORBIDDEN_TRACK_WROK, rtwdev->flags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtw89_ops_resume(struct ieee80211_hw *hw)
|
||||
{
|
||||
struct rtw89_dev *rtwdev = hw->priv;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&rtwdev->mutex);
|
||||
ret = rtw89_wow_resume(rtwdev);
|
||||
if (ret)
|
||||
rtw89_warn(rtwdev, "failed to resume for wow %d\n", ret);
|
||||
mutex_unlock(&rtwdev->mutex);
|
||||
|
||||
clear_bit(RTW89_FLAG_FORBIDDEN_TRACK_WROK, rtwdev->flags);
|
||||
ieee80211_queue_delayed_work(rtwdev->hw, &rtwdev->track_work,
|
||||
RTW89_TRACK_WORK_PERIOD);
|
||||
|
||||
return ret ? 1 : 0;
|
||||
}
|
||||
|
||||
static void rtw89_ops_set_wakeup(struct ieee80211_hw *hw, bool enabled)
|
||||
{
|
||||
struct rtw89_dev *rtwdev = hw->priv;
|
||||
|
||||
device_set_wakeup_enable(rtwdev->dev, enabled);
|
||||
}
|
||||
#endif
|
||||
|
||||
const struct ieee80211_ops rtw89_ops = {
|
||||
.tx = rtw89_ops_tx,
|
||||
.wake_tx_queue = rtw89_ops_wake_tx_queue,
|
||||
@@ -951,5 +1016,10 @@ const struct ieee80211_ops rtw89_ops = {
|
||||
.set_sar_specs = rtw89_ops_set_sar_specs,
|
||||
.sta_rc_update = rtw89_ops_sta_rc_update,
|
||||
.set_tid_config = rtw89_ops_set_tid_config,
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = rtw89_ops_suspend,
|
||||
.resume = rtw89_ops_resume,
|
||||
.set_wakeup = rtw89_ops_set_wakeup,
|
||||
#endif
|
||||
};
|
||||
EXPORT_SYMBOL(rtw89_ops);
|
||||
|
||||
@@ -186,6 +186,17 @@ static void rtw89_pci_ctrl_txdma_ch_pcie(struct rtw89_dev *rtwdev, bool enable)
|
||||
}
|
||||
}
|
||||
|
||||
static void rtw89_pci_ctrl_txdma_fw_ch_pcie(struct rtw89_dev *rtwdev, bool enable)
|
||||
{
|
||||
const struct rtw89_pci_info *info = rtwdev->pci_info;
|
||||
const struct rtw89_reg_def *dma_stop1 = &info->dma_stop1;
|
||||
|
||||
if (enable)
|
||||
rtw89_write32_clr(rtwdev, dma_stop1->addr, B_AX_STOP_CH12);
|
||||
else
|
||||
rtw89_write32_set(rtwdev, dma_stop1->addr, B_AX_STOP_CH12);
|
||||
}
|
||||
|
||||
static bool
|
||||
rtw89_skb_put_rx_data(struct rtw89_dev *rtwdev, bool fs, bool ls,
|
||||
struct sk_buff *new,
|
||||
@@ -256,7 +267,7 @@ static u32 rtw89_pci_rxbd_deliver_skbs(struct rtw89_dev *rtwdev,
|
||||
|
||||
rtw89_core_query_rxdesc(rtwdev, desc_info, skb->data, rxinfo_size);
|
||||
|
||||
new = dev_alloc_skb(desc_info->pkt_size);
|
||||
new = rtw89_alloc_skb_for_rx(rtwdev, desc_info->pkt_size);
|
||||
if (!new)
|
||||
goto err_sync_device;
|
||||
|
||||
@@ -961,8 +972,10 @@ static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv;
|
||||
struct rtw89_pci_tx_ring *tx_ring = &rtwpci->tx_rings[txch];
|
||||
struct rtw89_pci_tx_wd_ring *wd_ring = &tx_ring->wd_ring;
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
u32 bd_cnt, wd_cnt, min_cnt = 0;
|
||||
struct rtw89_pci_rx_ring *rx_ring;
|
||||
enum rtw89_debug_mask debug_mask;
|
||||
u32 cnt;
|
||||
|
||||
rx_ring = &rtwpci->rx_rings[RTW89_RXCH_RPQ];
|
||||
@@ -986,10 +999,20 @@ static u32 __rtw89_pci_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
|
||||
bd_cnt = rtw89_pci_get_avail_txbd_num(tx_ring);
|
||||
wd_cnt = wd_ring->curr_num;
|
||||
min_cnt = min(bd_cnt, wd_cnt);
|
||||
if (min_cnt == 0)
|
||||
rtw89_debug(rtwdev, rtwpci->low_power ? RTW89_DBG_TXRX : RTW89_DBG_UNEXP,
|
||||
if (min_cnt == 0) {
|
||||
/* This message can be frequently shown in low power mode or
|
||||
* high traffic with 8852B, and we have recognized it as normal
|
||||
* behavior, so print with mask RTW89_DBG_TXRX in these situations.
|
||||
*/
|
||||
if (rtwpci->low_power || chip->chip_id == RTL8852B)
|
||||
debug_mask = RTW89_DBG_TXRX;
|
||||
else
|
||||
debug_mask = RTW89_DBG_UNEXP;
|
||||
|
||||
rtw89_debug(rtwdev, debug_mask,
|
||||
"still no tx resource after reclaim: wd_cnt=%d bd_cnt=%d\n",
|
||||
wd_cnt, bd_cnt);
|
||||
}
|
||||
|
||||
out_unlock:
|
||||
spin_unlock_bh(&rtwpci->trx_lock);
|
||||
@@ -1362,7 +1385,7 @@ static int rtw89_pci_ops_tx_write(struct rtw89_dev *rtwdev, struct rtw89_core_tx
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct rtw89_pci_bd_ram bd_ram_table[RTW89_TXCH_NUM] = {
|
||||
const struct rtw89_pci_bd_ram rtw89_bd_ram_table_dual[RTW89_TXCH_NUM] = {
|
||||
[RTW89_TXCH_ACH0] = {.start_idx = 0, .max_num = 5, .min_num = 2},
|
||||
[RTW89_TXCH_ACH1] = {.start_idx = 5, .max_num = 5, .min_num = 2},
|
||||
[RTW89_TXCH_ACH2] = {.start_idx = 10, .max_num = 5, .min_num = 2},
|
||||
@@ -1377,11 +1400,24 @@ static const struct rtw89_pci_bd_ram bd_ram_table[RTW89_TXCH_NUM] = {
|
||||
[RTW89_TXCH_CH11] = {.start_idx = 55, .max_num = 5, .min_num = 1},
|
||||
[RTW89_TXCH_CH12] = {.start_idx = 60, .max_num = 4, .min_num = 1},
|
||||
};
|
||||
EXPORT_SYMBOL(rtw89_bd_ram_table_dual);
|
||||
|
||||
const struct rtw89_pci_bd_ram rtw89_bd_ram_table_single[RTW89_TXCH_NUM] = {
|
||||
[RTW89_TXCH_ACH0] = {.start_idx = 0, .max_num = 5, .min_num = 2},
|
||||
[RTW89_TXCH_ACH1] = {.start_idx = 5, .max_num = 5, .min_num = 2},
|
||||
[RTW89_TXCH_ACH2] = {.start_idx = 10, .max_num = 5, .min_num = 2},
|
||||
[RTW89_TXCH_ACH3] = {.start_idx = 15, .max_num = 5, .min_num = 2},
|
||||
[RTW89_TXCH_CH8] = {.start_idx = 20, .max_num = 4, .min_num = 1},
|
||||
[RTW89_TXCH_CH9] = {.start_idx = 24, .max_num = 4, .min_num = 1},
|
||||
[RTW89_TXCH_CH12] = {.start_idx = 28, .max_num = 4, .min_num = 1},
|
||||
};
|
||||
EXPORT_SYMBOL(rtw89_bd_ram_table_single);
|
||||
|
||||
static void rtw89_pci_reset_trx_rings(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_pci *rtwpci = (struct rtw89_pci *)rtwdev->priv;
|
||||
const struct rtw89_pci_info *info = rtwdev->pci_info;
|
||||
const struct rtw89_pci_bd_ram *bd_ram_table = *info->bd_ram_table;
|
||||
struct rtw89_pci_tx_ring *tx_ring;
|
||||
struct rtw89_pci_rx_ring *rx_ring;
|
||||
struct rtw89_pci_dma_ring *bd_ring;
|
||||
@@ -2514,7 +2550,7 @@ static int rtw89_pci_ops_mac_pre_init(struct rtw89_dev *rtwdev)
|
||||
|
||||
/* disable all channels except to FW CMD channel to download firmware */
|
||||
rtw89_pci_ctrl_txdma_ch_pcie(rtwdev, false);
|
||||
rtw89_write32_clr(rtwdev, info->dma_stop1.addr, B_AX_STOP_CH12);
|
||||
rtw89_pci_ctrl_txdma_fw_ch_pcie(rtwdev, true);
|
||||
|
||||
/* start DMA activities */
|
||||
rtw89_pci_ctrl_dma_all(rtwdev, true);
|
||||
@@ -3772,6 +3808,16 @@ static const struct rtw89_hci_ops rtw89_pci_ops = {
|
||||
|
||||
.recovery_start = rtw89_pci_ops_recovery_start,
|
||||
.recovery_complete = rtw89_pci_ops_recovery_complete,
|
||||
|
||||
.ctrl_txdma_ch = rtw89_pci_ctrl_txdma_ch_pcie,
|
||||
.ctrl_txdma_fw_ch = rtw89_pci_ctrl_txdma_fw_ch_pcie,
|
||||
.ctrl_trxhci = rtw89_pci_ctrl_dma_trx,
|
||||
.poll_txdma_ch = rtw89_poll_txdma_ch_idle_pcie,
|
||||
.clr_idx_all = rtw89_pci_clr_idx_all,
|
||||
.clear = rtw89_pci_clear_resource,
|
||||
.disable_intr = rtw89_pci_disable_intr_lock,
|
||||
.enable_intr = rtw89_pci_enable_intr_lock,
|
||||
.rst_bdram = rtw89_pci_rst_bdram_pcie,
|
||||
};
|
||||
|
||||
int rtw89_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
|
||||
@@ -202,6 +202,18 @@
|
||||
#define B_AX_RXP1DMA_INT BIT(1)
|
||||
#define B_AX_RXDMA_INT BIT(0)
|
||||
|
||||
#define R_AX_HAXI_IDCT_MSK 0x10B8
|
||||
#define B_AX_TXBD_LEN0_ERR_IDCT_MSK BIT(3)
|
||||
#define B_AX_TXBD_4KBOUND_ERR_IDCT_MSK BIT(2)
|
||||
#define B_AX_RXMDA_STUCK_IDCT_MSK BIT(1)
|
||||
#define B_AX_TXMDA_STUCK_IDCT_MSK BIT(0)
|
||||
|
||||
#define R_AX_HAXI_IDCT 0x10BC
|
||||
#define B_AX_TXBD_LEN0_ERR_IDCT BIT(3)
|
||||
#define B_AX_TXBD_4KBOUND_ERR_IDCT BIT(2)
|
||||
#define B_AX_RXMDA_STUCK_IDCT BIT(1)
|
||||
#define B_AX_TXMDA_STUCK_IDCT BIT(0)
|
||||
|
||||
#define R_AX_HAXI_HIMR10 0x11E0
|
||||
#define B_AX_TXDMA_CH11_INT_EN_V1 BIT(1)
|
||||
#define B_AX_TXDMA_CH10_INT_EN_V1 BIT(0)
|
||||
@@ -738,6 +750,12 @@ struct rtw89_pci_ch_dma_addr_set {
|
||||
struct rtw89_pci_ch_dma_addr rx[RTW89_RXCH_NUM];
|
||||
};
|
||||
|
||||
struct rtw89_pci_bd_ram {
|
||||
u8 start_idx;
|
||||
u8 max_num;
|
||||
u8 min_num;
|
||||
};
|
||||
|
||||
struct rtw89_pci_info {
|
||||
enum mac_ax_bd_trunc_mode txbd_trunc_mode;
|
||||
enum mac_ax_bd_trunc_mode rxbd_trunc_mode;
|
||||
@@ -773,6 +791,7 @@ struct rtw89_pci_info {
|
||||
u32 tx_dma_ch_mask;
|
||||
const struct rtw89_pci_bd_idx_addr *bd_idx_addr_low_power;
|
||||
const struct rtw89_pci_ch_dma_addr_set *dma_addr_set;
|
||||
const struct rtw89_pci_bd_ram (*bd_ram_table)[RTW89_TXCH_NUM];
|
||||
|
||||
int (*ltr_set)(struct rtw89_dev *rtwdev, bool en);
|
||||
u32 (*fill_txaddr_info)(struct rtw89_dev *rtwdev,
|
||||
@@ -786,12 +805,6 @@ struct rtw89_pci_info {
|
||||
struct rtw89_pci_isrs *isrs);
|
||||
};
|
||||
|
||||
struct rtw89_pci_bd_ram {
|
||||
u8 start_idx;
|
||||
u8 max_num;
|
||||
u8 min_num;
|
||||
};
|
||||
|
||||
struct rtw89_pci_tx_data {
|
||||
dma_addr_t dma;
|
||||
};
|
||||
@@ -1045,6 +1058,8 @@ static inline bool rtw89_pci_ltr_is_err_reg_val(u32 val)
|
||||
extern const struct dev_pm_ops rtw89_pm_ops;
|
||||
extern const struct rtw89_pci_ch_dma_addr_set rtw89_pci_ch_dma_addr_set;
|
||||
extern const struct rtw89_pci_ch_dma_addr_set rtw89_pci_ch_dma_addr_set_v1;
|
||||
extern const struct rtw89_pci_bd_ram rtw89_bd_ram_table_dual[RTW89_TXCH_NUM];
|
||||
extern const struct rtw89_pci_bd_ram rtw89_bd_ram_table_single[RTW89_TXCH_NUM];
|
||||
|
||||
struct pci_device_id;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright(c) 2019-2020 Realtek Corporation
|
||||
*/
|
||||
|
||||
#include "coex.h"
|
||||
#include "debug.h"
|
||||
#include "fw.h"
|
||||
#include "mac.h"
|
||||
@@ -9,7 +10,7 @@
|
||||
#include "ps.h"
|
||||
#include "reg.h"
|
||||
#include "sar.h"
|
||||
#include "coex.h"
|
||||
#include "util.h"
|
||||
|
||||
static u16 get_max_amsdu_len(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_ra_report *report)
|
||||
@@ -801,6 +802,11 @@ bool rtw89_phy_write_rf_v1(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_write_rf_v1);
|
||||
|
||||
static bool rtw89_chip_rf_v1(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
return rtwdev->chip->ops->write_rf == rtw89_phy_write_rf_v1;
|
||||
}
|
||||
|
||||
static void rtw89_phy_bb_reset(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
@@ -1036,6 +1042,7 @@ static void rtw89_phy_config_bb_gain(struct rtw89_dev *rtwdev,
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
union rtw89_phy_bb_gain_arg arg = { .addr = reg->addr };
|
||||
struct rtw89_efuse *efuse = &rtwdev->efuse;
|
||||
|
||||
if (arg.gain_band >= RTW89_BB_GAIN_BAND_NR)
|
||||
return;
|
||||
@@ -1061,6 +1068,11 @@ static void rtw89_phy_config_bb_gain(struct rtw89_dev *rtwdev,
|
||||
case 3:
|
||||
rtw89_phy_cfg_bb_gain_op1db(rtwdev, arg, reg->data);
|
||||
break;
|
||||
case 4:
|
||||
/* This cfg_type is only used by rfe_type >= 50 with eFEM */
|
||||
if (efuse->rfe_type < 50)
|
||||
break;
|
||||
fallthrough;
|
||||
default:
|
||||
rtw89_warn(rtwdev,
|
||||
"bb gain {0x%x:0x%x} with unknown cfg type: %d\n",
|
||||
@@ -1117,6 +1129,24 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void rtw89_phy_config_rf_reg_noio(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_reg2_def *reg,
|
||||
enum rtw89_rf_path rf_path,
|
||||
void *extra_data)
|
||||
{
|
||||
u32 addr = reg->addr;
|
||||
|
||||
if (addr == 0xfe || addr == 0xfd || addr == 0xfc || addr == 0xfb ||
|
||||
addr == 0xfa || addr == 0xf9)
|
||||
return;
|
||||
|
||||
if (rtw89_chip_rf_v1(rtwdev) && addr < 0x100)
|
||||
return;
|
||||
|
||||
rtw89_phy_cofig_rf_reg_store(rtwdev, reg, rf_path,
|
||||
(struct rtw89_fw_h2c_rf_reg_info *)extra_data);
|
||||
}
|
||||
|
||||
static void rtw89_phy_config_rf_reg(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_reg2_def *reg,
|
||||
enum rtw89_rf_path rf_path,
|
||||
@@ -1329,7 +1359,7 @@ static u32 rtw89_phy_nctl_poll(struct rtw89_dev *rtwdev)
|
||||
return rtw89_phy_read32(rtwdev, 0x8080);
|
||||
}
|
||||
|
||||
void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev)
|
||||
void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev, bool noio)
|
||||
{
|
||||
void (*config)(struct rtw89_dev *rtwdev, const struct rtw89_reg2_def *reg,
|
||||
enum rtw89_rf_path rf_path, void *data);
|
||||
@@ -1345,7 +1375,11 @@ void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev)
|
||||
for (path = RF_PATH_A; path < chip->rf_path_num; path++) {
|
||||
rf_table = chip->rf_table[path];
|
||||
rf_reg_info->rf_path = rf_table->rf_path;
|
||||
config = rf_table->config ? rf_table->config : rtw89_phy_config_rf_reg;
|
||||
if (noio)
|
||||
config = rtw89_phy_config_rf_reg_noio;
|
||||
else
|
||||
config = rf_table->config ? rf_table->config :
|
||||
rtw89_phy_config_rf_reg;
|
||||
rtw89_phy_init_reg(rtwdev, rf_table, config, (void *)rf_reg_info);
|
||||
if (rtw89_phy_config_rf_reg_fw(rtwdev, rf_reg_info))
|
||||
rtw89_warn(rtwdev, "rf path %d reg h2c config failed\n",
|
||||
@@ -1362,13 +1396,15 @@ static void rtw89_phy_init_rf_nctl(struct rtw89_dev *rtwdev)
|
||||
int ret;
|
||||
|
||||
/* IQK/DPK clock & reset */
|
||||
rtw89_phy_write32_set(rtwdev, 0x0c60, 0x3);
|
||||
rtw89_phy_write32_set(rtwdev, 0x0c6c, 0x1);
|
||||
rtw89_phy_write32_set(rtwdev, 0x58ac, 0x8000000);
|
||||
rtw89_phy_write32_set(rtwdev, 0x78ac, 0x8000000);
|
||||
rtw89_phy_write32_set(rtwdev, R_IOQ_IQK_DPK, 0x3);
|
||||
rtw89_phy_write32_set(rtwdev, R_GNT_BT_WGT_EN, 0x1);
|
||||
rtw89_phy_write32_set(rtwdev, R_P0_PATH_RST, 0x8000000);
|
||||
rtw89_phy_write32_set(rtwdev, R_P1_PATH_RST, 0x8000000);
|
||||
if (chip->chip_id == RTL8852B)
|
||||
rtw89_phy_write32_set(rtwdev, R_IOQ_IQK_DPK, 0x2);
|
||||
|
||||
/* check 0x8080 */
|
||||
rtw89_phy_write32(rtwdev, 0x8000, 0x8);
|
||||
rtw89_phy_write32(rtwdev, R_NCTL_CFG, 0x8);
|
||||
|
||||
ret = read_poll_timeout(rtw89_phy_nctl_poll, val, val == 0x4, 10,
|
||||
1000, false, rtwdev);
|
||||
@@ -1419,6 +1455,15 @@ void rtw89_phy_write32_idx(struct rtw89_dev *rtwdev, u32 addr, u32 mask,
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_write32_idx);
|
||||
|
||||
u32 rtw89_phy_read32_idx(struct rtw89_dev *rtwdev, u32 addr, u32 mask,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
if (rtwdev->dbcc_en && phy_idx == RTW89_PHY_1)
|
||||
addr += rtw89_phy0_phy1_offset(rtwdev, addr);
|
||||
return rtw89_phy_read32_mask(rtwdev, addr, mask);
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_read32_idx);
|
||||
|
||||
void rtw89_phy_set_phy_regs(struct rtw89_dev *rtwdev, u32 addr, u32 mask,
|
||||
u32 val)
|
||||
{
|
||||
@@ -1443,23 +1488,21 @@ void rtw89_phy_write_reg3_tbl(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_write_reg3_tbl);
|
||||
|
||||
const u8 rtw89_rs_idx_max[] = {
|
||||
static const u8 rtw89_rs_idx_max[] = {
|
||||
[RTW89_RS_CCK] = RTW89_RATE_CCK_MAX,
|
||||
[RTW89_RS_OFDM] = RTW89_RATE_OFDM_MAX,
|
||||
[RTW89_RS_MCS] = RTW89_RATE_MCS_MAX,
|
||||
[RTW89_RS_HEDCM] = RTW89_RATE_HEDCM_MAX,
|
||||
[RTW89_RS_OFFSET] = RTW89_RATE_OFFSET_MAX,
|
||||
};
|
||||
EXPORT_SYMBOL(rtw89_rs_idx_max);
|
||||
|
||||
const u8 rtw89_rs_nss_max[] = {
|
||||
static const u8 rtw89_rs_nss_max[] = {
|
||||
[RTW89_RS_CCK] = 1,
|
||||
[RTW89_RS_OFDM] = 1,
|
||||
[RTW89_RS_MCS] = RTW89_NSS_MAX,
|
||||
[RTW89_RS_HEDCM] = RTW89_NSS_HEDCM_MAX,
|
||||
[RTW89_RS_OFFSET] = 1,
|
||||
};
|
||||
EXPORT_SYMBOL(rtw89_rs_nss_max);
|
||||
|
||||
static const u8 _byr_of_rs[] = {
|
||||
[RTW89_RS_CCK] = offsetof(struct rtw89_txpwr_byrate, cck),
|
||||
@@ -1501,6 +1544,7 @@ EXPORT_SYMBOL(rtw89_phy_load_txpwr_byrate);
|
||||
(txpwr_rf) >> (__c->txpwr_factor_rf - __c->txpwr_factor_mac); \
|
||||
})
|
||||
|
||||
static
|
||||
s8 rtw89_phy_read_txpwr_byrate(struct rtw89_dev *rtwdev, u8 band,
|
||||
const struct rtw89_rate_desc *rate_desc)
|
||||
{
|
||||
@@ -1523,7 +1567,6 @@ s8 rtw89_phy_read_txpwr_byrate(struct rtw89_dev *rtwdev, u8 band,
|
||||
|
||||
return _phy_txpwr_rf_to_mac(rtwdev, byr[idx]);
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_read_txpwr_byrate);
|
||||
|
||||
static u8 rtw89_channel_6g_to_idx(struct rtw89_dev *rtwdev, u8 channel_6g)
|
||||
{
|
||||
@@ -1783,6 +1826,7 @@ static void rtw89_phy_fill_txpwr_limit_160m(struct rtw89_dev *rtwdev,
|
||||
lmt->mcs_40m_2p5[i] = min_t(s8, val_2p5_n[i], val_2p5_p[i]);
|
||||
}
|
||||
|
||||
static
|
||||
void rtw89_phy_fill_txpwr_limit(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
struct rtw89_txpwr_limit *lmt,
|
||||
@@ -1813,7 +1857,6 @@ void rtw89_phy_fill_txpwr_limit(struct rtw89_dev *rtwdev,
|
||||
break;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_fill_txpwr_limit);
|
||||
|
||||
static s8 rtw89_phy_read_txpwr_limit_ru(struct rtw89_dev *rtwdev, u8 band,
|
||||
u8 ru, u8 ntx, u8 ch)
|
||||
@@ -1962,6 +2005,7 @@ rtw89_phy_fill_txpwr_limit_ru_160m(struct rtw89_dev *rtwdev,
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void rtw89_phy_fill_txpwr_limit_ru(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
struct rtw89_txpwr_limit_ru *lmt_ru,
|
||||
@@ -1992,7 +2036,161 @@ void rtw89_phy_fill_txpwr_limit_ru(struct rtw89_dev *rtwdev,
|
||||
break;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_fill_txpwr_limit_ru);
|
||||
|
||||
void rtw89_phy_set_txpwr_byrate(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
static const u8 rs[] = {
|
||||
RTW89_RS_CCK,
|
||||
RTW89_RS_OFDM,
|
||||
RTW89_RS_MCS,
|
||||
RTW89_RS_HEDCM,
|
||||
};
|
||||
struct rtw89_rate_desc cur;
|
||||
u8 band = chan->band_type;
|
||||
u8 ch = chan->channel;
|
||||
u32 addr, val;
|
||||
s8 v[4] = {};
|
||||
u8 i;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
"[TXPWR] set txpwr byrate with ch=%d\n", ch);
|
||||
|
||||
BUILD_BUG_ON(rtw89_rs_idx_max[RTW89_RS_CCK] % 4);
|
||||
BUILD_BUG_ON(rtw89_rs_idx_max[RTW89_RS_OFDM] % 4);
|
||||
BUILD_BUG_ON(rtw89_rs_idx_max[RTW89_RS_MCS] % 4);
|
||||
BUILD_BUG_ON(rtw89_rs_idx_max[RTW89_RS_HEDCM] % 4);
|
||||
|
||||
addr = R_AX_PWR_BY_RATE;
|
||||
for (cur.nss = 0; cur.nss <= RTW89_NSS_2; cur.nss++) {
|
||||
for (i = 0; i < ARRAY_SIZE(rs); i++) {
|
||||
if (cur.nss >= rtw89_rs_nss_max[rs[i]])
|
||||
continue;
|
||||
|
||||
cur.rs = rs[i];
|
||||
for (cur.idx = 0; cur.idx < rtw89_rs_idx_max[rs[i]];
|
||||
cur.idx++) {
|
||||
v[cur.idx % 4] =
|
||||
rtw89_phy_read_txpwr_byrate(rtwdev,
|
||||
band,
|
||||
&cur);
|
||||
|
||||
if ((cur.idx + 1) % 4)
|
||||
continue;
|
||||
|
||||
val = FIELD_PREP(GENMASK(7, 0), v[0]) |
|
||||
FIELD_PREP(GENMASK(15, 8), v[1]) |
|
||||
FIELD_PREP(GENMASK(23, 16), v[2]) |
|
||||
FIELD_PREP(GENMASK(31, 24), v[3]);
|
||||
|
||||
rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr,
|
||||
val);
|
||||
addr += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_set_txpwr_byrate);
|
||||
|
||||
void rtw89_phy_set_txpwr_offset(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
struct rtw89_rate_desc desc = {
|
||||
.nss = RTW89_NSS_1,
|
||||
.rs = RTW89_RS_OFFSET,
|
||||
};
|
||||
u8 band = chan->band_type;
|
||||
s8 v[RTW89_RATE_OFFSET_MAX] = {};
|
||||
u32 val;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TXPWR, "[TXPWR] set txpwr offset\n");
|
||||
|
||||
for (desc.idx = 0; desc.idx < RTW89_RATE_OFFSET_MAX; desc.idx++)
|
||||
v[desc.idx] = rtw89_phy_read_txpwr_byrate(rtwdev, band, &desc);
|
||||
|
||||
BUILD_BUG_ON(RTW89_RATE_OFFSET_MAX != 5);
|
||||
val = FIELD_PREP(GENMASK(3, 0), v[0]) |
|
||||
FIELD_PREP(GENMASK(7, 4), v[1]) |
|
||||
FIELD_PREP(GENMASK(11, 8), v[2]) |
|
||||
FIELD_PREP(GENMASK(15, 12), v[3]) |
|
||||
FIELD_PREP(GENMASK(19, 16), v[4]);
|
||||
|
||||
rtw89_mac_txpwr_write32_mask(rtwdev, phy_idx, R_AX_PWR_RATE_OFST_CTRL,
|
||||
GENMASK(19, 0), val);
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_set_txpwr_offset);
|
||||
|
||||
void rtw89_phy_set_txpwr_limit(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
struct rtw89_txpwr_limit lmt;
|
||||
u8 ch = chan->channel;
|
||||
u8 bw = chan->band_width;
|
||||
const s8 *ptr;
|
||||
u32 addr, val;
|
||||
u8 i, j;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
"[TXPWR] set txpwr limit with ch=%d bw=%d\n", ch, bw);
|
||||
|
||||
BUILD_BUG_ON(sizeof(struct rtw89_txpwr_limit) !=
|
||||
RTW89_TXPWR_LMT_PAGE_SIZE);
|
||||
|
||||
addr = R_AX_PWR_LMT;
|
||||
for (i = 0; i < RTW89_NTX_NUM; i++) {
|
||||
rtw89_phy_fill_txpwr_limit(rtwdev, chan, &lmt, i);
|
||||
|
||||
ptr = (s8 *)&lmt;
|
||||
for (j = 0; j < RTW89_TXPWR_LMT_PAGE_SIZE;
|
||||
j += 4, addr += 4, ptr += 4) {
|
||||
val = FIELD_PREP(GENMASK(7, 0), ptr[0]) |
|
||||
FIELD_PREP(GENMASK(15, 8), ptr[1]) |
|
||||
FIELD_PREP(GENMASK(23, 16), ptr[2]) |
|
||||
FIELD_PREP(GENMASK(31, 24), ptr[3]);
|
||||
|
||||
rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_set_txpwr_limit);
|
||||
|
||||
void rtw89_phy_set_txpwr_limit_ru(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx)
|
||||
{
|
||||
struct rtw89_txpwr_limit_ru lmt_ru;
|
||||
u8 ch = chan->channel;
|
||||
u8 bw = chan->band_width;
|
||||
const s8 *ptr;
|
||||
u32 addr, val;
|
||||
u8 i, j;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_TXPWR,
|
||||
"[TXPWR] set txpwr limit ru with ch=%d bw=%d\n", ch, bw);
|
||||
|
||||
BUILD_BUG_ON(sizeof(struct rtw89_txpwr_limit_ru) !=
|
||||
RTW89_TXPWR_LMT_RU_PAGE_SIZE);
|
||||
|
||||
addr = R_AX_PWR_RU_LMT;
|
||||
for (i = 0; i < RTW89_NTX_NUM; i++) {
|
||||
rtw89_phy_fill_txpwr_limit_ru(rtwdev, chan, &lmt_ru, i);
|
||||
|
||||
ptr = (s8 *)&lmt_ru;
|
||||
for (j = 0; j < RTW89_TXPWR_LMT_RU_PAGE_SIZE;
|
||||
j += 4, addr += 4, ptr += 4) {
|
||||
val = FIELD_PREP(GENMASK(7, 0), ptr[0]) |
|
||||
FIELD_PREP(GENMASK(15, 8), ptr[1]) |
|
||||
FIELD_PREP(GENMASK(23, 16), ptr[2]) |
|
||||
FIELD_PREP(GENMASK(31, 24), ptr[3]);
|
||||
|
||||
rtw89_mac_txpwr_write32(rtwdev, phy_idx, addr, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(rtw89_phy_set_txpwr_limit_ru);
|
||||
|
||||
struct rtw89_phy_iter_ra_data {
|
||||
struct rtw89_dev *rtwdev;
|
||||
@@ -2106,6 +2304,10 @@ void rtw89_phy_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,
|
||||
if (func < RTW89_PHY_C2H_FUNC_RA_MAX)
|
||||
handler = rtw89_phy_c2h_ra_handler[func];
|
||||
break;
|
||||
case RTW89_PHY_C2H_CLASS_DM:
|
||||
if (func == RTW89_PHY_C2H_DM_FUNC_LOWRT_RTY)
|
||||
return;
|
||||
fallthrough;
|
||||
default:
|
||||
rtw89_info(rtwdev, "c2h class %d not support\n", class);
|
||||
return;
|
||||
@@ -2593,6 +2795,129 @@ void rtw89_phy_cfo_parse(struct rtw89_dev *rtwdev, s16 cfo_val,
|
||||
cfo->packet_count++;
|
||||
}
|
||||
|
||||
void rtw89_phy_ul_tb_assoc(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, RTW89_SUB_ENTITY_0);
|
||||
struct rtw89_phy_ul_tb_info *ul_tb_info = &rtwdev->ul_tb_info;
|
||||
|
||||
if (!chip->support_ul_tb_ctrl)
|
||||
return;
|
||||
|
||||
rtwvif->def_tri_idx =
|
||||
rtw89_phy_read32_mask(rtwdev, R_DCFO_OPT, B_TXSHAPE_TRIANGULAR_CFG);
|
||||
|
||||
if (chip->chip_id == RTL8852B && rtwdev->hal.cv > CHIP_CBV)
|
||||
rtwvif->dyn_tb_bedge_en = false;
|
||||
else if (chan->band_type >= RTW89_BAND_5G &&
|
||||
chan->band_width >= RTW89_CHANNEL_WIDTH_40)
|
||||
rtwvif->dyn_tb_bedge_en = true;
|
||||
else
|
||||
rtwvif->dyn_tb_bedge_en = false;
|
||||
|
||||
rtw89_debug(rtwdev, RTW89_DBG_UL_TB,
|
||||
"[ULTB] def_if_bandedge=%d, def_tri_idx=%d\n",
|
||||
ul_tb_info->def_if_bandedge, rtwvif->def_tri_idx);
|
||||
rtw89_debug(rtwdev, RTW89_DBG_UL_TB,
|
||||
"[ULTB] dyn_tb_begde_en=%d, dyn_tb_tri_en=%d\n",
|
||||
rtwvif->dyn_tb_bedge_en, ul_tb_info->dyn_tb_tri_en);
|
||||
}
|
||||
|
||||
struct rtw89_phy_ul_tb_check_data {
|
||||
bool valid;
|
||||
bool high_tf_client;
|
||||
bool low_tf_client;
|
||||
bool dyn_tb_bedge_en;
|
||||
u8 def_tri_idx;
|
||||
};
|
||||
|
||||
static
|
||||
void rtw89_phy_ul_tb_ctrl_check(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_vif *rtwvif,
|
||||
struct rtw89_phy_ul_tb_check_data *ul_tb_data)
|
||||
{
|
||||
struct rtw89_traffic_stats *stats = &rtwdev->stats;
|
||||
struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
|
||||
|
||||
if (rtwvif->wifi_role != RTW89_WIFI_ROLE_STATION)
|
||||
return;
|
||||
|
||||
if (!vif->cfg.assoc)
|
||||
return;
|
||||
|
||||
if (stats->rx_tf_periodic > UL_TB_TF_CNT_L2H_TH)
|
||||
ul_tb_data->high_tf_client = true;
|
||||
else if (stats->rx_tf_periodic < UL_TB_TF_CNT_H2L_TH)
|
||||
ul_tb_data->low_tf_client = true;
|
||||
|
||||
ul_tb_data->valid = true;
|
||||
ul_tb_data->def_tri_idx = rtwvif->def_tri_idx;
|
||||
ul_tb_data->dyn_tb_bedge_en = rtwvif->dyn_tb_bedge_en;
|
||||
}
|
||||
|
||||
void rtw89_phy_ul_tb_ctrl_track(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
struct rtw89_phy_ul_tb_info *ul_tb_info = &rtwdev->ul_tb_info;
|
||||
struct rtw89_phy_ul_tb_check_data ul_tb_data = {};
|
||||
struct rtw89_vif *rtwvif;
|
||||
|
||||
if (!chip->support_ul_tb_ctrl)
|
||||
return;
|
||||
|
||||
if (rtwdev->total_sta_assoc != 1)
|
||||
return;
|
||||
|
||||
rtw89_for_each_rtwvif(rtwdev, rtwvif)
|
||||
rtw89_phy_ul_tb_ctrl_check(rtwdev, rtwvif, &ul_tb_data);
|
||||
|
||||
if (!ul_tb_data.valid)
|
||||
return;
|
||||
|
||||
if (ul_tb_data.dyn_tb_bedge_en) {
|
||||
if (ul_tb_data.high_tf_client) {
|
||||
rtw89_phy_write32_mask(rtwdev, R_BANDEDGE, B_BANDEDGE_EN, 0);
|
||||
rtw89_debug(rtwdev, RTW89_DBG_UL_TB,
|
||||
"[ULTB] Turn off if_bandedge\n");
|
||||
} else if (ul_tb_data.low_tf_client) {
|
||||
rtw89_phy_write32_mask(rtwdev, R_BANDEDGE, B_BANDEDGE_EN,
|
||||
ul_tb_info->def_if_bandedge);
|
||||
rtw89_debug(rtwdev, RTW89_DBG_UL_TB,
|
||||
"[ULTB] Set to default if_bandedge = %d\n",
|
||||
ul_tb_info->def_if_bandedge);
|
||||
}
|
||||
}
|
||||
|
||||
if (ul_tb_info->dyn_tb_tri_en) {
|
||||
if (ul_tb_data.high_tf_client) {
|
||||
rtw89_phy_write32_mask(rtwdev, R_DCFO_OPT,
|
||||
B_TXSHAPE_TRIANGULAR_CFG, 0);
|
||||
rtw89_debug(rtwdev, RTW89_DBG_UL_TB,
|
||||
"[ULTB] Turn off Tx triangle\n");
|
||||
} else if (ul_tb_data.low_tf_client) {
|
||||
rtw89_phy_write32_mask(rtwdev, R_DCFO_OPT,
|
||||
B_TXSHAPE_TRIANGULAR_CFG,
|
||||
ul_tb_data.def_tri_idx);
|
||||
rtw89_debug(rtwdev, RTW89_DBG_UL_TB,
|
||||
"[ULTB] Set to default tx_shap_idx = %d\n",
|
||||
ul_tb_data.def_tri_idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void rtw89_phy_ul_tb_info_init(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
const struct rtw89_chip_info *chip = rtwdev->chip;
|
||||
struct rtw89_phy_ul_tb_info *ul_tb_info = &rtwdev->ul_tb_info;
|
||||
|
||||
if (!chip->support_ul_tb_ctrl)
|
||||
return;
|
||||
|
||||
ul_tb_info->dyn_tb_tri_en = true;
|
||||
ul_tb_info->def_if_bandedge =
|
||||
rtw89_phy_read32_mask(rtwdev, R_BANDEDGE, B_BANDEDGE_EN);
|
||||
}
|
||||
|
||||
static void rtw89_phy_stat_thermal_update(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct rtw89_phy_stat *phystat = &rtwdev->phystat;
|
||||
@@ -3779,6 +4104,7 @@ void rtw89_phy_dm_init(struct rtw89_dev *rtwdev)
|
||||
rtw89_physts_parsing_init(rtwdev);
|
||||
rtw89_phy_dig_init(rtwdev);
|
||||
rtw89_phy_cfo_init(rtwdev);
|
||||
rtw89_phy_ul_tb_info_init(rtwdev);
|
||||
|
||||
rtw89_phy_init_rf_nctl(rtwdev);
|
||||
rtw89_chip_rfk_init(rtwdev);
|
||||
|
||||
@@ -64,6 +64,9 @@
|
||||
#define MAX_CFO_TOLERANCE 30
|
||||
#define CFO_TF_CNT_TH 300
|
||||
|
||||
#define UL_TB_TF_CNT_L2H_TH 100
|
||||
#define UL_TB_TF_CNT_H2L_TH 70
|
||||
|
||||
#define CCX_MAX_PERIOD 2097
|
||||
#define CCX_MAX_PERIOD_UNIT 32
|
||||
#define MS_TO_4US_RATIO 250
|
||||
@@ -114,6 +117,15 @@ enum rtw89_phy_c2h_ra_func {
|
||||
RTW89_PHY_C2H_FUNC_RA_MAX,
|
||||
};
|
||||
|
||||
enum rtw89_phy_c2h_dm_func {
|
||||
RTW89_PHY_C2H_DM_FUNC_FW_TEST,
|
||||
RTW89_PHY_C2H_DM_FUNC_FW_TRIG_TX_RPT,
|
||||
RTW89_PHY_C2H_DM_FUNC_SIGB,
|
||||
RTW89_PHY_C2H_DM_FUNC_LOWRT_RTY,
|
||||
RTW89_PHY_C2H_DM_FUNC_MCC_DIG,
|
||||
RTW89_PHY_C2H_DM_FUNC_NUM,
|
||||
};
|
||||
|
||||
enum rtw89_phy_c2h_class {
|
||||
RTW89_PHY_C2H_CLASS_RUA,
|
||||
RTW89_PHY_C2H_CLASS_RA,
|
||||
@@ -317,9 +329,6 @@ struct rtw89_nbi_reg_def {
|
||||
struct rtw89_reg_def notch2_en;
|
||||
};
|
||||
|
||||
extern const u8 rtw89_rs_idx_max[RTW89_RS_MAX];
|
||||
extern const u8 rtw89_rs_nss_max[RTW89_RS_MAX];
|
||||
|
||||
static inline void rtw89_phy_write8(struct rtw89_dev *rtwdev,
|
||||
u32 addr, u8 data)
|
||||
{
|
||||
@@ -377,6 +386,50 @@ static inline u32 rtw89_phy_read32_mask(struct rtw89_dev *rtwdev,
|
||||
return rtw89_read32_mask(rtwdev, addr | RTW89_PHY_ADDR_OFFSET, mask);
|
||||
}
|
||||
|
||||
static inline
|
||||
enum rtw89_gain_offset rtw89_subband_to_gain_offset_band_of_ofdm(enum rtw89_subband subband)
|
||||
{
|
||||
switch (subband) {
|
||||
default:
|
||||
case RTW89_CH_2G:
|
||||
return RTW89_GAIN_OFFSET_2G_OFDM;
|
||||
case RTW89_CH_5G_BAND_1:
|
||||
return RTW89_GAIN_OFFSET_5G_LOW;
|
||||
case RTW89_CH_5G_BAND_3:
|
||||
return RTW89_GAIN_OFFSET_5G_MID;
|
||||
case RTW89_CH_5G_BAND_4:
|
||||
return RTW89_GAIN_OFFSET_5G_HIGH;
|
||||
}
|
||||
}
|
||||
|
||||
static inline
|
||||
enum rtw89_phy_bb_gain_band rtw89_subband_to_bb_gain_band(enum rtw89_subband subband)
|
||||
{
|
||||
switch (subband) {
|
||||
default:
|
||||
case RTW89_CH_2G:
|
||||
return RTW89_BB_GAIN_BAND_2G;
|
||||
case RTW89_CH_5G_BAND_1:
|
||||
return RTW89_BB_GAIN_BAND_5G_L;
|
||||
case RTW89_CH_5G_BAND_3:
|
||||
return RTW89_BB_GAIN_BAND_5G_M;
|
||||
case RTW89_CH_5G_BAND_4:
|
||||
return RTW89_BB_GAIN_BAND_5G_H;
|
||||
case RTW89_CH_6G_BAND_IDX0:
|
||||
case RTW89_CH_6G_BAND_IDX1:
|
||||
return RTW89_BB_GAIN_BAND_6G_L;
|
||||
case RTW89_CH_6G_BAND_IDX2:
|
||||
case RTW89_CH_6G_BAND_IDX3:
|
||||
return RTW89_BB_GAIN_BAND_6G_M;
|
||||
case RTW89_CH_6G_BAND_IDX4:
|
||||
case RTW89_CH_6G_BAND_IDX5:
|
||||
return RTW89_BB_GAIN_BAND_6G_H;
|
||||
case RTW89_CH_6G_BAND_IDX6:
|
||||
case RTW89_CH_6G_BAND_IDX7:
|
||||
return RTW89_BB_GAIN_BAND_6G_UH;
|
||||
}
|
||||
}
|
||||
|
||||
enum rtw89_rfk_flag {
|
||||
RTW89_RFK_F_WRF = 0,
|
||||
RTW89_RFK_F_WM = 1,
|
||||
@@ -450,7 +503,7 @@ bool rtw89_phy_write_rf(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
|
||||
bool rtw89_phy_write_rf_v1(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
|
||||
u32 addr, u32 mask, u32 data);
|
||||
void rtw89_phy_init_bb_reg(struct rtw89_dev *rtwdev);
|
||||
void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev);
|
||||
void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev, bool noio);
|
||||
void rtw89_phy_config_rf_reg_v1(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_reg2_def *reg,
|
||||
enum rtw89_rf_path rf_path,
|
||||
@@ -458,20 +511,24 @@ void rtw89_phy_config_rf_reg_v1(struct rtw89_dev *rtwdev,
|
||||
void rtw89_phy_dm_init(struct rtw89_dev *rtwdev);
|
||||
void rtw89_phy_write32_idx(struct rtw89_dev *rtwdev, u32 addr, u32 mask,
|
||||
u32 data, enum rtw89_phy_idx phy_idx);
|
||||
u32 rtw89_phy_read32_idx(struct rtw89_dev *rtwdev, u32 addr, u32 mask,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
void rtw89_phy_load_txpwr_byrate(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_txpwr_table *tbl);
|
||||
s8 rtw89_phy_read_txpwr_byrate(struct rtw89_dev *rtwdev, u8 band,
|
||||
const struct rtw89_rate_desc *rate_desc);
|
||||
void rtw89_phy_fill_txpwr_limit(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
struct rtw89_txpwr_limit *lmt,
|
||||
u8 ntx);
|
||||
void rtw89_phy_fill_txpwr_limit_ru(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
struct rtw89_txpwr_limit_ru *lmt_ru,
|
||||
u8 ntx);
|
||||
s8 rtw89_phy_read_txpwr_limit(struct rtw89_dev *rtwdev, u8 band,
|
||||
u8 bw, u8 ntx, u8 rs, u8 bf, u8 ch);
|
||||
void rtw89_phy_set_txpwr_byrate(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
void rtw89_phy_set_txpwr_offset(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
void rtw89_phy_set_txpwr_limit(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
void rtw89_phy_set_txpwr_limit_ru(struct rtw89_dev *rtwdev,
|
||||
const struct rtw89_chan *chan,
|
||||
enum rtw89_phy_idx phy_idx);
|
||||
void rtw89_phy_ra_assoc(struct rtw89_dev *rtwdev, struct ieee80211_sta *sta);
|
||||
void rtw89_phy_ra_update(struct rtw89_dev *rtwdev);
|
||||
void rtw89_phy_ra_updata_sta(struct rtw89_dev *rtwdev, struct ieee80211_sta *sta,
|
||||
@@ -496,5 +553,7 @@ void rtw89_phy_set_bss_color(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif
|
||||
void rtw89_phy_tssi_ctrl_set_bandedge_cfg(struct rtw89_dev *rtwdev,
|
||||
enum rtw89_mac_idx mac_idx,
|
||||
enum rtw89_tssi_bandedge_cfg bandedge_cfg);
|
||||
void rtw89_phy_ul_tb_assoc(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
|
||||
void rtw89_phy_ul_tb_ctrl_track(struct rtw89_dev *rtwdev);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -59,7 +59,7 @@ static void rtw89_ps_power_mode_change(struct rtw89_dev *rtwdev, bool enter)
|
||||
rtw89_mac_power_mode_change(rtwdev, enter);
|
||||
}
|
||||
|
||||
static void __rtw89_enter_ps_mode(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
void __rtw89_enter_ps_mode(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif)
|
||||
{
|
||||
if (rtwvif->wifi_role == RTW89_WIFI_ROLE_P2P_CLIENT)
|
||||
return;
|
||||
@@ -244,29 +244,3 @@ void rtw89_process_p2p_ps(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif)
|
||||
rtw89_p2p_disable_all_noa(rtwdev, vif);
|
||||
rtw89_p2p_update_noa(rtwdev, vif);
|
||||
}
|
||||
|
||||
void rtw89_recalc_lps(struct rtw89_dev *rtwdev)
|
||||
{
|
||||
struct ieee80211_vif *vif, *found_vif = NULL;
|
||||
struct rtw89_vif *rtwvif;
|
||||
int count = 0;
|
||||
|
||||
rtw89_for_each_rtwvif(rtwdev, rtwvif) {
|
||||
vif = rtwvif_to_vif(rtwvif);
|
||||
|
||||
if (vif->type != NL80211_IFTYPE_STATION) {
|
||||
count = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
count++;
|
||||
found_vif = vif;
|
||||
}
|
||||
|
||||
if (count == 1 && found_vif->cfg.ps) {
|
||||
rtwdev->lps_enabled = true;
|
||||
} else {
|
||||
rtw89_leave_lps(rtwdev);
|
||||
rtwdev->lps_enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
void rtw89_enter_lps(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
|
||||
void rtw89_leave_lps(struct rtw89_dev *rtwdev);
|
||||
void __rtw89_leave_ps_mode(struct rtw89_dev *rtwdev);
|
||||
void __rtw89_enter_ps_mode(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif);
|
||||
void rtw89_leave_ps_mode(struct rtw89_dev *rtwdev);
|
||||
void rtw89_enter_ips(struct rtw89_dev *rtwdev);
|
||||
void rtw89_leave_ips(struct rtw89_dev *rtwdev);
|
||||
void rtw89_set_coex_ctrl_lps(struct rtw89_dev *rtwdev, bool btc_ctrl);
|
||||
void rtw89_process_p2p_ps(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif);
|
||||
void rtw89_recalc_lps(struct rtw89_dev *rtwdev);
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user