linux/drivers/net/wireless/mediatek/mt76/mt792x.h

/* SPDX-License-Identifier: ISC */
/* Copyright (C) 2023 MediaTek Inc. */

#ifndef __MT792X_H
#define __MT792X_H

#include <linux/interrupt.h>
#include <linux/ktime.h>

#include "mt76_connac_mcu.h"
#include "mt792x_regs.h"
#include "mt792x_acpi_sar.h"

#define MT792x_PM_TIMEOUT
#define MT792x_HW_SCAN_TIMEOUT

#define MT792x_MAX_INTERFACES
#define MT792x_WTBL_SIZE
#define MT792x_WTBL_RESERVED
#define MT792x_WTBL_STA

#define MT792x_CFEND_RATE_DEFAULT
#define MT792x_CFEND_RATE_11B

#define MT792x_FW_TAG_FEATURE
#define MT792x_FW_CAP_CNM

#define MT792x_CHIP_CAP_CLC_EVT_EN
#define MT792x_CHIP_CAP_RSSI_NOTIFY_EVT_EN
#define MT792x_CHIP_CAP_MLO_EVT_EN

/* NOTE: used to map mt76_rates. idx may change if firmware expands table */
#define MT792x_BASIC_RATES_TBL

#define MT792x_WATCHDOG_TIME

#define MT792x_DRV_OWN_RETRY_COUNT
#define MT792x_MCU_INIT_RETRY_COUNT
#define MT792x_WFSYS_INIT_RETRY_COUNT

#define MT7920_FIRMWARE_WM
#define MT7921_FIRMWARE_WM
#define MT7922_FIRMWARE_WM
#define MT7925_FIRMWARE_WM

#define MT7920_ROM_PATCH
#define MT7921_ROM_PATCH
#define MT7922_ROM_PATCH
#define MT7925_ROM_PATCH

#define MT792x_SDIO_HDR_TX_BYTES
#define MT792x_SDIO_HDR_PKT_TYPE

struct mt792x_vif;
struct mt792x_sta;

struct mt792x_realease_info {} __packed;

struct mt792x_fw_features {} __packed;

enum {};

enum mt792x_reg_power_type {};

DECLARE_EWMA(avg_signal, 10, 8)

struct mt792x_link_sta {};

struct mt792x_sta {};

DECLARE_EWMA(rssi, 10, 8);

struct mt792x_chanctx {};

struct mt792x_bss_conf {};

struct mt792x_vif {};

struct mt792x_phy {};

struct mt792x_irq_map {};

#define mt792x_init_reset(dev)
#define mt792x_dev_reset(dev)
#define mt792x_mcu_init(dev)
#define __mt792x_mcu_drv_pmctrl(dev)
#define __mt792x_mcu_fw_pmctrl(dev)

struct mt792x_hif_ops {};

struct mt792x_dev {};

static inline struct mt792x_bss_conf *
mt792x_vif_to_link(struct mt792x_vif *mvif, u8 link_id)
{}

static inline struct mt792x_link_sta *
mt792x_sta_to_link(struct mt792x_sta *msta, u8 link_id)
{}

static inline struct mt792x_bss_conf *
mt792x_link_conf_to_mconf(struct ieee80211_bss_conf *link_conf)
{}

static inline struct ieee80211_bss_conf *
mt792x_vif_to_bss_conf(struct ieee80211_vif *vif, unsigned int link_id)
{}

static inline struct ieee80211_link_sta *
mt792x_sta_to_link_sta(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
		       unsigned int link_id)
{}

static inline struct mt792x_dev *
mt792x_hw_dev(struct ieee80211_hw *hw)
{}

static inline struct mt792x_phy *
mt792x_hw_phy(struct ieee80211_hw *hw)
{}

static inline void
mt792x_get_status_freq_info(struct mt76_rx_status *status, u8 chfreq)
{}

static inline bool mt792x_dma_need_reinit(struct mt792x_dev *dev)
{}

#define mt792x_mutex_acquire(dev)
#define mt792x_mutex_release(dev)

void mt792x_stop(struct ieee80211_hw *hw, bool suspend);
void mt792x_pm_wake_work(struct work_struct *work);
void mt792x_pm_power_save_work(struct work_struct *work);
void mt792x_reset(struct mt76_dev *mdev);
void mt792x_update_channel(struct mt76_phy *mphy);
void mt792x_mac_reset_counters(struct mt792x_phy *phy);
void mt792x_mac_init_band(struct mt792x_dev *dev, u8 band);
void mt792x_mac_assoc_rssi(struct mt792x_dev *dev, struct sk_buff *skb);
struct mt76_wcid *mt792x_rx_get_wcid(struct mt792x_dev *dev, u16 idx,
				     bool unicast);
void mt792x_mac_update_mib_stats(struct mt792x_phy *phy);
void mt792x_mac_set_timeing(struct mt792x_phy *phy);
void mt792x_mac_work(struct work_struct *work);
void mt792x_remove_interface(struct ieee80211_hw *hw,
			     struct ieee80211_vif *vif);
void mt792x_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
	       struct sk_buff *skb);
int mt792x_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
		   unsigned int link_id, u16 queue,
		   const struct ieee80211_tx_queue_params *params);
int mt792x_get_stats(struct ieee80211_hw *hw,
		     struct ieee80211_low_level_stats *stats);
u64 mt792x_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
void mt792x_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
		    u64 timestamp);
void mt792x_tx_worker(struct mt76_worker *w);
void mt792x_roc_timer(struct timer_list *timer);
void mt792x_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
		  u32 queues, bool drop);
int mt792x_assign_vif_chanctx(struct ieee80211_hw *hw,
			      struct ieee80211_vif *vif,
			      struct ieee80211_bss_conf *link_conf,
			      struct ieee80211_chanctx_conf *ctx);
void mt792x_unassign_vif_chanctx(struct ieee80211_hw *hw,
				 struct ieee80211_vif *vif,
				 struct ieee80211_bss_conf *link_conf,
				 struct ieee80211_chanctx_conf *ctx);
void mt792x_set_wakeup(struct ieee80211_hw *hw, bool enabled);
void mt792x_get_et_strings(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
			   u32 sset, u8 *data);
int mt792x_get_et_sset_count(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
			     int sset);
void mt792x_get_et_stats(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
			 struct ethtool_stats *stats, u64 *data);
void mt792x_sta_statistics(struct ieee80211_hw *hw,
			   struct ieee80211_vif *vif,
			   struct ieee80211_sta *sta,
			   struct station_info *sinfo);
void mt792x_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class);
void mt792x_dma_cleanup(struct mt792x_dev *dev);
int mt792x_dma_enable(struct mt792x_dev *dev);
int mt792x_wpdma_reset(struct mt792x_dev *dev, bool force);
int mt792x_wpdma_reinit_cond(struct mt792x_dev *dev);
int mt792x_dma_disable(struct mt792x_dev *dev, bool force);
irqreturn_t mt792x_irq_handler(int irq, void *dev_instance);
void mt792x_rx_poll_complete(struct mt76_dev *mdev, enum mt76_rxq_id q);
int mt792x_poll_tx(struct napi_struct *napi, int budget);
int mt792x_poll_rx(struct napi_struct *napi, int budget);
void mt792x_irq_tasklet(unsigned long data);
int mt792x_wfsys_reset(struct mt792x_dev *dev);
int mt792x_tx_stats_show(struct seq_file *file, void *data);
int mt792x_queues_acq(struct seq_file *s, void *data);
int mt792x_queues_read(struct seq_file *s, void *data);
int mt792x_pm_stats(struct seq_file *s, void *data);
int mt792x_pm_idle_timeout_set(void *data, u64 val);
int mt792x_pm_idle_timeout_get(void *data, u64 *val);
int mt792x_init_wiphy(struct ieee80211_hw *hw);
struct ieee80211_ops *
mt792x_get_mac80211_ops(struct device *dev,
			const struct ieee80211_ops *mac80211_ops,
			void *drv_data, u8 *fw_features);
int mt792x_init_wcid(struct mt792x_dev *dev);
int mt792x_mcu_drv_pmctrl(struct mt792x_dev *dev);
int mt792x_mcu_fw_pmctrl(struct mt792x_dev *dev);
void mt792x_mac_link_bss_remove(struct mt792x_dev *dev,
				struct mt792x_bss_conf *mconf,
				struct mt792x_link_sta *mlink);

static inline char *mt792x_ram_name(struct mt792x_dev *dev)
{}

static inline char *mt792x_patch_name(struct mt792x_dev *dev)
{}

int mt792x_load_firmware(struct mt792x_dev *dev);

/* usb */
#define MT_USB_TYPE_VENDOR
#define MT_USB_TYPE_UHW_VENDOR
int mt792xu_dma_init(struct mt792x_dev *dev, bool resume);
int mt792xu_mcu_power_on(struct mt792x_dev *dev);
int mt792xu_wfsys_reset(struct mt792x_dev *dev);
int mt792xu_init_reset(struct mt792x_dev *dev);
u32 mt792xu_rr(struct mt76_dev *dev, u32 addr);
void mt792xu_wr(struct mt76_dev *dev, u32 addr, u32 val);
u32 mt792xu_rmw(struct mt76_dev *dev, u32 addr, u32 mask, u32 val);
void mt792xu_copy(struct mt76_dev *dev, u32 offset, const void *data, int len);
void mt792xu_disconnect(struct usb_interface *usb_intf);
void mt792xu_stop(struct ieee80211_hw *hw, bool suspend);

static inline void
mt792x_skb_add_usb_sdio_hdr(struct mt792x_dev *dev, struct sk_buff *skb,
			    int type)
{}

int __mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev);
int mt792xe_mcu_drv_pmctrl(struct mt792x_dev *dev);
int mt792xe_mcu_fw_pmctrl(struct mt792x_dev *dev);

#ifdef CONFIG_ACPI
int mt792x_init_acpi_sar(struct mt792x_dev *dev);
int mt792x_init_acpi_sar_power(struct mt792x_phy *phy, bool set_default);
u8 mt792x_acpi_get_flags(struct mt792x_phy *phy);
u8 mt792x_acpi_get_mtcl_conf(struct mt792x_phy *phy, char *alpha2);
#else
static inline int mt792x_init_acpi_sar(struct mt792x_dev *dev)
{
	return 0;
}

static inline int mt792x_init_acpi_sar_power(struct mt792x_phy *phy,
					     bool set_default)
{
	return 0;
}

static inline u8 mt792x_acpi_get_flags(struct mt792x_phy *phy)
{
	return 0;
}

static inline u8 mt792x_acpi_get_mtcl_conf(struct mt792x_phy *phy, char *alpha2)
{
	return 0xf;
}
#endif

#endif /* __MT7925_H */