Skip to content

Commit f4ae7cc

Browse files
Ping-Ke ShihKalle Valo
authored andcommitted
rtw89: 8852c: fill freq and band of RX status by PPDU report
Hardware reports PPDU status containing encoded channel index to driver, so we decode it and then fill freq and band. Signed-off-by: Ping-Ke Shih <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3ecca40 commit f4ae7cc

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

drivers/net/wireless/realtek/rtw89/rtw8852c.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,6 +2440,38 @@ static void rtw8852c_btc_init_cfg(struct rtw89_dev *rtwdev)
24402440
btc->cx.wl.status.map.init_ok = true;
24412441
}
24422442

2443+
static void rtw8852c_fill_freq_with_ppdu(struct rtw89_dev *rtwdev,
2444+
struct rtw89_rx_phy_ppdu *phy_ppdu,
2445+
struct ieee80211_rx_status *status)
2446+
{
2447+
u8 chan_idx = phy_ppdu->chan_idx;
2448+
enum nl80211_band band;
2449+
u8 ch;
2450+
2451+
if (chan_idx == 0)
2452+
return;
2453+
2454+
rtw8852c_decode_chan_idx(rtwdev, chan_idx, &ch, &band);
2455+
status->freq = ieee80211_channel_to_frequency(ch, band);
2456+
status->band = band;
2457+
}
2458+
2459+
static void rtw8852c_query_ppdu(struct rtw89_dev *rtwdev,
2460+
struct rtw89_rx_phy_ppdu *phy_ppdu,
2461+
struct ieee80211_rx_status *status)
2462+
{
2463+
u8 path;
2464+
s8 *rx_power = phy_ppdu->rssi;
2465+
2466+
status->signal = max_t(s8, rx_power[RF_PATH_A], rx_power[RF_PATH_B]);
2467+
for (path = 0; path < rtwdev->chip->rf_path_num; path++) {
2468+
status->chains |= BIT(path);
2469+
status->chain_signal[path] = rx_power[path];
2470+
}
2471+
if (phy_ppdu->valid)
2472+
rtw8852c_fill_freq_with_ppdu(rtwdev, phy_ppdu, status);
2473+
}
2474+
24432475
static int rtw8852c_mac_enable_bb_rf(struct rtw89_dev *rtwdev)
24442476
{
24452477
int ret;
@@ -2499,6 +2531,7 @@ static const struct rtw89_chip_ops rtw8852c_chip_ops = {
24992531
.set_txpwr_ctrl = rtw8852c_set_txpwr_ctrl,
25002532
.init_txpwr_unit = rtw8852c_init_txpwr_unit,
25012533
.get_thermal = rtw8852c_get_thermal,
2534+
.query_ppdu = rtw8852c_query_ppdu,
25022535
.read_rf = rtw89_phy_read_rf_v1,
25032536
.write_rf = rtw89_phy_write_rf_v1,
25042537
.set_txpwr_ul_tb_offset = rtw8852c_set_txpwr_ul_tb_offset,

0 commit comments

Comments
 (0)