forked from FreedomBen/rtl8188ce-linux-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhalbtc8821a1ant.c
2977 lines (2655 loc) · 94.3 KB
/
halbtc8821a1ant.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// SPDX-License-Identifier: GPL-2.0
/* Copyright( c ) 2012 Realtek Corporation.*/
/**************************************************************
* Description:
*
* This file is for RTL8821A Co-exist mechanism
*
* History
* 2012/11/15 Cosa first check in.
*
**************************************************************/
/**************************************************************
* include files
**************************************************************/
#include "halbt_precomp.h"
/**************************************************************
* Global variables, these are static variables
**************************************************************/
static struct coex_dm_8821a_1ant glcoex_dm_8821a_1ant;
static struct coex_dm_8821a_1ant *coex_dm = &glcoex_dm_8821a_1ant;
static struct coex_sta_8821a_1ant glcoex_sta_8821a_1ant;
static struct coex_sta_8821a_1ant *coex_sta = &glcoex_sta_8821a_1ant;
static void btc8821a1ant_act_bt_sco_hid_only_busy( struct btc_coexist *btcoexist,
u8 wifi_status );
static const char *const glbt_info_src_8821a_1ant[] = {
"BT Info[wifi fw]",
"BT Info[bt rsp]",
"BT Info[bt auto report]",
};
static u32 glcoex_ver_date_8821a_1ant = 20130816;
static u32 glcoex_ver_8821a_1ant = 0x41;
/**************************************************************
* local function proto type if needed
*
* local function start with btc8821a1ant_
**************************************************************/
static u8 btc8821a1ant_bt_rssi_state( struct btc_coexist *btcoexist,
u8 level_num, u8 rssi_thresh,
u8 rssi_thresh1 )
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
long bt_rssi = 0;
u8 bt_rssi_state = coex_sta->pre_bt_rssi_state;
bt_rssi = coex_sta->bt_rssi;
if ( level_num == 2 ) {
if ( ( coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_LOW ) ||
( coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_LOW ) ) {
if ( bt_rssi >= ( rssi_thresh +
BTC_RSSI_COEX_THRESH_TOL_8821A_1ANT ) ) {
bt_rssi_state = BTC_RSSI_STATE_HIGH;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Rssi state switch to High\n" );
} else {
bt_rssi_state = BTC_RSSI_STATE_STAY_LOW;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Rssi state stay at Low\n" );
}
} else {
if ( bt_rssi < rssi_thresh ) {
bt_rssi_state = BTC_RSSI_STATE_LOW;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Rssi state switch to Low\n" );
} else {
bt_rssi_state = BTC_RSSI_STATE_STAY_HIGH;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Rssi state stay at High\n" );
}
}
} else if ( level_num == 3 ) {
if ( rssi_thresh > rssi_thresh1 ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Rssi thresh error!!\n" );
return coex_sta->pre_bt_rssi_state;
}
if ( ( coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_LOW ) ||
( coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_LOW ) ) {
if ( bt_rssi >= ( rssi_thresh +
BTC_RSSI_COEX_THRESH_TOL_8821A_1ANT ) ) {
bt_rssi_state = BTC_RSSI_STATE_MEDIUM;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Rssi state switch to Medium\n" );
} else {
bt_rssi_state = BTC_RSSI_STATE_STAY_LOW;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Rssi state stay at Low\n" );
}
} else if ( ( coex_sta->pre_bt_rssi_state ==
BTC_RSSI_STATE_MEDIUM ) ||
( coex_sta->pre_bt_rssi_state ==
BTC_RSSI_STATE_STAY_MEDIUM ) ) {
if ( bt_rssi >= ( rssi_thresh1 +
BTC_RSSI_COEX_THRESH_TOL_8821A_1ANT ) ) {
bt_rssi_state = BTC_RSSI_STATE_HIGH;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Rssi state switch to High\n" );
} else if ( bt_rssi < rssi_thresh ) {
bt_rssi_state = BTC_RSSI_STATE_LOW;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Rssi state switch to Low\n" );
} else {
bt_rssi_state = BTC_RSSI_STATE_STAY_MEDIUM;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Rssi state stay at Medium\n" );
}
} else {
if ( bt_rssi < rssi_thresh1 ) {
bt_rssi_state = BTC_RSSI_STATE_MEDIUM;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Rssi state switch to Medium\n" );
} else {
bt_rssi_state = BTC_RSSI_STATE_STAY_HIGH;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Rssi state stay at High\n" );
}
}
}
coex_sta->pre_bt_rssi_state = bt_rssi_state;
return bt_rssi_state;
}
static u8 btc8821a1ant_wifi_rssi_state( struct btc_coexist *btcoexist,
u8 index, u8 level_num, u8 rssi_thresh,
u8 rssi_thresh1 )
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
long wifi_rssi = 0;
u8 wifi_rssi_state = coex_sta->pre_wifi_rssi_state[index];
btcoexist->btc_get( btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi );
if ( level_num == 2 ) {
if ( ( coex_sta->pre_wifi_rssi_state[index] ==
BTC_RSSI_STATE_LOW ) ||
( coex_sta->pre_wifi_rssi_state[index] ==
BTC_RSSI_STATE_STAY_LOW ) ) {
if ( wifi_rssi >= ( rssi_thresh +
BTC_RSSI_COEX_THRESH_TOL_8821A_1ANT ) ) {
wifi_rssi_state = BTC_RSSI_STATE_HIGH;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], wifi RSSI state switch to High\n" );
} else {
wifi_rssi_state = BTC_RSSI_STATE_STAY_LOW;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], wifi RSSI state stay at Low\n" );
}
} else {
if ( wifi_rssi < rssi_thresh ) {
wifi_rssi_state = BTC_RSSI_STATE_LOW;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], wifi RSSI state switch to Low\n" );
} else {
wifi_rssi_state = BTC_RSSI_STATE_STAY_HIGH;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], wifi RSSI state stay at High\n" );
}
}
} else if ( level_num == 3 ) {
if ( rssi_thresh > rssi_thresh1 ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], wifi RSSI thresh error!!\n" );
return coex_sta->pre_wifi_rssi_state[index];
}
if ( ( coex_sta->pre_wifi_rssi_state[index] ==
BTC_RSSI_STATE_LOW ) ||
( coex_sta->pre_wifi_rssi_state[index] ==
BTC_RSSI_STATE_STAY_LOW ) ) {
if ( wifi_rssi >= ( rssi_thresh +
BTC_RSSI_COEX_THRESH_TOL_8821A_1ANT ) ) {
wifi_rssi_state = BTC_RSSI_STATE_MEDIUM;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], wifi RSSI state switch to Medium\n" );
} else {
wifi_rssi_state = BTC_RSSI_STATE_STAY_LOW;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], wifi RSSI state stay at Low\n" );
}
} else if ( ( coex_sta->pre_wifi_rssi_state[index] ==
BTC_RSSI_STATE_MEDIUM ) ||
( coex_sta->pre_wifi_rssi_state[index] ==
BTC_RSSI_STATE_STAY_MEDIUM ) ) {
if ( wifi_rssi >= ( rssi_thresh1 +
BTC_RSSI_COEX_THRESH_TOL_8821A_1ANT ) ) {
wifi_rssi_state = BTC_RSSI_STATE_HIGH;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], wifi RSSI state switch to High\n" );
} else if ( wifi_rssi < rssi_thresh ) {
wifi_rssi_state = BTC_RSSI_STATE_LOW;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], wifi RSSI state switch to Low\n" );
} else {
wifi_rssi_state = BTC_RSSI_STATE_STAY_MEDIUM;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], wifi RSSI state stay at Medium\n" );
}
} else {
if ( wifi_rssi < rssi_thresh1 ) {
wifi_rssi_state = BTC_RSSI_STATE_MEDIUM;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], wifi RSSI state switch to Medium\n" );
} else {
wifi_rssi_state = BTC_RSSI_STATE_STAY_HIGH;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], wifi RSSI state stay at High\n" );
}
}
}
coex_sta->pre_wifi_rssi_state[index] = wifi_rssi_state;
return wifi_rssi_state;
}
static void btc8821a1ant_update_ra_mask( struct btc_coexist *btcoexist,
bool force_exec, u32 dis_rate_mask )
{
coex_dm->cur_ra_mask = dis_rate_mask;
if ( force_exec ||
( coex_dm->pre_ra_mask != coex_dm->cur_ra_mask ) ) {
btcoexist->btc_set( btcoexist, BTC_SET_ACT_UPDATE_RAMASK,
&coex_dm->cur_ra_mask );
}
coex_dm->pre_ra_mask = coex_dm->cur_ra_mask;
}
static void btc8821a1ant_auto_rate_fb_retry( struct btc_coexist *btcoexist,
bool force_exec, u8 type )
{
bool wifi_under_b_mode = false;
coex_dm->cur_arfr_type = type;
if ( force_exec ||
( coex_dm->pre_arfr_type != coex_dm->cur_arfr_type ) ) {
switch ( coex_dm->cur_arfr_type ) {
case 0: /* normal mode */
btcoexist->btc_write_4byte( btcoexist, 0x430,
coex_dm->backup_arfr_cnt1 );
btcoexist->btc_write_4byte( btcoexist, 0x434,
coex_dm->backup_arfr_cnt2 );
break;
case 1:
btcoexist->btc_get( btcoexist,
BTC_GET_BL_WIFI_UNDER_B_MODE,
&wifi_under_b_mode );
if ( wifi_under_b_mode ) {
btcoexist->btc_write_4byte( btcoexist, 0x430,
0x0 );
btcoexist->btc_write_4byte( btcoexist, 0x434,
0x01010101 );
} else {
btcoexist->btc_write_4byte( btcoexist, 0x430,
0x0 );
btcoexist->btc_write_4byte( btcoexist, 0x434,
0x04030201 );
}
break;
default:
break;
}
}
coex_dm->pre_arfr_type = coex_dm->cur_arfr_type;
}
static void btc8821a1ant_retry_limit( struct btc_coexist *btcoexist,
bool force_exec, u8 type )
{
coex_dm->cur_retry_limit_type = type;
if ( force_exec ||
( coex_dm->pre_retry_limit_type != coex_dm->cur_retry_limit_type ) ) {
switch ( coex_dm->cur_retry_limit_type ) {
case 0: /* normal mode */
btcoexist->btc_write_2byte( btcoexist, 0x42a,
coex_dm->backup_retry_limit );
break;
case 1: /* retry limit = 8 */
btcoexist->btc_write_2byte( btcoexist, 0x42a, 0x0808 );
break;
default:
break;
}
}
coex_dm->pre_retry_limit_type = coex_dm->cur_retry_limit_type;
}
static void btc8821a1ant_ampdu_max_time( struct btc_coexist *btcoexist,
bool force_exec, u8 type )
{
coex_dm->cur_ampdu_time_type = type;
if ( force_exec ||
( coex_dm->pre_ampdu_time_type != coex_dm->cur_ampdu_time_type ) ) {
switch ( coex_dm->cur_ampdu_time_type ) {
case 0: /* normal mode */
btcoexist->btc_write_1byte( btcoexist, 0x456,
coex_dm->backup_ampdu_max_time );
break;
case 1: /* AMPDU time = 0x38 * 32us */
btcoexist->btc_write_1byte( btcoexist, 0x456, 0x38 );
break;
default:
break;
}
}
coex_dm->pre_ampdu_time_type = coex_dm->cur_ampdu_time_type;
}
static void btc8821a1ant_limited_tx( struct btc_coexist *btcoexist,
bool force_exec, u8 ra_mask_type,
u8 arfr_type, u8 retry_limit_type,
u8 ampdu_time_type )
{
switch ( ra_mask_type ) {
case 0: /* normal mode */
btc8821a1ant_update_ra_mask( btcoexist, force_exec, 0x0 );
break;
case 1: /* disable cck 1/2 */
btc8821a1ant_update_ra_mask( btcoexist, force_exec,
0x00000003 );
break;
case 2: /* disable cck 1/2/5.5, ofdm 6/9/12/18/24, mcs 0/1/2/3/4 */
btc8821a1ant_update_ra_mask( btcoexist, force_exec,
0x0001f1f7 );
break;
default:
break;
}
btc8821a1ant_auto_rate_fb_retry( btcoexist, force_exec, arfr_type );
btc8821a1ant_retry_limit( btcoexist, force_exec, retry_limit_type );
btc8821a1ant_ampdu_max_time( btcoexist, force_exec, ampdu_time_type );
}
static void btc8821a1ant_limited_rx( struct btc_coexist *btcoexist,
bool force_exec, bool rej_ap_agg_pkt,
bool bt_ctrl_agg_buf_size, u8 agg_buf_size )
{
bool reject_rx_agg = rej_ap_agg_pkt;
bool bt_ctrl_rx_agg_size = bt_ctrl_agg_buf_size;
u8 rx_agg_size = agg_buf_size;
/* Rx Aggregation related setting */
btcoexist->btc_set( btcoexist,
BTC_SET_BL_TO_REJ_AP_AGG_PKT, &reject_rx_agg );
/* decide BT control aggregation buf size or not */
btcoexist->btc_set( btcoexist, BTC_SET_BL_BT_CTRL_AGG_SIZE,
&bt_ctrl_rx_agg_size );
/* aggregation buf size, only work when BT control Rx agg size */
btcoexist->btc_set( btcoexist, BTC_SET_U1_AGG_BUF_SIZE, &rx_agg_size );
/* real update aggregation setting */
btcoexist->btc_set( btcoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL );
}
static void btc8821a1ant_monitor_bt_ctr( struct btc_coexist *btcoexist )
{
u32 reg_hp_tx_rx, reg_lp_tx_rx, u4_tmp;
u32 reg_hp_tx = 0, reg_hp_rx = 0, reg_lp_tx = 0, reg_lp_rx = 0;
reg_hp_tx_rx = 0x770;
reg_lp_tx_rx = 0x774;
u4_tmp = btcoexist->btc_read_4byte( btcoexist, reg_hp_tx_rx );
reg_hp_tx = u4_tmp & MASKLWORD;
reg_hp_rx = ( u4_tmp & MASKHWORD ) >> 16;
u4_tmp = btcoexist->btc_read_4byte( btcoexist, reg_lp_tx_rx );
reg_lp_tx = u4_tmp & MASKLWORD;
reg_lp_rx = ( u4_tmp & MASKHWORD ) >> 16;
coex_sta->high_priority_tx = reg_hp_tx;
coex_sta->high_priority_rx = reg_hp_rx;
coex_sta->low_priority_tx = reg_lp_tx;
coex_sta->low_priority_rx = reg_lp_rx;
/* reset counter */
btcoexist->btc_write_1byte( btcoexist, 0x76e, 0xc );
}
static void btc8821a1ant_query_bt_info( struct btc_coexist *btcoexist )
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
u8 h2c_parameter[1] = {0};
coex_sta->c2h_bt_info_req_sent = true;
h2c_parameter[0] |= BIT0; /* trigger */
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], Query Bt Info, FW write 0x61 = 0x%x\n",
h2c_parameter[0] );
btcoexist->btc_fill_h2c( btcoexist, 0x61, 1, h2c_parameter );
}
static void btc8821a1ant_update_bt_link_info( struct btc_coexist *btcoexist )
{
struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
bool bt_hs_on = false;
btcoexist->btc_get( btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on );
bt_link_info->bt_link_exist = coex_sta->bt_link_exist;
bt_link_info->sco_exist = coex_sta->sco_exist;
bt_link_info->a2dp_exist = coex_sta->a2dp_exist;
bt_link_info->pan_exist = coex_sta->pan_exist;
bt_link_info->hid_exist = coex_sta->hid_exist;
/* work around for HS mode */
if ( bt_hs_on ) {
bt_link_info->pan_exist = true;
bt_link_info->bt_link_exist = true;
}
/* check if Sco only */
if ( bt_link_info->sco_exist &&
!bt_link_info->a2dp_exist &&
!bt_link_info->pan_exist &&
!bt_link_info->hid_exist )
bt_link_info->sco_only = true;
else
bt_link_info->sco_only = false;
/* check if A2dp only */
if ( !bt_link_info->sco_exist &&
bt_link_info->a2dp_exist &&
!bt_link_info->pan_exist &&
!bt_link_info->hid_exist )
bt_link_info->a2dp_only = true;
else
bt_link_info->a2dp_only = false;
/* check if Pan only */
if ( !bt_link_info->sco_exist &&
!bt_link_info->a2dp_exist &&
bt_link_info->pan_exist &&
!bt_link_info->hid_exist )
bt_link_info->pan_only = true;
else
bt_link_info->pan_only = false;
/* check if Hid only */
if ( !bt_link_info->sco_exist &&
!bt_link_info->a2dp_exist &&
!bt_link_info->pan_exist &&
bt_link_info->hid_exist )
bt_link_info->hid_only = true;
else
bt_link_info->hid_only = false;
}
static u8 btc8821a1ant_action_algorithm( struct btc_coexist *btcoexist )
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
bool bt_hs_on = false;
u8 algorithm = BT_8821A_1ANT_COEX_ALGO_UNDEFINED;
u8 num_of_diff_profile = 0;
btcoexist->btc_get( btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on );
if ( !bt_link_info->bt_link_exist ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], No BT link exists!!!\n" );
return algorithm;
}
if ( bt_link_info->sco_exist )
num_of_diff_profile++;
if ( bt_link_info->hid_exist )
num_of_diff_profile++;
if ( bt_link_info->pan_exist )
num_of_diff_profile++;
if ( bt_link_info->a2dp_exist )
num_of_diff_profile++;
if ( num_of_diff_profile == 1 ) {
if ( bt_link_info->sco_exist ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Profile = SCO only\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_SCO;
} else {
if ( bt_link_info->hid_exist ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Profile = HID only\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_HID;
} else if ( bt_link_info->a2dp_exist ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Profile = A2DP only\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_A2DP;
} else if ( bt_link_info->pan_exist ) {
if ( bt_hs_on ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = PAN(HS) only\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_PANHS;
} else {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = PAN(EDR) only\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR;
}
}
}
} else if ( num_of_diff_profile == 2 ) {
if ( bt_link_info->sco_exist ) {
if ( bt_link_info->hid_exist ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Profile = SCO + HID\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_HID;
} else if ( bt_link_info->a2dp_exist ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Profile = SCO + A2DP ==> SCO\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_SCO;
} else if ( bt_link_info->pan_exist ) {
if ( bt_hs_on ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = SCO + PAN(HS)\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_SCO;
} else {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = SCO + PAN(EDR)\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
}
}
} else {
if ( bt_link_info->hid_exist &&
bt_link_info->a2dp_exist ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Profile = HID + A2DP\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP;
} else if ( bt_link_info->hid_exist &&
bt_link_info->pan_exist ) {
if ( bt_hs_on ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = HID + PAN(HS)\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP;
} else {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = HID + PAN(EDR)\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
}
} else if ( bt_link_info->pan_exist &&
bt_link_info->a2dp_exist ) {
if ( bt_hs_on ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = A2DP + PAN(HS)\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_A2DP_PANHS;
} else {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = A2DP + PAN(EDR)\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_A2DP;
}
}
}
} else if ( num_of_diff_profile == 3 ) {
if ( bt_link_info->sco_exist ) {
if ( bt_link_info->hid_exist &&
bt_link_info->a2dp_exist ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], BT Profile = SCO + HID + A2DP ==> HID\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_HID;
} else if ( bt_link_info->hid_exist &&
bt_link_info->pan_exist ) {
if ( bt_hs_on ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = SCO + HID + PAN(HS)\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP;
} else {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = SCO + HID + PAN(EDR)\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
}
} else if ( bt_link_info->pan_exist &&
bt_link_info->a2dp_exist ) {
if ( bt_hs_on ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = SCO + A2DP + PAN(HS)\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_SCO;
} else {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = SCO + A2DP + PAN(EDR) ==> HID\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
}
}
} else {
if ( bt_link_info->hid_exist &&
bt_link_info->pan_exist &&
bt_link_info->a2dp_exist ) {
if ( bt_hs_on ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = HID + A2DP + PAN(HS)\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP;
} else {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = HID + A2DP + PAN(EDR)\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_HID_A2DP_PANEDR;
}
}
}
} else if ( num_of_diff_profile >= 3 ) {
if ( bt_link_info->sco_exist ) {
if ( bt_link_info->hid_exist &&
bt_link_info->pan_exist &&
bt_link_info->a2dp_exist ) {
if ( bt_hs_on ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], Error!!! BT Profile = SCO + HID + A2DP + PAN(HS)\n" );
} else {
RT_TRACE( rtlpriv, COMP_BT_COEXIST,
DBG_LOUD,
"[BTCoex], BT Profile = SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n" );
algorithm = BT_8821A_1ANT_COEX_ALGO_PANEDR_HID;
}
}
}
}
return algorithm;
}
static void btc8821a1ant_set_sw_penalty_tx_rate( struct btc_coexist *btcoexist,
bool low_penalty_ra )
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
u8 h2c_parameter[6] = {0};
h2c_parameter[0] = 0x6; /* opCode, 0x6= Retry_Penalty*/
if ( low_penalty_ra ) {
h2c_parameter[1] |= BIT0;
/* normal rate except MCS7/6/5, OFDM54/48/36 */
h2c_parameter[2] = 0x00;
h2c_parameter[3] = 0xf7; /* MCS7 or OFDM54 */
h2c_parameter[4] = 0xf8; /* MCS6 or OFDM48 */
h2c_parameter[5] = 0xf9; /* MCS5 or OFDM36 */
}
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], set WiFi Low-Penalty Retry: %s",
( low_penalty_ra ? "ON!!" : "OFF!!" ) );
btcoexist->btc_fill_h2c( btcoexist, 0x69, 6, h2c_parameter );
}
static void btc8821a1ant_low_penalty_ra( struct btc_coexist *btcoexist,
bool force_exec, bool low_penalty_ra )
{
coex_dm->cur_low_penalty_ra = low_penalty_ra;
if ( !force_exec ) {
if ( coex_dm->pre_low_penalty_ra == coex_dm->cur_low_penalty_ra )
return;
}
btc8821a1ant_set_sw_penalty_tx_rate( btcoexist,
coex_dm->cur_low_penalty_ra );
coex_dm->pre_low_penalty_ra = coex_dm->cur_low_penalty_ra;
}
static void btc8821a1ant_set_coex_table( struct btc_coexist *btcoexist,
u32 val0x6c0, u32 val0x6c4,
u32 val0x6c8, u8 val0x6cc )
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], set coex table, set 0x6c0 = 0x%x\n", val0x6c0 );
btcoexist->btc_write_4byte( btcoexist, 0x6c0, val0x6c0 );
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], set coex table, set 0x6c4 = 0x%x\n", val0x6c4 );
btcoexist->btc_write_4byte( btcoexist, 0x6c4, val0x6c4 );
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], set coex table, set 0x6c8 = 0x%x\n", val0x6c8 );
btcoexist->btc_write_4byte( btcoexist, 0x6c8, val0x6c8 );
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], set coex table, set 0x6cc = 0x%x\n", val0x6cc );
btcoexist->btc_write_1byte( btcoexist, 0x6cc, val0x6cc );
}
static void btc8821a1ant_coex_table( struct btc_coexist *btcoexist,
bool force_exec, u32 val0x6c0, u32 val0x6c4,
u32 val0x6c8, u8 val0x6cc )
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], %s write Coex Table 0x6c0 = 0x%x, 0x6c4 = 0x%x, 0x6c8 = 0x%x, 0x6cc = 0x%x\n",
( force_exec ? "force to" : "" ), val0x6c0, val0x6c4,
val0x6c8, val0x6cc );
coex_dm->cur_val_0x6c0 = val0x6c0;
coex_dm->cur_val_0x6c4 = val0x6c4;
coex_dm->cur_val_0x6c8 = val0x6c8;
coex_dm->cur_val_0x6cc = val0x6cc;
if ( !force_exec ) {
if ( ( coex_dm->pre_val_0x6c0 == coex_dm->cur_val_0x6c0 ) &&
( coex_dm->pre_val_0x6c4 == coex_dm->cur_val_0x6c4 ) &&
( coex_dm->pre_val_0x6c8 == coex_dm->cur_val_0x6c8 ) &&
( coex_dm->pre_val_0x6cc == coex_dm->cur_val_0x6cc ) )
return;
}
btc8821a1ant_set_coex_table( btcoexist, val0x6c0, val0x6c4,
val0x6c8, val0x6cc );
coex_dm->pre_val_0x6c0 = coex_dm->cur_val_0x6c0;
coex_dm->pre_val_0x6c4 = coex_dm->cur_val_0x6c4;
coex_dm->pre_val_0x6c8 = coex_dm->cur_val_0x6c8;
coex_dm->pre_val_0x6cc = coex_dm->cur_val_0x6cc;
}
static void btc8821a1ant_coex_table_with_type( struct btc_coexist *btcoexist,
bool force_exec, u8 type )
{
switch ( type ) {
case 0:
btc8821a1ant_coex_table( btcoexist, force_exec, 0x55555555,
0x55555555, 0xffffff, 0x3 );
break;
case 1:
btc8821a1ant_coex_table( btcoexist, force_exec, 0x55555555,
0x5a5a5a5a, 0xffffff, 0x3 );
break;
case 2:
btc8821a1ant_coex_table( btcoexist, force_exec, 0x5a5a5a5a,
0x5a5a5a5a, 0xffffff, 0x3 );
break;
case 3:
btc8821a1ant_coex_table( btcoexist, force_exec, 0x5a5a5a5a,
0xaaaaaaaa, 0xffffff, 0x3 );
break;
case 4:
btc8821a1ant_coex_table( btcoexist, force_exec, 0x55555555,
0x5a5a5a5a, 0xffffff, 0x3 );
break;
case 5:
btc8821a1ant_coex_table( btcoexist, force_exec, 0x5a5a5a5a,
0xaaaa5a5a, 0xffffff, 0x3 );
break;
case 6:
btc8821a1ant_coex_table( btcoexist, force_exec, 0x55555555,
0xaaaa5a5a, 0xffffff, 0x3 );
break;
case 7:
btc8821a1ant_coex_table( btcoexist, force_exec, 0xaaaaaaaa,
0xaaaaaaaa, 0xffffff, 0x3 );
break;
default:
break;
}
}
static void btc8821a1ant_set_fw_ignore_wlan_act( struct btc_coexist *btcoexist,
bool enable )
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
u8 h2c_parameter[1] = {0};
if ( enable )
h2c_parameter[0] |= BIT0; /* function enable */
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], set FW for BT Ignore Wlan_Act, FW write 0x63 = 0x%x\n",
h2c_parameter[0] );
btcoexist->btc_fill_h2c( btcoexist, 0x63, 1, h2c_parameter );
}
static void btc8821a1ant_ignore_wlan_act( struct btc_coexist *btcoexist,
bool force_exec, bool enable )
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], %s turn Ignore WlanAct %s\n",
( force_exec ? "force to" : "" ), ( enable ? "ON" : "OFF" ) );
coex_dm->cur_ignore_wlan_act = enable;
if ( !force_exec ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], pre_ignore_wlan_act = %d, cur_ignore_wlan_act = %d!!\n",
coex_dm->pre_ignore_wlan_act,
coex_dm->cur_ignore_wlan_act );
if ( coex_dm->pre_ignore_wlan_act ==
coex_dm->cur_ignore_wlan_act )
return;
}
btc8821a1ant_set_fw_ignore_wlan_act( btcoexist, enable );
coex_dm->pre_ignore_wlan_act = coex_dm->cur_ignore_wlan_act;
}
static void btc8821a1ant_set_fw_ps_tdma( struct btc_coexist *btcoexist, u8 byte1,
u8 byte2, u8 byte3, u8 byte4, u8 byte5 )
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
u8 h2c_parameter[5] = {0};
u8 real_byte1 = byte1, real_byte5 = byte5;
bool ap_enable = false;
btcoexist->btc_get( btcoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE,
&ap_enable );
if ( ap_enable ) {
if ( byte1 & BIT4 && !( byte1 & BIT5 ) ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], FW for 1Ant AP mode\n" );
real_byte1 &= ~BIT4;
real_byte1 |= BIT5;
real_byte5 |= BIT5;
real_byte5 &= ~BIT6;
}
}
h2c_parameter[0] = real_byte1;
h2c_parameter[1] = byte2;
h2c_parameter[2] = byte3;
h2c_parameter[3] = byte4;
h2c_parameter[4] = real_byte5;
coex_dm->ps_tdma_para[0] = real_byte1;
coex_dm->ps_tdma_para[1] = byte2;
coex_dm->ps_tdma_para[2] = byte3;
coex_dm->ps_tdma_para[3] = byte4;
coex_dm->ps_tdma_para[4] = real_byte5;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], PS-TDMA H2C cmd =0x%x%08x\n",
h2c_parameter[0],
h2c_parameter[1] << 24 |
h2c_parameter[2] << 16 |
h2c_parameter[3] << 8 |
h2c_parameter[4] );
btcoexist->btc_fill_h2c( btcoexist, 0x60, 5, h2c_parameter );
}
static void btc8821a1ant_set_lps_rpwm( struct btc_coexist *btcoexist,
u8 lps_val, u8 rpwm_val )
{
u8 lps = lps_val;
u8 rpwm = rpwm_val;
btcoexist->btc_set( btcoexist, BTC_SET_U1_LPS_VAL, &lps );
btcoexist->btc_set( btcoexist, BTC_SET_U1_RPWM_VAL, &rpwm );
}
static void btc8821a1ant_lps_rpwm( struct btc_coexist *btcoexist,
bool force_exec, u8 lps_val, u8 rpwm_val )
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], %s set lps/rpwm = 0x%x/0x%x\n",
( force_exec ? "force to" : "" ), lps_val, rpwm_val );
coex_dm->cur_lps = lps_val;
coex_dm->cur_rpwm = rpwm_val;
if ( !force_exec ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], LPS-RxBeaconMode = 0x%x, LPS-RPWM = 0x%x!!\n",
coex_dm->cur_lps, coex_dm->cur_rpwm );
if ( ( coex_dm->pre_lps == coex_dm->cur_lps ) &&
( coex_dm->pre_rpwm == coex_dm->cur_rpwm ) ) {
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], LPS-RPWM_Last = 0x%x, LPS-RPWM_Now = 0x%x!!\n",
coex_dm->pre_rpwm, coex_dm->cur_rpwm );
return;
}
}
btc8821a1ant_set_lps_rpwm( btcoexist, lps_val, rpwm_val );
coex_dm->pre_lps = coex_dm->cur_lps;
coex_dm->pre_rpwm = coex_dm->cur_rpwm;
}
static void btc8821a1ant_sw_mechanism( struct btc_coexist *btcoexist,
bool low_penalty_ra )
{
struct rtl_priv *rtlpriv = btcoexist->adapter;
RT_TRACE( rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
"[BTCoex], SM[LpRA] = %d\n", low_penalty_ra );
btc8821a1ant_low_penalty_ra( btcoexist, NORMAL_EXEC, low_penalty_ra );
}
static void btc8821a1ant_set_ant_path( struct btc_coexist *btcoexist,
u8 ant_pos_type, bool init_hw_cfg,
bool wifi_off )
{
struct btc_board_info *board_info = &btcoexist->board_info;
u32 u4_tmp = 0;
u8 h2c_parameter[2] = {0};
if ( init_hw_cfg ) {
/* 0x4c[23] = 0, 0x4c[24] = 1 Antenna control by WL/BT */
u4_tmp = btcoexist->btc_read_4byte( btcoexist, 0x4c );
u4_tmp &= ~BIT23;
u4_tmp |= BIT24;
btcoexist->btc_write_4byte( btcoexist, 0x4c, u4_tmp );
btcoexist->btc_write_1byte_bitmask( btcoexist, 0x975, 0x3, 0x3 );
btcoexist->btc_write_1byte( btcoexist, 0xcb4, 0x77 );
if ( board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT ) {
/* tell firmware "antenna inverse"
* WRONG firmware antenna control code, need fw to fix
*/
h2c_parameter[0] = 1;
h2c_parameter[1] = 1;
btcoexist->btc_fill_h2c( btcoexist, 0x65, 2,
h2c_parameter );
} else {
/* tell firmware "no antenna inverse"
* WRONG firmware antenna control code, need fw to fix
*/
h2c_parameter[0] = 0;
h2c_parameter[1] = 1;
btcoexist->btc_fill_h2c( btcoexist, 0x65, 2,
h2c_parameter );
}
} else if ( wifi_off ) {
/* 0x4c[24:23] = 00, Set Antenna control
* by BT_RFE_CTRL BT Vendor 0xac = 0xf002
*/
u4_tmp = btcoexist->btc_read_4byte( btcoexist, 0x4c );
u4_tmp &= ~BIT23;
u4_tmp &= ~BIT24;
btcoexist->btc_write_4byte( btcoexist, 0x4c, u4_tmp );
/* 0x765 = 0x18 */
btcoexist->btc_write_1byte_bitmask( btcoexist, 0x765, 0x18, 0x3 );
} else {
/* 0x765 = 0x0 */
btcoexist->btc_write_1byte_bitmask( btcoexist, 0x765, 0x18, 0x0 );
}
/* ext switch setting */
switch ( ant_pos_type ) {
case BTC_ANT_PATH_WIFI:
btcoexist->btc_write_1byte( btcoexist, 0xcb4, 0x77 );
if ( board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT )
btcoexist->btc_write_1byte_bitmask( btcoexist, 0xcb7,
0x30, 0x1 );
else
btcoexist->btc_write_1byte_bitmask( btcoexist, 0xcb7,
0x30, 0x2 );
break;
case BTC_ANT_PATH_BT:
btcoexist->btc_write_1byte( btcoexist, 0xcb4, 0x77 );
if ( board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT )
btcoexist->btc_write_1byte_bitmask( btcoexist, 0xcb7,
0x30, 0x2 );
else
btcoexist->btc_write_1byte_bitmask( btcoexist, 0xcb7,
0x30, 0x1 );
break;
default:
case BTC_ANT_PATH_PTA:
btcoexist->btc_write_1byte( btcoexist, 0xcb4, 0x66 );
if ( board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT )
btcoexist->btc_write_1byte_bitmask( btcoexist, 0xcb7,
0x30, 0x1 );
else
btcoexist->btc_write_1byte_bitmask( btcoexist, 0xcb7,
0x30, 0x2 );
break;
}
}