| .. | .. |
|---|
| 51 | 51 | usb_write32(adapt, regaddr, data); |
|---|
| 52 | 52 | } |
|---|
| 53 | 53 | |
|---|
| 54 | | -static u32 rf_serial_read(struct adapter *adapt, |
|---|
| 55 | | - enum rf_radio_path rfpath, u32 offset) |
|---|
| 54 | +static u32 rf_serial_read(struct adapter *adapt, enum rf_radio_path rfpath, u32 offset) |
|---|
| 56 | 55 | { |
|---|
| 57 | 56 | u32 ret = 0; |
|---|
| 58 | 57 | struct bb_reg_def *phyreg = &adapt->HalData->PHYRegDef[rfpath]; |
|---|
| .. | .. |
|---|
| 69 | 68 | bMaskDWord); |
|---|
| 70 | 69 | |
|---|
| 71 | 70 | tmplong2 = (tmplong2 & (~bLSSIReadAddress)) | |
|---|
| 72 | | - (offset<<23) | bLSSIReadEdge; |
|---|
| 71 | + (offset << 23) | bLSSIReadEdge; |
|---|
| 73 | 72 | |
|---|
| 74 | 73 | phy_set_bb_reg(adapt, rFPGA0_XA_HSSIParameter2, bMaskDWord, |
|---|
| 75 | | - tmplong&(~bLSSIReadEdge)); |
|---|
| 74 | + tmplong & (~bLSSIReadEdge)); |
|---|
| 76 | 75 | udelay(10); |
|---|
| 77 | 76 | |
|---|
| 78 | 77 | phy_set_bb_reg(adapt, phyreg->rfHSSIPara2, bMaskDWord, tmplong2); |
|---|
| .. | .. |
|---|
| 102 | 101 | struct bb_reg_def *phyreg = &adapt->HalData->PHYRegDef[rfpath]; |
|---|
| 103 | 102 | |
|---|
| 104 | 103 | offset &= 0xff; |
|---|
| 105 | | - data_and_addr = ((offset<<20) | (data&0x000fffff)) & 0x0fffffff; |
|---|
| 104 | + data_and_addr = ((offset << 20) | (data & 0x000fffff)) & 0x0fffffff; |
|---|
| 106 | 105 | phy_set_bb_reg(adapt, phyreg->rf3wireOffset, bMaskDWord, data_and_addr); |
|---|
| 107 | 106 | } |
|---|
| 108 | 107 | |
|---|
| 109 | 108 | u32 rtw_hal_read_rfreg(struct adapter *adapt, enum rf_radio_path rf_path, |
|---|
| 110 | | - u32 reg_addr, u32 bit_mask) |
|---|
| 109 | + u32 reg_addr, u32 bit_mask) |
|---|
| 111 | 110 | { |
|---|
| 112 | 111 | u32 original_value, bit_shift; |
|---|
| 113 | 112 | |
|---|
| .. | .. |
|---|
| 117 | 116 | } |
|---|
| 118 | 117 | |
|---|
| 119 | 118 | void phy_set_rf_reg(struct adapter *adapt, enum rf_radio_path rf_path, |
|---|
| 120 | | - u32 reg_addr, u32 bit_mask, u32 data) |
|---|
| 119 | + u32 reg_addr, u32 bit_mask, u32 data) |
|---|
| 121 | 120 | { |
|---|
| 122 | 121 | u32 original_value, bit_shift; |
|---|
| 123 | 122 | |
|---|
| .. | .. |
|---|
| 143 | 142 | for (TxCount = 0; TxCount < path_nums; TxCount++) { |
|---|
| 144 | 143 | if (TxCount == RF_PATH_A) { |
|---|
| 145 | 144 | cck_pwr[TxCount] = hal_data->Index24G_CCK_Base[TxCount][index]; |
|---|
| 146 | | - ofdm_pwr[TxCount] = hal_data->Index24G_BW40_Base[RF_PATH_A][index]+ |
|---|
| 145 | + ofdm_pwr[TxCount] = hal_data->Index24G_BW40_Base[RF_PATH_A][index] + |
|---|
| 147 | 146 | hal_data->OFDM_24G_Diff[TxCount][RF_PATH_A]; |
|---|
| 148 | 147 | |
|---|
| 149 | | - bw20_pwr[TxCount] = hal_data->Index24G_BW40_Base[RF_PATH_A][index]+ |
|---|
| 148 | + bw20_pwr[TxCount] = hal_data->Index24G_BW40_Base[RF_PATH_A][index] + |
|---|
| 150 | 149 | hal_data->BW20_24G_Diff[TxCount][RF_PATH_A]; |
|---|
| 151 | 150 | bw40_pwr[TxCount] = hal_data->Index24G_BW40_Base[TxCount][index]; |
|---|
| 152 | 151 | } else if (TxCount == RF_PATH_B) { |
|---|
| 153 | 152 | cck_pwr[TxCount] = hal_data->Index24G_CCK_Base[TxCount][index]; |
|---|
| 154 | | - ofdm_pwr[TxCount] = hal_data->Index24G_BW40_Base[RF_PATH_A][index]+ |
|---|
| 155 | | - hal_data->BW20_24G_Diff[RF_PATH_A][index]+ |
|---|
| 153 | + ofdm_pwr[TxCount] = hal_data->Index24G_BW40_Base[RF_PATH_A][index] + |
|---|
| 154 | + hal_data->BW20_24G_Diff[RF_PATH_A][index] + |
|---|
| 156 | 155 | hal_data->BW20_24G_Diff[TxCount][index]; |
|---|
| 157 | 156 | |
|---|
| 158 | | - bw20_pwr[TxCount] = hal_data->Index24G_BW40_Base[RF_PATH_A][index]+ |
|---|
| 159 | | - hal_data->BW20_24G_Diff[TxCount][RF_PATH_A]+ |
|---|
| 157 | + bw20_pwr[TxCount] = hal_data->Index24G_BW40_Base[RF_PATH_A][index] + |
|---|
| 158 | + hal_data->BW20_24G_Diff[TxCount][RF_PATH_A] + |
|---|
| 160 | 159 | hal_data->BW20_24G_Diff[TxCount][index]; |
|---|
| 161 | 160 | bw40_pwr[TxCount] = hal_data->Index24G_BW40_Base[TxCount][index]; |
|---|
| 162 | 161 | } |
|---|
| .. | .. |
|---|
| 190 | 189 | |
|---|
| 191 | 190 | rtl88eu_phy_rf6052_set_cck_txpower(adapt, &cck_pwr[0]); |
|---|
| 192 | 191 | rtl88eu_phy_rf6052_set_ofdm_txpower(adapt, &ofdm_pwr[0], &bw20_pwr[0], |
|---|
| 193 | | - &bw40_pwr[0], channel); |
|---|
| 192 | + &bw40_pwr[0], channel); |
|---|
| 194 | 193 | } |
|---|
| 195 | 194 | |
|---|
| 196 | 195 | static void phy_set_bw_mode_callback(struct adapter *adapt) |
|---|
| .. | .. |
|---|
| 205 | 204 | /* Set MAC register */ |
|---|
| 206 | 205 | |
|---|
| 207 | 206 | reg_bw_opmode = usb_read8(adapt, REG_BWOPMODE); |
|---|
| 208 | | - reg_prsr_rsc = usb_read8(adapt, REG_RRSR+2); |
|---|
| 207 | + reg_prsr_rsc = usb_read8(adapt, REG_RRSR + 2); |
|---|
| 209 | 208 | |
|---|
| 210 | 209 | switch (hal_data->CurrentChannelBW) { |
|---|
| 211 | 210 | case HT_CHANNEL_WIDTH_20: |
|---|
| .. | .. |
|---|
| 215 | 214 | case HT_CHANNEL_WIDTH_40: |
|---|
| 216 | 215 | reg_bw_opmode &= ~BW_OPMODE_20MHZ; |
|---|
| 217 | 216 | usb_write8(adapt, REG_BWOPMODE, reg_bw_opmode); |
|---|
| 218 | | - reg_prsr_rsc = (reg_prsr_rsc&0x90) | |
|---|
| 219 | | - (hal_data->nCur40MhzPrimeSC<<5); |
|---|
| 220 | | - usb_write8(adapt, REG_RRSR+2, reg_prsr_rsc); |
|---|
| 217 | + reg_prsr_rsc = (reg_prsr_rsc & 0x90) | |
|---|
| 218 | + (hal_data->nCur40MhzPrimeSC << 5); |
|---|
| 219 | + usb_write8(adapt, REG_RRSR + 2, reg_prsr_rsc); |
|---|
| 221 | 220 | break; |
|---|
| 222 | 221 | default: |
|---|
| 223 | 222 | break; |
|---|
| .. | .. |
|---|
| 236 | 235 | * These settings are required only for 40MHz |
|---|
| 237 | 236 | */ |
|---|
| 238 | 237 | phy_set_bb_reg(adapt, rCCK0_System, bCCKSideBand, |
|---|
| 239 | | - (hal_data->nCur40MhzPrimeSC>>1)); |
|---|
| 238 | + (hal_data->nCur40MhzPrimeSC >> 1)); |
|---|
| 240 | 239 | phy_set_bb_reg(adapt, rOFDM1_LSTF, 0xC00, |
|---|
| 241 | 240 | hal_data->nCur40MhzPrimeSC); |
|---|
| 242 | 241 | phy_set_bb_reg(adapt, 0x818, (BIT(26) | BIT(27)), |
|---|
| 243 | | - (hal_data->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1); |
|---|
| 242 | + (hal_data->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1); |
|---|
| 244 | 243 | break; |
|---|
| 245 | 244 | default: |
|---|
| 246 | 245 | break; |
|---|
| .. | .. |
|---|
| 251 | 250 | } |
|---|
| 252 | 251 | |
|---|
| 253 | 252 | void rtw_hal_set_bwmode(struct adapter *adapt, enum ht_channel_width bandwidth, |
|---|
| 254 | | - unsigned char offset) |
|---|
| 253 | + unsigned char offset) |
|---|
| 255 | 254 | { |
|---|
| 256 | 255 | struct hal_data_8188e *hal_data = adapt->HalData; |
|---|
| 257 | 256 | enum ht_channel_width tmp_bw = hal_data->CurrentChannelBW; |
|---|
| .. | .. |
|---|
| 298 | 297 | |
|---|
| 299 | 298 | #define ODM_TXPWRTRACK_MAX_IDX_88E 6 |
|---|
| 300 | 299 | |
|---|
| 301 | | -static u8 get_right_chnl_for_iqk(u8 chnl) |
|---|
| 302 | | -{ |
|---|
| 303 | | - u8 place; |
|---|
| 304 | | - u8 channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = { |
|---|
| 305 | | - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, |
|---|
| 306 | | - 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, |
|---|
| 307 | | - 124, 126, 128, 130, 132, 134, 136, 138, 140, 149, 151, 153, |
|---|
| 308 | | - 155, 157, 159, 161, 163, 165 |
|---|
| 309 | | - }; |
|---|
| 310 | | - |
|---|
| 311 | | - if (chnl > 14) { |
|---|
| 312 | | - for (place = 0; place < sizeof(channel_all); place++) { |
|---|
| 313 | | - if (channel_all[place] == chnl) |
|---|
| 314 | | - return ++place; |
|---|
| 315 | | - } |
|---|
| 316 | | - } |
|---|
| 317 | | - return 0; |
|---|
| 318 | | -} |
|---|
| 319 | | - |
|---|
| 320 | 300 | void rtl88eu_dm_txpower_track_adjust(struct odm_dm_struct *dm_odm, u8 type, |
|---|
| 321 | 301 | u8 *direction, u32 *out_write_val) |
|---|
| 322 | 302 | { |
|---|
| .. | .. |
|---|
| 356 | 336 | if (pwr_value >= ODM_TXPWRTRACK_MAX_IDX_88E && *direction == 1) |
|---|
| 357 | 337 | pwr_value = ODM_TXPWRTRACK_MAX_IDX_88E; |
|---|
| 358 | 338 | |
|---|
| 359 | | - *out_write_val = pwr_value | (pwr_value<<8) | (pwr_value<<16) | |
|---|
| 360 | | - (pwr_value<<24); |
|---|
| 339 | + *out_write_val = pwr_value | (pwr_value << 8) | (pwr_value << 16) | |
|---|
| 340 | + (pwr_value << 24); |
|---|
| 361 | 341 | } |
|---|
| 362 | 342 | |
|---|
| 363 | 343 | static void dm_txpwr_track_setpwr(struct odm_dm_struct *dm_odm) |
|---|
| 364 | 344 | { |
|---|
| 365 | 345 | if (dm_odm->BbSwingFlagOfdm || dm_odm->BbSwingFlagCck) { |
|---|
| 366 | 346 | ODM_RT_TRACE(dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, |
|---|
| 367 | | - ("dm_txpwr_track_setpwr CH=%d\n", *(dm_odm->pChannel))); |
|---|
| 368 | | - phy_set_tx_power_level(dm_odm->Adapter, *(dm_odm->pChannel)); |
|---|
| 347 | + ("%s CH=%d\n", __func__, *dm_odm->pChannel)); |
|---|
| 348 | + phy_set_tx_power_level(dm_odm->Adapter, *dm_odm->pChannel); |
|---|
| 369 | 349 | dm_odm->BbSwingFlagOfdm = false; |
|---|
| 370 | 350 | dm_odm->BbSwingFlagCck = false; |
|---|
| 371 | 351 | } |
|---|
| .. | .. |
|---|
| 408 | 388 | |
|---|
| 409 | 389 | if (thermal_val) { |
|---|
| 410 | 390 | /* Query OFDM path A default setting */ |
|---|
| 411 | | - ele_d = phy_query_bb_reg(adapt, rOFDM0_XATxIQImbalance, bMaskDWord)&bMaskOFDM_D; |
|---|
| 391 | + ele_d = phy_query_bb_reg(adapt, rOFDM0_XATxIQImbalance, bMaskDWord) & bMaskOFDM_D; |
|---|
| 412 | 392 | for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) { |
|---|
| 413 | | - if (ele_d == (OFDMSwingTable[i]&bMaskOFDM_D)) { |
|---|
| 393 | + if (ele_d == (OFDMSwingTable[i] & bMaskOFDM_D)) { |
|---|
| 414 | 394 | ofdm_index_old[0] = (u8)i; |
|---|
| 415 | 395 | dm_odm->BbSwingIdxOfdmBase = (u8)i; |
|---|
| 416 | 396 | break; |
|---|
| .. | .. |
|---|
| 422 | 402 | |
|---|
| 423 | 403 | for (i = 0; i < CCK_TABLE_SIZE; i++) { |
|---|
| 424 | 404 | if ((dm_odm->RFCalibrateInfo.bCCKinCH14 && |
|---|
| 425 | | - memcmp(&temp_cck, &CCKSwingTable_Ch14[i][2], 4)) || |
|---|
| 426 | | - memcmp(&temp_cck, &CCKSwingTable_Ch1_Ch13[i][2], 4)) { |
|---|
| 427 | | - cck_index_old = (u8)i; |
|---|
| 428 | | - dm_odm->BbSwingIdxCckBase = (u8)i; |
|---|
| 429 | | - break; |
|---|
| 405 | + memcmp(&temp_cck, &CCKSwingTable_Ch14[i][2], 4)) || |
|---|
| 406 | + memcmp(&temp_cck, &CCKSwingTable_Ch1_Ch13[i][2], 4)) { |
|---|
| 407 | + cck_index_old = (u8)i; |
|---|
| 408 | + dm_odm->BbSwingIdxCckBase = (u8)i; |
|---|
| 409 | + break; |
|---|
| 430 | 410 | } |
|---|
| 431 | 411 | } |
|---|
| 432 | 412 | |
|---|
| .. | .. |
|---|
| 456 | 436 | thermal_val = (u8)(thermal_avg / thermal_avg_count); |
|---|
| 457 | 437 | |
|---|
| 458 | 438 | if (dm_odm->RFCalibrateInfo.bDoneTxpower && |
|---|
| 459 | | - !dm_odm->RFCalibrateInfo.bReloadtxpowerindex) |
|---|
| 439 | + !dm_odm->RFCalibrateInfo.bReloadtxpowerindex) { |
|---|
| 460 | 440 | delta = abs(thermal_val - dm_odm->RFCalibrateInfo.ThermalValue); |
|---|
| 461 | | - else { |
|---|
| 441 | + } else { |
|---|
| 462 | 442 | delta = abs(thermal_val - hal_data->EEPROMThermalMeter); |
|---|
| 463 | 443 | if (dm_odm->RFCalibrateInfo.bReloadtxpowerindex) { |
|---|
| 464 | 444 | dm_odm->RFCalibrateInfo.bReloadtxpowerindex = false; |
|---|
| .. | .. |
|---|
| 491 | 471 | } |
|---|
| 492 | 472 | } |
|---|
| 493 | 473 | if (offset >= index_mapping_NUM_88E) |
|---|
| 494 | | - offset = index_mapping_NUM_88E-1; |
|---|
| 474 | + offset = index_mapping_NUM_88E - 1; |
|---|
| 495 | 475 | |
|---|
| 496 | 476 | /* Updating ofdm_index values with new OFDM / CCK offset */ |
|---|
| 497 | 477 | ofdm_index[0] = dm_odm->RFCalibrateInfo.OFDM_index[0] + ofdm_index_mapping[j][offset]; |
|---|
| 498 | | - if (ofdm_index[0] > OFDM_TABLE_SIZE_92D-1) |
|---|
| 499 | | - ofdm_index[0] = OFDM_TABLE_SIZE_92D-1; |
|---|
| 478 | + if (ofdm_index[0] > OFDM_TABLE_SIZE_92D - 1) |
|---|
| 479 | + ofdm_index[0] = OFDM_TABLE_SIZE_92D - 1; |
|---|
| 500 | 480 | else if (ofdm_index[0] < ofdm_min_index) |
|---|
| 501 | 481 | ofdm_index[0] = ofdm_min_index; |
|---|
| 502 | 482 | |
|---|
| 503 | 483 | cck_index = dm_odm->RFCalibrateInfo.CCK_index + ofdm_index_mapping[j][offset]; |
|---|
| 504 | | - if (cck_index > CCK_TABLE_SIZE-1) |
|---|
| 505 | | - cck_index = CCK_TABLE_SIZE-1; |
|---|
| 484 | + if (cck_index > CCK_TABLE_SIZE - 1) |
|---|
| 485 | + cck_index = CCK_TABLE_SIZE - 1; |
|---|
| 506 | 486 | else if (cck_index < 0) |
|---|
| 507 | 487 | cck_index = 0; |
|---|
| 508 | 488 | |
|---|
| .. | .. |
|---|
| 567 | 547 | reg_e9c = phy_query_bb_reg(adapt, rTx_Power_After_IQK_A, bMaskDWord); |
|---|
| 568 | 548 | |
|---|
| 569 | 549 | if (!(reg_eac & BIT(28)) && |
|---|
| 570 | | - (((reg_e94 & 0x03FF0000)>>16) != 0x142) && |
|---|
| 571 | | - (((reg_e9c & 0x03FF0000)>>16) != 0x42)) |
|---|
| 550 | + (((reg_e94 & 0x03FF0000) >> 16) != 0x142) && |
|---|
| 551 | + (((reg_e9c & 0x03FF0000) >> 16) != 0x42)) |
|---|
| 572 | 552 | result |= 0x01; |
|---|
| 573 | 553 | return result; |
|---|
| 574 | 554 | } |
|---|
| .. | .. |
|---|
| 619 | 599 | reg_e9c = phy_query_bb_reg(adapt, rTx_Power_After_IQK_A, bMaskDWord); |
|---|
| 620 | 600 | |
|---|
| 621 | 601 | if (!(reg_eac & BIT(28)) && |
|---|
| 622 | | - (((reg_e94 & 0x03FF0000)>>16) != 0x142) && |
|---|
| 623 | | - (((reg_e9c & 0x03FF0000)>>16) != 0x42)) |
|---|
| 602 | + (((reg_e94 & 0x03FF0000) >> 16) != 0x142) && |
|---|
| 603 | + (((reg_e9c & 0x03FF0000) >> 16) != 0x42)) |
|---|
| 624 | 604 | result |= 0x01; |
|---|
| 625 | 605 | else /* if Tx not OK, ignore Rx */ |
|---|
| 626 | 606 | return result; |
|---|
| 627 | 607 | |
|---|
| 628 | | - u4tmp = 0x80007C00 | (reg_e94&0x3FF0000) | ((reg_e9c&0x3FF0000) >> 16); |
|---|
| 608 | + u4tmp = 0x80007C00 | (reg_e94 & 0x3FF0000) | ((reg_e9c & 0x3FF0000) >> 16); |
|---|
| 629 | 609 | phy_set_bb_reg(adapt, rTx_IQK, bMaskDWord, u4tmp); |
|---|
| 630 | 610 | |
|---|
| 631 | 611 | /* 1 RX IQK */ |
|---|
| .. | .. |
|---|
| 667 | 647 | phy_set_rf_reg(adapt, RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x180); |
|---|
| 668 | 648 | |
|---|
| 669 | 649 | if (!(reg_eac & BIT(27)) && /* if Tx is OK, check whether Rx is OK */ |
|---|
| 670 | | - (((reg_ea4 & 0x03FF0000)>>16) != 0x132) && |
|---|
| 671 | | - (((reg_eac & 0x03FF0000)>>16) != 0x36)) |
|---|
| 650 | + (((reg_ea4 & 0x03FF0000) >> 16) != 0x132) && |
|---|
| 651 | + (((reg_eac & 0x03FF0000) >> 16) != 0x36)) |
|---|
| 672 | 652 | result |= 0x02; |
|---|
| 673 | 653 | else |
|---|
| 674 | 654 | ODM_RT_TRACE(dm_odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, |
|---|
| .. | .. |
|---|
| 696 | 676 | regecc = phy_query_bb_reg(adapt, rRx_Power_After_IQK_B_2, bMaskDWord); |
|---|
| 697 | 677 | |
|---|
| 698 | 678 | if (!(regeac & BIT(31)) && |
|---|
| 699 | | - (((regeb4 & 0x03FF0000)>>16) != 0x142) && |
|---|
| 700 | | - (((regebc & 0x03FF0000)>>16) != 0x42)) |
|---|
| 679 | + (((regeb4 & 0x03FF0000) >> 16) != 0x142) && |
|---|
| 680 | + (((regebc & 0x03FF0000) >> 16) != 0x42)) |
|---|
| 701 | 681 | result |= 0x01; |
|---|
| 702 | 682 | else |
|---|
| 703 | 683 | return result; |
|---|
| 704 | 684 | |
|---|
| 705 | 685 | if (!(regeac & BIT(30)) && |
|---|
| 706 | | - (((regec4 & 0x03FF0000)>>16) != 0x132) && |
|---|
| 707 | | - (((regecc & 0x03FF0000)>>16) != 0x36)) |
|---|
| 686 | + (((regec4 & 0x03FF0000) >> 16) != 0x132) && |
|---|
| 687 | + (((regecc & 0x03FF0000) >> 16) != 0x36)) |
|---|
| 708 | 688 | result |= 0x02; |
|---|
| 709 | 689 | else |
|---|
| 710 | 690 | ODM_RT_TRACE(dm_odm, ODM_COMP_CALIBRATION, |
|---|
| .. | .. |
|---|
| 730 | 710 | tx0_a = (x * oldval_0) >> 8; |
|---|
| 731 | 711 | phy_set_bb_reg(adapt, rOFDM0_XATxIQImbalance, 0x3FF, tx0_a); |
|---|
| 732 | 712 | phy_set_bb_reg(adapt, rOFDM0_ECCAThreshold, BIT(31), |
|---|
| 733 | | - ((x * oldval_0>>7) & 0x1)); |
|---|
| 713 | + ((x * oldval_0 >> 7) & 0x1)); |
|---|
| 734 | 714 | |
|---|
| 735 | 715 | y = result[final_candidate][1]; |
|---|
| 736 | 716 | if ((y & 0x00000200) != 0) |
|---|
| .. | .. |
|---|
| 738 | 718 | |
|---|
| 739 | 719 | tx0_c = (y * oldval_0) >> 8; |
|---|
| 740 | 720 | phy_set_bb_reg(adapt, rOFDM0_XCTxAFE, 0xF0000000, |
|---|
| 741 | | - ((tx0_c&0x3C0)>>6)); |
|---|
| 721 | + ((tx0_c & 0x3C0) >> 6)); |
|---|
| 742 | 722 | phy_set_bb_reg(adapt, rOFDM0_XATxIQImbalance, 0x003F0000, |
|---|
| 743 | | - (tx0_c&0x3F)); |
|---|
| 723 | + (tx0_c & 0x3F)); |
|---|
| 744 | 724 | phy_set_bb_reg(adapt, rOFDM0_ECCAThreshold, BIT(29), |
|---|
| 745 | | - ((y * oldval_0>>7) & 0x1)); |
|---|
| 725 | + ((y * oldval_0 >> 7) & 0x1)); |
|---|
| 746 | 726 | |
|---|
| 747 | 727 | if (txonly) |
|---|
| 748 | 728 | return; |
|---|
| .. | .. |
|---|
| 776 | 756 | phy_set_bb_reg(adapt, rOFDM0_XBTxIQImbalance, 0x3FF, tx1_a); |
|---|
| 777 | 757 | |
|---|
| 778 | 758 | phy_set_bb_reg(adapt, rOFDM0_ECCAThreshold, BIT(27), |
|---|
| 779 | | - ((x * oldval_1>>7) & 0x1)); |
|---|
| 759 | + ((x * oldval_1 >> 7) & 0x1)); |
|---|
| 780 | 760 | |
|---|
| 781 | 761 | y = result[final_candidate][5]; |
|---|
| 782 | 762 | if ((y & 0x00000200) != 0) |
|---|
| .. | .. |
|---|
| 785 | 765 | tx1_c = (y * oldval_1) >> 8; |
|---|
| 786 | 766 | |
|---|
| 787 | 767 | phy_set_bb_reg(adapt, rOFDM0_XDTxAFE, 0xF0000000, |
|---|
| 788 | | - ((tx1_c&0x3C0)>>6)); |
|---|
| 768 | + ((tx1_c & 0x3C0) >> 6)); |
|---|
| 789 | 769 | phy_set_bb_reg(adapt, rOFDM0_XBTxIQImbalance, 0x003F0000, |
|---|
| 790 | | - (tx1_c&0x3F)); |
|---|
| 770 | + (tx1_c & 0x3F)); |
|---|
| 791 | 771 | phy_set_bb_reg(adapt, rOFDM0_ECCAThreshold, BIT(25), |
|---|
| 792 | | - ((y * oldval_1>>7) & 0x1)); |
|---|
| 772 | + ((y * oldval_1 >> 7) & 0x1)); |
|---|
| 793 | 773 | |
|---|
| 794 | 774 | if (txonly) |
|---|
| 795 | 775 | return; |
|---|
| .. | .. |
|---|
| 805 | 785 | } |
|---|
| 806 | 786 | } |
|---|
| 807 | 787 | |
|---|
| 808 | | -static void save_adda_registers(struct adapter *adapt, u32 *addareg, |
|---|
| 788 | +static void save_adda_registers(struct adapter *adapt, const u32 *addareg, |
|---|
| 809 | 789 | u32 *backup, u32 register_num) |
|---|
| 810 | 790 | { |
|---|
| 811 | 791 | u32 i; |
|---|
| .. | .. |
|---|
| 814 | 794 | backup[i] = phy_query_bb_reg(adapt, addareg[i], bMaskDWord); |
|---|
| 815 | 795 | } |
|---|
| 816 | 796 | |
|---|
| 817 | | -static void save_mac_registers(struct adapter *adapt, u32 *mac_reg, |
|---|
| 797 | +static void save_mac_registers(struct adapter *adapt, const u32 *mac_reg, |
|---|
| 818 | 798 | u32 *backup) |
|---|
| 819 | 799 | { |
|---|
| 820 | 800 | u32 i; |
|---|
| .. | .. |
|---|
| 825 | 805 | backup[i] = usb_read32(adapt, mac_reg[i]); |
|---|
| 826 | 806 | } |
|---|
| 827 | 807 | |
|---|
| 828 | | -static void reload_adda_reg(struct adapter *adapt, u32 *adda_reg, |
|---|
| 808 | +static void reload_adda_reg(struct adapter *adapt, const u32 *adda_reg, |
|---|
| 829 | 809 | u32 *backup, u32 regiester_num) |
|---|
| 830 | 810 | { |
|---|
| 831 | 811 | u32 i; |
|---|
| .. | .. |
|---|
| 834 | 814 | phy_set_bb_reg(adapt, adda_reg[i], bMaskDWord, backup[i]); |
|---|
| 835 | 815 | } |
|---|
| 836 | 816 | |
|---|
| 837 | | -static void reload_mac_registers(struct adapter *adapt, |
|---|
| 838 | | - u32 *mac_reg, u32 *backup) |
|---|
| 817 | +static void reload_mac_registers(struct adapter *adapt, const u32 *mac_reg, |
|---|
| 818 | + u32 *backup) |
|---|
| 839 | 819 | { |
|---|
| 840 | 820 | u32 i; |
|---|
| 841 | 821 | |
|---|
| .. | .. |
|---|
| 845 | 825 | usb_write32(adapt, mac_reg[i], backup[i]); |
|---|
| 846 | 826 | } |
|---|
| 847 | 827 | |
|---|
| 848 | | -static void path_adda_on(struct adapter *adapt, u32 *adda_reg, |
|---|
| 828 | +static void path_adda_on(struct adapter *adapt, const u32 *adda_reg, |
|---|
| 849 | 829 | bool is_path_a_on, bool is2t) |
|---|
| 850 | 830 | { |
|---|
| 851 | 831 | u32 path_on; |
|---|
| .. | .. |
|---|
| 863 | 843 | phy_set_bb_reg(adapt, adda_reg[i], bMaskDWord, path_on); |
|---|
| 864 | 844 | } |
|---|
| 865 | 845 | |
|---|
| 866 | | -static void mac_setting_calibration(struct adapter *adapt, u32 *mac_reg, u32 *backup) |
|---|
| 846 | +static void mac_setting_calibration(struct adapter *adapt, const u32 *mac_reg, |
|---|
| 847 | + u32 *backup) |
|---|
| 867 | 848 | { |
|---|
| 868 | 849 | u32 i = 0; |
|---|
| 869 | 850 | |
|---|
| 870 | 851 | usb_write8(adapt, mac_reg[i], 0x3F); |
|---|
| 871 | 852 | |
|---|
| 872 | 853 | for (i = 1; i < (IQK_MAC_REG_NUM - 1); i++) |
|---|
| 873 | | - usb_write8(adapt, mac_reg[i], (u8)(backup[i]&(~BIT(3)))); |
|---|
| 854 | + usb_write8(adapt, mac_reg[i], (u8)(backup[i] & (~BIT(3)))); |
|---|
| 874 | 855 | |
|---|
| 875 | | - usb_write8(adapt, mac_reg[i], (u8)(backup[i]&(~BIT(5)))); |
|---|
| 856 | + usb_write8(adapt, mac_reg[i], (u8)(backup[i] & (~BIT(5)))); |
|---|
| 876 | 857 | } |
|---|
| 877 | 858 | |
|---|
| 878 | 859 | static void path_a_standby(struct adapter *adapt) |
|---|
| .. | .. |
|---|
| 921 | 902 | |
|---|
| 922 | 903 | if (diff > MAX_TOLERANCE) { |
|---|
| 923 | 904 | if ((i == 2 || i == 6) && !sim_bitmap) { |
|---|
| 924 | | - if (resulta[c1][i] + resulta[c1][i+1] == 0) |
|---|
| 925 | | - final_candidate[(i/4)] = c2; |
|---|
| 926 | | - else if (resulta[c2][i] + resulta[c2][i+1] == 0) |
|---|
| 927 | | - final_candidate[(i/4)] = c1; |
|---|
| 905 | + if (resulta[c1][i] + resulta[c1][i + 1] == 0) |
|---|
| 906 | + final_candidate[(i / 4)] = c2; |
|---|
| 907 | + else if (resulta[c2][i] + resulta[c2][i + 1] == 0) |
|---|
| 908 | + final_candidate[(i / 4)] = c1; |
|---|
| 928 | 909 | else |
|---|
| 929 | | - sim_bitmap = sim_bitmap | (1<<i); |
|---|
| 910 | + sim_bitmap = sim_bitmap | (1 << i); |
|---|
| 930 | 911 | } else { |
|---|
| 931 | | - sim_bitmap = sim_bitmap | (1<<i); |
|---|
| 912 | + sim_bitmap = sim_bitmap | (1 << i); |
|---|
| 932 | 913 | } |
|---|
| 933 | 914 | } |
|---|
| 934 | 915 | } |
|---|
| 935 | 916 | |
|---|
| 936 | 917 | if (sim_bitmap == 0) { |
|---|
| 937 | | - for (i = 0; i < (bound/4); i++) { |
|---|
| 918 | + for (i = 0; i < (bound / 4); i++) { |
|---|
| 938 | 919 | if (final_candidate[i] != 0xFF) { |
|---|
| 939 | | - for (j = i*4; j < (i+1)*4-2; j++) |
|---|
| 920 | + for (j = i * 4; j < (i + 1) * 4 - 2; j++) |
|---|
| 940 | 921 | resulta[3][j] = resulta[final_candidate[i]][j]; |
|---|
| 941 | 922 | result = false; |
|---|
| 942 | 923 | } |
|---|
| 943 | 924 | } |
|---|
| 944 | 925 | return result; |
|---|
| 945 | | - } else { |
|---|
| 946 | | - if (!(sim_bitmap & 0x03)) { /* path A TX OK */ |
|---|
| 947 | | - for (i = 0; i < 2; i++) |
|---|
| 948 | | - resulta[3][i] = resulta[c1][i]; |
|---|
| 949 | | - } |
|---|
| 950 | | - if (!(sim_bitmap & 0x0c)) { /* path A RX OK */ |
|---|
| 951 | | - for (i = 2; i < 4; i++) |
|---|
| 952 | | - resulta[3][i] = resulta[c1][i]; |
|---|
| 953 | | - } |
|---|
| 954 | | - |
|---|
| 955 | | - if (!(sim_bitmap & 0x30)) { /* path B TX OK */ |
|---|
| 956 | | - for (i = 4; i < 6; i++) |
|---|
| 957 | | - resulta[3][i] = resulta[c1][i]; |
|---|
| 958 | | - } |
|---|
| 959 | | - |
|---|
| 960 | | - if (!(sim_bitmap & 0xc0)) { /* path B RX OK */ |
|---|
| 961 | | - for (i = 6; i < 8; i++) |
|---|
| 962 | | - resulta[3][i] = resulta[c1][i]; |
|---|
| 963 | | - } |
|---|
| 964 | | - return false; |
|---|
| 965 | 926 | } |
|---|
| 927 | + |
|---|
| 928 | + if (!(sim_bitmap & 0x03)) { /* path A TX OK */ |
|---|
| 929 | + for (i = 0; i < 2; i++) |
|---|
| 930 | + resulta[3][i] = resulta[c1][i]; |
|---|
| 931 | + } |
|---|
| 932 | + if (!(sim_bitmap & 0x0c)) { /* path A RX OK */ |
|---|
| 933 | + for (i = 2; i < 4; i++) |
|---|
| 934 | + resulta[3][i] = resulta[c1][i]; |
|---|
| 935 | + } |
|---|
| 936 | + |
|---|
| 937 | + if (!(sim_bitmap & 0x30)) { /* path B TX OK */ |
|---|
| 938 | + for (i = 4; i < 6; i++) |
|---|
| 939 | + resulta[3][i] = resulta[c1][i]; |
|---|
| 940 | + } |
|---|
| 941 | + |
|---|
| 942 | + if (!(sim_bitmap & 0xc0)) { /* path B RX OK */ |
|---|
| 943 | + for (i = 6; i < 8; i++) |
|---|
| 944 | + resulta[3][i] = resulta[c1][i]; |
|---|
| 945 | + } |
|---|
| 946 | + return false; |
|---|
| 966 | 947 | } |
|---|
| 967 | 948 | |
|---|
| 968 | 949 | static void phy_iq_calibrate(struct adapter *adapt, s32 result[][8], |
|---|
| .. | .. |
|---|
| 971 | 952 | struct odm_dm_struct *dm_odm = &adapt->HalData->odmpriv; |
|---|
| 972 | 953 | u32 i; |
|---|
| 973 | 954 | u8 path_a_ok, path_b_ok; |
|---|
| 974 | | - u32 adda_reg[IQK_ADDA_REG_NUM] = { |
|---|
| 975 | | - rFPGA0_XCD_SwitchControl, rBlue_Tooth, |
|---|
| 976 | | - rRx_Wait_CCA, rTx_CCK_RFON, |
|---|
| 977 | | - rTx_CCK_BBON, rTx_OFDM_RFON, |
|---|
| 978 | | - rTx_OFDM_BBON, rTx_To_Rx, |
|---|
| 979 | | - rTx_To_Tx, rRx_CCK, |
|---|
| 980 | | - rRx_OFDM, rRx_Wait_RIFS, |
|---|
| 981 | | - rRx_TO_Rx, rStandby, |
|---|
| 982 | | - rSleep, rPMPD_ANAEN}; |
|---|
| 983 | | - |
|---|
| 984 | | - u32 iqk_mac_reg[IQK_MAC_REG_NUM] = { |
|---|
| 985 | | - REG_TXPAUSE, REG_BCN_CTRL, |
|---|
| 986 | | - REG_BCN_CTRL_1, REG_GPIO_MUXCFG}; |
|---|
| 987 | | - |
|---|
| 955 | + static const u32 adda_reg[IQK_ADDA_REG_NUM] = { |
|---|
| 956 | + rFPGA0_XCD_SwitchControl, rBlue_Tooth, |
|---|
| 957 | + rRx_Wait_CCA, rTx_CCK_RFON, |
|---|
| 958 | + rTx_CCK_BBON, rTx_OFDM_RFON, |
|---|
| 959 | + rTx_OFDM_BBON, rTx_To_Rx, |
|---|
| 960 | + rTx_To_Tx, rRx_CCK, |
|---|
| 961 | + rRx_OFDM, rRx_Wait_RIFS, |
|---|
| 962 | + rRx_TO_Rx, rStandby, |
|---|
| 963 | + rSleep, rPMPD_ANAEN |
|---|
| 964 | + }; |
|---|
| 965 | + static const u32 iqk_mac_reg[IQK_MAC_REG_NUM] = { |
|---|
| 966 | + REG_TXPAUSE, REG_BCN_CTRL, |
|---|
| 967 | + REG_BCN_CTRL_1, REG_GPIO_MUXCFG |
|---|
| 968 | + }; |
|---|
| 988 | 969 | /* since 92C & 92D have the different define in IQK_BB_REG */ |
|---|
| 989 | | - u32 iqk_bb_reg_92c[IQK_BB_REG_NUM] = { |
|---|
| 990 | | - rOFDM0_TRxPathEnable, rOFDM0_TRMuxPar, |
|---|
| 991 | | - rFPGA0_XCD_RFInterfaceSW, rConfig_AntA, rConfig_AntB, |
|---|
| 992 | | - rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE, |
|---|
| 993 | | - rFPGA0_XB_RFInterfaceOE, rFPGA0_RFMOD}; |
|---|
| 970 | + static const u32 iqk_bb_reg_92c[IQK_BB_REG_NUM] = { |
|---|
| 971 | + rOFDM0_TRxPathEnable, rOFDM0_TRMuxPar, |
|---|
| 972 | + rFPGA0_XCD_RFInterfaceSW, rConfig_AntA, rConfig_AntB, |
|---|
| 973 | + rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE, |
|---|
| 974 | + rFPGA0_XB_RFInterfaceOE, rFPGA0_RFMOD |
|---|
| 975 | + }; |
|---|
| 994 | 976 | |
|---|
| 995 | 977 | u32 retry_count = 9; |
|---|
| 996 | 978 | |
|---|
| 997 | | - if (*(dm_odm->mp_mode) == 1) |
|---|
| 979 | + if (*dm_odm->mp_mode == 1) |
|---|
| 998 | 980 | retry_count = 9; |
|---|
| 999 | 981 | else |
|---|
| 1000 | 982 | retry_count = 2; |
|---|
| .. | .. |
|---|
| 1056 | 1038 | for (i = 0; i < retry_count; i++) { |
|---|
| 1057 | 1039 | path_a_ok = phy_path_a_iqk(adapt, is2t); |
|---|
| 1058 | 1040 | if (path_a_ok == 0x01) { |
|---|
| 1059 | | - result[t][0] = (phy_query_bb_reg(adapt, rTx_Power_Before_IQK_A, |
|---|
| 1060 | | - bMaskDWord)&0x3FF0000)>>16; |
|---|
| 1061 | | - result[t][1] = (phy_query_bb_reg(adapt, rTx_Power_After_IQK_A, |
|---|
| 1062 | | - bMaskDWord)&0x3FF0000)>>16; |
|---|
| 1041 | + result[t][0] = (phy_query_bb_reg(adapt, rTx_Power_Before_IQK_A, |
|---|
| 1042 | + bMaskDWord) & 0x3FF0000) >> 16; |
|---|
| 1043 | + result[t][1] = (phy_query_bb_reg(adapt, rTx_Power_After_IQK_A, |
|---|
| 1044 | + bMaskDWord) & 0x3FF0000) >> 16; |
|---|
| 1063 | 1045 | break; |
|---|
| 1064 | 1046 | } |
|---|
| 1065 | 1047 | } |
|---|
| .. | .. |
|---|
| 1067 | 1049 | for (i = 0; i < retry_count; i++) { |
|---|
| 1068 | 1050 | path_a_ok = phy_path_a_rx_iqk(adapt, is2t); |
|---|
| 1069 | 1051 | if (path_a_ok == 0x03) { |
|---|
| 1070 | | - result[t][2] = (phy_query_bb_reg(adapt, rRx_Power_Before_IQK_A_2, |
|---|
| 1071 | | - bMaskDWord)&0x3FF0000)>>16; |
|---|
| 1072 | | - result[t][3] = (phy_query_bb_reg(adapt, rRx_Power_After_IQK_A_2, |
|---|
| 1073 | | - bMaskDWord)&0x3FF0000)>>16; |
|---|
| 1052 | + result[t][2] = (phy_query_bb_reg(adapt, rRx_Power_Before_IQK_A_2, |
|---|
| 1053 | + bMaskDWord) & 0x3FF0000) >> 16; |
|---|
| 1054 | + result[t][3] = (phy_query_bb_reg(adapt, rRx_Power_After_IQK_A_2, |
|---|
| 1055 | + bMaskDWord) & 0x3FF0000) >> 16; |
|---|
| 1074 | 1056 | break; |
|---|
| 1075 | | - } else { |
|---|
| 1076 | | - ODM_RT_TRACE(dm_odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, |
|---|
| 1077 | | - ("Path A Rx IQK Fail!!\n")); |
|---|
| 1078 | 1057 | } |
|---|
| 1058 | + ODM_RT_TRACE(dm_odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, |
|---|
| 1059 | + ("Path A Rx IQK Fail!!\n")); |
|---|
| 1079 | 1060 | } |
|---|
| 1080 | 1061 | |
|---|
| 1081 | 1062 | if (path_a_ok == 0x00) { |
|---|
| .. | .. |
|---|
| 1093 | 1074 | path_b_ok = phy_path_b_iqk(adapt); |
|---|
| 1094 | 1075 | if (path_b_ok == 0x03) { |
|---|
| 1095 | 1076 | result[t][4] = (phy_query_bb_reg(adapt, rTx_Power_Before_IQK_B, |
|---|
| 1096 | | - bMaskDWord)&0x3FF0000)>>16; |
|---|
| 1077 | + bMaskDWord) & 0x3FF0000) >> 16; |
|---|
| 1097 | 1078 | result[t][5] = (phy_query_bb_reg(adapt, rTx_Power_After_IQK_B, |
|---|
| 1098 | | - bMaskDWord)&0x3FF0000)>>16; |
|---|
| 1079 | + bMaskDWord) & 0x3FF0000) >> 16; |
|---|
| 1099 | 1080 | result[t][6] = (phy_query_bb_reg(adapt, rRx_Power_Before_IQK_B_2, |
|---|
| 1100 | | - bMaskDWord)&0x3FF0000)>>16; |
|---|
| 1081 | + bMaskDWord) & 0x3FF0000) >> 16; |
|---|
| 1101 | 1082 | result[t][7] = (phy_query_bb_reg(adapt, rRx_Power_After_IQK_B_2, |
|---|
| 1102 | | - bMaskDWord)&0x3FF0000)>>16; |
|---|
| 1083 | + bMaskDWord) & 0x3FF0000) >> 16; |
|---|
| 1103 | 1084 | break; |
|---|
| 1104 | 1085 | } else if (i == (retry_count - 1) && path_b_ok == 0x01) { /* Tx IQK OK */ |
|---|
| 1105 | 1086 | result[t][4] = (phy_query_bb_reg(adapt, rTx_Power_Before_IQK_B, |
|---|
| 1106 | | - bMaskDWord)&0x3FF0000)>>16; |
|---|
| 1087 | + bMaskDWord) & 0x3FF0000) >> 16; |
|---|
| 1107 | 1088 | result[t][5] = (phy_query_bb_reg(adapt, rTx_Power_After_IQK_B, |
|---|
| 1108 | | - bMaskDWord)&0x3FF0000)>>16; |
|---|
| 1089 | + bMaskDWord) & 0x3FF0000) >> 16; |
|---|
| 1109 | 1090 | } |
|---|
| 1110 | 1091 | } |
|---|
| 1111 | 1092 | |
|---|
| .. | .. |
|---|
| 1158 | 1139 | /* Check continuous TX and Packet TX */ |
|---|
| 1159 | 1140 | tmpreg = usb_read8(adapt, 0xd03); |
|---|
| 1160 | 1141 | |
|---|
| 1161 | | - if ((tmpreg&0x70) != 0) |
|---|
| 1162 | | - usb_write8(adapt, 0xd03, tmpreg&0x8F); |
|---|
| 1142 | + if ((tmpreg & 0x70) != 0) |
|---|
| 1143 | + usb_write8(adapt, 0xd03, tmpreg & 0x8F); |
|---|
| 1163 | 1144 | else |
|---|
| 1164 | 1145 | usb_write8(adapt, REG_TXPAUSE, 0xFF); |
|---|
| 1165 | 1146 | |
|---|
| 1166 | | - if ((tmpreg&0x70) != 0) { |
|---|
| 1147 | + if ((tmpreg & 0x70) != 0) { |
|---|
| 1167 | 1148 | /* 1. Read original RF mode */ |
|---|
| 1168 | 1149 | /* Path-A */ |
|---|
| 1169 | 1150 | rf_a_mode = rtw_hal_read_rfreg(adapt, RF_PATH_A, RF_AC, |
|---|
| 1170 | | - bMask12Bits); |
|---|
| 1151 | + bMask12Bits); |
|---|
| 1171 | 1152 | |
|---|
| 1172 | 1153 | /* Path-B */ |
|---|
| 1173 | 1154 | if (is2t) |
|---|
| 1174 | 1155 | rf_b_mode = rtw_hal_read_rfreg(adapt, RF_PATH_B, RF_AC, |
|---|
| 1175 | | - bMask12Bits); |
|---|
| 1156 | + bMask12Bits); |
|---|
| 1176 | 1157 | |
|---|
| 1177 | 1158 | /* 2. Set RF mode = standby mode */ |
|---|
| 1178 | 1159 | /* Path-A */ |
|---|
| 1179 | 1160 | phy_set_rf_reg(adapt, RF_PATH_A, RF_AC, bMask12Bits, |
|---|
| 1180 | | - (rf_a_mode&0x8FFFF)|0x10000); |
|---|
| 1161 | + (rf_a_mode & 0x8FFFF) | 0x10000); |
|---|
| 1181 | 1162 | |
|---|
| 1182 | 1163 | /* Path-B */ |
|---|
| 1183 | 1164 | if (is2t) |
|---|
| 1184 | 1165 | phy_set_rf_reg(adapt, RF_PATH_B, RF_AC, bMask12Bits, |
|---|
| 1185 | | - (rf_b_mode&0x8FFFF)|0x10000); |
|---|
| 1166 | + (rf_b_mode & 0x8FFFF) | 0x10000); |
|---|
| 1186 | 1167 | } |
|---|
| 1187 | 1168 | |
|---|
| 1188 | 1169 | /* 3. Read RF reg18 */ |
|---|
| .. | .. |
|---|
| 1190 | 1171 | |
|---|
| 1191 | 1172 | /* 4. Set LC calibration begin bit15 */ |
|---|
| 1192 | 1173 | phy_set_rf_reg(adapt, RF_PATH_A, RF_CHNLBW, bMask12Bits, |
|---|
| 1193 | | - lc_cal|0x08000); |
|---|
| 1174 | + lc_cal | 0x08000); |
|---|
| 1194 | 1175 | |
|---|
| 1195 | 1176 | msleep(100); |
|---|
| 1196 | 1177 | |
|---|
| 1197 | 1178 | /* Restore original situation */ |
|---|
| 1198 | | - if ((tmpreg&0x70) != 0) { |
|---|
| 1179 | + if ((tmpreg & 0x70) != 0) { |
|---|
| 1199 | 1180 | /* Deal with continuous TX case */ |
|---|
| 1200 | 1181 | /* Path-A */ |
|---|
| 1201 | 1182 | usb_write8(adapt, 0xd03, tmpreg); |
|---|
| .. | .. |
|---|
| 1215 | 1196 | { |
|---|
| 1216 | 1197 | struct odm_dm_struct *dm_odm = &adapt->HalData->odmpriv; |
|---|
| 1217 | 1198 | s32 result[4][8]; |
|---|
| 1218 | | - u8 i, final, chn_index; |
|---|
| 1199 | + u8 i, final; |
|---|
| 1219 | 1200 | bool pathaok, pathbok; |
|---|
| 1220 | 1201 | s32 reg_e94, reg_e9c, reg_ea4, reg_eb4, reg_ebc, reg_ec4; |
|---|
| 1221 | 1202 | bool is12simular, is13simular, is23simular; |
|---|
| .. | .. |
|---|
| 1244 | 1225 | return; |
|---|
| 1245 | 1226 | } |
|---|
| 1246 | 1227 | |
|---|
| 1247 | | - for (i = 0; i < 8; i++) { |
|---|
| 1248 | | - result[0][i] = 0; |
|---|
| 1249 | | - result[1][i] = 0; |
|---|
| 1250 | | - result[2][i] = 0; |
|---|
| 1251 | | - if ((i == 0) || (i == 2) || (i == 4) || (i == 6)) |
|---|
| 1252 | | - result[3][i] = 0x100; |
|---|
| 1253 | | - else |
|---|
| 1254 | | - result[3][i] = 0; |
|---|
| 1255 | | - } |
|---|
| 1228 | + memset(result, 0, sizeof(result)); |
|---|
| 1229 | + for (i = 0; i < 8; i += 2) |
|---|
| 1230 | + result[3][i] = 0x100; |
|---|
| 1231 | + |
|---|
| 1256 | 1232 | final = 0xff; |
|---|
| 1257 | 1233 | pathaok = false; |
|---|
| 1258 | 1234 | pathbok = false; |
|---|
| .. | .. |
|---|
| 1324 | 1300 | (reg_ec4 == 0)); |
|---|
| 1325 | 1301 | } |
|---|
| 1326 | 1302 | |
|---|
| 1327 | | - chn_index = get_right_chnl_for_iqk(adapt->HalData->CurrentChannel); |
|---|
| 1328 | | - |
|---|
| 1329 | 1303 | if (final < 4) { |
|---|
| 1330 | 1304 | for (i = 0; i < IQK_Matrix_REG_NUM; i++) |
|---|
| 1331 | | - dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[chn_index].Value[0][i] = result[final][i]; |
|---|
| 1332 | | - dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[chn_index].bIQKDone = true; |
|---|
| 1305 | + dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[0].Value[0][i] = result[final][i]; |
|---|
| 1306 | + dm_odm->RFCalibrateInfo.IQKMatrixRegSetting[0].bIQKDone = true; |
|---|
| 1333 | 1307 | } |
|---|
| 1334 | 1308 | |
|---|
| 1335 | 1309 | save_adda_registers(adapt, iqk_bb_reg_92c, |
|---|
| .. | .. |
|---|
| 1347 | 1321 | if (singletone || carrier_sup) |
|---|
| 1348 | 1322 | return; |
|---|
| 1349 | 1323 | |
|---|
| 1350 | | - while (*(dm_odm->pbScanInProcess) && timecount < timeout) { |
|---|
| 1324 | + while (*dm_odm->pbScanInProcess && timecount < timeout) { |
|---|
| 1351 | 1325 | mdelay(50); |
|---|
| 1352 | 1326 | timecount += 50; |
|---|
| 1353 | 1327 | } |
|---|