main.c (4fcf6e770b4487db3dbcf48993a36f16f8836680) main.c (e90354e0452d33f3dc77d7f5c0ff7033f97e1fbf)
1// SPDX-License-Identifier: ISC
2/* Copyright (C) 2019 MediaTek Inc.
3 *
4 * Author: Roy Luo <royluo@google.com>
5 * Ryder Lee <ryder.lee@mediatek.com>
6 * Felix Fietkau <nbd@nbd.name>
1// SPDX-License-Identifier: ISC
2/* Copyright (C) 2019 MediaTek Inc.
3 *
4 * Author: Roy Luo <royluo@google.com>
5 * Ryder Lee <ryder.lee@mediatek.com>
6 * Felix Fietkau <nbd@nbd.name>
7 * Lorenzo Bianconi <lorenzo@kernel.org>
7 */
8
9#include <linux/etherdevice.h>
8 */
9
10#include <linux/etherdevice.h>
10#include <linux/platform_device.h>
11#include <linux/pci.h>
12#include <linux/module.h>
13#include "mt7615.h"
14#include "mcu.h"
15
16static bool mt7615_dev_running(struct mt7615_dev *dev)
17{
18 struct mt7615_phy *phy;
19

--- 471 unchanged lines hidden (view full) ---

491
492 mt7615_mac_wtbl_update(dev, idx,
493 MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
494
495 mt7615_mcu_sta_add(dev, vif, sta, true);
496
497 return 0;
498}
11#include <linux/module.h>
12#include "mt7615.h"
13#include "mcu.h"
14
15static bool mt7615_dev_running(struct mt7615_dev *dev)
16{
17 struct mt7615_phy *phy;
18

--- 471 unchanged lines hidden (view full) ---

490
491 mt7615_mac_wtbl_update(dev, idx,
492 MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
493
494 mt7615_mcu_sta_add(dev, vif, sta, true);
495
496 return 0;
497}
498EXPORT_SYMBOL_GPL(mt7615_mac_sta_add);
499
500void mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
501 struct ieee80211_sta *sta)
502{
503 struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
504 struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv;
505
506 mt7615_mcu_sta_add(dev, vif, sta, false);
507 mt7615_mac_wtbl_update(dev, msta->wcid.idx,
508 MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
509
510 spin_lock_bh(&dev->sta_poll_lock);
511 if (!list_empty(&msta->poll_list))
512 list_del_init(&msta->poll_list);
513 spin_unlock_bh(&dev->sta_poll_lock);
514}
499
500void mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
501 struct ieee80211_sta *sta)
502{
503 struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);
504 struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv;
505
506 mt7615_mcu_sta_add(dev, vif, sta, false);
507 mt7615_mac_wtbl_update(dev, msta->wcid.idx,
508 MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
509
510 spin_lock_bh(&dev->sta_poll_lock);
511 if (!list_empty(&msta->poll_list))
512 list_del_init(&msta->poll_list);
513 spin_unlock_bh(&dev->sta_poll_lock);
514}
515EXPORT_SYMBOL_GPL(mt7615_mac_sta_remove);
515
516static void mt7615_sta_rate_tbl_update(struct ieee80211_hw *hw,
517 struct ieee80211_vif *vif,
518 struct ieee80211_sta *sta)
519{
520 struct mt7615_dev *dev = mt7615_hw_dev(hw);
521 struct mt7615_phy *phy = mt7615_hw_phy(hw);
522 struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv;

--- 304 unchanged lines hidden (view full) ---

827 .get_antenna = mt76_get_antenna,
828 .set_antenna = mt7615_set_antenna,
829 .set_coverage_class = mt7615_set_coverage_class,
830 .hw_scan = mt7615_hw_scan,
831 .cancel_hw_scan = mt7615_cancel_hw_scan,
832 .sched_scan_start = mt7615_start_sched_scan,
833 .sched_scan_stop = mt7615_stop_sched_scan,
834};
516
517static void mt7615_sta_rate_tbl_update(struct ieee80211_hw *hw,
518 struct ieee80211_vif *vif,
519 struct ieee80211_sta *sta)
520{
521 struct mt7615_dev *dev = mt7615_hw_dev(hw);
522 struct mt7615_phy *phy = mt7615_hw_phy(hw);
523 struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv;

--- 304 unchanged lines hidden (view full) ---

828 .get_antenna = mt76_get_antenna,
829 .set_antenna = mt7615_set_antenna,
830 .set_coverage_class = mt7615_set_coverage_class,
831 .hw_scan = mt7615_hw_scan,
832 .cancel_hw_scan = mt7615_cancel_hw_scan,
833 .sched_scan_start = mt7615_start_sched_scan,
834 .sched_scan_stop = mt7615_stop_sched_scan,
835};
836EXPORT_SYMBOL_GPL(mt7615_ops);
835
837
836static int __init mt7615_init(void)
837{
838 int ret;
839
840 ret = pci_register_driver(&mt7615_pci_driver);
841 if (ret)
842 return ret;
843
844 if (IS_ENABLED(CONFIG_MT7622_WMAC)) {
845 ret = platform_driver_register(&mt7622_wmac_driver);
846 if (ret)
847 pci_unregister_driver(&mt7615_pci_driver);
848 }
849
850 return ret;
851}
852
853static void __exit mt7615_exit(void)
854{
855 if (IS_ENABLED(CONFIG_MT7622_WMAC))
856 platform_driver_unregister(&mt7622_wmac_driver);
857 pci_unregister_driver(&mt7615_pci_driver);
858}
859
860module_init(mt7615_init);
861module_exit(mt7615_exit);
862MODULE_LICENSE("Dual BSD/GPL");
838MODULE_LICENSE("Dual BSD/GPL");