162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Copyright(c) 2009-2012  Realtek Corporation.*/
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef __RTL8723E_DEF_H__
562306a36Sopenharmony_ci#define __RTL8723E_DEF_H__
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#define HAL_PRIME_CHNL_OFFSET_DONT_CARE		0
862306a36Sopenharmony_ci#define HAL_PRIME_CHNL_OFFSET_LOWER			1
962306a36Sopenharmony_ci#define HAL_PRIME_CHNL_OFFSET_UPPER			2
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define RX_MPDU_QUEUE						0
1262306a36Sopenharmony_ci#define RX_CMD_QUEUE						1
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define CHIP_BONDING_IDENTIFIER(_value)	(((_value)>>22)&0x3)
1562306a36Sopenharmony_ci#define	CHIP_BONDING_92C_1T2R		0x1
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define CHIP_8723		BIT(0)
1862306a36Sopenharmony_ci#define NORMAL_CHIP		BIT(3)
1962306a36Sopenharmony_ci#define RF_TYPE_1T1R		(~(BIT(4)|BIT(5)|BIT(6)))
2062306a36Sopenharmony_ci#define RF_TYPE_1T2R		BIT(4)
2162306a36Sopenharmony_ci#define RF_TYPE_2T2R		BIT(5)
2262306a36Sopenharmony_ci#define CHIP_VENDOR_UMC		BIT(7)
2362306a36Sopenharmony_ci#define B_CUT_VERSION		BIT(12)
2462306a36Sopenharmony_ci#define C_CUT_VERSION		BIT(13)
2562306a36Sopenharmony_ci#define D_CUT_VERSION		((BIT(12)|BIT(13)))
2662306a36Sopenharmony_ci#define E_CUT_VERSION		BIT(14)
2762306a36Sopenharmony_ci#define	RF_RL_ID		(BIT(31)|BIT(30)|BIT(29)|BIT(28))
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/* MASK */
3062306a36Sopenharmony_ci#define IC_TYPE_MASK		(BIT(0)|BIT(1)|BIT(2))
3162306a36Sopenharmony_ci#define CHIP_TYPE_MASK		BIT(3)
3262306a36Sopenharmony_ci#define RF_TYPE_MASK		(BIT(4)|BIT(5)|BIT(6))
3362306a36Sopenharmony_ci#define MANUFACTUER_MASK	BIT(7)
3462306a36Sopenharmony_ci#define ROM_VERSION_MASK	(BIT(11)|BIT(10)|BIT(9)|BIT(8))
3562306a36Sopenharmony_ci#define CUT_VERSION_MASK	(BIT(15)|BIT(14)|BIT(13)|BIT(12))
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* Get element */
3862306a36Sopenharmony_ci#define GET_CVID_IC_TYPE(version)	((version) & IC_TYPE_MASK)
3962306a36Sopenharmony_ci#define GET_CVID_CHIP_TYPE(version)	((version) & CHIP_TYPE_MASK)
4062306a36Sopenharmony_ci#define GET_CVID_RF_TYPE(version)	((version) & RF_TYPE_MASK)
4162306a36Sopenharmony_ci#define GET_CVID_MANUFACTUER(version)	((version) & MANUFACTUER_MASK)
4262306a36Sopenharmony_ci#define GET_CVID_ROM_VERSION(version)	((version) & ROM_VERSION_MASK)
4362306a36Sopenharmony_ci#define GET_CVID_CUT_VERSION(version)	((version) & CUT_VERSION_MASK)
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#define IS_81XXC(version)	((GET_CVID_IC_TYPE(version) == 0) ?\
4662306a36Sopenharmony_ci						true : false)
4762306a36Sopenharmony_ci#define IS_8723_SERIES(version)	((GET_CVID_IC_TYPE(version) == CHIP_8723) ? \
4862306a36Sopenharmony_ci						true : false)
4962306a36Sopenharmony_ci#define IS_1T1R(version)	((GET_CVID_RF_TYPE(version)) ? false : true)
5062306a36Sopenharmony_ci#define IS_1T2R(version)	((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R)\
5162306a36Sopenharmony_ci						? true : false)
5262306a36Sopenharmony_ci#define IS_2T2R(version)	((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R)\
5362306a36Sopenharmony_ci						? true : false)
5462306a36Sopenharmony_ci#define IS_CHIP_VENDOR_UMC(version)	((GET_CVID_MANUFACTUER(version)) ? \
5562306a36Sopenharmony_ci						true : false)
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#define IS_VENDOR_UMC_A_CUT(version)	((IS_CHIP_VENDOR_UMC(version))\
5862306a36Sopenharmony_ci					? ((GET_CVID_CUT_VERSION(version)) ? \
5962306a36Sopenharmony_ci					false : true) : false)
6062306a36Sopenharmony_ci#define IS_VENDOR_8723_A_CUT(version)	((IS_8723_SERIES(version))\
6162306a36Sopenharmony_ci					? ((GET_CVID_CUT_VERSION(version)) ? \
6262306a36Sopenharmony_ci					false : true) : false)
6362306a36Sopenharmony_ci#define IS_VENDOR_8723A_B_CUT(version)	((IS_8723_SERIES(version))\
6462306a36Sopenharmony_ci		? ((GET_CVID_CUT_VERSION(version) == \
6562306a36Sopenharmony_ci		B_CUT_VERSION) ? true : false) : false)
6662306a36Sopenharmony_ci#define IS_81XXC_VENDOR_UMC_B_CUT(version)	((IS_CHIP_VENDOR_UMC(version))\
6762306a36Sopenharmony_ci		? ((GET_CVID_CUT_VERSION(version) == \
6862306a36Sopenharmony_ci		B_CUT_VERSION) ? true : false) : false)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_cienum rf_optype {
7162306a36Sopenharmony_ci	RF_OP_BY_SW_3WIRE = 0,
7262306a36Sopenharmony_ci	RF_OP_BY_FW,
7362306a36Sopenharmony_ci	RF_OP_MAX
7462306a36Sopenharmony_ci};
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_cienum rf_power_state {
7762306a36Sopenharmony_ci	RF_ON,
7862306a36Sopenharmony_ci	RF_OFF,
7962306a36Sopenharmony_ci	RF_SLEEP,
8062306a36Sopenharmony_ci	RF_SHUT_DOWN,
8162306a36Sopenharmony_ci};
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_cienum power_save_mode {
8462306a36Sopenharmony_ci	POWER_SAVE_MODE_ACTIVE,
8562306a36Sopenharmony_ci	POWER_SAVE_MODE_SAVE,
8662306a36Sopenharmony_ci};
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_cienum power_policy_config {
8962306a36Sopenharmony_ci	POWERCFG_MAX_POWER_SAVINGS,
9062306a36Sopenharmony_ci	POWERCFG_GLOBAL_POWER_SAVINGS,
9162306a36Sopenharmony_ci	POWERCFG_LOCAL_POWER_SAVINGS,
9262306a36Sopenharmony_ci	POWERCFG_LENOVO,
9362306a36Sopenharmony_ci};
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_cienum interface_select_pci {
9662306a36Sopenharmony_ci	INTF_SEL1_MINICARD = 0,
9762306a36Sopenharmony_ci	INTF_SEL0_PCIE = 1,
9862306a36Sopenharmony_ci	INTF_SEL2_RSV = 2,
9962306a36Sopenharmony_ci	INTF_SEL3_RSV = 3,
10062306a36Sopenharmony_ci};
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_cienum rtl_desc_qsel {
10362306a36Sopenharmony_ci	QSLT_BK = 0x2,
10462306a36Sopenharmony_ci	QSLT_BE = 0x0,
10562306a36Sopenharmony_ci	QSLT_VI = 0x5,
10662306a36Sopenharmony_ci	QSLT_VO = 0x7,
10762306a36Sopenharmony_ci	QSLT_BEACON = 0x10,
10862306a36Sopenharmony_ci	QSLT_HIGH = 0x11,
10962306a36Sopenharmony_ci	QSLT_MGNT = 0x12,
11062306a36Sopenharmony_ci	QSLT_CMD = 0x13,
11162306a36Sopenharmony_ci};
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_cienum rtl_desc8723e_rate {
11462306a36Sopenharmony_ci	DESC92C_RATE1M = 0x00,
11562306a36Sopenharmony_ci	DESC92C_RATE2M = 0x01,
11662306a36Sopenharmony_ci	DESC92C_RATE5_5M = 0x02,
11762306a36Sopenharmony_ci	DESC92C_RATE11M = 0x03,
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci	DESC92C_RATE6M = 0x04,
12062306a36Sopenharmony_ci	DESC92C_RATE9M = 0x05,
12162306a36Sopenharmony_ci	DESC92C_RATE12M = 0x06,
12262306a36Sopenharmony_ci	DESC92C_RATE18M = 0x07,
12362306a36Sopenharmony_ci	DESC92C_RATE24M = 0x08,
12462306a36Sopenharmony_ci	DESC92C_RATE36M = 0x09,
12562306a36Sopenharmony_ci	DESC92C_RATE48M = 0x0a,
12662306a36Sopenharmony_ci	DESC92C_RATE54M = 0x0b,
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci	DESC92C_RATEMCS0 = 0x0c,
12962306a36Sopenharmony_ci	DESC92C_RATEMCS1 = 0x0d,
13062306a36Sopenharmony_ci	DESC92C_RATEMCS2 = 0x0e,
13162306a36Sopenharmony_ci	DESC92C_RATEMCS3 = 0x0f,
13262306a36Sopenharmony_ci	DESC92C_RATEMCS4 = 0x10,
13362306a36Sopenharmony_ci	DESC92C_RATEMCS5 = 0x11,
13462306a36Sopenharmony_ci	DESC92C_RATEMCS6 = 0x12,
13562306a36Sopenharmony_ci	DESC92C_RATEMCS7 = 0x13,
13662306a36Sopenharmony_ci	DESC92C_RATEMCS8 = 0x14,
13762306a36Sopenharmony_ci	DESC92C_RATEMCS9 = 0x15,
13862306a36Sopenharmony_ci	DESC92C_RATEMCS10 = 0x16,
13962306a36Sopenharmony_ci	DESC92C_RATEMCS11 = 0x17,
14062306a36Sopenharmony_ci	DESC92C_RATEMCS12 = 0x18,
14162306a36Sopenharmony_ci	DESC92C_RATEMCS13 = 0x19,
14262306a36Sopenharmony_ci	DESC92C_RATEMCS14 = 0x1a,
14362306a36Sopenharmony_ci	DESC92C_RATEMCS15 = 0x1b,
14462306a36Sopenharmony_ci	DESC92C_RATEMCS15_SG = 0x1c,
14562306a36Sopenharmony_ci	DESC92C_RATEMCS32 = 0x20,
14662306a36Sopenharmony_ci};
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_cistruct phy_sts_cck_8723e_t {
14962306a36Sopenharmony_ci	u8 adc_pwdb_X[4];
15062306a36Sopenharmony_ci	u8 sq_rpt;
15162306a36Sopenharmony_ci	u8 cck_agc_rpt;
15262306a36Sopenharmony_ci};
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_cistruct h2c_cmd_8723e {
15562306a36Sopenharmony_ci	u8 element_id;
15662306a36Sopenharmony_ci	u32 cmd_len;
15762306a36Sopenharmony_ci	u8 *p_cmdbuffer;
15862306a36Sopenharmony_ci};
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci#endif
161