xref: /linux/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h (revision 336b78c655c84ce9ce47219185171b3912109c0a)
1 /* SPDX-License-Identifier: ISC */
2 /* Copyright (C) 2020 MediaTek Inc. */
3 
4 #ifndef __MT7921_H
5 #define __MT7921_H
6 
7 #include <linux/interrupt.h>
8 #include <linux/ktime.h>
9 #include "../mt76_connac_mcu.h"
10 #include "regs.h"
11 #include "acpi_sar.h"
12 
13 #define MT7921_MAX_INTERFACES		4
14 #define MT7921_WTBL_SIZE		20
15 #define MT7921_WTBL_RESERVED		(MT7921_WTBL_SIZE - 1)
16 #define MT7921_WTBL_STA			(MT7921_WTBL_RESERVED - \
17 					 MT7921_MAX_INTERFACES)
18 
19 #define MT7921_PM_TIMEOUT		(HZ / 12)
20 #define MT7921_HW_SCAN_TIMEOUT		(HZ / 10)
21 #define MT7921_WATCHDOG_TIME		(HZ / 4)
22 #define MT7921_RESET_TIMEOUT		(30 * HZ)
23 
24 #define MT7921_TX_RING_SIZE		2048
25 #define MT7921_TX_MCU_RING_SIZE		256
26 #define MT7921_TX_FWDL_RING_SIZE	128
27 
28 #define MT7921_RX_RING_SIZE		1536
29 #define MT7921_RX_MCU_RING_SIZE		512
30 
31 #define MT7921_DRV_OWN_RETRY_COUNT	10
32 #define MT7921_MCU_INIT_RETRY_COUNT	10
33 #define MT7921_WFSYS_INIT_RETRY_COUNT	2
34 
35 #define MT7921_FW_TAG_FEATURE		4
36 #define MT7921_FW_CAP_CNM		BIT(7)
37 
38 #define MT7921_FIRMWARE_WM		"mediatek/WIFI_RAM_CODE_MT7961_1.bin"
39 #define MT7921_ROM_PATCH		"mediatek/WIFI_MT7961_patch_mcu_1_2_hdr.bin"
40 
41 #define MT7922_FIRMWARE_WM		"mediatek/WIFI_RAM_CODE_MT7922_1.bin"
42 #define MT7922_ROM_PATCH		"mediatek/WIFI_MT7922_patch_mcu_1_1_hdr.bin"
43 
44 #define MT7921_EEPROM_SIZE		3584
45 #define MT7921_TOKEN_SIZE		8192
46 
47 #define MT7921_EEPROM_BLOCK_SIZE	16
48 
49 #define MT7921_CFEND_RATE_DEFAULT	0x49	/* OFDM 24M */
50 #define MT7921_CFEND_RATE_11B		0x03	/* 11B LP, 11M */
51 
52 #define MT7921_SKU_RATE_NUM		161
53 #define MT7921_SKU_MAX_DELTA_IDX	MT7921_SKU_RATE_NUM
54 #define MT7921_SKU_TABLE_SIZE		(MT7921_SKU_RATE_NUM + 1)
55 
56 #define MT7921_SDIO_HDR_TX_BYTES	GENMASK(15, 0)
57 #define MT7921_SDIO_HDR_PKT_TYPE	GENMASK(17, 16)
58 
59 #define MCU_UNI_EVENT_ROC  0x27
60 
61 enum {
62 	UNI_ROC_ACQUIRE,
63 	UNI_ROC_ABORT,
64 	UNI_ROC_NUM
65 };
66 
67 enum mt7921_roc_req {
68 	MT7921_ROC_REQ_JOIN,
69 	MT7921_ROC_REQ_ROC,
70 	MT7921_ROC_REQ_NUM
71 };
72 
73 enum {
74 	UNI_EVENT_ROC_GRANT = 0,
75 	UNI_EVENT_ROC_TAG_NUM
76 };
77 
78 struct mt7921_realease_info {
79 	__le16 len;
80 	u8 pad_len;
81 	u8 tag;
82 } __packed;
83 
84 struct mt7921_fw_features {
85 	u8 segment;
86 	u8 data;
87 	u8 rsv[14];
88 } __packed;
89 
90 struct mt7921_roc_grant_tlv {
91 	__le16 tag;
92 	__le16 len;
93 	u8 bss_idx;
94 	u8 tokenid;
95 	u8 status;
96 	u8 primarychannel;
97 	u8 rfsco;
98 	u8 rfband;
99 	u8 channelwidth;
100 	u8 centerfreqseg1;
101 	u8 centerfreqseg2;
102 	u8 reqtype;
103 	u8 dbdcband;
104 	u8 rsv[1];
105 	__le32 max_interval;
106 } __packed;
107 
108 enum mt7921_sdio_pkt_type {
109 	MT7921_SDIO_TXD,
110 	MT7921_SDIO_DATA,
111 	MT7921_SDIO_CMD,
112 	MT7921_SDIO_FWDL,
113 };
114 
115 struct mt7921_sdio_intr {
116 	u32 isr;
117 	struct {
118 		u32 wtqcr[16];
119 	} tx;
120 	struct {
121 		u16 num[2];
122 		u16 len0[16];
123 		u16 len1[128];
124 	} rx;
125 	u32 rec_mb[2];
126 } __packed;
127 
128 #define to_rssi(field, rxv)		((FIELD_GET(field, rxv) - 220) / 2)
129 #define to_rcpi(rssi)			(2 * (rssi) + 220)
130 
131 struct mt7921_vif;
132 struct mt7921_sta;
133 
134 enum mt7921_txq_id {
135 	MT7921_TXQ_BAND0,
136 	MT7921_TXQ_BAND1,
137 	MT7921_TXQ_FWDL = 16,
138 	MT7921_TXQ_MCU_WM,
139 };
140 
141 enum mt7921_rxq_id {
142 	MT7921_RXQ_BAND0 = 0,
143 	MT7921_RXQ_BAND1,
144 	MT7921_RXQ_MCU_WM = 0,
145 };
146 
147 DECLARE_EWMA(avg_signal, 10, 8)
148 
149 struct mt7921_sta {
150 	struct mt76_wcid wcid; /* must be first */
151 
152 	struct mt7921_vif *vif;
153 
154 	struct list_head poll_list;
155 	u32 airtime_ac[8];
156 
157 	int ack_signal;
158 	struct ewma_avg_signal avg_ack_signal;
159 
160 	unsigned long last_txs;
161 	unsigned long ampdu_state;
162 
163 	struct mt76_connac_sta_key_conf bip;
164 };
165 
166 DECLARE_EWMA(rssi, 10, 8);
167 
168 struct mt7921_vif {
169 	struct mt76_vif mt76; /* must be first */
170 
171 	struct mt7921_sta sta;
172 	struct mt7921_sta *wep_sta;
173 
174 	struct mt7921_phy *phy;
175 
176 	struct ewma_rssi rssi;
177 
178 	struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
179 	struct ieee80211_chanctx_conf *ctx;
180 };
181 
182 struct mib_stats {
183 	u32 ack_fail_cnt;
184 	u32 fcs_err_cnt;
185 	u32 rts_cnt;
186 	u32 rts_retries_cnt;
187 	u32 ba_miss_cnt;
188 
189 	u32 tx_bf_ibf_ppdu_cnt;
190 	u32 tx_bf_ebf_ppdu_cnt;
191 	u32 tx_bf_rx_fb_all_cnt;
192 	u32 tx_bf_rx_fb_he_cnt;
193 	u32 tx_bf_rx_fb_vht_cnt;
194 	u32 tx_bf_rx_fb_ht_cnt;
195 
196 	u32 tx_ampdu_cnt;
197 	u32 tx_mpdu_attempts_cnt;
198 	u32 tx_mpdu_success_cnt;
199 	u32 tx_pkt_ebf_cnt;
200 	u32 tx_pkt_ibf_cnt;
201 
202 	u32 rx_mpdu_cnt;
203 	u32 rx_ampdu_cnt;
204 	u32 rx_ampdu_bytes_cnt;
205 	u32 rx_ba_cnt;
206 
207 	u32 tx_amsdu[8];
208 	u32 tx_amsdu_cnt;
209 };
210 
211 enum {
212 	MT7921_CLC_POWER,
213 	MT7921_CLC_CHAN,
214 	MT7921_CLC_MAX_NUM,
215 };
216 
217 struct mt7921_clc_rule {
218 	u8 alpha2[2];
219 	u8 type[2];
220 	__le16 len;
221 	u8 data[];
222 } __packed;
223 
224 struct mt7921_clc {
225 	__le32 len;
226 	u8 idx;
227 	u8 ver;
228 	u8 nr_country;
229 	u8 type;
230 	u8 rsv[8];
231 	u8 data[];
232 } __packed;
233 
234 struct mt7921_phy {
235 	struct mt76_phy *mt76;
236 	struct mt7921_dev *dev;
237 
238 	struct ieee80211_sband_iftype_data iftype[NUM_NL80211_BANDS][NUM_NL80211_IFTYPES];
239 
240 	u64 omac_mask;
241 
242 	u16 noise;
243 
244 	s16 coverage_class;
245 	u8 slottime;
246 
247 	u32 rx_ampdu_ts;
248 	u32 ampdu_ref;
249 
250 	struct mib_stats mib;
251 
252 	u8 sta_work_count;
253 
254 	struct sk_buff_head scan_event_list;
255 	struct delayed_work scan_work;
256 #ifdef CONFIG_ACPI
257 	struct mt7921_acpi_sar *acpisar;
258 #endif
259 
260 	struct mt7921_clc *clc[MT7921_CLC_MAX_NUM];
261 
262 	struct work_struct roc_work;
263 	struct timer_list roc_timer;
264 	wait_queue_head_t roc_wait;
265 	u8 roc_token_id;
266 	bool roc_grant;
267 };
268 
269 #define mt7921_init_reset(dev)		((dev)->hif_ops->init_reset(dev))
270 #define mt7921_dev_reset(dev)		((dev)->hif_ops->reset(dev))
271 #define mt7921_mcu_init(dev)		((dev)->hif_ops->mcu_init(dev))
272 #define __mt7921_mcu_drv_pmctrl(dev)	((dev)->hif_ops->drv_own(dev))
273 #define	__mt7921_mcu_fw_pmctrl(dev)	((dev)->hif_ops->fw_own(dev))
274 struct mt7921_hif_ops {
275 	int (*init_reset)(struct mt7921_dev *dev);
276 	int (*reset)(struct mt7921_dev *dev);
277 	int (*mcu_init)(struct mt7921_dev *dev);
278 	int (*drv_own)(struct mt7921_dev *dev);
279 	int (*fw_own)(struct mt7921_dev *dev);
280 };
281 
282 struct mt7921_dev {
283 	union { /* must be first */
284 		struct mt76_dev mt76;
285 		struct mt76_phy mphy;
286 	};
287 
288 	const struct mt76_bus_ops *bus_ops;
289 	struct mt7921_phy phy;
290 	struct tasklet_struct irq_tasklet;
291 
292 	struct work_struct reset_work;
293 	bool hw_full_reset:1;
294 	bool hw_init_done:1;
295 	bool fw_assert:1;
296 
297 	struct list_head sta_poll_list;
298 	spinlock_t sta_poll_lock;
299 
300 	struct work_struct init_work;
301 
302 	u8 fw_debug;
303 	u8 fw_features;
304 
305 	struct mt76_connac_pm pm;
306 	struct mt76_connac_coredump coredump;
307 	const struct mt7921_hif_ops *hif_ops;
308 
309 	struct work_struct ipv6_ns_work;
310 	/* IPv6 addresses for WoWLAN */
311 	struct sk_buff_head ipv6_ns_list;
312 
313 	enum environment_cap country_ie_env;
314 };
315 
316 enum {
317 	TXPWR_USER,
318 	TXPWR_EEPROM,
319 	TXPWR_MAC,
320 	TXPWR_MAX_NUM,
321 };
322 
323 struct mt7921_txpwr {
324 	u8 ch;
325 	u8 rsv[3];
326 	struct {
327 		u8 ch;
328 		u8 cck[4];
329 		u8 ofdm[8];
330 		u8 ht20[8];
331 		u8 ht40[9];
332 		u8 vht20[12];
333 		u8 vht40[12];
334 		u8 vht80[12];
335 		u8 vht160[12];
336 		u8 he26[12];
337 		u8 he52[12];
338 		u8 he106[12];
339 		u8 he242[12];
340 		u8 he484[12];
341 		u8 he996[12];
342 		u8 he996x2[12];
343 	} data[TXPWR_MAX_NUM];
344 };
345 
346 static inline struct mt7921_phy *
347 mt7921_hw_phy(struct ieee80211_hw *hw)
348 {
349 	struct mt76_phy *phy = hw->priv;
350 
351 	return phy->priv;
352 }
353 
354 static inline struct mt7921_dev *
355 mt7921_hw_dev(struct ieee80211_hw *hw)
356 {
357 	struct mt76_phy *phy = hw->priv;
358 
359 	return container_of(phy->dev, struct mt7921_dev, mt76);
360 }
361 
362 #define mt7921_mutex_acquire(dev)	\
363 	mt76_connac_mutex_acquire(&(dev)->mt76, &(dev)->pm)
364 #define mt7921_mutex_release(dev)	\
365 	mt76_connac_mutex_release(&(dev)->mt76, &(dev)->pm)
366 
367 extern const struct ieee80211_ops mt7921_ops;
368 
369 u32 mt7921_reg_map(struct mt7921_dev *dev, u32 addr);
370 
371 int __mt7921_start(struct mt7921_phy *phy);
372 int mt7921_register_device(struct mt7921_dev *dev);
373 void mt7921_unregister_device(struct mt7921_dev *dev);
374 int mt7921_dma_init(struct mt7921_dev *dev);
375 int mt7921_wpdma_reset(struct mt7921_dev *dev, bool force);
376 int mt7921_wpdma_reinit_cond(struct mt7921_dev *dev);
377 void mt7921_dma_cleanup(struct mt7921_dev *dev);
378 int mt7921_run_firmware(struct mt7921_dev *dev);
379 int mt7921_mcu_set_bss_pm(struct mt7921_dev *dev, struct ieee80211_vif *vif,
380 			  bool enable);
381 int mt7921_mcu_sta_update(struct mt7921_dev *dev, struct ieee80211_sta *sta,
382 			  struct ieee80211_vif *vif, bool enable,
383 			  enum mt76_sta_info_state state);
384 int mt7921_mcu_set_chan_info(struct mt7921_phy *phy, int cmd);
385 int mt7921_mcu_set_tx(struct mt7921_dev *dev, struct ieee80211_vif *vif);
386 int mt7921_mcu_set_eeprom(struct mt7921_dev *dev);
387 int mt7921_mcu_get_rx_rate(struct mt7921_phy *phy, struct ieee80211_vif *vif,
388 			   struct ieee80211_sta *sta, struct rate_info *rate);
389 int mt7921_mcu_fw_log_2_host(struct mt7921_dev *dev, u8 ctrl);
390 void mt7921_mcu_rx_event(struct mt7921_dev *dev, struct sk_buff *skb);
391 int mt7921_mcu_set_rxfilter(struct mt7921_dev *dev, u32 fif,
392 			    u8 bit_op, u32 bit_map);
393 
394 static inline void mt7921_irq_enable(struct mt7921_dev *dev, u32 mask)
395 {
396 	mt76_set_irq_mask(&dev->mt76, 0, 0, mask);
397 
398 	tasklet_schedule(&dev->irq_tasklet);
399 }
400 
401 static inline u32
402 mt7921_reg_map_l1(struct mt7921_dev *dev, u32 addr)
403 {
404 	u32 offset = FIELD_GET(MT_HIF_REMAP_L1_OFFSET, addr);
405 	u32 base = FIELD_GET(MT_HIF_REMAP_L1_BASE, addr);
406 
407 	mt76_rmw_field(dev, MT_HIF_REMAP_L1, MT_HIF_REMAP_L1_MASK, base);
408 	/* use read to push write */
409 	mt76_rr(dev, MT_HIF_REMAP_L1);
410 
411 	return MT_HIF_REMAP_BASE_L1 + offset;
412 }
413 
414 static inline u32
415 mt7921_l1_rr(struct mt7921_dev *dev, u32 addr)
416 {
417 	return mt76_rr(dev, mt7921_reg_map_l1(dev, addr));
418 }
419 
420 static inline void
421 mt7921_l1_wr(struct mt7921_dev *dev, u32 addr, u32 val)
422 {
423 	mt76_wr(dev, mt7921_reg_map_l1(dev, addr), val);
424 }
425 
426 static inline u32
427 mt7921_l1_rmw(struct mt7921_dev *dev, u32 addr, u32 mask, u32 val)
428 {
429 	val |= mt7921_l1_rr(dev, addr) & ~mask;
430 	mt7921_l1_wr(dev, addr, val);
431 
432 	return val;
433 }
434 
435 #define mt7921_l1_set(dev, addr, val)	mt7921_l1_rmw(dev, addr, 0, val)
436 #define mt7921_l1_clear(dev, addr, val)	mt7921_l1_rmw(dev, addr, val, 0)
437 
438 static inline bool mt7921_dma_need_reinit(struct mt7921_dev *dev)
439 {
440 	return !mt76_get_field(dev, MT_WFDMA_DUMMY_CR, MT_WFDMA_NEED_REINIT);
441 }
442 
443 static inline void
444 mt7921_skb_add_usb_sdio_hdr(struct mt7921_dev *dev, struct sk_buff *skb,
445 			    int type)
446 {
447 	u32 hdr, len;
448 
449 	len = mt76_is_usb(&dev->mt76) ? skb->len : skb->len + sizeof(hdr);
450 	hdr = FIELD_PREP(MT7921_SDIO_HDR_TX_BYTES, len) |
451 	      FIELD_PREP(MT7921_SDIO_HDR_PKT_TYPE, type);
452 
453 	put_unaligned_le32(hdr, skb_push(skb, sizeof(hdr)));
454 }
455 
456 void mt7921_stop(struct ieee80211_hw *hw);
457 int mt7921_mac_init(struct mt7921_dev *dev);
458 bool mt7921_mac_wtbl_update(struct mt7921_dev *dev, int idx, u32 mask);
459 void mt7921_mac_reset_counters(struct mt7921_phy *phy);
460 void mt7921_mac_set_timing(struct mt7921_phy *phy);
461 int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
462 		       struct ieee80211_sta *sta);
463 void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
464 			  struct ieee80211_sta *sta);
465 void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
466 			   struct ieee80211_sta *sta);
467 void mt7921_mac_work(struct work_struct *work);
468 void mt7921_mac_reset_work(struct work_struct *work);
469 void mt7921_mac_update_mib_stats(struct mt7921_phy *phy);
470 void mt7921_reset(struct mt76_dev *mdev);
471 int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
472 			   enum mt76_txq_id qid, struct mt76_wcid *wcid,
473 			   struct ieee80211_sta *sta,
474 			   struct mt76_tx_info *tx_info);
475 
476 void mt7921_tx_worker(struct mt76_worker *w);
477 void mt7921_tx_token_put(struct mt7921_dev *dev);
478 bool mt7921_rx_check(struct mt76_dev *mdev, void *data, int len);
479 void mt7921_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
480 			 struct sk_buff *skb, u32 *info);
481 void mt7921_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps);
482 void mt7921_stats_work(struct work_struct *work);
483 void mt7921_set_stream_he_caps(struct mt7921_phy *phy);
484 void mt7921_update_channel(struct mt76_phy *mphy);
485 int mt7921_init_debugfs(struct mt7921_dev *dev);
486 
487 int mt7921_mcu_set_beacon_filter(struct mt7921_dev *dev,
488 				 struct ieee80211_vif *vif,
489 				 bool enable);
490 int mt7921_mcu_uni_tx_ba(struct mt7921_dev *dev,
491 			 struct ieee80211_ampdu_params *params,
492 			 bool enable);
493 int mt7921_mcu_uni_rx_ba(struct mt7921_dev *dev,
494 			 struct ieee80211_ampdu_params *params,
495 			 bool enable);
496 void mt7921_scan_work(struct work_struct *work);
497 void mt7921_roc_work(struct work_struct *work);
498 void mt7921_roc_timer(struct timer_list *timer);
499 int mt7921_mcu_uni_bss_ps(struct mt7921_dev *dev, struct ieee80211_vif *vif);
500 int mt7921_mcu_drv_pmctrl(struct mt7921_dev *dev);
501 int mt7921_mcu_fw_pmctrl(struct mt7921_dev *dev);
502 void mt7921_pm_wake_work(struct work_struct *work);
503 void mt7921_pm_power_save_work(struct work_struct *work);
504 void mt7921_coredump_work(struct work_struct *work);
505 int mt7921_wfsys_reset(struct mt7921_dev *dev);
506 int mt7921_get_txpwr_info(struct mt7921_dev *dev, struct mt7921_txpwr *txpwr);
507 int mt7921_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
508 			void *data, int len);
509 int mt7921_testmode_dump(struct ieee80211_hw *hw, struct sk_buff *msg,
510 			 struct netlink_callback *cb, void *data, int len);
511 void mt7921_txwi_free(struct mt7921_dev *dev, struct mt76_txwi_cache *t,
512 		      struct ieee80211_sta *sta, bool clear_status,
513 		      struct list_head *free_list);
514 void mt7921_mac_sta_poll(struct mt7921_dev *dev);
515 int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd,
516 			      struct sk_buff *skb, int seq);
517 
518 int mt7921e_driver_own(struct mt7921_dev *dev);
519 int mt7921e_mac_reset(struct mt7921_dev *dev);
520 int mt7921e_mcu_init(struct mt7921_dev *dev);
521 int mt7921s_wfsys_reset(struct mt7921_dev *dev);
522 int mt7921s_mac_reset(struct mt7921_dev *dev);
523 int mt7921s_init_reset(struct mt7921_dev *dev);
524 int __mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev);
525 int mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev);
526 int mt7921e_mcu_fw_pmctrl(struct mt7921_dev *dev);
527 
528 int mt7921s_mcu_init(struct mt7921_dev *dev);
529 int mt7921s_mcu_drv_pmctrl(struct mt7921_dev *dev);
530 int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev);
531 void mt7921_mac_add_txs(struct mt7921_dev *dev, void *data);
532 void mt7921_set_runtime_pm(struct mt7921_dev *dev);
533 void mt7921_mcu_set_suspend_iter(void *priv, u8 *mac,
534 				 struct ieee80211_vif *vif);
535 void mt7921_set_ipv6_ns_work(struct work_struct *work);
536 
537 int mt7921_mcu_set_sniffer(struct mt7921_dev *dev, struct ieee80211_vif *vif,
538 			   bool enable);
539 int mt7921_mcu_config_sniffer(struct mt7921_vif *vif,
540 			      struct ieee80211_chanctx_conf *ctx);
541 
542 int mt7921_usb_sdio_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
543 				   enum mt76_txq_id qid, struct mt76_wcid *wcid,
544 				   struct ieee80211_sta *sta,
545 				   struct mt76_tx_info *tx_info);
546 void mt7921_usb_sdio_tx_complete_skb(struct mt76_dev *mdev,
547 				     struct mt76_queue_entry *e);
548 bool mt7921_usb_sdio_tx_status_data(struct mt76_dev *mdev, u8 *update);
549 
550 /* usb */
551 #define MT_USB_TYPE_VENDOR	(USB_TYPE_VENDOR | 0x1f)
552 #define MT_USB_TYPE_UHW_VENDOR	(USB_TYPE_VENDOR | 0x1e)
553 
554 int mt7921u_mcu_power_on(struct mt7921_dev *dev);
555 int mt7921u_wfsys_reset(struct mt7921_dev *dev);
556 int mt7921u_dma_init(struct mt7921_dev *dev, bool resume);
557 int mt7921u_init_reset(struct mt7921_dev *dev);
558 int mt7921u_mac_reset(struct mt7921_dev *dev);
559 int mt7921_mcu_uni_add_beacon_offload(struct mt7921_dev *dev,
560 				      struct ieee80211_hw *hw,
561 				      struct ieee80211_vif *vif,
562 				      bool enable);
563 #ifdef CONFIG_ACPI
564 int mt7921_init_acpi_sar(struct mt7921_dev *dev);
565 int mt7921_init_acpi_sar_power(struct mt7921_phy *phy, bool set_default);
566 u8 mt7921_acpi_get_flags(struct mt7921_phy *phy);
567 #else
568 static inline int
569 mt7921_init_acpi_sar(struct mt7921_dev *dev)
570 {
571 	return 0;
572 }
573 
574 static inline int
575 mt7921_init_acpi_sar_power(struct mt7921_phy *phy, bool set_default)
576 {
577 	return 0;
578 }
579 
580 static inline u8
581 mt7921_acpi_get_flags(struct mt7921_phy *phy)
582 {
583 	return 0;
584 }
585 #endif
586 int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw,
587 			  const struct cfg80211_sar_specs *sar);
588 
589 int mt7921_mcu_set_clc(struct mt7921_dev *dev, u8 *alpha2,
590 		       enum environment_cap env_cap);
591 int mt7921_mcu_set_roc(struct mt7921_phy *phy, struct mt7921_vif *vif,
592 		       struct ieee80211_channel *chan, int duration,
593 		       enum mt7921_roc_req type, u8 token_id);
594 int mt7921_mcu_abort_roc(struct mt7921_phy *phy, struct mt7921_vif *vif,
595 			 u8 token_id);
596 u8 mt7921_check_offload_capability(struct device *dev, const char *fw_wm);
597 #endif
598