linux/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c

// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2009-2010  Realtek Corporation.*/

#include "../wifi.h"
#include "../efuse.h"
#include "../base.h"
#include "../regd.h"
#include "../cam.h"
#include "../ps.h"
#include "../pci.h"
#include "reg.h"
#include "def.h"
#include "phy.h"
#include "dm.h"
#include "fw.h"
#include "led.h"
#include "hw.h"
#include "../pwrseqcmd.h"
#include "pwrseq.h"
#include "../btcoexist/rtl_btc.h"

#define LLT_CONFIG

static void _rtl8821ae_return_beacon_queue_skb(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_set_bcn_ctrl_reg(struct ieee80211_hw *hw,
					u8 set_bits, u8 clear_bits)
{}

void _rtl8821ae_stop_tx_beacon(struct ieee80211_hw *hw)
{}

void _rtl8821ae_resume_tx_beacon(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_enable_bcn_sub_func(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_disable_bcn_sub_func(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_set_fw_clock_on(struct ieee80211_hw *hw,
				       u8 rpwm_val, bool b_need_turn_off_ckk)
{}

static void _rtl8821ae_set_fw_clock_off(struct ieee80211_hw *hw,
					u8 rpwm_val)
{}

static void _rtl8821ae_set_fw_ps_rf_on(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_fwlps_leave(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_fwlps_enter(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_download_rsvd_page(struct ieee80211_hw *hw,
					  bool dl_whole_packets)
{}

void rtl8821ae_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
{}

void rtl8821ae_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
{}

static bool _rtl8821ae_llt_write(struct ieee80211_hw *hw, u32 address, u32 data)
{}

static bool _rtl8821ae_llt_table_init(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_gen_refresh_led_state(struct ieee80211_hw *hw)
{}

static bool _rtl8821ae_init_mac(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_hw_configure(struct ieee80211_hw *hw)
{}

static u16 _rtl8821ae_mdio_read(struct rtl_priv *rtlpriv, u8 addr)
{}

static void _rtl8821ae_mdio_write(struct rtl_priv *rtlpriv, u8 addr, u16 data)
{}

static u8 _rtl8821ae_dbi_read(struct rtl_priv *rtlpriv, u16 addr)
{}

static void _rtl8821ae_dbi_write(struct rtl_priv *rtlpriv, u16 addr, u8 data)
{}

static void _rtl8821ae_enable_aspm_back_door(struct ieee80211_hw *hw)
{}

void rtl8821ae_enable_hw_security_config(struct ieee80211_hw *hw)
{}

/* Static MacID Mapping (cf. Used in MacIdDoStaticMapping) ---------- */
#define MAC_ID_STATIC_FOR_DEFAULT_PORT
#define MAC_ID_STATIC_FOR_BROADCAST_MULTICAST
#define MAC_ID_STATIC_FOR_BT_CLIENT_START
#define MAC_ID_STATIC_FOR_BT_CLIENT_END
/* ----------------------------------------------------------- */

static void rtl8821ae_macid_initialize_mediastatus(struct ieee80211_hw *hw)
{}

static bool _rtl8821ae_check_pcie_dma_hang(struct ieee80211_hw *hw)
{}

static bool _rtl8821ae_reset_pcie_interface_dma(struct ieee80211_hw *hw,
					 bool mac_power_on,
					 bool in_watchdog)
{}

static void _rtl8821ae_get_wakeup_reason(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_init_trx_desc_hw_address(struct ieee80211_hw *hw)
{}

static bool _rtl8821ae_init_llt_table(struct ieee80211_hw *hw, u32 boundary)
{}

static bool _rtl8821ae_dynamic_rqpn(struct ieee80211_hw *hw, u32 boundary,
			     u16 npq_rqpn_value, u32 rqpn_val)
{}

static void _rtl8821ae_simple_initialize_adapter(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_enable_l1off(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_enable_ltr(struct ieee80211_hw *hw)
{}

static bool _rtl8821ae_wowlan_initialize_adapter(struct ieee80211_hw *hw)
{}

static void _rtl8812ae_bb8812_config_1t(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_poweroff_adapter(struct ieee80211_hw *hw)
{}

int rtl8821ae_hw_init(struct ieee80211_hw *hw)
{}

static enum version_8821ae _rtl8821ae_read_chip_version(struct ieee80211_hw *hw)
{}

static int _rtl8821ae_set_media_status(struct ieee80211_hw *hw,
				     enum nl80211_iftype type)
{}

void rtl8821ae_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid)
{}

int rtl8821ae_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type)
{}

/* don't set REG_EDCA_BE_PARAM here because mac80211 will send pkt when scan */
void rtl8821ae_set_qos(struct ieee80211_hw *hw, int aci)
{}

static void rtl8821ae_clear_interrupt(struct ieee80211_hw *hw)
{}

void rtl8821ae_enable_interrupt(struct ieee80211_hw *hw)
{}

void rtl8821ae_disable_interrupt(struct ieee80211_hw *hw)
{}

static void _rtl8821ae_clear_pci_pme_status(struct ieee80211_hw *hw)
{}

void rtl8821ae_card_disable(struct ieee80211_hw *hw)
{}

void rtl8821ae_interrupt_recognized(struct ieee80211_hw *hw,
				    struct rtl_int *intvec)
{}

void rtl8821ae_set_beacon_related_registers(struct ieee80211_hw *hw)
{}

void rtl8821ae_set_beacon_interval(struct ieee80211_hw *hw)
{}

void rtl8821ae_update_interrupt_mask(struct ieee80211_hw *hw,
				   u32 add_msr, u32 rm_msr)
{}

static u8 _rtl8821ae_get_chnl_group(u8 chnl)
{}

static void _rtl8821ae_read_power_value_fromprom(struct ieee80211_hw *hw,
	struct txpower_info_2g *pwrinfo24g,
	struct txpower_info_5g *pwrinfo5g,
	bool autoload_fail,
	u8 *hwinfo)
{}
#if 0
static void _rtl8812ae_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
						 bool autoload_fail,
						 u8 *hwinfo)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw));
	struct txpower_info_2g pwrinfo24g;
	struct txpower_info_5g pwrinfo5g;
	u8 rf_path, index;
	u8 i;

	_rtl8821ae_read_power_value_fromprom(hw, &pwrinfo24g,
					&pwrinfo5g, autoload_fail, hwinfo);

	for (rf_path = 0; rf_path < 2; rf_path++) {
		for (i = 0; i < CHANNEL_MAX_NUMBER_2G; i++) {
			index = _rtl8821ae_get_chnl_group(i + 1);

			if (i == CHANNEL_MAX_NUMBER_2G - 1) {
				rtlefuse->txpwrlevel_cck[rf_path][i] =
					pwrinfo24g.index_cck_base[rf_path][5];
				rtlefuse->txpwrlevel_ht40_1s[rf_path][i] =
					pwrinfo24g.index_bw40_base[rf_path][index];
			} else {
				rtlefuse->txpwrlevel_cck[rf_path][i] =
					pwrinfo24g.index_cck_base[rf_path][index];
				rtlefuse->txpwrlevel_ht40_1s[rf_path][i] =
					pwrinfo24g.index_bw40_base[rf_path][index];
			}
		}

		for (i = 0; i < CHANNEL_MAX_NUMBER_5G; i++) {
			index = _rtl8821ae_get_chnl_group(channel5g[i]);
			rtlefuse->txpwr_5g_bw40base[rf_path][i] =
					pwrinfo5g.index_bw40_base[rf_path][index];
		}
		for (i = 0; i < CHANNEL_MAX_NUMBER_5G_80M; i++) {
			u8 upper, lower;
			index = _rtl8821ae_get_chnl_group(channel5g_80m[i]);
			upper = pwrinfo5g.index_bw40_base[rf_path][index];
			lower = pwrinfo5g.index_bw40_base[rf_path][index + 1];

			rtlefuse->txpwr_5g_bw80base[rf_path][i] = (upper + lower) / 2;
		}
		for (i = 0; i < MAX_TX_COUNT; i++) {
			rtlefuse->txpwr_cckdiff[rf_path][i] =
				pwrinfo24g.cck_diff[rf_path][i];
			rtlefuse->txpwr_legacyhtdiff[rf_path][i] =
				pwrinfo24g.ofdm_diff[rf_path][i];
			rtlefuse->txpwr_ht20diff[rf_path][i] =
				pwrinfo24g.bw20_diff[rf_path][i];
			rtlefuse->txpwr_ht40diff[rf_path][i] =
				pwrinfo24g.bw40_diff[rf_path][i];

			rtlefuse->txpwr_5g_ofdmdiff[rf_path][i] =
				pwrinfo5g.ofdm_diff[rf_path][i];
			rtlefuse->txpwr_5g_bw20diff[rf_path][i] =
				pwrinfo5g.bw20_diff[rf_path][i];
			rtlefuse->txpwr_5g_bw40diff[rf_path][i] =
				pwrinfo5g.bw40_diff[rf_path][i];
			rtlefuse->txpwr_5g_bw80diff[rf_path][i] =
				pwrinfo5g.bw80_diff[rf_path][i];
		}
	}

	if (!autoload_fail) {
		rtlefuse->eeprom_regulatory =
			hwinfo[EEPROM_RF_BOARD_OPTION] & 0x07;/*bit0~2*/
		if (hwinfo[EEPROM_RF_BOARD_OPTION] == 0xFF)
			rtlefuse->eeprom_regulatory = 0;
	} else {
		rtlefuse->eeprom_regulatory = 0;
	}

	RTPRINT(rtlpriv, FINIT, INIT_TXPOWER,
	"eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory);
}
#endif
static void _rtl8821ae_read_txpower_info_from_hwpg(struct ieee80211_hw *hw,
						 bool autoload_fail,
						 u8 *hwinfo)
{}

static void _rtl8812ae_read_pa_type(struct ieee80211_hw *hw, u8 *hwinfo,
				    bool autoload_fail)
{}

static void _rtl8812ae_read_amplifier_type(struct ieee80211_hw *hw, u8 *hwinfo,
					   bool autoload_fail)
{}

static void _rtl8821ae_read_pa_type(struct ieee80211_hw *hw, u8 *hwinfo,
				    bool autoload_fail)
{}

static void _rtl8821ae_read_rfe_type(struct ieee80211_hw *hw, u8 *hwinfo,
			      bool autoload_fail)
{}

static void _rtl8812ae_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw,
					      bool auto_load_fail, u8 *hwinfo)
{}

static void _rtl8821ae_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw,
					      bool auto_load_fail, u8 *hwinfo)
{}

static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_test)
{}

/*static void _rtl8821ae_hal_customized_behavior(struct ieee80211_hw *hw)
{
	struct rtl_priv *rtlpriv = rtl_priv(hw);
	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));

	rtlpriv->ledctl.led_opendrain = true;
	switch (rtlhal->oem_id) {
	case RT_CID_819X_HP:
		rtlpriv->ledctl.led_opendrain = true;
		break;
	case RT_CID_819X_LENOVO:
	case RT_CID_DEFAULT:
	case RT_CID_TOSHIBA:
	case RT_CID_CCX:
	case RT_CID_819X_ACER:
	case RT_CID_WHQL:
	default:
		break;
	}
	rtl_dbg(rtlpriv, COMP_INIT, DBG_DMESG,
		"RT Customized ID: 0x%02X\n", rtlhal->oem_id);
}*/

void rtl8821ae_read_eeprom_info(struct ieee80211_hw *hw)
{}

static void rtl8821ae_update_hal_rate_table(struct ieee80211_hw *hw,
		struct ieee80211_sta *sta)
{}

static u32 _rtl8821ae_rate_to_bitmap_2ssvht(__le16 vht_rate)
{}

static u32 _rtl8821ae_set_ra_vht_ratr_bitmap(struct ieee80211_hw *hw,
					     enum wireless_mode wirelessmode,
					     u32 ratr_bitmap)
{}

static u8 _rtl8821ae_get_vht_eni(enum wireless_mode wirelessmode,
			u32 ratr_bitmap)
{}

static u8 _rtl8821ae_get_ra_ldpc(struct ieee80211_hw *hw,
			     u8 mac_id, struct rtl_sta_info *sta_entry,
			     enum wireless_mode wirelessmode)
{}

static u8 _rtl8821ae_get_ra_rftype(struct ieee80211_hw *hw,
			  enum wireless_mode wirelessmode,
			  u32 ratr_bitmap)
{}

static bool _rtl8821ae_get_ra_shortgi(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
			      u8 mac_id)
{}

static void rtl8821ae_update_hal_rate_mask(struct ieee80211_hw *hw,
		struct ieee80211_sta *sta, u8 rssi_level, bool update_bw)
{}

void rtl8821ae_update_hal_rate_tbl(struct ieee80211_hw *hw,
		struct ieee80211_sta *sta, u8 rssi_level, bool update_bw)
{}

void rtl8821ae_update_channel_access_setting(struct ieee80211_hw *hw)
{}

bool rtl8821ae_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid)
{}

void rtl8821ae_set_key(struct ieee80211_hw *hw, u32 key_index,
		     u8 *p_macaddr, bool is_group, u8 enc_algo,
		     bool is_wepkey, bool clear_all)
{}

void rtl8821ae_bt_reg_init(struct ieee80211_hw *hw)
{}

void rtl8821ae_bt_hw_init(struct ieee80211_hw *hw)
{}

void rtl8821ae_suspend(struct ieee80211_hw *hw)
{}

void rtl8821ae_resume(struct ieee80211_hw *hw)
{}

/* Turn on AAP (RCR:bit 0) for promicuous mode. */
void rtl8821ae_allow_all_destaddr(struct ieee80211_hw *hw,
	bool allow_all_da, bool write_into_reg)
{}

/* WKFMCAMAddAllEntry8812 */
void rtl8821ae_add_wowlan_pattern(struct ieee80211_hw *hw,
				  struct rtl_wow_pattern *rtl_pattern,
				  u8 index)
{}