xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852bs/phl/phl_mcc.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2019 Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  *****************************************************************************/
15 #ifndef _PHL_MCC_H_
16 #define _PHL_MCC_H_
17 /* MCC definition for private usage */
18 
19 #define phl_to_com_mcc_info(_phl) ((struct phl_com_mcc_info *)(phl_to_mr_ctrl(_phl)->com_mcc))
20 #define get_mcc_info(_phl, _band) ((struct phl_mcc_info *)((get_band_ctrl(_phl, _band)->mcc_info)))
21 #define set_mcc_init_state(_phl, _state) (((struct mr_ctl_t *)phl_to_mr_ctrl(_phl))->init_mcc = _state)
22 #define is_mcc_init(_phl) (((struct mr_ctl_t *)phl_to_mr_ctrl(_phl))->init_mcc == true)
23 #define get_ref_role(_en_info) ((struct rtw_phl_mcc_role *)&(_en_info->mcc_role[_en_info->ref_role_idx]))
24 
25 #define EARLY_TX_BCN_T 10
26 #define MIN_TX_BCN_T 10
27 #define EARLY_RX_BCN_T 5
28 #define MIN_RX_BCN_T 10
29 #define MIN_GO_STA_OFFSET_T 15
30 #define MIN_CLIENT_DUR (EARLY_RX_BCN_T + MIN_RX_BCN_T)
31 #define MIN_AP_DUR (EARLY_TX_BCN_T + MIN_GO_STA_OFFSET_T - EARLY_RX_BCN_T)
32 #define MIN_BCNS_OFFSET (EARLY_RX_BCN_T + MIN_RX_BCN_T)
33 #define MAX_MCC_GROUP_ROLE 2
34 #define DEFAULT_AP_DUR 60
35 #define DEFAULT_CLIENT_DUR 40
36 #define MCC_DUR_NONSPECIFIC 0xff
37 #define CLIENTS_WORSECASE_REF_TOA 30
38 #define CLIENTS_WORSECASE_SMALL_DUR 60
39 #define CLIENTS_WORSECASE_LARGE_DUR 90
40 #define WORSECASE_INTVL 150
41 #define MIN_TRIGGER_MCC_TIME 300/*TU*/
42 #define CLIENTS_TRACKING_TH 3
43 #define CLIENTS_TRACKING_WORSECASE_TH 3
44 #define CLIENTS_TRACKING_COURTESY_TH 3
45 #define CLIENTS_TRACKING_CRITICAL_POINT_TH 2
46 #define HANDLE_BCN_INTVL 100
47 #define BT_DUR_SEG_TH 20
48 #define AP_CLIENT_OFFSET 40
49 #define REF_ROLE_IDX 0
50 #define BT_DUR_MAX_2WS 33 /*The max bt slot for 2wifi slot and 1 bt slot*/
51 
52 enum _mcc_minfo_reset_type {
53 	MINFO_RESET_EN_INFO = BIT(0),
54 	MINFO_RESET_MODE = BIT(1),
55 	MINFO_RESET_ROLE_MAP = BIT(2),
56 	MINFO_RESET_STATE = BIT(3),
57 	MINFO_RESET_COEX_MODE = BIT(4),
58 	MINFO_RESET_BT_INFO = BIT(5),
59 	MINFO_RESET_PATTERN_INFO = BIT(6),
60 	MINFO_RESET_ALL = 0xFF
61 };
62 
63 enum _mcc_role_cat {
64 	MCC_ROLE_NONE = 0,
65 	MCC_ROLE_AP_CAT,
66 	MCC_ROLE_CLIENT_CAT
67 };
68 
69 struct phl_mcc_fw_log_info {
70 	bool en_fw_mcc_log;
71 	u8 fw_mcc_log_lv;/* fw mcc log level */
72 	bool update; /*if update = true, we need to update setting to fw.*/
73 };
74 
75 struct phl_mcc_info {
76 	struct rtw_phl_mcc_en_info en_info;
77 	enum rtw_phl_tdmra_wmode mcc_mode;
78 	u8 role_map; /*the wifi role map in operating mcc */
79 	enum rtw_phl_mcc_state state;
80 	enum rtw_phl_mcc_coex_mode coex_mode;
81 	struct rtw_phl_mcc_bt_info bt_info;
82 	struct phl_mcc_fw_log_info fw_log_i;
83 };
84 
85 
86 
87 #endif /*_PHL_MCC_H_*/
88