Skip to content

Commit

Permalink
mt76: mt7915: add Tx beamformer support
Browse files Browse the repository at this point in the history
Enable TxBF modules and trigger sounding process to support Tx beamformer.

Signed-off-by: Ryder Lee <[email protected]>
Tested-by: Evelyn Tsai <[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
ryderlee1110 authored and nbd168 committed May 12, 2020
1 parent 1d0903d commit 095c72c
Show file tree
Hide file tree
Showing 5 changed files with 434 additions and 35 deletions.
20 changes: 20 additions & 0 deletions mt7915/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,25 @@ static void mt7915_mac_init(struct mt7915_dev *dev)
mt7915_mcu_set_rts_thresh(&dev->phy, 0x92b);
}

static int mt7915_txbf_init(struct mt7915_dev *dev)
{
int ret;

/*
* TODO: DBDC & check whether iBF phase calibration data has
* been stored in eeprom offset 0x651~0x7b8, then write down
* 0x1111 into 0x651 and 0x651 to trigger iBF.
*/

/* trigger sounding packets */
ret = mt7915_mcu_set_txbf_sounding(dev);
if (ret)
return ret;

/* enable iBF & eBF */
return mt7915_mcu_set_txbf_type(dev);
}

static void
mt7915_init_txpower_band(struct mt7915_dev *dev,
struct ieee80211_supported_band *sband)
Expand Down Expand Up @@ -97,6 +116,7 @@ static void mt7915_init_work(struct work_struct *work)
mt7915_mcu_set_eeprom(dev);
mt7915_mac_init(dev);
mt7915_init_txpower(dev);
mt7915_txbf_init(dev);
}

static int mt7915_init_hardware(struct mt7915_dev *dev)
Expand Down
9 changes: 6 additions & 3 deletions mt7915/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7915_dev *dev = container_of(mdev, struct mt7915_dev, mt76);
struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
int idx;
int ret, idx;

idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA - 1);
if (idx < 0)
Expand All @@ -504,9 +504,11 @@ int mt7915_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
mt7915_mac_wtbl_update(dev, idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);

mt7915_mcu_add_sta(dev, vif, sta, true);
ret = mt7915_mcu_add_sta(dev, vif, sta, true);
if (ret)
return ret;

return 0;
return mt7915_mcu_add_sta_adv(dev, vif, sta, true);
}

void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
Expand All @@ -515,6 +517,7 @@ void mt7915_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct mt7915_dev *dev = container_of(mdev, struct mt7915_dev, mt76);
struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;

mt7915_mcu_add_sta_adv(dev, vif, sta, false);
mt7915_mcu_add_sta(dev, vif, sta, false);

mt7915_mac_wtbl_update(dev, msta->wcid.idx,
Expand Down
Loading

0 comments on commit 095c72c

Please sign in to comment.