mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt7603: report signal strength to mac80211
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
@@ -74,6 +74,8 @@ struct mt7603_dev {
|
||||
u8 rx_chains;
|
||||
u8 tx_chains;
|
||||
|
||||
u8 rssi_offset[3];
|
||||
|
||||
struct mt7603_mcu mcu;
|
||||
struct mt76_queue q_rx;
|
||||
struct mt76_queue q_tx[__MT_TXQ_MAX];
|
||||
|
||||
+12
-1
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "mt7603.h"
|
||||
#include "mt7603_eeprom.h"
|
||||
|
||||
void mt7603_set_irq_mask(struct mt7603_dev *dev, u32 clear, u32 set)
|
||||
{
|
||||
@@ -76,6 +77,7 @@ u32 mt7603_reg_map(struct mt7603_dev *dev, u32 addr)
|
||||
|
||||
int mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
|
||||
{
|
||||
u8 *rssi_data = (u8 *) dev->mt76.eeprom.data;
|
||||
int idx, ret;
|
||||
|
||||
u8 bw = MT_BW_20;
|
||||
@@ -88,7 +90,16 @@ int mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
idx = def->chan->band == IEEE80211_BAND_5GHZ;
|
||||
if (def->chan->band == IEEE80211_BAND_5GHZ) {
|
||||
idx = 1;
|
||||
rssi_data += MT_EE_RSSI_OFFSET_5G;
|
||||
} else {
|
||||
idx = 0;
|
||||
rssi_data += MT_EE_RSSI_OFFSET_2G;
|
||||
}
|
||||
|
||||
memcpy(dev->rssi_offset, rssi_data, sizeof(dev->rssi_offset));
|
||||
|
||||
idx |= (def->chan - mt76_hw(dev)->wiphy->bands[def->chan->band]->channels) << 1;
|
||||
mt76_set(dev, MT_WF_RMAC_CH_FREQ, idx);
|
||||
mt7603_mac_start(dev);
|
||||
|
||||
@@ -26,7 +26,9 @@ enum mt7603_eeprom_field {
|
||||
|
||||
MT_EE_XTAL_TRIM_1 = 0x03a,
|
||||
|
||||
MT_EE_RSSI_OFFSET_2G = 0x046,
|
||||
MT_EE_WIFI_RF_SETTING = 0x048,
|
||||
MT_EE_RSSI_OFFSET_5G = 0x04a,
|
||||
|
||||
MT_EE_TX_POWER_DELTA_BW40 = 0x050,
|
||||
MT_EE_TX_POWER_DELTA_BW80 = 0x052,
|
||||
|
||||
+8
-1
@@ -215,8 +215,15 @@ mt7603_mac_fill_rx(struct mt7603_dev *dev, struct sk_buff *skb)
|
||||
MT76_GET(MT_RXV1_HT_STBC, rxd[0]);
|
||||
|
||||
status->rate_idx = i;
|
||||
rxd += 6;
|
||||
|
||||
status->chains = BIT(0) | BIT(1);
|
||||
status->chain_signal[0] = MT76_GET(MT_RXV4_IB_RSSI0, rxd[3]) +
|
||||
dev->rssi_offset[0];
|
||||
status->chain_signal[1] = MT76_GET(MT_RXV4_IB_RSSI1, rxd[3]) +
|
||||
dev->rssi_offset[1];
|
||||
status->signal = max(status->chain_signal[0], status->chain_signal[1]);
|
||||
|
||||
rxd += 6;
|
||||
if ((u8 *) rxd - skb->data >= skb->len)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user