forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
....@@ -1,14 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (c) 2014 - 2017 Jes Sorensen <Jes.Sorensen@gmail.com>
3
- *
4
- * This program is free software; you can redistribute it and/or modify it
5
- * under the terms of version 2 of the GNU General Public License as
6
- * published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope that it will be useful, but WITHOUT
9
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11
- * more details.
124 *
135 * Register definitions taken from original Realtek rtl8723au driver
146 */
....@@ -635,7 +627,7 @@
635627 u32 reserved4;
636628 u32 reserved5;
637629
638
- u8 data[0];
630
+ u8 data[];
639631 };
640632
641633 /*
....@@ -1136,6 +1128,15 @@
11361128 BT_MP_OP_ENABLE_CFO_TRACKING = 0x24,
11371129 };
11381130
1131
+enum rtl8xxxu_bw_mode {
1132
+ RTL8XXXU_CHANNEL_WIDTH_20 = 0,
1133
+ RTL8XXXU_CHANNEL_WIDTH_40 = 1,
1134
+ RTL8XXXU_CHANNEL_WIDTH_80 = 2,
1135
+ RTL8XXXU_CHANNEL_WIDTH_160 = 3,
1136
+ RTL8XXXU_CHANNEL_WIDTH_80_80 = 4,
1137
+ RTL8XXXU_CHANNEL_WIDTH_MAX = 5,
1138
+};
1139
+
11391140 struct rtl8723bu_c2h {
11401141 u8 id;
11411142 u8 seq;
....@@ -1177,18 +1178,100 @@
11771178 } __packed bt_info;
11781179 struct {
11791180 u8 rate:7;
1180
- u8 dummy0_0:1;
1181
+ u8 sgi:1;
11811182 u8 macid;
11821183 u8 ldpc:1;
11831184 u8 txbf:1;
11841185 u8 noisy_state:1;
11851186 u8 dummy2_0:5;
11861187 u8 dummy3_0;
1188
+ u8 dummy4_0;
1189
+ u8 dummy5_0;
1190
+ u8 bw;
11871191 } __packed ra_report;
11881192 };
1189
-};
1193
+} __packed;
11901194
11911195 struct rtl8xxxu_fileops;
1196
+
1197
+/*mlme related.*/
1198
+enum wireless_mode {
1199
+ WIRELESS_MODE_UNKNOWN = 0,
1200
+ /* Sub-Element */
1201
+ WIRELESS_MODE_B = BIT(0),
1202
+ WIRELESS_MODE_G = BIT(1),
1203
+ WIRELESS_MODE_A = BIT(2),
1204
+ WIRELESS_MODE_N_24G = BIT(3),
1205
+ WIRELESS_MODE_N_5G = BIT(4),
1206
+ WIRELESS_AUTO = BIT(5),
1207
+ WIRELESS_MODE_AC = BIT(6),
1208
+ WIRELESS_MODE_MAX = 0x7F,
1209
+};
1210
+
1211
+/* from rtlwifi/wifi.h */
1212
+enum ratr_table_mode_new {
1213
+ RATEID_IDX_BGN_40M_2SS = 0,
1214
+ RATEID_IDX_BGN_40M_1SS = 1,
1215
+ RATEID_IDX_BGN_20M_2SS_BN = 2,
1216
+ RATEID_IDX_BGN_20M_1SS_BN = 3,
1217
+ RATEID_IDX_GN_N2SS = 4,
1218
+ RATEID_IDX_GN_N1SS = 5,
1219
+ RATEID_IDX_BG = 6,
1220
+ RATEID_IDX_G = 7,
1221
+ RATEID_IDX_B = 8,
1222
+ RATEID_IDX_VHT_2SS = 9,
1223
+ RATEID_IDX_VHT_1SS = 10,
1224
+ RATEID_IDX_MIX1 = 11,
1225
+ RATEID_IDX_MIX2 = 12,
1226
+ RATEID_IDX_VHT_3SS = 13,
1227
+ RATEID_IDX_BGN_3SS = 14,
1228
+};
1229
+
1230
+#define BT_INFO_8723B_1ANT_B_FTP BIT(7)
1231
+#define BT_INFO_8723B_1ANT_B_A2DP BIT(6)
1232
+#define BT_INFO_8723B_1ANT_B_HID BIT(5)
1233
+#define BT_INFO_8723B_1ANT_B_SCO_BUSY BIT(4)
1234
+#define BT_INFO_8723B_1ANT_B_ACL_BUSY BIT(3)
1235
+#define BT_INFO_8723B_1ANT_B_INQ_PAGE BIT(2)
1236
+#define BT_INFO_8723B_1ANT_B_SCO_ESCO BIT(1)
1237
+#define BT_INFO_8723B_1ANT_B_CONNECTION BIT(0)
1238
+
1239
+enum _BT_8723B_1ANT_STATUS {
1240
+ BT_8723B_1ANT_STATUS_NON_CONNECTED_IDLE = 0x0,
1241
+ BT_8723B_1ANT_STATUS_CONNECTED_IDLE = 0x1,
1242
+ BT_8723B_1ANT_STATUS_INQ_PAGE = 0x2,
1243
+ BT_8723B_1ANT_STATUS_ACL_BUSY = 0x3,
1244
+ BT_8723B_1ANT_STATUS_SCO_BUSY = 0x4,
1245
+ BT_8723B_1ANT_STATUS_ACL_SCO_BUSY = 0x5,
1246
+ BT_8723B_1ANT_STATUS_MAX
1247
+};
1248
+
1249
+struct rtl8xxxu_btcoex {
1250
+ u8 bt_status;
1251
+ bool bt_busy;
1252
+ bool has_sco;
1253
+ bool has_a2dp;
1254
+ bool has_hid;
1255
+ bool has_pan;
1256
+ bool hid_only;
1257
+ bool a2dp_only;
1258
+ bool c2h_bt_inquiry;
1259
+};
1260
+
1261
+#define RTL8XXXU_RATR_STA_INIT 0
1262
+#define RTL8XXXU_RATR_STA_HIGH 1
1263
+#define RTL8XXXU_RATR_STA_MID 2
1264
+#define RTL8XXXU_RATR_STA_LOW 3
1265
+
1266
+#define RTL8XXXU_NOISE_FLOOR_MIN -100
1267
+#define RTL8XXXU_SNR_THRESH_HIGH 50
1268
+#define RTL8XXXU_SNR_THRESH_LOW 20
1269
+
1270
+struct rtl8xxxu_ra_report {
1271
+ struct rate_info txrate;
1272
+ u32 bit_rate;
1273
+ u8 desc_rate;
1274
+};
11921275
11931276 struct rtl8xxxu_priv {
11941277 struct ieee80211_hw *hw;
....@@ -1263,6 +1346,7 @@
12631346 u32 rege9c;
12641347 u32 regeb4;
12651348 u32 regebc;
1349
+ u32 regrcr;
12661350 int next_mbox;
12671351 int nr_out_eps;
12681352
....@@ -1294,6 +1378,20 @@
12941378 u8 pi_enabled:1;
12951379 u8 no_pape:1;
12961380 u8 int_buf[USB_INTR_CONTENT_LENGTH];
1381
+ u8 rssi_level;
1382
+ DECLARE_BITMAP(tx_aggr_started, IEEE80211_NUM_TIDS);
1383
+ DECLARE_BITMAP(tid_tx_operational, IEEE80211_NUM_TIDS);
1384
+ /*
1385
+ * Only one virtual interface permitted because only STA mode
1386
+ * is supported and no iface_combinations are provided.
1387
+ */
1388
+ struct ieee80211_vif *vif;
1389
+ struct delayed_work ra_watchdog;
1390
+ struct work_struct c2hcmd_work;
1391
+ struct sk_buff_head c2hcmd_queue;
1392
+ spinlock_t c2hcmd_lock;
1393
+ struct rtl8xxxu_btcoex bt_coex;
1394
+ struct rtl8xxxu_ra_report ra_report;
12971395 };
12981396
12991397 struct rtl8xxxu_rx_urb {
....@@ -1329,7 +1427,7 @@
13291427 void (*set_tx_power) (struct rtl8xxxu_priv *priv, int channel,
13301428 bool ht40);
13311429 void (*update_rate_mask) (struct rtl8xxxu_priv *priv,
1332
- u32 ramask, int sgi);
1430
+ u32 ramask, u8 rateid, int sgi);
13331431 void (*report_connect) (struct rtl8xxxu_priv *priv,
13341432 u8 macid, bool connect);
13351433 void (*fill_txdesc) (struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
....@@ -1415,9 +1513,9 @@
14151513 void rtl8xxxu_gen1_usb_quirks(struct rtl8xxxu_priv *priv);
14161514 void rtl8xxxu_gen2_usb_quirks(struct rtl8xxxu_priv *priv);
14171515 void rtl8xxxu_update_rate_mask(struct rtl8xxxu_priv *priv,
1418
- u32 ramask, int sgi);
1516
+ u32 ramask, u8 rateid, int sgi);
14191517 void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv,
1420
- u32 ramask, int sgi);
1518
+ u32 ramask, u8 rateid, int sgi);
14211519 void rtl8xxxu_gen1_report_connect(struct rtl8xxxu_priv *priv,
14221520 u8 macid, bool connect);
14231521 void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv,
....@@ -1441,6 +1539,8 @@
14411539 struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi,
14421540 bool short_preamble, bool ampdu_enable,
14431541 u32 rts_rate);
1542
+void rtl8723bu_set_ps_tdma(struct rtl8xxxu_priv *priv,
1543
+ u8 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5);
14441544
14451545 extern struct rtl8xxxu_fileops rtl8192cu_fops;
14461546 extern struct rtl8xxxu_fileops rtl8192eu_fops;