Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cris-mirror.git] / drivers / staging / vt6656 / card.c
bloba382fc6aa9d3a55827635342fdc9c4cab284d722
1 /*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
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.
16 * File: card.c
17 * Purpose: Provide functions to setup NIC operation mode
18 * Functions:
19 * vnt_set_rspinf - Set RSPINF
20 * vnt_update_ifs - Update slotTime,SIFS,DIFS, and EIFS
21 * vnt_update_top_rates - Update BasicTopRate
22 * vnt_add_basic_rate - Add to BasicRateSet
23 * vnt_ofdm_min_rate - Check if any OFDM rate is in BasicRateSet
24 * vnt_get_tsf_offset - Calculate TSFOffset
25 * vnt_get_current_tsf - Read Current NIC TSF counter
26 * vnt_get_next_tbtt - Calculate Next Beacon TSF counter
27 * vnt_reset_next_tbtt - Set NIC Beacon time
28 * vnt_update_next_tbtt - Sync. NIC Beacon time
29 * vnt_radio_power_off - Turn Off NIC Radio Power
30 * vnt_radio_power_on - Turn On NIC Radio Power
32 * Revision History:
33 * 06-10-2003 Bryan YC Fan: Re-write codes to support VT3253 spec.
34 * 08-26-2003 Kyle Hsu: Modify the definition type of dwIoBase.
35 * 09-01-2003 Bryan YC Fan: Add vnt_update_ifs().
39 #include "device.h"
40 #include "card.h"
41 #include "baseband.h"
42 #include "mac.h"
43 #include "desc.h"
44 #include "rf.h"
45 #include "power.h"
46 #include "key.h"
47 #include "usbpipe.h"
49 /* const u16 cwRXBCNTSFOff[MAX_RATE] =
50 {17, 34, 96, 192, 34, 23, 17, 11, 8, 5, 4, 3}; */
52 static const u16 cwRXBCNTSFOff[MAX_RATE] = {
53 192, 96, 34, 17, 34, 23, 17, 11, 8, 5, 4, 3
57 * Description: Set NIC media channel
59 * Parameters:
60 * In:
61 * pDevice - The adapter to be set
62 * connection_channel - Channel to be set
63 * Out:
64 * none
66 void vnt_set_channel(struct vnt_private *priv, u32 connection_channel)
69 if (connection_channel > CB_MAX_CHANNEL || !connection_channel)
70 return;
72 /* clear NAV */
73 vnt_mac_reg_bits_on(priv, MAC_REG_MACCR, MACCR_CLRNAV);
75 /* Set Channel[7] = 0 to tell H/W channel is changing now. */
76 vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL, 0xb0);
78 vnt_control_out(priv, MESSAGE_TYPE_SELECT_CHANNEL,
79 connection_channel, 0, 0, NULL);
81 vnt_control_out_u8(priv, MESSAGE_REQUEST_MACREG, MAC_REG_CHANNEL,
82 (u8)(connection_channel | 0x80));
86 * Description: Get CCK mode basic rate
88 * Parameters:
89 * In:
90 * priv - The adapter to be set
91 * rate_idx - Receiving data rate
92 * Out:
93 * none
95 * Return Value: response Control frame rate
98 static u16 vnt_get_cck_rate(struct vnt_private *priv, u16 rate_idx)
100 u16 ui = rate_idx;
102 while (ui > RATE_1M) {
103 if (priv->basic_rates & (1 << ui))
104 return ui;
105 ui--;
108 return RATE_1M;
112 * Description: Get OFDM mode basic rate
114 * Parameters:
115 * In:
116 * priv - The adapter to be set
117 * rate_idx - Receiving data rate
118 * Out:
119 * none
121 * Return Value: response Control frame rate
124 static u16 vnt_get_ofdm_rate(struct vnt_private *priv, u16 rate_idx)
126 u16 ui = rate_idx;
128 dev_dbg(&priv->usb->dev, "%s basic rate: %d\n",
129 __func__, priv->basic_rates);
131 if (!vnt_ofdm_min_rate(priv)) {
132 dev_dbg(&priv->usb->dev, "%s (NO OFDM) %d\n",
133 __func__, rate_idx);
134 if (rate_idx > RATE_24M)
135 rate_idx = RATE_24M;
136 return rate_idx;
139 while (ui > RATE_11M) {
140 if (priv->basic_rates & (1 << ui)) {
141 dev_dbg(&priv->usb->dev, "%s rate: %d\n",
142 __func__, ui);
143 return ui;
145 ui--;
148 dev_dbg(&priv->usb->dev, "%s basic rate: 24M\n", __func__);
150 return RATE_24M;
154 * Description: Calculate TxRate and RsvTime fields for RSPINF in OFDM mode.
156 * Parameters:
157 * In:
158 * rate - Tx Rate
159 * bb_type - Tx Packet type
160 * Out:
161 * tx_rate - pointer to RSPINF TxRate field
162 * rsv_time- pointer to RSPINF RsvTime field
164 * Return Value: none
167 static void vnt_calculate_ofdm_rate(u16 rate, u8 bb_type,
168 u8 *tx_rate, u8 *rsv_time)
171 switch (rate) {
172 case RATE_6M:
173 if (bb_type == BB_TYPE_11A) {
174 *tx_rate = 0x9b;
175 *rsv_time = 24;
176 } else {
177 *tx_rate = 0x8b;
178 *rsv_time = 30;
180 break;
181 case RATE_9M:
182 if (bb_type == BB_TYPE_11A) {
183 *tx_rate = 0x9f;
184 *rsv_time = 16;
185 } else {
186 *tx_rate = 0x8f;
187 *rsv_time = 22;
189 break;
190 case RATE_12M:
191 if (bb_type == BB_TYPE_11A) {
192 *tx_rate = 0x9a;
193 *rsv_time = 12;
194 } else {
195 *tx_rate = 0x8a;
196 *rsv_time = 18;
198 break;
199 case RATE_18M:
200 if (bb_type == BB_TYPE_11A) {
201 *tx_rate = 0x9e;
202 *rsv_time = 8;
203 } else {
204 *tx_rate = 0x8e;
205 *rsv_time = 14;
207 break;
208 case RATE_36M:
209 if (bb_type == BB_TYPE_11A) {
210 *tx_rate = 0x9d;
211 *rsv_time = 4;
212 } else {
213 *tx_rate = 0x8d;
214 *rsv_time = 10;
216 break;
217 case RATE_48M:
218 if (bb_type == BB_TYPE_11A) {
219 *tx_rate = 0x98;
220 *rsv_time = 4;
221 } else {
222 *tx_rate = 0x88;
223 *rsv_time = 10;
225 break;
226 case RATE_54M:
227 if (bb_type == BB_TYPE_11A) {
228 *tx_rate = 0x9c;
229 *rsv_time = 4;
230 } else {
231 *tx_rate = 0x8c;
232 *rsv_time = 10;
234 break;
235 case RATE_24M:
236 default:
237 if (bb_type == BB_TYPE_11A) {
238 *tx_rate = 0x99;
239 *rsv_time = 8;
240 } else {
241 *tx_rate = 0x89;
242 *rsv_time = 14;
244 break;
249 * Description: Set RSPINF
251 * Parameters:
252 * In:
253 * pDevice - The adapter to be set
254 * Out:
255 * none
257 * Return Value: None.
261 void vnt_set_rspinf(struct vnt_private *priv, u8 bb_type)
263 struct vnt_phy_field phy[4];
264 u8 tx_rate[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; /* For OFDM */
265 u8 rsv_time[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
266 u8 data[34];
267 int i;
269 /*RSPINF_b_1*/
270 vnt_get_phy_field(priv, 14,
271 vnt_get_cck_rate(priv, RATE_1M), PK_TYPE_11B, &phy[0]);
273 /*RSPINF_b_2*/
274 vnt_get_phy_field(priv, 14,
275 vnt_get_cck_rate(priv, RATE_2M), PK_TYPE_11B, &phy[1]);
277 /*RSPINF_b_5*/
278 vnt_get_phy_field(priv, 14,
279 vnt_get_cck_rate(priv, RATE_5M), PK_TYPE_11B, &phy[2]);
281 /*RSPINF_b_11*/
282 vnt_get_phy_field(priv, 14,
283 vnt_get_cck_rate(priv, RATE_11M), PK_TYPE_11B, &phy[3]);
285 /*RSPINF_a_6*/
286 vnt_calculate_ofdm_rate(RATE_6M, bb_type, &tx_rate[0], &rsv_time[0]);
288 /*RSPINF_a_9*/
289 vnt_calculate_ofdm_rate(RATE_9M, bb_type, &tx_rate[1], &rsv_time[1]);
291 /*RSPINF_a_12*/
292 vnt_calculate_ofdm_rate(RATE_12M, bb_type, &tx_rate[2], &rsv_time[2]);
294 /*RSPINF_a_18*/
295 vnt_calculate_ofdm_rate(RATE_18M, bb_type, &tx_rate[3], &rsv_time[3]);
297 /*RSPINF_a_24*/
298 vnt_calculate_ofdm_rate(RATE_24M, bb_type, &tx_rate[4], &rsv_time[4]);
300 /*RSPINF_a_36*/
301 vnt_calculate_ofdm_rate(vnt_get_ofdm_rate(priv, RATE_36M),
302 bb_type, &tx_rate[5], &rsv_time[5]);
304 /*RSPINF_a_48*/
305 vnt_calculate_ofdm_rate(vnt_get_ofdm_rate(priv, RATE_48M),
306 bb_type, &tx_rate[6], &rsv_time[6]);
308 /*RSPINF_a_54*/
309 vnt_calculate_ofdm_rate(vnt_get_ofdm_rate(priv, RATE_54M),
310 bb_type, &tx_rate[7], &rsv_time[7]);
312 /*RSPINF_a_72*/
313 vnt_calculate_ofdm_rate(vnt_get_ofdm_rate(priv, RATE_54M),
314 bb_type, &tx_rate[8], &rsv_time[8]);
316 put_unaligned(phy[0].len, (u16 *)&data[0]);
317 data[2] = phy[0].signal;
318 data[3] = phy[0].service;
320 put_unaligned(phy[1].len, (u16 *)&data[4]);
321 data[6] = phy[1].signal;
322 data[7] = phy[1].service;
324 put_unaligned(phy[2].len, (u16 *)&data[8]);
325 data[10] = phy[2].signal;
326 data[11] = phy[2].service;
328 put_unaligned(phy[3].len, (u16 *)&data[12]);
329 data[14] = phy[3].signal;
330 data[15] = phy[3].service;
332 for (i = 0; i < 9; i++) {
333 data[16 + i * 2] = tx_rate[i];
334 data[16 + i * 2 + 1] = rsv_time[i];
337 vnt_control_out(priv, MESSAGE_TYPE_WRITE,
338 MAC_REG_RSPINF_B_1, MESSAGE_REQUEST_MACREG, 34, &data[0]);
342 * Description: Update IFS
344 * Parameters:
345 * In:
346 * priv - The adapter to be set
347 * Out:
348 * none
350 * Return Value: None.
353 void vnt_update_ifs(struct vnt_private *priv)
355 u8 max_min = 0;
356 u8 data[4];
358 if (priv->packet_type == PK_TYPE_11A) {
359 priv->slot = C_SLOT_SHORT;
360 priv->sifs = C_SIFS_A;
361 priv->difs = C_SIFS_A + 2 * C_SLOT_SHORT;
362 max_min = 4;
363 } else if (priv->packet_type == PK_TYPE_11B) {
364 priv->slot = C_SLOT_LONG;
365 priv->sifs = C_SIFS_BG;
366 priv->difs = C_SIFS_BG + 2 * C_SLOT_LONG;
367 max_min = 5;
368 } else {/* PK_TYPE_11GA & PK_TYPE_11GB */
369 bool ofdm_rate = false;
370 unsigned int ii = 0;
372 priv->sifs = C_SIFS_BG;
374 if (priv->short_slot_time)
375 priv->slot = C_SLOT_SHORT;
376 else
377 priv->slot = C_SLOT_LONG;
379 priv->difs = C_SIFS_BG + 2 * priv->slot;
381 for (ii = RATE_54M; ii >= RATE_6M; ii--) {
382 if (priv->basic_rates & ((u32)(0x1 << ii))) {
383 ofdm_rate = true;
384 break;
388 if (ofdm_rate)
389 max_min = 4;
390 else
391 max_min = 5;
394 priv->eifs = C_EIFS;
396 switch (priv->rf_type) {
397 case RF_VT3226D0:
398 if (priv->bb_type != BB_TYPE_11B) {
399 priv->sifs -= 1;
400 priv->difs -= 1;
401 break;
403 case RF_AIROHA7230:
404 case RF_AL2230:
405 case RF_AL2230S:
406 if (priv->bb_type != BB_TYPE_11B)
407 break;
408 case RF_RFMD2959:
409 case RF_VT3226:
410 case RF_VT3342A0:
411 priv->sifs -= 3;
412 priv->difs -= 3;
413 break;
414 case RF_MAXIM2829:
415 if (priv->bb_type == BB_TYPE_11A) {
416 priv->sifs -= 5;
417 priv->difs -= 5;
418 } else {
419 priv->sifs -= 2;
420 priv->difs -= 2;
423 break;
426 data[0] = (u8)priv->sifs;
427 data[1] = (u8)priv->difs;
428 data[2] = (u8)priv->eifs;
429 data[3] = (u8)priv->slot;
431 vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_SIFS,
432 MESSAGE_REQUEST_MACREG, 4, &data[0]);
434 max_min |= 0xa0;
436 vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_CWMAXMIN0,
437 MESSAGE_REQUEST_MACREG, 1, &max_min);
440 void vnt_update_top_rates(struct vnt_private *priv)
442 u8 top_ofdm = RATE_24M, top_cck = RATE_1M;
443 u8 i;
445 /*Determines the highest basic rate.*/
446 for (i = RATE_54M; i >= RATE_6M; i--) {
447 if (priv->basic_rates & (u16)(1 << i)) {
448 top_ofdm = i;
449 break;
453 priv->top_ofdm_basic_rate = top_ofdm;
455 for (i = RATE_11M;; i--) {
456 if (priv->basic_rates & (u16)(1 << i)) {
457 top_cck = i;
458 break;
460 if (i == RATE_1M)
461 break;
464 priv->top_cck_basic_rate = top_cck;
467 int vnt_ofdm_min_rate(struct vnt_private *priv)
469 int ii;
471 for (ii = RATE_54M; ii >= RATE_6M; ii--) {
472 if ((priv->basic_rates) & ((u16)BIT(ii)))
473 return true;
476 return false;
479 u8 vnt_get_pkt_type(struct vnt_private *priv)
482 if (priv->bb_type == BB_TYPE_11A || priv->bb_type == BB_TYPE_11B)
483 return (u8)priv->bb_type;
484 else if (vnt_ofdm_min_rate(priv))
485 return PK_TYPE_11GA;
486 return PK_TYPE_11GB;
490 * Description: Calculate TSF offset of two TSF input
491 * Get TSF Offset from RxBCN's TSF and local TSF
493 * Parameters:
494 * In:
495 * rx_rate - rx rate.
496 * tsf1 - Rx BCN's TSF
497 * tsf2 - Local TSF
498 * Out:
499 * none
501 * Return Value: TSF Offset value
504 u64 vnt_get_tsf_offset(u8 rx_rate, u64 tsf1, u64 tsf2)
506 u64 tsf_offset = 0;
507 u16 rx_bcn_offset;
509 rx_bcn_offset = cwRXBCNTSFOff[rx_rate % MAX_RATE];
511 tsf2 += (u64)rx_bcn_offset;
513 tsf_offset = tsf1 - tsf2;
515 return tsf_offset;
519 * Description: Sync. TSF counter to BSS
520 * Get TSF offset and write to HW
522 * Parameters:
523 * In:
524 * priv - The adapter to be sync.
525 * time_stamp - Rx BCN's TSF
526 * local_tsf - Local TSF
527 * Out:
528 * none
530 * Return Value: none
533 void vnt_adjust_tsf(struct vnt_private *priv, u8 rx_rate,
534 u64 time_stamp, u64 local_tsf)
536 u64 tsf_offset = 0;
537 u8 data[8];
539 tsf_offset = vnt_get_tsf_offset(rx_rate, time_stamp, local_tsf);
541 data[0] = (u8)tsf_offset;
542 data[1] = (u8)(tsf_offset >> 8);
543 data[2] = (u8)(tsf_offset >> 16);
544 data[3] = (u8)(tsf_offset >> 24);
545 data[4] = (u8)(tsf_offset >> 32);
546 data[5] = (u8)(tsf_offset >> 40);
547 data[6] = (u8)(tsf_offset >> 48);
548 data[7] = (u8)(tsf_offset >> 56);
550 vnt_control_out(priv, MESSAGE_TYPE_SET_TSFTBTT,
551 MESSAGE_REQUEST_TSF, 0, 8, data);
554 * Description: Read NIC TSF counter
555 * Get local TSF counter
557 * Parameters:
558 * In:
559 * priv - The adapter to be read
560 * Out:
561 * current_tsf - Current TSF counter
563 * Return Value: true if success; otherwise false
566 bool vnt_get_current_tsf(struct vnt_private *priv, u64 *current_tsf)
569 *current_tsf = priv->current_tsf;
571 return true;
575 * Description: Clear NIC TSF counter
576 * Clear local TSF counter
578 * Parameters:
579 * In:
580 * priv - The adapter to be read
582 * Return Value: true if success; otherwise false
585 bool vnt_clear_current_tsf(struct vnt_private *priv)
588 vnt_mac_reg_bits_on(priv, MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
590 priv->current_tsf = 0;
592 return true;
596 * Description: Read NIC TSF counter
597 * Get NEXTTBTT from adjusted TSF and Beacon Interval
599 * Parameters:
600 * In:
601 * tsf - Current TSF counter
602 * beacon_interval - Beacon Interval
603 * Out:
604 * tsf - Current TSF counter
606 * Return Value: TSF value of next Beacon
609 u64 vnt_get_next_tbtt(u64 tsf, u16 beacon_interval)
611 u32 beacon_int;
613 beacon_int = beacon_interval * 1024;
615 /* Next TBTT =
616 * ((local_current_TSF / beacon_interval) + 1) * beacon_interval
618 if (beacon_int) {
619 do_div(tsf, beacon_int);
620 tsf += 1;
621 tsf *= beacon_int;
624 return tsf;
628 * Description: Set NIC TSF counter for first Beacon time
629 * Get NEXTTBTT from adjusted TSF and Beacon Interval
631 * Parameters:
632 * In:
633 * dwIoBase - IO Base
634 * beacon_interval - Beacon Interval
635 * Out:
636 * none
638 * Return Value: none
641 void vnt_reset_next_tbtt(struct vnt_private *priv, u16 beacon_interval)
643 u64 next_tbtt = 0;
644 u8 data[8];
646 vnt_clear_current_tsf(priv);
648 next_tbtt = vnt_get_next_tbtt(next_tbtt, beacon_interval);
650 data[0] = (u8)next_tbtt;
651 data[1] = (u8)(next_tbtt >> 8);
652 data[2] = (u8)(next_tbtt >> 16);
653 data[3] = (u8)(next_tbtt >> 24);
654 data[4] = (u8)(next_tbtt >> 32);
655 data[5] = (u8)(next_tbtt >> 40);
656 data[6] = (u8)(next_tbtt >> 48);
657 data[7] = (u8)(next_tbtt >> 56);
659 vnt_control_out(priv, MESSAGE_TYPE_SET_TSFTBTT,
660 MESSAGE_REQUEST_TBTT, 0, 8, data);
664 * Description: Sync NIC TSF counter for Beacon time
665 * Get NEXTTBTT and write to HW
667 * Parameters:
668 * In:
669 * priv - The adapter to be set
670 * tsf - Current TSF counter
671 * beacon_interval - Beacon Interval
672 * Out:
673 * none
675 * Return Value: none
678 void vnt_update_next_tbtt(struct vnt_private *priv, u64 tsf,
679 u16 beacon_interval)
681 u8 data[8];
683 tsf = vnt_get_next_tbtt(tsf, beacon_interval);
685 data[0] = (u8)tsf;
686 data[1] = (u8)(tsf >> 8);
687 data[2] = (u8)(tsf >> 16);
688 data[3] = (u8)(tsf >> 24);
689 data[4] = (u8)(tsf >> 32);
690 data[5] = (u8)(tsf >> 40);
691 data[6] = (u8)(tsf >> 48);
692 data[7] = (u8)(tsf >> 56);
694 vnt_control_out(priv, MESSAGE_TYPE_SET_TSFTBTT,
695 MESSAGE_REQUEST_TBTT, 0, 8, data);
697 dev_dbg(&priv->usb->dev, "%s TBTT: %8llx\n", __func__, tsf);
701 * Description: Turn off Radio power
703 * Parameters:
704 * In:
705 * priv - The adapter to be turned off
706 * Out:
707 * none
709 * Return Value: true if success; otherwise false
712 int vnt_radio_power_off(struct vnt_private *priv)
714 int ret = true;
716 switch (priv->rf_type) {
717 case RF_AL2230:
718 case RF_AL2230S:
719 case RF_AIROHA7230:
720 case RF_VT3226:
721 case RF_VT3226D0:
722 case RF_VT3342A0:
723 vnt_mac_reg_bits_off(priv, MAC_REG_SOFTPWRCTL,
724 (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
725 break;
728 vnt_mac_reg_bits_off(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
730 vnt_set_deep_sleep(priv);
732 vnt_mac_reg_bits_on(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
734 return ret;
738 * Description: Turn on Radio power
740 * Parameters:
741 * In:
742 * priv - The adapter to be turned on
743 * Out:
744 * none
746 * Return Value: true if success; otherwise false
749 int vnt_radio_power_on(struct vnt_private *priv)
751 int ret = true;
753 vnt_exit_deep_sleep(priv);
755 vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
757 switch (priv->rf_type) {
758 case RF_AL2230:
759 case RF_AL2230S:
760 case RF_AIROHA7230:
761 case RF_VT3226:
762 case RF_VT3226D0:
763 case RF_VT3342A0:
764 vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
765 (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
766 break;
769 vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
771 return ret;
774 void vnt_set_bss_mode(struct vnt_private *priv)
776 if (priv->rf_type == RF_AIROHA7230 && priv->bb_type == BB_TYPE_11A)
777 vnt_mac_set_bb_type(priv, BB_TYPE_11G);
778 else
779 vnt_mac_set_bb_type(priv, priv->bb_type);
781 priv->packet_type = vnt_get_pkt_type(priv);
783 if (priv->bb_type == BB_TYPE_11A)
784 vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x88, 0x03);
785 else if (priv->bb_type == BB_TYPE_11B)
786 vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x88, 0x02);
787 else if (priv->bb_type == BB_TYPE_11G)
788 vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x88, 0x08);
790 vnt_update_ifs(priv);
791 vnt_set_rspinf(priv, (u8)priv->bb_type);
793 if (priv->bb_type == BB_TYPE_11A) {
794 if (priv->rf_type == RF_AIROHA7230) {
795 priv->bb_vga[0] = 0x20;
797 vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG,
798 0xe7, priv->bb_vga[0]);
801 priv->bb_vga[2] = 0x10;
802 priv->bb_vga[3] = 0x10;
803 } else {
804 if (priv->rf_type == RF_AIROHA7230) {
805 priv->bb_vga[0] = 0x1c;
807 vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG,
808 0xe7, priv->bb_vga[0]);
811 priv->bb_vga[2] = 0x0;
812 priv->bb_vga[3] = 0x0;
815 vnt_set_vga_gain_offset(priv, priv->bb_vga[0]);