2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 * Purpose: Implement functions to access baseband
29 * vnt_get_frame_time - Calculate data frame transmitting time
30 * vnt_get_phy_field - Calculate PhyLength, PhyService and Phy
31 * Signal parameter for baseband Tx
32 * vnt_vt3184_init - VIA VT3184 baseband chip init code
44 static u8 vnt_vt3184_agc
[] = {
45 0x00, 0x00, 0x02, 0x02, 0x04, 0x04, 0x06, 0x06,
46 0x08, 0x08, 0x0a, 0x0a, 0x0c, 0x0c, 0x0e, 0x0e, /* 0x0f */
47 0x10, 0x10, 0x12, 0x12, 0x14, 0x14, 0x16, 0x16,
48 0x18, 0x18, 0x1a, 0x1a, 0x1c, 0x1c, 0x1e, 0x1e, /* 0x1f */
49 0x20, 0x20, 0x22, 0x22, 0x24, 0x24, 0x26, 0x26,
50 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c, 0x2e, 0x2e, /* 0x2f */
51 0x30, 0x30, 0x32, 0x32, 0x34, 0x34, 0x36, 0x36,
52 0x38, 0x38, 0x3a, 0x3a, 0x3c, 0x3c, 0x3e, 0x3e /* 0x3f */
55 static u8 vnt_vt3184_al2230
[] = {
56 0x31, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
57 0x70, 0x45, 0x2a, 0x76, 0x00, 0x00, 0x80, 0x00, /* 0x0f */
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0x00, 0x00, 0x00, 0x8e, 0x0a, 0x00, 0x00, 0x00, /* 0x1f */
60 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00,
61 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x0c, /* 0x2f */
62 0x26, 0x5b, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa,
63 0xff, 0xff, 0x79, 0x00, 0x00, 0x0b, 0x48, 0x04, /* 0x3f */
64 0x00, 0x08, 0x00, 0x08, 0x08, 0x14, 0x05, 0x09,
65 0x00, 0x00, 0x00, 0x00, 0x09, 0x73, 0x00, 0xc5, /* 0x4f */
66 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67 0x00, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x5f */
68 0xe4, 0x80, 0x00, 0x00, 0x00, 0x00, 0x98, 0x0a,
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, /* 0x6f */
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x7f */
72 0x8c, 0x01, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00,
73 0x08, 0x00, 0x1f, 0xb7, 0x88, 0x47, 0xaa, 0x00, /* 0x8f */
74 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xeb,
75 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* 0x9f */
76 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
77 0x18, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x18, /* 0xaf */
78 0x38, 0x30, 0x00, 0x00, 0xff, 0x0f, 0xe4, 0xe2,
79 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, /* 0xbf */
80 0x18, 0x20, 0x07, 0x18, 0xff, 0xff, 0x0e, 0x0a,
81 0x0e, 0x00, 0x82, 0xa7, 0x3c, 0x10, 0x30, 0x05, /* 0xcf */
82 0x40, 0x12, 0x00, 0x00, 0x10, 0x28, 0x80, 0x2a,
83 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xdf */
84 0x00, 0xf3, 0x00, 0x00, 0x00, 0x10, 0x00, 0x12,
85 0x00, 0xf4, 0x00, 0xff, 0x79, 0x20, 0x30, 0x05, /* 0xef */
86 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
87 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0xff */
90 /* {{RobertYu:20060515, new BB setting for VT3226D0 */
91 static u8 vnt_vt3184_vt3226d0
[] = {
92 0x31, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
93 0x70, 0x45, 0x2a, 0x76, 0x00, 0x00, 0x80, 0x00, /* 0x0f */
94 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
95 0x00, 0x00, 0x00, 0x8e, 0x0a, 0x00, 0x00, 0x00, /* 0x1f */
96 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00,
97 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x0c, /* 0x2f */
98 0x26, 0x5b, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa,
99 0xff, 0xff, 0x79, 0x00, 0x00, 0x0b, 0x48, 0x04, /* 0x3f */
100 0x00, 0x08, 0x00, 0x08, 0x08, 0x14, 0x05, 0x09,
101 0x00, 0x00, 0x00, 0x00, 0x09, 0x73, 0x00, 0xc5, /* 0x4f */
102 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
103 0x00, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x5f */
104 0xe4, 0x80, 0x00, 0x00, 0x00, 0x00, 0x98, 0x0a,
105 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, /* 0x6f */
106 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
107 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x7f */
108 0x8c, 0x01, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00,
109 0x08, 0x00, 0x1f, 0xb7, 0x88, 0x47, 0xaa, 0x00, /* 0x8f */
110 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xeb,
111 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* 0x9f */
112 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
113 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, /* 0xaf */
114 0x38, 0x30, 0x00, 0x00, 0xff, 0x0f, 0xe4, 0xe2,
115 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, /* 0xbf */
116 0x18, 0x20, 0x07, 0x18, 0xff, 0xff, 0x10, 0x0a,
117 0x0e, 0x00, 0x84, 0xa7, 0x3c, 0x10, 0x24, 0x05, /* 0xcf */
118 0x40, 0x12, 0x00, 0x00, 0x10, 0x28, 0x80, 0x2a,
119 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xdf */
120 0x00, 0xf3, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10,
121 0x00, 0xf4, 0x00, 0xff, 0x79, 0x20, 0x30, 0x08, /* 0xef */
122 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0xff */
126 static const u16 vnt_frame_time
[MAX_RATE
] = {
127 10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216
131 * Description: Calculate data frame transmitting time
135 * preamble_type - Preamble Type
136 * pkt_type - PK_TYPE_11A, PK_TYPE_11B, PK_TYPE_11GB, PK_TYPE_11GA
137 * frame_length - Baseband Type
141 * Return Value: FrameTime
144 unsigned int vnt_get_frame_time(u8 preamble_type
, u8 pkt_type
,
145 unsigned int frame_length
, u16 tx_rate
)
147 unsigned int frame_time
;
148 unsigned int preamble
;
150 unsigned int rate
= 0;
152 if (tx_rate
> RATE_54M
)
155 rate
= (unsigned int)vnt_frame_time
[tx_rate
];
158 if (preamble_type
== 1)
163 frame_time
= (frame_length
* 80) / rate
;
164 tmp
= (frame_time
* rate
) / 80;
166 if (frame_length
!= tmp
)
169 return preamble
+ frame_time
;
171 frame_time
= (frame_length
* 8 + 22) / rate
;
172 tmp
= ((frame_time
* rate
) - 22) / 8;
174 if (frame_length
!= tmp
)
177 frame_time
= frame_time
* 4;
179 if (pkt_type
!= PK_TYPE_11A
)
181 return 20 + frame_time
;
185 * Description: Calculate Length, Service, and Signal fields of Phy for Tx
189 * priv - Device Structure
190 * frame_length - Tx Frame Length
193 * struct vnt_phy_field *phy
194 * - pointer to Phy Length field
195 * - pointer to Phy Service field
196 * - pointer to Phy Signal field
201 void vnt_get_phy_field(struct vnt_private
*priv
, u32 frame_length
,
202 u16 tx_rate
, u8 pkt_type
, struct vnt_phy_field
*phy
)
208 u8 preamble_type
= priv
->preamble_type
;
210 bit_count
= frame_length
* 8;
221 count
= bit_count
/ 2;
223 if (preamble_type
== 1)
230 count
= (bit_count
* 10) / 55;
231 tmp
= (count
* 55) / 10;
233 if (tmp
!= bit_count
)
236 if (preamble_type
== 1)
243 count
= bit_count
/ 11;
246 if (tmp
!= bit_count
) {
249 if ((bit_count
- tmp
) <= 3)
253 if (preamble_type
== 1)
260 if (pkt_type
== PK_TYPE_11A
)
267 if (pkt_type
== PK_TYPE_11A
)
274 if (pkt_type
== PK_TYPE_11A
)
281 if (pkt_type
== PK_TYPE_11A
)
288 if (pkt_type
== PK_TYPE_11A
)
295 if (pkt_type
== PK_TYPE_11A
)
302 if (pkt_type
== PK_TYPE_11A
)
309 if (pkt_type
== PK_TYPE_11A
)
315 if (pkt_type
== PK_TYPE_11A
)
322 if (pkt_type
== PK_TYPE_11B
) {
325 phy
->service
|= 0x80;
326 phy
->len
= cpu_to_le16((u16
)count
);
329 phy
->len
= cpu_to_le16((u16
)frame_length
);
334 * Description: Set Antenna mode
338 * priv - Device Structure
339 * antenna_mode - Antenna Mode
346 void vnt_set_antenna_mode(struct vnt_private
*priv
, u8 antenna_mode
)
348 switch (antenna_mode
) {
353 priv
->bb_rx_conf
&= 0xFC;
356 priv
->bb_rx_conf
&= 0xFE;
357 priv
->bb_rx_conf
|= 0x02;
361 vnt_control_out(priv
, MESSAGE_TYPE_SET_ANTMD
,
362 (u16
)antenna_mode
, 0, 0, NULL
);
366 * Description: Set Antenna mode
370 * pDevice - Device Structure
371 * byAntennaMode - Antenna Mode
379 int vnt_vt3184_init(struct vnt_private
*priv
)
389 status
= vnt_control_in(priv
, MESSAGE_TYPE_READ
, 0,
390 MESSAGE_REQUEST_EEPROM
, EEP_MAX_CONTEXT_SIZE
,
392 if (status
!= STATUS_SUCCESS
)
395 priv
->rf_type
= priv
->eeprom
[EEP_OFS_RFTYPE
];
397 dev_dbg(&priv
->usb
->dev
, "RF Type %d\n", priv
->rf_type
);
399 if ((priv
->rf_type
== RF_AL2230
) ||
400 (priv
->rf_type
== RF_AL2230S
)) {
401 priv
->bb_rx_conf
= vnt_vt3184_al2230
[10];
402 length
= sizeof(vnt_vt3184_al2230
);
403 addr
= vnt_vt3184_al2230
;
404 agc
= vnt_vt3184_agc
;
405 length_agc
= sizeof(vnt_vt3184_agc
);
407 priv
->bb_vga
[0] = 0x1C;
408 priv
->bb_vga
[1] = 0x10;
409 priv
->bb_vga
[2] = 0x0;
410 priv
->bb_vga
[3] = 0x0;
412 } else if (priv
->rf_type
== RF_AIROHA7230
) {
413 priv
->bb_rx_conf
= vnt_vt3184_al2230
[10];
414 length
= sizeof(vnt_vt3184_al2230
);
415 addr
= vnt_vt3184_al2230
;
416 agc
= vnt_vt3184_agc
;
417 length_agc
= sizeof(vnt_vt3184_agc
);
421 priv
->bb_vga
[0] = 0x1c;
422 priv
->bb_vga
[1] = 0x10;
423 priv
->bb_vga
[2] = 0x0;
424 priv
->bb_vga
[3] = 0x0;
426 } else if ((priv
->rf_type
== RF_VT3226
) ||
427 (priv
->rf_type
== RF_VT3226D0
)) {
428 priv
->bb_rx_conf
= vnt_vt3184_vt3226d0
[10];
429 length
= sizeof(vnt_vt3184_vt3226d0
);
430 addr
= vnt_vt3184_vt3226d0
;
431 agc
= vnt_vt3184_agc
;
432 length_agc
= sizeof(vnt_vt3184_agc
);
434 priv
->bb_vga
[0] = 0x20;
435 priv
->bb_vga
[1] = 0x10;
436 priv
->bb_vga
[2] = 0x0;
437 priv
->bb_vga
[3] = 0x0;
439 /* Fix VT3226 DFC system timing issue */
440 vnt_mac_reg_bits_on(priv
, MAC_REG_SOFTPWRCTL2
,
442 } else if (priv
->rf_type
== RF_VT3342A0
) {
443 priv
->bb_rx_conf
= vnt_vt3184_vt3226d0
[10];
444 length
= sizeof(vnt_vt3184_vt3226d0
);
445 addr
= vnt_vt3184_vt3226d0
;
446 agc
= vnt_vt3184_agc
;
447 length_agc
= sizeof(vnt_vt3184_agc
);
449 priv
->bb_vga
[0] = 0x20;
450 priv
->bb_vga
[1] = 0x10;
451 priv
->bb_vga
[2] = 0x0;
452 priv
->bb_vga
[3] = 0x0;
454 /* Fix VT3226 DFC system timing issue */
455 vnt_mac_reg_bits_on(priv
, MAC_REG_SOFTPWRCTL2
,
461 memcpy(array
, addr
, length
);
463 vnt_control_out(priv
, MESSAGE_TYPE_WRITE
, 0,
464 MESSAGE_REQUEST_BBREG
, length
, array
);
466 memcpy(array
, agc
, length_agc
);
468 vnt_control_out(priv
, MESSAGE_TYPE_WRITE
, 0,
469 MESSAGE_REQUEST_BBAGC
, length_agc
, array
);
471 if ((priv
->rf_type
== RF_VT3226
) ||
472 (priv
->rf_type
== RF_VT3342A0
)) {
473 vnt_control_out_u8(priv
, MESSAGE_REQUEST_MACREG
,
474 MAC_REG_ITRTMSET
, 0x23);
475 vnt_mac_reg_bits_on(priv
, MAC_REG_PAPEDELAY
, 0x01);
476 } else if (priv
->rf_type
== RF_VT3226D0
) {
477 vnt_control_out_u8(priv
, MESSAGE_REQUEST_MACREG
,
478 MAC_REG_ITRTMSET
, 0x11);
479 vnt_mac_reg_bits_on(priv
, MAC_REG_PAPEDELAY
, 0x01);
482 vnt_control_out_u8(priv
, MESSAGE_REQUEST_BBREG
, 0x04, 0x7f);
483 vnt_control_out_u8(priv
, MESSAGE_REQUEST_BBREG
, 0x0d, 0x01);
485 vnt_rf_table_download(priv
);
487 /* Fix for TX USB resets from vendors driver */
488 vnt_control_in(priv
, MESSAGE_TYPE_READ
, USB_REG4
,
489 MESSAGE_REQUEST_MEM
, sizeof(data
), &data
);
493 vnt_control_out(priv
, MESSAGE_TYPE_WRITE
, USB_REG4
,
494 MESSAGE_REQUEST_MEM
, sizeof(data
), &data
);
500 * Description: Set ShortSlotTime mode
504 * priv - Device Structure
511 void vnt_set_short_slot_time(struct vnt_private
*priv
)
515 if (priv
->short_slot_time
)
516 priv
->bb_rx_conf
&= 0xdf;
518 priv
->bb_rx_conf
|= 0x20;
520 vnt_control_in_u8(priv
, MESSAGE_REQUEST_BBREG
, 0xe7, &bb_vga
);
522 if (bb_vga
== priv
->bb_vga
[0])
523 priv
->bb_rx_conf
|= 0x20;
525 vnt_control_out_u8(priv
, MESSAGE_REQUEST_BBREG
, 0x0a, priv
->bb_rx_conf
);
528 void vnt_set_vga_gain_offset(struct vnt_private
*priv
, u8 data
)
530 vnt_control_out_u8(priv
, MESSAGE_REQUEST_BBREG
, 0xE7, data
);
532 /* patch for 3253B0 Baseband with Cardbus module */
533 if (priv
->short_slot_time
)
534 priv
->bb_rx_conf
&= 0xdf; /* 1101 1111 */
536 priv
->bb_rx_conf
|= 0x20; /* 0010 0000 */
538 vnt_control_out_u8(priv
, MESSAGE_REQUEST_BBREG
, 0x0a, priv
->bb_rx_conf
);
542 * Description: vnt_set_deep_sleep
546 * priv - Device Structure
553 void vnt_set_deep_sleep(struct vnt_private
*priv
)
555 vnt_control_out_u8(priv
, MESSAGE_REQUEST_BBREG
, 0x0c, 0x17);/* CR12 */
556 vnt_control_out_u8(priv
, MESSAGE_REQUEST_BBREG
, 0x0d, 0xB9);/* CR13 */
559 void vnt_exit_deep_sleep(struct vnt_private
*priv
)
561 vnt_control_out_u8(priv
, MESSAGE_REQUEST_BBREG
, 0x0c, 0x00);/* CR12 */
562 vnt_control_out_u8(priv
, MESSAGE_REQUEST_BBREG
, 0x0d, 0x01);/* CR13 */
565 void vnt_update_pre_ed_threshold(struct vnt_private
*priv
, int scanning
)
567 u8 cr_201
= 0x0, cr_206
= 0x0;
568 u8 ed_inx
= priv
->bb_pre_ed_index
;
570 switch (priv
->rf_type
) {
574 if (scanning
) { /* Max sensitivity */
580 if (priv
->bb_pre_ed_rssi
<= 45) {
583 } else if (priv
->bb_pre_ed_rssi
<= 46) {
586 } else if (priv
->bb_pre_ed_rssi
<= 47) {
589 } else if (priv
->bb_pre_ed_rssi
<= 49) {
592 } else if (priv
->bb_pre_ed_rssi
<= 51) {
595 } else if (priv
->bb_pre_ed_rssi
<= 53) {
598 } else if (priv
->bb_pre_ed_rssi
<= 55) {
601 } else if (priv
->bb_pre_ed_rssi
<= 56) {
605 } else if (priv
->bb_pre_ed_rssi
<= 57) {
609 } else if (priv
->bb_pre_ed_rssi
<= 58) {
613 } else if (priv
->bb_pre_ed_rssi
<= 59) {
617 } else if (priv
->bb_pre_ed_rssi
<= 60) {
621 } else if (priv
->bb_pre_ed_rssi
<= 61) {
624 } else if (priv
->bb_pre_ed_rssi
<= 62) {
627 } else if (priv
->bb_pre_ed_rssi
<= 63) {
630 } else if (priv
->bb_pre_ed_rssi
<= 64) {
633 } else if (priv
->bb_pre_ed_rssi
<= 65) {
636 } else if (priv
->bb_pre_ed_rssi
<= 66) {
639 } else if (priv
->bb_pre_ed_rssi
<= 67) {
642 } else if (priv
->bb_pre_ed_rssi
<= 68) {
653 if (scanning
) { /* Max sensitivity */
659 if (priv
->bb_pre_ed_rssi
<= 41) {
662 } else if (priv
->bb_pre_ed_rssi
<= 42) {
665 } else if (priv
->bb_pre_ed_rssi
<= 43) {
668 } else if (priv
->bb_pre_ed_rssi
<= 45) {
671 } else if (priv
->bb_pre_ed_rssi
<= 47) {
674 } else if (priv
->bb_pre_ed_rssi
<= 49) {
677 } else if (priv
->bb_pre_ed_rssi
<= 51) {
680 } else if (priv
->bb_pre_ed_rssi
<= 53) {
683 } else if (priv
->bb_pre_ed_rssi
<= 55) {
687 } else if (priv
->bb_pre_ed_rssi
<= 56) {
691 } else if (priv
->bb_pre_ed_rssi
<= 57) {
695 } else if (priv
->bb_pre_ed_rssi
<= 58) {
699 } else if (priv
->bb_pre_ed_rssi
<= 59) {
703 } else if (priv
->bb_pre_ed_rssi
<= 60) {
706 } else if (priv
->bb_pre_ed_rssi
<= 61) {
709 } else if (priv
->bb_pre_ed_rssi
<= 62) {
712 } else if (priv
->bb_pre_ed_rssi
<= 63) {
715 } else if (priv
->bb_pre_ed_rssi
<= 64) {
718 } else if (priv
->bb_pre_ed_rssi
<= 65) {
721 } else if (priv
->bb_pre_ed_rssi
<= 66) {
724 } else if (priv
->bb_pre_ed_rssi
<= 67) {
727 } else if (priv
->bb_pre_ed_rssi
<= 68) {
737 if (scanning
) { /* need Max sensitivity */
743 if (priv
->bb_pre_ed_rssi
<= 41) {
746 } else if (priv
->bb_pre_ed_rssi
<= 42) {
749 } else if (priv
->bb_pre_ed_rssi
<= 43) {
752 } else if (priv
->bb_pre_ed_rssi
<= 45) {
755 } else if (priv
->bb_pre_ed_rssi
<= 47) {
758 } else if (priv
->bb_pre_ed_rssi
<= 49) {
761 } else if (priv
->bb_pre_ed_rssi
<= 51) {
764 } else if (priv
->bb_pre_ed_rssi
<= 53) {
767 } else if (priv
->bb_pre_ed_rssi
<= 55) {
771 } else if (priv
->bb_pre_ed_rssi
<= 56) {
775 } else if (priv
->bb_pre_ed_rssi
<= 57) {
779 } else if (priv
->bb_pre_ed_rssi
<= 58) {
783 } else if (priv
->bb_pre_ed_rssi
<= 59) {
787 } else if (priv
->bb_pre_ed_rssi
<= 60) {
790 } else if (priv
->bb_pre_ed_rssi
<= 61) {
793 } else if (priv
->bb_pre_ed_rssi
<= 62) {
796 } else if (priv
->bb_pre_ed_rssi
<= 63) {
799 } else if (priv
->bb_pre_ed_rssi
<= 64) {
802 } else if (priv
->bb_pre_ed_rssi
<= 65) {
805 } else if (priv
->bb_pre_ed_rssi
<= 66) {
815 if (ed_inx
== priv
->bb_pre_ed_index
&& !scanning
)
818 priv
->bb_pre_ed_index
= ed_inx
;
820 dev_dbg(&priv
->usb
->dev
, "%s bb_pre_ed_rssi %d\n",
821 __func__
, priv
->bb_pre_ed_rssi
);
823 if (!cr_201
&& !cr_206
)
826 vnt_control_out_u8(priv
, MESSAGE_REQUEST_BBREG
, 0xc9, cr_201
);
827 vnt_control_out_u8(priv
, MESSAGE_REQUEST_BBREG
, 0xce, cr_206
);