forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_btcoex.c
....@@ -2329,7 +2329,23 @@
23292329 }
23302330 }
23312331
2332
-u32 halbtcoutsrc_Read_scbd(void *pBtcContext, u32* score_board_val)
2332
+u16 halbtcoutsrc_Read_scbd(void *pBtcContext, u16* score_board_val)
2333
+{
2334
+ PBTC_COEXIST btc = (PBTC_COEXIST)pBtcContext;
2335
+ struct btc_coex_sta *coex_sta = &btc->coex_sta;
2336
+ const struct btc_chip_para *chip_para = btc->chip_para;
2337
+
2338
+ if (!chip_para->scbd_support)
2339
+ return 0;
2340
+
2341
+ *score_board_val = (btc->btc_read_2byte(btc, chip_para->scbd_reg))
2342
+ & 0x7fff;
2343
+ coex_sta->score_board_BW = *score_board_val;
2344
+
2345
+ return coex_sta->score_board_BW;
2346
+}
2347
+
2348
+u32 halbtcoutsrc_Read_scbd_32bit(void *pBtcContext, u32* score_board_val)
23332349 {
23342350 PBTC_COEXIST btc = (PBTC_COEXIST)pBtcContext;
23352351 struct btc_coex_sta *coex_sta = &btc->coex_sta;
....@@ -2340,18 +2356,17 @@
23402356
23412357 *score_board_val = (btc->btc_read_4byte(btc, chip_para->scbd_reg))
23422358 & 0x7fffffff;
2343
- coex_sta->score_board_BW = *score_board_val;
2359
+ coex_sta->score_board_BW_32bit = *score_board_val;
23442360
2345
- return coex_sta->score_board_BW;
2361
+ return coex_sta->score_board_BW_32bit;
23462362 }
23472363
2348
-void halbtcoutsrc_Write_scbd(void *pBtcContext, u32 bitpos, u8 state)
2364
+void halbtcoutsrc_Write_scbd(void *pBtcContext, u16 bitpos, u8 state)
23492365 {
23502366 PBTC_COEXIST btc = (PBTC_COEXIST)pBtcContext;
23512367 struct btc_coex_sta *coex_sta = &btc->coex_sta;
23522368 const struct btc_chip_para *chip_para = btc->chip_para;
2353
- u32 val = 0x2;
2354
- u8* btc_dbg_buf = &gl_btc_trace_buf[0];
2369
+ u16 val = 0x2;
23552370
23562371 if (!chip_para->scbd_support)
23572372 return;
....@@ -2375,19 +2390,52 @@
23752390
23762391 if (val != coex_sta->score_board_WB) {
23772392 coex_sta->score_board_WB = val;
2393
+ val = val | 0x8000;
23782394
2379
- if(chip_para->scbd_bit_num == BTC_SCBD_32_BIT)
2380
- val = val | 0x80000000;
2381
- else
2382
- val = val | 0x8000;
2383
-
2384
- btc->btc_write_4byte(btc, chip_para->scbd_reg, val);
2385
-
2386
- BTC_SPRINTF(btc_dbg_buf, BT_TMP_BUF_SIZE,
2387
- "[BTCoex], write scoreboard 0x%x\n", val);
2395
+ btc->btc_write_2byte(btc, chip_para->scbd_reg, val);
2396
+
2397
+ RTW_DBG("[BTC], write scoreboard 0x%x\n", val);
23882398 } else {
2389
- BTC_SPRINTF(btc_dbg_buf, BT_TMP_BUF_SIZE,
2390
- "[BTCoex], %s: return for nochange\n", __func__);
2399
+ RTW_DBG("[BTC], return for nochange\n");
2400
+ }
2401
+}
2402
+
2403
+void halbtcoutsrc_Write_scbd_32bit(void *pBtcContext, u32 bitpos, u8 state)
2404
+{
2405
+ PBTC_COEXIST btc = (PBTC_COEXIST)pBtcContext;
2406
+ struct btc_coex_sta *coex_sta = &btc->coex_sta;
2407
+ const struct btc_chip_para *chip_para = btc->chip_para;
2408
+ u32 val = 0x2;
2409
+
2410
+ if (!chip_para->scbd_support)
2411
+ return;
2412
+
2413
+ val = val | coex_sta->score_board_WB;
2414
+
2415
+ /* for 8822b, Scoreboard[10]: 0: CQDDR off, 1: CQDDR on
2416
+ * for 8822c, Scoreboard[10]: 0: CQDDR on, 1:CQDDR fix 2M
2417
+ */
2418
+ if (!btc->chip_para->new_scbd10_def && (bitpos & BTC_SCBD_FIX2M)) {
2419
+ if (state)
2420
+ val = val & (~BTC_SCBD_FIX2M);
2421
+ else
2422
+ val = val | BTC_SCBD_FIX2M;
2423
+ } else {
2424
+ if (state)
2425
+ val = val | bitpos;
2426
+ else
2427
+ val = val & (~bitpos);
2428
+ }
2429
+
2430
+ if (val != coex_sta->score_board_WB_32bit) {
2431
+ coex_sta->score_board_WB_32bit = val;
2432
+ val = val | 0x80000000;
2433
+
2434
+ btc->btc_write_4byte(btc, chip_para->scbd_reg, val);
2435
+
2436
+ RTW_DBG("[BTC], write scoreboard 0x%x\n", val);
2437
+ } else {
2438
+ RTW_DBG("[BTC], return for nochange\n");
23912439 }
23922440 }
23932441
....@@ -3211,11 +3259,13 @@
32113259 pBtCoexist->chip_para = &btc_chip_para_8192f;
32123260 }
32133261 #endif
3262
+#ifdef PLATFORM_LINUX
32143263 #ifdef CONFIG_RTL8723F
32153264 else if (IS_HARDWARE_TYPE_8723F(padapter)) {
32163265 pBtCoexist->chip_type = BTC_CHIP_RTL8723F;
32173266 pBtCoexist->chip_para = &btc_chip_para_8723f;
32183267 }
3268
+#endif
32193269 #endif
32203270 else {
32213271 pBtCoexist->chip_type = BTC_CHIP_UNDEF;
....@@ -3291,7 +3341,9 @@
32913341 pBtCoexist->btc_write_linderct = halbtcoutsrc_WriteLIndirectReg;
32923342
32933343 pBtCoexist->btc_read_scbd = halbtcoutsrc_Read_scbd;
3344
+ pBtCoexist->btc_read_scbd_32bit = halbtcoutsrc_Read_scbd_32bit;
32943345 pBtCoexist->btc_write_scbd = halbtcoutsrc_Write_scbd;
3346
+ pBtCoexist->btc_write_scbd_32bit = halbtcoutsrc_Write_scbd_32bit;
32953347
32963348 pBtCoexist->btc_set_bb_reg = halbtcoutsrc_SetBbReg;
32973349 pBtCoexist->btc_get_bb_reg = halbtcoutsrc_GetBbReg;