Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: ISC */
0002 /*
0003  * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
0004  */
0005 
0006 #ifndef __MT76x2_H
0007 #define __MT76x2_H
0008 
0009 #include <linux/device.h>
0010 #include <linux/dma-mapping.h>
0011 #include <linux/spinlock.h>
0012 #include <linux/skbuff.h>
0013 #include <linux/netdevice.h>
0014 #include <linux/irq.h>
0015 #include <linux/interrupt.h>
0016 #include <linux/mutex.h>
0017 #include <linux/bitops.h>
0018 
0019 #define MT7662_FIRMWARE     "mt7662.bin"
0020 #define MT7662_ROM_PATCH    "mt7662_rom_patch.bin"
0021 #define MT7662_EEPROM_SIZE  512
0022 
0023 #include "../mt76x02.h"
0024 #include "mac.h"
0025 
0026 static inline bool is_mt7612(struct mt76x02_dev *dev)
0027 {
0028     return mt76_chip(&dev->mt76) == 0x7612;
0029 }
0030 
0031 static inline bool mt76x2_channel_silent(struct mt76x02_dev *dev)
0032 {
0033     struct ieee80211_channel *chan = dev->mphy.chandef.chan;
0034 
0035     return ((chan->flags & IEEE80211_CHAN_RADAR) &&
0036         chan->dfs_state != NL80211_DFS_AVAILABLE);
0037 }
0038 
0039 extern const struct ieee80211_ops mt76x2_ops;
0040 
0041 int mt76x2_register_device(struct mt76x02_dev *dev);
0042 int mt76x2_resume_device(struct mt76x02_dev *dev);
0043 
0044 int mt76x2_set_sar_specs(struct ieee80211_hw *hw,
0045              const struct cfg80211_sar_specs *sar);
0046 void mt76x2_phy_power_on(struct mt76x02_dev *dev);
0047 void mt76x2_stop_hardware(struct mt76x02_dev *dev);
0048 int mt76x2_eeprom_init(struct mt76x02_dev *dev);
0049 int mt76x2_apply_calibration_data(struct mt76x02_dev *dev, int channel);
0050 
0051 void mt76x2_phy_set_antenna(struct mt76x02_dev *dev);
0052 int mt76x2_phy_start(struct mt76x02_dev *dev);
0053 int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
0054                struct cfg80211_chan_def *chandef);
0055 void mt76x2_phy_calibrate(struct work_struct *work);
0056 void mt76x2_phy_set_txpower(struct mt76x02_dev *dev);
0057 
0058 int mt76x2_mcu_init(struct mt76x02_dev *dev);
0059 int mt76x2_mcu_set_channel(struct mt76x02_dev *dev, u8 channel, u8 bw,
0060                u8 bw_index, bool scan);
0061 int mt76x2_mcu_load_cr(struct mt76x02_dev *dev, u8 type, u8 temp_level,
0062                u8 channel);
0063 
0064 void mt76x2_cleanup(struct mt76x02_dev *dev);
0065 
0066 int mt76x2_mac_reset(struct mt76x02_dev *dev, bool hard);
0067 void mt76x2_reset_wlan(struct mt76x02_dev *dev, bool enable);
0068 void mt76x2_init_txpower(struct mt76x02_dev *dev,
0069              struct ieee80211_supported_band *sband);
0070 void mt76_write_mac_initvals(struct mt76x02_dev *dev);
0071 
0072 void mt76x2_phy_tssi_compensate(struct mt76x02_dev *dev);
0073 void mt76x2_phy_set_txpower_regs(struct mt76x02_dev *dev,
0074                  enum nl80211_band band);
0075 void mt76x2_configure_tx_delay(struct mt76x02_dev *dev,
0076                    enum nl80211_band band, u8 bw);
0077 void mt76x2_apply_gain_adj(struct mt76x02_dev *dev);
0078 void mt76x2_phy_update_channel_gain(struct mt76x02_dev *dev);
0079 
0080 #endif