Path: blob/main/sys/contrib/dev/mediatek/mt76/mt7615/main.c
48526 views
// SPDX-License-Identifier: ISC1/* Copyright (C) 2019 MediaTek Inc.2*3* Author: Roy Luo <[email protected]>4* Ryder Lee <[email protected]>5* Felix Fietkau <[email protected]>6* Lorenzo Bianconi <[email protected]>7*/89#include <linux/etherdevice.h>10#include <linux/module.h>11#include "mt7615.h"12#include "mcu.h"1314static bool mt7615_dev_running(struct mt7615_dev *dev)15{16struct mt7615_phy *phy;1718if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state))19return true;2021phy = mt7615_ext_phy(dev);2223return phy && test_bit(MT76_STATE_RUNNING, &phy->mt76->state);24}2526static int mt7615_start(struct ieee80211_hw *hw)27{28struct mt7615_dev *dev = mt7615_hw_dev(hw);29struct mt7615_phy *phy = mt7615_hw_phy(hw);30unsigned long timeout;31bool running;32int ret;3334if (!mt7615_wait_for_mcu_init(dev))35return -EIO;3637mt7615_mutex_acquire(dev);3839running = mt7615_dev_running(dev);4041if (!running) {42ret = mt7615_mcu_set_pm(dev, 0, 0);43if (ret)44goto out;4546ret = mt76_connac_mcu_set_mac_enable(&dev->mt76, 0, true, false);47if (ret)48goto out;4950mt7615_mac_enable_nf(dev, 0);51}5253if (phy != &dev->phy) {54ret = mt7615_mcu_set_pm(dev, 1, 0);55if (ret)56goto out;5758ret = mt76_connac_mcu_set_mac_enable(&dev->mt76, 1, true, false);59if (ret)60goto out;6162mt7615_mac_enable_nf(dev, 1);63}6465if (mt7615_firmware_offload(dev)) {66ret = mt76_connac_mcu_set_channel_domain(phy->mt76);67if (ret)68goto out;6970ret = mt76_connac_mcu_set_rate_txpower(phy->mt76);71if (ret)72goto out;73}7475ret = mt7615_mcu_set_chan_info(phy, MCU_EXT_CMD(SET_RX_PATH));76if (ret)77goto out;7879set_bit(MT76_STATE_RUNNING, &phy->mt76->state);8081timeout = mt7615_get_macwork_timeout(dev);82ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work, timeout);8384if (!running)85mt7615_mac_reset_counters(phy);8687out:88mt7615_mutex_release(dev);8990return ret;91}9293static void mt7615_stop(struct ieee80211_hw *hw, bool suspend)94{95struct mt7615_dev *dev = mt7615_hw_dev(hw);96struct mt7615_phy *phy = mt7615_hw_phy(hw);9798cancel_delayed_work_sync(&phy->mt76->mac_work);99timer_delete_sync(&phy->roc_timer);100cancel_work_sync(&phy->roc_work);101102cancel_delayed_work_sync(&dev->pm.ps_work);103cancel_work_sync(&dev->pm.wake_work);104105mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);106107mt7615_mutex_acquire(dev);108109mt76_testmode_reset(phy->mt76, true);110111clear_bit(MT76_STATE_RUNNING, &phy->mt76->state);112cancel_delayed_work_sync(&phy->scan_work);113114if (phy != &dev->phy) {115mt7615_mcu_set_pm(dev, 1, 1);116mt76_connac_mcu_set_mac_enable(&dev->mt76, 1, false, false);117}118119if (!mt7615_dev_running(dev)) {120mt7615_mcu_set_pm(dev, 0, 1);121mt76_connac_mcu_set_mac_enable(&dev->mt76, 0, false, false);122}123124mt7615_mutex_release(dev);125}126127static inline int get_free_idx(u32 mask, u8 start, u8 end)128{129return ffs(~mask & GENMASK(end, start));130}131132static int get_omac_idx(enum nl80211_iftype type, u64 mask)133{134int i;135136switch (type) {137case NL80211_IFTYPE_STATION:138/* prefer hw bssid slot 1-3 */139i = get_free_idx(mask, HW_BSSID_1, HW_BSSID_3);140if (i)141return i - 1;142143/* next, try to find a free repeater entry for the sta */144i = get_free_idx(mask >> REPEATER_BSSID_START, 0,145REPEATER_BSSID_MAX - REPEATER_BSSID_START);146if (i)147return i + 32 - 1;148149i = get_free_idx(mask, EXT_BSSID_1, EXT_BSSID_MAX);150if (i)151return i - 1;152153if (~mask & BIT(HW_BSSID_0))154return HW_BSSID_0;155156break;157case NL80211_IFTYPE_ADHOC:158case NL80211_IFTYPE_MESH_POINT:159case NL80211_IFTYPE_MONITOR:160case NL80211_IFTYPE_AP:161/* ap uses hw bssid 0 and ext bssid */162if (~mask & BIT(HW_BSSID_0))163return HW_BSSID_0;164165i = get_free_idx(mask, EXT_BSSID_1, EXT_BSSID_MAX);166if (i)167return i - 1;168169break;170default:171WARN_ON(1);172break;173}174175return -1;176}177178static int mt7615_add_interface(struct ieee80211_hw *hw,179struct ieee80211_vif *vif)180{181struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;182struct mt7615_dev *dev = mt7615_hw_dev(hw);183struct mt7615_phy *phy = mt7615_hw_phy(hw);184struct mt76_txq *mtxq;185bool ext_phy = phy != &dev->phy;186int idx, ret = 0;187188mt7615_mutex_acquire(dev);189190mt76_testmode_reset(phy->mt76, true);191192if (vif->type == NL80211_IFTYPE_MONITOR &&193is_zero_ether_addr(vif->addr))194phy->monitor_vif = vif;195196mvif->mt76.idx = __ffs64(~dev->mt76.vif_mask);197if (mvif->mt76.idx >= MT7615_MAX_INTERFACES) {198ret = -ENOSPC;199goto out;200}201202idx = get_omac_idx(vif->type, dev->omac_mask);203if (idx < 0) {204ret = -ENOSPC;205goto out;206}207mvif->mt76.omac_idx = idx;208209mvif->mt76.band_idx = ext_phy;210mvif->mt76.wmm_idx = vif->type != NL80211_IFTYPE_AP;211mvif->mt76.wcid = &mvif->sta.wcid;212if (ext_phy)213mvif->mt76.wmm_idx += 2;214215dev->mt76.vif_mask |= BIT_ULL(mvif->mt76.idx);216dev->omac_mask |= BIT_ULL(mvif->mt76.omac_idx);217phy->omac_mask |= BIT_ULL(mvif->mt76.omac_idx);218219ret = mt7615_mcu_set_dbdc(dev);220if (ret)221goto out;222223idx = MT7615_WTBL_RESERVED - mvif->mt76.idx;224225INIT_LIST_HEAD(&mvif->sta.wcid.poll_list);226mvif->sta.wcid.idx = idx;227mt76_wcid_init(&mvif->sta.wcid, mvif->mt76.band_idx);228229mt7615_mac_wtbl_update(dev, idx,230MT_WTBL_UPDATE_ADM_COUNT_CLEAR);231232rcu_assign_pointer(dev->mt76.wcid[idx], &mvif->sta.wcid);233if (vif->txq) {234mtxq = (struct mt76_txq *)vif->txq->drv_priv;235mtxq->wcid = idx;236}237238ret = mt7615_mcu_add_dev_info(phy, vif, true);239out:240mt7615_mutex_release(dev);241242return ret;243}244245static void mt7615_remove_interface(struct ieee80211_hw *hw,246struct ieee80211_vif *vif)247{248struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;249struct mt7615_sta *msta = &mvif->sta;250struct mt7615_dev *dev = mt7615_hw_dev(hw);251struct mt7615_phy *phy = mt7615_hw_phy(hw);252int idx = msta->wcid.idx;253254mt7615_mutex_acquire(dev);255256mt7615_mcu_add_bss_info(phy, vif, NULL, false);257mt7615_mcu_sta_add(phy, vif, NULL, false);258259mt76_testmode_reset(phy->mt76, true);260if (vif == phy->monitor_vif)261phy->monitor_vif = NULL;262263mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid);264265mt7615_mcu_add_dev_info(phy, vif, false);266267rcu_assign_pointer(dev->mt76.wcid[idx], NULL);268269dev->mt76.vif_mask &= ~BIT_ULL(mvif->mt76.idx);270dev->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx);271phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx);272273mt7615_mutex_release(dev);274275spin_lock_bh(&dev->mt76.sta_poll_lock);276if (!list_empty(&msta->wcid.poll_list))277list_del_init(&msta->wcid.poll_list);278spin_unlock_bh(&dev->mt76.sta_poll_lock);279280mt76_wcid_cleanup(&dev->mt76, &mvif->sta.wcid);281}282283int mt7615_set_channel(struct mt76_phy *mphy)284{285struct mt7615_phy *phy = mphy->priv;286struct mt7615_dev *dev = phy->dev;287bool ext_phy = phy != &dev->phy;288int ret;289290mt76_connac_pm_wake(mphy, &dev->pm);291292if (is_mt7615(&dev->mt76) && dev->flash_eeprom) {293ret = mt7615_mcu_apply_rx_dcoc(phy);294if (ret)295goto out;296297ret = mt7615_mcu_apply_tx_dpd(phy);298if (ret)299goto out;300}301302ret = mt7615_mcu_set_chan_info(phy, MCU_EXT_CMD(CHANNEL_SWITCH));303if (ret)304goto out;305306mt7615_mac_set_timing(phy);307ret = mt7615_dfs_init_radar_detector(phy);308if (ret)309goto out;310311mt7615_mac_cca_stats_reset(phy);312ret = mt7615_mcu_set_sku_en(phy, true);313if (ret)314goto out;315316mt7615_mac_reset_counters(phy);317phy->noise = 0;318phy->chfreq = mt76_rr(dev, MT_CHFREQ(ext_phy));319320out:321mt76_connac_power_save_sched(mphy, &dev->pm);322323if (!mt76_testmode_enabled(phy->mt76)) {324unsigned long timeout = mt7615_get_macwork_timeout(dev);325326ieee80211_queue_delayed_work(phy->mt76->hw,327&phy->mt76->mac_work, timeout);328}329330return ret;331}332EXPORT_SYMBOL_GPL(mt7615_set_channel);333334static int mt7615_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,335struct ieee80211_vif *vif, struct ieee80211_sta *sta,336struct ieee80211_key_conf *key)337{338struct mt7615_dev *dev = mt7615_hw_dev(hw);339struct mt7615_phy *phy = mt7615_hw_phy(hw);340struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;341struct mt7615_sta *msta = sta ? (struct mt7615_sta *)sta->drv_priv :342&mvif->sta;343struct mt76_wcid *wcid = &msta->wcid;344int idx = key->keyidx, err = 0;345u8 *wcid_keyidx = &wcid->hw_key_idx;346347/* The hardware does not support per-STA RX GTK, fallback348* to software mode for these.349*/350if ((vif->type == NL80211_IFTYPE_ADHOC ||351vif->type == NL80211_IFTYPE_MESH_POINT) &&352(key->cipher == WLAN_CIPHER_SUITE_TKIP ||353key->cipher == WLAN_CIPHER_SUITE_CCMP) &&354!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))355return -EOPNOTSUPP;356357/* fall back to sw encryption for unsupported ciphers */358switch (key->cipher) {359case WLAN_CIPHER_SUITE_AES_CMAC:360wcid_keyidx = &wcid->hw_key_idx2;361key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIE;362break;363case WLAN_CIPHER_SUITE_TKIP:364case WLAN_CIPHER_SUITE_CCMP:365case WLAN_CIPHER_SUITE_CCMP_256:366case WLAN_CIPHER_SUITE_GCMP:367case WLAN_CIPHER_SUITE_GCMP_256:368case WLAN_CIPHER_SUITE_SMS4:369break;370case WLAN_CIPHER_SUITE_WEP40:371case WLAN_CIPHER_SUITE_WEP104:372default:373return -EOPNOTSUPP;374}375376mt7615_mutex_acquire(dev);377378if (cmd == SET_KEY && !sta && !mvif->mt76.cipher) {379mvif->mt76.cipher = mt76_connac_mcu_get_cipher(key->cipher);380mt7615_mcu_add_bss_info(phy, vif, NULL, true);381}382383if (cmd == SET_KEY)384*wcid_keyidx = idx;385else {386if (idx == *wcid_keyidx)387*wcid_keyidx = -1;388goto out;389}390391mt76_wcid_key_setup(&dev->mt76, wcid, key);392if (mt76_is_mmio(&dev->mt76))393err = mt7615_mac_wtbl_set_key(dev, wcid, key);394else395err = __mt7615_mac_wtbl_set_key(dev, wcid, key);396397out:398mt7615_mutex_release(dev);399400return err;401}402403static int mt7615_set_sar_specs(struct ieee80211_hw *hw,404const struct cfg80211_sar_specs *sar)405{406struct mt7615_phy *phy = mt7615_hw_phy(hw);407int err;408409if (!cfg80211_chandef_valid(&phy->mt76->chandef))410return -EINVAL;411412err = mt76_init_sar_power(hw, sar);413if (err)414return err;415416if (mt7615_firmware_offload(phy->dev))417return mt76_connac_mcu_set_rate_txpower(phy->mt76);418419return mt76_update_channel(phy->mt76);420}421422static int mt7615_config(struct ieee80211_hw *hw, int radio_idx, u32 changed)423{424struct mt7615_dev *dev = mt7615_hw_dev(hw);425struct mt7615_phy *phy = mt7615_hw_phy(hw);426bool band = phy != &dev->phy;427int ret = 0;428429if (changed & (IEEE80211_CONF_CHANGE_CHANNEL |430IEEE80211_CONF_CHANGE_POWER)) {431#ifdef CONFIG_NL80211_TESTMODE432if (phy->mt76->test.state != MT76_TM_STATE_OFF) {433mt7615_mutex_acquire(dev);434mt76_testmode_reset(phy->mt76, false);435mt7615_mutex_release(dev);436}437#endif438ret = mt76_update_channel(phy->mt76);439}440441mt7615_mutex_acquire(dev);442443if (changed & IEEE80211_CONF_CHANGE_MONITOR) {444mt76_testmode_reset(phy->mt76, true);445446if (!(hw->conf.flags & IEEE80211_CONF_MONITOR))447phy->rxfilter |= MT_WF_RFCR_DROP_OTHER_UC;448else449phy->rxfilter &= ~MT_WF_RFCR_DROP_OTHER_UC;450451mt76_wr(dev, MT_WF_RFCR(band), phy->rxfilter);452}453454mt7615_mutex_release(dev);455456return ret;457}458459static int460mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,461unsigned int link_id, u16 queue,462const struct ieee80211_tx_queue_params *params)463{464struct mt76_vif_link *mvif = (struct mt76_vif_link *)vif->drv_priv;465struct mt7615_dev *dev = mt7615_hw_dev(hw);466int err;467468mt7615_mutex_acquire(dev);469470queue = mt7615_lmac_mapping(dev, queue);471queue += mvif->wmm_idx * MT7615_MAX_WMM_SETS;472err = mt7615_mcu_set_wmm(dev, queue, params);473474mt7615_mutex_release(dev);475476return err;477}478479static void mt7615_configure_filter(struct ieee80211_hw *hw,480unsigned int changed_flags,481unsigned int *total_flags,482u64 multicast)483{484struct mt7615_dev *dev = mt7615_hw_dev(hw);485struct mt7615_phy *phy = mt7615_hw_phy(hw);486bool band = phy != &dev->phy;487488u32 ctl_flags = MT_WF_RFCR1_DROP_ACK |489MT_WF_RFCR1_DROP_BF_POLL |490MT_WF_RFCR1_DROP_BA |491MT_WF_RFCR1_DROP_CFEND |492MT_WF_RFCR1_DROP_CFACK;493u32 flags = 0;494495mt7615_mutex_acquire(dev);496497#define MT76_FILTER(_flag, _hw) do { \498flags |= *total_flags & FIF_##_flag; \499phy->rxfilter &= ~(_hw); \500if (!mt76_testmode_enabled(phy->mt76)) \501phy->rxfilter |= !(flags & FIF_##_flag) * (_hw);\502} while (0)503504phy->rxfilter &= ~(MT_WF_RFCR_DROP_OTHER_BSS |505MT_WF_RFCR_DROP_FRAME_REPORT |506MT_WF_RFCR_DROP_PROBEREQ |507MT_WF_RFCR_DROP_MCAST_FILTERED |508MT_WF_RFCR_DROP_MCAST |509MT_WF_RFCR_DROP_BCAST |510MT_WF_RFCR_DROP_DUPLICATE |511MT_WF_RFCR_DROP_A2_BSSID |512MT_WF_RFCR_DROP_UNWANTED_CTL |513MT_WF_RFCR_DROP_STBC_MULTI);514515if (phy->n_beacon_vif || !mt7615_firmware_offload(dev))516phy->rxfilter &= ~MT_WF_RFCR_DROP_OTHER_BEACON;517518MT76_FILTER(OTHER_BSS, MT_WF_RFCR_DROP_OTHER_TIM |519MT_WF_RFCR_DROP_A3_MAC |520MT_WF_RFCR_DROP_A3_BSSID);521522MT76_FILTER(FCSFAIL, MT_WF_RFCR_DROP_FCSFAIL);523524MT76_FILTER(CONTROL, MT_WF_RFCR_DROP_CTS |525MT_WF_RFCR_DROP_RTS |526MT_WF_RFCR_DROP_CTL_RSV |527MT_WF_RFCR_DROP_NDPA);528529*total_flags = flags;530mt76_wr(dev, MT_WF_RFCR(band), phy->rxfilter);531532if (*total_flags & FIF_CONTROL)533mt76_clear(dev, MT_WF_RFCR1(band), ctl_flags);534else535mt76_set(dev, MT_WF_RFCR1(band), ctl_flags);536537mt7615_mutex_release(dev);538}539540static void541mt7615_update_mu_group(struct ieee80211_hw *hw, struct ieee80211_vif *vif,542struct ieee80211_bss_conf *info)543{544struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;545struct mt7615_dev *dev = mt7615_hw_dev(hw);546u8 i, band = mvif->mt76.band_idx;547u32 *mu;548549mu = (u32 *)info->mu_group.membership;550for (i = 0; i < WLAN_MEMBERSHIP_LEN / sizeof(*mu); i++) {551if (is_mt7663(&dev->mt76))552mt76_wr(dev, MT7663_WF_PHY_GID_TAB_VLD(band, i), mu[i]);553else554mt76_wr(dev, MT_WF_PHY_GID_TAB_VLD(band, i), mu[i]);555}556557mu = (u32 *)info->mu_group.position;558for (i = 0; i < WLAN_USER_POSITION_LEN / sizeof(*mu); i++) {559if (is_mt7663(&dev->mt76))560mt76_wr(dev, MT7663_WF_PHY_GID_TAB_POS(band, i), mu[i]);561else562mt76_wr(dev, MT_WF_PHY_GID_TAB_POS(band, i), mu[i]);563}564}565566static void mt7615_bss_info_changed(struct ieee80211_hw *hw,567struct ieee80211_vif *vif,568struct ieee80211_bss_conf *info,569u64 changed)570{571struct mt7615_dev *dev = mt7615_hw_dev(hw);572struct mt7615_phy *phy = mt7615_hw_phy(hw);573574mt7615_mutex_acquire(dev);575576if (changed & BSS_CHANGED_ERP_SLOT) {577int slottime = info->use_short_slot ? 9 : 20;578579if (slottime != phy->slottime) {580phy->slottime = slottime;581mt7615_mac_set_timing(phy);582}583}584585if (changed & BSS_CHANGED_ERP_CTS_PROT)586mt7615_mac_enable_rtscts(dev, vif, info->use_cts_prot);587588if (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon) {589mt7615_mcu_add_bss_info(phy, vif, NULL, true);590mt7615_mcu_sta_add(phy, vif, NULL, true);591592if (mt7615_firmware_offload(dev) && vif->p2p)593mt76_connac_mcu_set_p2p_oppps(hw, vif);594}595596if (changed & (BSS_CHANGED_BEACON |597BSS_CHANGED_BEACON_ENABLED))598mt7615_mcu_add_beacon(dev, hw, vif, info->enable_beacon);599600if (changed & BSS_CHANGED_PS)601mt76_connac_mcu_set_vif_ps(&dev->mt76, vif);602603if ((changed & BSS_CHANGED_ARP_FILTER) &&604mt7615_firmware_offload(dev)) {605struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;606607mt76_connac_mcu_update_arp_filter(&dev->mt76, &mvif->mt76,608info);609}610611if (changed & BSS_CHANGED_ASSOC)612mt7615_mac_set_beacon_filter(phy, vif, vif->cfg.assoc);613614if (changed & BSS_CHANGED_MU_GROUPS)615mt7615_update_mu_group(hw, vif, info);616617mt7615_mutex_release(dev);618}619620static void621mt7615_channel_switch_beacon(struct ieee80211_hw *hw,622struct ieee80211_vif *vif,623struct cfg80211_chan_def *chandef)624{625struct mt7615_dev *dev = mt7615_hw_dev(hw);626627mt7615_mutex_acquire(dev);628mt7615_mcu_add_beacon(dev, hw, vif, true);629mt7615_mutex_release(dev);630}631632int mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,633struct ieee80211_sta *sta)634{635struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);636struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv;637struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;638struct mt7615_phy *phy;639int idx, err;640641idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7615_WTBL_STA - 1);642if (idx < 0)643return -ENOSPC;644645INIT_LIST_HEAD(&msta->wcid.poll_list);646msta->vif = mvif;647msta->wcid.sta = 1;648msta->wcid.idx = idx;649msta->wcid.phy_idx = mvif->mt76.band_idx;650651phy = mvif->mt76.band_idx ? mt7615_ext_phy(dev) : &dev->phy;652err = mt76_connac_pm_wake(phy->mt76, &dev->pm);653if (err)654return err;655656if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls) {657err = mt7615_mcu_add_bss_info(phy, vif, sta, true);658if (err)659return err;660}661662mt7615_mac_wtbl_update(dev, idx,663MT_WTBL_UPDATE_ADM_COUNT_CLEAR);664err = mt7615_mcu_sta_add(&dev->phy, vif, sta, true);665if (err)666return err;667668mt76_connac_power_save_sched(phy->mt76, &dev->pm);669670return err;671}672EXPORT_SYMBOL_GPL(mt7615_mac_sta_add);673674void mt7615_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,675struct ieee80211_sta *sta)676{677struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76);678struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv;679struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;680struct mt7615_phy *phy;681682mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->wcid);683684phy = mvif->mt76.band_idx ? mt7615_ext_phy(dev) : &dev->phy;685mt76_connac_pm_wake(phy->mt76, &dev->pm);686687mt7615_mcu_sta_add(&dev->phy, vif, sta, false);688mt7615_mac_wtbl_update(dev, msta->wcid.idx,689MT_WTBL_UPDATE_ADM_COUNT_CLEAR);690if (vif->type == NL80211_IFTYPE_STATION && !sta->tdls)691mt7615_mcu_add_bss_info(phy, vif, sta, false);692693spin_lock_bh(&mdev->sta_poll_lock);694if (!list_empty(&msta->wcid.poll_list))695list_del_init(&msta->wcid.poll_list);696spin_unlock_bh(&mdev->sta_poll_lock);697698mt76_connac_power_save_sched(phy->mt76, &dev->pm);699}700EXPORT_SYMBOL_GPL(mt7615_mac_sta_remove);701702static void mt7615_sta_rate_tbl_update(struct ieee80211_hw *hw,703struct ieee80211_vif *vif,704struct ieee80211_sta *sta)705{706struct mt7615_dev *dev = mt7615_hw_dev(hw);707struct mt7615_phy *phy = mt7615_hw_phy(hw);708struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv;709struct ieee80211_sta_rates *sta_rates = rcu_dereference(sta->rates);710int i;711712if (!sta_rates)713return;714715spin_lock_bh(&dev->mt76.lock);716for (i = 0; i < ARRAY_SIZE(msta->rates); i++) {717msta->rates[i].idx = sta_rates->rate[i].idx;718msta->rates[i].count = sta_rates->rate[i].count;719msta->rates[i].flags = sta_rates->rate[i].flags;720721if (msta->rates[i].idx < 0 || !msta->rates[i].count)722break;723}724msta->n_rates = i;725if (mt76_connac_pm_ref(phy->mt76, &dev->pm)) {726mt7615_mac_set_rates(phy, msta, NULL, msta->rates);727mt76_connac_pm_unref(phy->mt76, &dev->pm);728}729spin_unlock_bh(&dev->mt76.lock);730}731732void mt7615_tx_worker(struct mt76_worker *w)733{734struct mt7615_dev *dev = container_of(w, struct mt7615_dev,735mt76.tx_worker);736737if (!mt76_connac_pm_ref(&dev->mphy, &dev->pm)) {738queue_work(dev->mt76.wq, &dev->pm.wake_work);739return;740}741742mt76_tx_worker_run(&dev->mt76);743mt76_connac_pm_unref(&dev->mphy, &dev->pm);744}745746static void mt7615_tx(struct ieee80211_hw *hw,747struct ieee80211_tx_control *control,748struct sk_buff *skb)749{750struct mt7615_dev *dev = mt7615_hw_dev(hw);751struct mt76_phy *mphy = hw->priv;752struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);753struct ieee80211_vif *vif = info->control.vif;754struct mt76_wcid *wcid = &dev->mt76.global_wcid;755struct mt7615_sta *msta = NULL;756int qid;757758if (control->sta) {759msta = (struct mt7615_sta *)control->sta->drv_priv;760wcid = &msta->wcid;761}762763if (vif && !control->sta) {764struct mt7615_vif *mvif;765766mvif = (struct mt7615_vif *)vif->drv_priv;767msta = &mvif->sta;768wcid = &msta->wcid;769}770771if (mt76_connac_pm_ref(mphy, &dev->pm)) {772mt76_tx(mphy, control->sta, wcid, skb);773mt76_connac_pm_unref(mphy, &dev->pm);774return;775}776777qid = skb_get_queue_mapping(skb);778if (qid >= MT_TXQ_PSD) {779qid = IEEE80211_AC_BE;780skb_set_queue_mapping(skb, qid);781}782783mt76_connac_pm_queue_skb(hw, &dev->pm, wcid, skb);784}785786static int mt7615_set_rts_threshold(struct ieee80211_hw *hw, int radio_idx,787u32 val)788{789struct mt7615_dev *dev = mt7615_hw_dev(hw);790struct mt7615_phy *phy = mt7615_hw_phy(hw);791int err, band = phy != &dev->phy;792793mt7615_mutex_acquire(dev);794err = mt76_connac_mcu_set_rts_thresh(&dev->mt76, val, band);795mt7615_mutex_release(dev);796797return err;798}799800static int801mt7615_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,802struct ieee80211_ampdu_params *params)803{804enum ieee80211_ampdu_mlme_action action = params->action;805struct mt7615_dev *dev = mt7615_hw_dev(hw);806struct ieee80211_sta *sta = params->sta;807struct ieee80211_txq *txq = sta->txq[params->tid];808struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv;809u16 tid = params->tid;810u16 ssn = params->ssn;811struct mt76_txq *mtxq;812int ret = 0;813814if (!txq)815return -EINVAL;816817mtxq = (struct mt76_txq *)txq->drv_priv;818819mt7615_mutex_acquire(dev);820821switch (action) {822case IEEE80211_AMPDU_RX_START:823mt76_rx_aggr_start(&dev->mt76, &msta->wcid, tid, ssn,824params->buf_size);825ret = mt7615_mcu_add_rx_ba(dev, params, true);826break;827case IEEE80211_AMPDU_RX_STOP:828mt76_rx_aggr_stop(&dev->mt76, &msta->wcid, tid);829ret = mt7615_mcu_add_rx_ba(dev, params, false);830break;831case IEEE80211_AMPDU_TX_OPERATIONAL:832mtxq->aggr = true;833mtxq->send_bar = false;834ret = mt7615_mcu_add_tx_ba(dev, params, true);835ssn = mt7615_mac_get_sta_tid_sn(dev, msta->wcid.idx, tid);836ieee80211_send_bar(vif, sta->addr, tid,837IEEE80211_SN_TO_SEQ(ssn));838break;839case IEEE80211_AMPDU_TX_STOP_FLUSH:840case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:841mtxq->aggr = false;842ret = mt7615_mcu_add_tx_ba(dev, params, false);843break;844case IEEE80211_AMPDU_TX_START:845ssn = mt7615_mac_get_sta_tid_sn(dev, msta->wcid.idx, tid);846params->ssn = ssn;847ret = IEEE80211_AMPDU_TX_START_IMMEDIATE;848break;849case IEEE80211_AMPDU_TX_STOP_CONT:850mtxq->aggr = false;851ret = mt7615_mcu_add_tx_ba(dev, params, false);852ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);853break;854}855mt7615_mutex_release(dev);856857return ret;858}859860static int861mt7615_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,862struct ieee80211_sta *sta)863{864return mt76_sta_state(hw, vif, sta, IEEE80211_STA_NOTEXIST,865IEEE80211_STA_NONE);866}867868static int869mt7615_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,870struct ieee80211_sta *sta)871{872return mt76_sta_state(hw, vif, sta, IEEE80211_STA_NONE,873IEEE80211_STA_NOTEXIST);874}875876static int877mt7615_get_stats(struct ieee80211_hw *hw,878struct ieee80211_low_level_stats *stats)879{880struct mt7615_phy *phy = mt7615_hw_phy(hw);881struct mib_stats *mib = &phy->mib;882883mt7615_mutex_acquire(phy->dev);884885stats->dot11RTSSuccessCount = mib->rts_cnt;886stats->dot11RTSFailureCount = mib->rts_retries_cnt;887stats->dot11FCSErrorCount = mib->fcs_err_cnt;888stats->dot11ACKFailureCount = mib->ack_fail_cnt;889890mt7615_mutex_release(phy->dev);891892return 0;893}894895static u64896mt7615_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif)897{898struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;899struct mt7615_dev *dev = mt7615_hw_dev(hw);900union {901u64 t64;902u32 t32[2];903} tsf;904u16 idx = mvif->mt76.omac_idx;905u32 reg;906907idx = idx > HW_BSSID_MAX ? HW_BSSID_0 : idx;908reg = idx > 1 ? MT_LPON_TCR2(idx): MT_LPON_TCR0(idx);909910mt7615_mutex_acquire(dev);911912/* TSF read */913mt76_rmw(dev, reg, MT_LPON_TCR_MODE, MT_LPON_TCR_READ);914tsf.t32[0] = mt76_rr(dev, MT_LPON_UTTR0);915tsf.t32[1] = mt76_rr(dev, MT_LPON_UTTR1);916917mt7615_mutex_release(dev);918919return tsf.t64;920}921922static void923mt7615_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,924u64 timestamp)925{926struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;927struct mt7615_dev *dev = mt7615_hw_dev(hw);928union {929u64 t64;930u32 t32[2];931} tsf = { .t64 = timestamp, };932u16 idx = mvif->mt76.omac_idx;933u32 reg;934935idx = idx > HW_BSSID_MAX ? HW_BSSID_0 : idx;936reg = idx > 1 ? MT_LPON_TCR2(idx): MT_LPON_TCR0(idx);937938mt7615_mutex_acquire(dev);939940mt76_wr(dev, MT_LPON_UTTR0, tsf.t32[0]);941mt76_wr(dev, MT_LPON_UTTR1, tsf.t32[1]);942/* TSF software overwrite */943mt76_rmw(dev, reg, MT_LPON_TCR_MODE, MT_LPON_TCR_WRITE);944945mt7615_mutex_release(dev);946}947948static void949mt7615_offset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,950s64 timestamp)951{952struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;953struct mt7615_dev *dev = mt7615_hw_dev(hw);954union {955u64 t64;956u32 t32[2];957} tsf = { .t64 = timestamp, };958u16 idx = mvif->mt76.omac_idx;959u32 reg;960961idx = idx > HW_BSSID_MAX ? HW_BSSID_0 : idx;962reg = idx > 1 ? MT_LPON_TCR2(idx): MT_LPON_TCR0(idx);963964mt7615_mutex_acquire(dev);965966mt76_wr(dev, MT_LPON_UTTR0, tsf.t32[0]);967mt76_wr(dev, MT_LPON_UTTR1, tsf.t32[1]);968/* TSF software adjust*/969mt76_rmw(dev, reg, MT_LPON_TCR_MODE, MT_LPON_TCR_ADJUST);970971mt7615_mutex_release(dev);972}973974static void975mt7615_set_coverage_class(struct ieee80211_hw *hw, int radio_idx,976s16 coverage_class)977{978struct mt7615_phy *phy = mt7615_hw_phy(hw);979struct mt7615_dev *dev = phy->dev;980981mt7615_mutex_acquire(dev);982phy->coverage_class = max_t(s16, coverage_class, 0);983mt7615_mac_set_timing(phy);984mt7615_mutex_release(dev);985}986987static int988mt7615_set_antenna(struct ieee80211_hw *hw, int radio_idx,989u32 tx_ant, u32 rx_ant)990{991struct mt7615_dev *dev = mt7615_hw_dev(hw);992struct mt7615_phy *phy = mt7615_hw_phy(hw);993int max_nss = hweight8(hw->wiphy->available_antennas_tx);994bool ext_phy = phy != &dev->phy;995996if (!tx_ant || tx_ant != rx_ant || ffs(tx_ant) > max_nss)997return -EINVAL;998999if ((BIT(hweight8(tx_ant)) - 1) != tx_ant)1000tx_ant = BIT(ffs(tx_ant) - 1) - 1;10011002mt7615_mutex_acquire(dev);10031004phy->mt76->antenna_mask = tx_ant;1005if (ext_phy) {1006if (dev->chainmask == 0xf)1007tx_ant <<= 2;1008else1009tx_ant <<= 1;1010}1011phy->mt76->chainmask = tx_ant;10121013mt76_set_stream_caps(phy->mt76, true);10141015mt7615_mutex_release(dev);10161017return 0;1018}10191020static void mt7615_roc_iter(void *priv, u8 *mac,1021struct ieee80211_vif *vif)1022{1023struct mt7615_phy *phy = priv;10241025mt7615_mcu_set_roc(phy, vif, NULL, 0);1026}10271028void mt7615_roc_work(struct work_struct *work)1029{1030struct mt7615_phy *phy;10311032phy = (struct mt7615_phy *)container_of(work, struct mt7615_phy,1033roc_work);10341035if (!test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state))1036return;10371038mt7615_mutex_acquire(phy->dev);1039ieee80211_iterate_active_interfaces(phy->mt76->hw,1040IEEE80211_IFACE_ITER_RESUME_ALL,1041mt7615_roc_iter, phy);1042mt7615_mutex_release(phy->dev);1043ieee80211_remain_on_channel_expired(phy->mt76->hw);1044}10451046void mt7615_roc_timer(struct timer_list *timer)1047{1048struct mt7615_phy *phy = timer_container_of(phy, timer, roc_timer);10491050ieee80211_queue_work(phy->mt76->hw, &phy->roc_work);1051}10521053void mt7615_scan_work(struct work_struct *work)1054{1055struct mt7615_phy *phy;10561057phy = (struct mt7615_phy *)container_of(work, struct mt7615_phy,1058scan_work.work);10591060while (true) {1061struct mt7615_mcu_rxd *rxd;1062struct sk_buff *skb;10631064spin_lock_bh(&phy->dev->mt76.lock);1065skb = __skb_dequeue(&phy->scan_event_list);1066spin_unlock_bh(&phy->dev->mt76.lock);10671068if (!skb)1069break;10701071rxd = (struct mt7615_mcu_rxd *)skb->data;1072if (rxd->eid == MCU_EVENT_SCHED_SCAN_DONE) {1073ieee80211_sched_scan_results(phy->mt76->hw);1074} else if (test_and_clear_bit(MT76_HW_SCANNING,1075&phy->mt76->state)) {1076struct cfg80211_scan_info info = {1077.aborted = false,1078};10791080ieee80211_scan_completed(phy->mt76->hw, &info);1081}1082dev_kfree_skb(skb);1083}1084}10851086static int1087mt7615_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,1088struct ieee80211_scan_request *req)1089{1090struct mt7615_dev *dev = mt7615_hw_dev(hw);1091struct mt76_phy *mphy = hw->priv;1092int err;10931094/* fall-back to sw-scan */1095if (!mt7615_firmware_offload(dev))1096return 1;10971098mt7615_mutex_acquire(dev);1099err = mt76_connac_mcu_hw_scan(mphy, vif, req);1100mt7615_mutex_release(dev);11011102return err;1103}11041105static void1106mt7615_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)1107{1108struct mt7615_dev *dev = mt7615_hw_dev(hw);1109struct mt76_phy *mphy = hw->priv;11101111mt7615_mutex_acquire(dev);1112mt76_connac_mcu_cancel_hw_scan(mphy, vif);1113mt7615_mutex_release(dev);1114}11151116static int1117mt7615_start_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,1118struct cfg80211_sched_scan_request *req,1119struct ieee80211_scan_ies *ies)1120{1121struct mt7615_dev *dev = mt7615_hw_dev(hw);1122struct mt76_phy *mphy = hw->priv;1123int err;11241125if (!mt7615_firmware_offload(dev))1126return -EOPNOTSUPP;11271128mt7615_mutex_acquire(dev);11291130err = mt76_connac_mcu_sched_scan_req(mphy, vif, req);1131if (err < 0)1132goto out;11331134err = mt76_connac_mcu_sched_scan_enable(mphy, vif, true);1135out:1136mt7615_mutex_release(dev);11371138return err;1139}11401141static int1142mt7615_stop_sched_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif)1143{1144struct mt7615_dev *dev = mt7615_hw_dev(hw);1145struct mt76_phy *mphy = hw->priv;1146int err;11471148if (!mt7615_firmware_offload(dev))1149return -EOPNOTSUPP;11501151mt7615_mutex_acquire(dev);1152err = mt76_connac_mcu_sched_scan_enable(mphy, vif, false);1153mt7615_mutex_release(dev);11541155return err;1156}11571158static int mt7615_remain_on_channel(struct ieee80211_hw *hw,1159struct ieee80211_vif *vif,1160struct ieee80211_channel *chan,1161int duration,1162enum ieee80211_roc_type type)1163{1164struct mt7615_phy *phy = mt7615_hw_phy(hw);1165int err;11661167if (test_and_set_bit(MT76_STATE_ROC, &phy->mt76->state))1168return 0;11691170mt7615_mutex_acquire(phy->dev);11711172err = mt7615_mcu_set_roc(phy, vif, chan, duration);1173if (err < 0) {1174clear_bit(MT76_STATE_ROC, &phy->mt76->state);1175goto out;1176}11771178if (!wait_event_timeout(phy->roc_wait, phy->roc_grant, HZ)) {1179mt7615_mcu_set_roc(phy, vif, NULL, 0);1180clear_bit(MT76_STATE_ROC, &phy->mt76->state);1181err = -ETIMEDOUT;1182}11831184out:1185mt7615_mutex_release(phy->dev);11861187return err;1188}11891190static int mt7615_cancel_remain_on_channel(struct ieee80211_hw *hw,1191struct ieee80211_vif *vif)1192{1193struct mt7615_phy *phy = mt7615_hw_phy(hw);1194int err;11951196if (!test_and_clear_bit(MT76_STATE_ROC, &phy->mt76->state))1197return 0;11981199timer_delete_sync(&phy->roc_timer);1200cancel_work_sync(&phy->roc_work);12011202mt7615_mutex_acquire(phy->dev);1203err = mt7615_mcu_set_roc(phy, vif, NULL, 0);1204mt7615_mutex_release(phy->dev);12051206return err;1207}12081209static void mt7615_sta_set_decap_offload(struct ieee80211_hw *hw,1210struct ieee80211_vif *vif,1211struct ieee80211_sta *sta,1212bool enabled)1213{1214struct mt7615_dev *dev = mt7615_hw_dev(hw);1215struct mt7615_sta *msta = (struct mt7615_sta *)sta->drv_priv;12161217mt7615_mutex_acquire(dev);12181219if (enabled)1220set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags);1221else1222clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->wcid.flags);12231224mt7615_mcu_set_sta_decap_offload(dev, vif, sta);12251226mt7615_mutex_release(dev);1227}12281229#ifdef CONFIG_PM1230static int mt7615_suspend(struct ieee80211_hw *hw,1231struct cfg80211_wowlan *wowlan)1232{1233struct mt7615_phy *phy = mt7615_hw_phy(hw);1234struct mt7615_dev *dev = mt7615_hw_dev(hw);1235int err = 0;12361237cancel_delayed_work_sync(&dev->pm.ps_work);1238mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);12391240mt7615_mutex_acquire(dev);12411242clear_bit(MT76_STATE_RUNNING, &phy->mt76->state);1243cancel_delayed_work_sync(&phy->scan_work);1244cancel_delayed_work_sync(&phy->mt76->mac_work);12451246set_bit(MT76_STATE_SUSPEND, &phy->mt76->state);1247ieee80211_iterate_active_interfaces(hw,1248IEEE80211_IFACE_ITER_RESUME_ALL,1249mt76_connac_mcu_set_suspend_iter,1250phy->mt76);12511252if (!mt7615_dev_running(dev))1253err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, true, true);12541255mt7615_mutex_release(dev);12561257return err;1258}12591260static int mt7615_resume(struct ieee80211_hw *hw)1261{1262struct mt7615_phy *phy = mt7615_hw_phy(hw);1263struct mt7615_dev *dev = mt7615_hw_dev(hw);1264unsigned long timeout;1265bool running;12661267mt7615_mutex_acquire(dev);12681269running = mt7615_dev_running(dev);1270set_bit(MT76_STATE_RUNNING, &phy->mt76->state);12711272if (!running) {1273int err;12741275err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, false, true);1276if (err < 0) {1277mt7615_mutex_release(dev);1278return err;1279}1280}12811282clear_bit(MT76_STATE_SUSPEND, &phy->mt76->state);1283ieee80211_iterate_active_interfaces(hw,1284IEEE80211_IFACE_ITER_RESUME_ALL,1285mt76_connac_mcu_set_suspend_iter,1286phy->mt76);12871288timeout = mt7615_get_macwork_timeout(dev);1289ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work, timeout);12901291mt7615_mutex_release(dev);12921293return 0;1294}12951296static void mt7615_set_wakeup(struct ieee80211_hw *hw, bool enabled)1297{1298struct mt7615_dev *dev = mt7615_hw_dev(hw);1299struct mt76_dev *mdev = &dev->mt76;13001301device_set_wakeup_enable(mdev->dev, enabled);1302}13031304static void mt7615_set_rekey_data(struct ieee80211_hw *hw,1305struct ieee80211_vif *vif,1306struct cfg80211_gtk_rekey_data *data)1307{1308struct mt7615_dev *dev = mt7615_hw_dev(hw);13091310mt7615_mutex_acquire(dev);1311mt76_connac_mcu_update_gtk_rekey(hw, vif, data);1312mt7615_mutex_release(dev);1313}1314#endif /* CONFIG_PM */13151316const struct ieee80211_ops mt7615_ops = {1317.add_chanctx = ieee80211_emulate_add_chanctx,1318.remove_chanctx = ieee80211_emulate_remove_chanctx,1319.change_chanctx = ieee80211_emulate_change_chanctx,1320.switch_vif_chanctx = ieee80211_emulate_switch_vif_chanctx,1321.tx = mt7615_tx,1322.start = mt7615_start,1323.stop = mt7615_stop,1324.add_interface = mt7615_add_interface,1325.remove_interface = mt7615_remove_interface,1326.config = mt7615_config,1327.conf_tx = mt7615_conf_tx,1328.configure_filter = mt7615_configure_filter,1329.bss_info_changed = mt7615_bss_info_changed,1330.sta_add = mt7615_sta_add,1331.sta_remove = mt7615_sta_remove,1332.sta_pre_rcu_remove = mt76_sta_pre_rcu_remove,1333.set_key = mt7615_set_key,1334.sta_set_decap_offload = mt7615_sta_set_decap_offload,1335.ampdu_action = mt7615_ampdu_action,1336.set_rts_threshold = mt7615_set_rts_threshold,1337.wake_tx_queue = mt76_wake_tx_queue,1338.sta_rate_tbl_update = mt7615_sta_rate_tbl_update,1339.sw_scan_start = mt76_sw_scan,1340.sw_scan_complete = mt76_sw_scan_complete,1341.release_buffered_frames = mt76_release_buffered_frames,1342.get_txpower = mt76_get_txpower,1343.channel_switch_beacon = mt7615_channel_switch_beacon,1344.get_stats = mt7615_get_stats,1345.get_tsf = mt7615_get_tsf,1346.set_tsf = mt7615_set_tsf,1347.offset_tsf = mt7615_offset_tsf,1348.get_survey = mt76_get_survey,1349.get_antenna = mt76_get_antenna,1350.set_antenna = mt7615_set_antenna,1351.set_coverage_class = mt7615_set_coverage_class,1352.hw_scan = mt7615_hw_scan,1353.cancel_hw_scan = mt7615_cancel_hw_scan,1354.sched_scan_start = mt7615_start_sched_scan,1355.sched_scan_stop = mt7615_stop_sched_scan,1356.remain_on_channel = mt7615_remain_on_channel,1357.cancel_remain_on_channel = mt7615_cancel_remain_on_channel,1358CFG80211_TESTMODE_CMD(mt76_testmode_cmd)1359CFG80211_TESTMODE_DUMP(mt76_testmode_dump)1360#ifdef CONFIG_PM1361.suspend = mt7615_suspend,1362.resume = mt7615_resume,1363.set_wakeup = mt7615_set_wakeup,1364.set_rekey_data = mt7615_set_rekey_data,1365#endif /* CONFIG_PM */1366.set_sar_specs = mt7615_set_sar_specs,1367};1368EXPORT_SYMBOL_GPL(mt7615_ops);13691370MODULE_DESCRIPTION("MediaTek MT7615E and MT7663E wireless driver");1371MODULE_LICENSE("Dual BSD/GPL");137213731374