2014-12-31 18:49:44

by Lorenzo Stoakes

[permalink] [raw]
Subject: [PATCH 1/4] staging: rtl8192u: fix comments

This patch fixes errors raised by checkpatch.pl relating to use of C99 comments
in r8192U_dm.c.

Signed-off-by: Lorenzo Stoakes <[email protected]>
---
drivers/staging/rtl8192u/r8192U_dm.c | 841 ++++++++++++++++++-----------------
1 file changed, 432 insertions(+), 409 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 936565d..44f4c38 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -21,14 +21,15 @@ Major Change History:
#include "r8190_rtl8256.h"
#include "r819xU_cmdpkt.h"
/*---------------------------Define Local Constant---------------------------*/
-//
-// Indicate different AP vendor for IOT issue.
-//
-static u32 edca_setting_DL[HT_IOT_PEER_MAX] =
- { 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f};
-static u32 edca_setting_UL[HT_IOT_PEER_MAX] =
- { 0x5e4322, 0xa44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f};
-
+/*
+ * Indicate different AP vendor for IOT issue.
+ */
+static u32 edca_setting_DL[HT_IOT_PEER_MAX] = {
+ 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f
+};
+static u32 edca_setting_UL[HT_IOT_PEER_MAX] = {
+ 0x5e4322, 0xa44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f
+};

#define RTK_UL_EDCA 0xa44f
#define RTK_DL_EDCA 0x5e4322
@@ -36,11 +37,11 @@ static u32 edca_setting_UL[HT_IOT_PEER_MAX] =


/*------------------------Define global variable-----------------------------*/
-// Debug variable ?
+/* Debug variable ? */
dig_t dm_digtable;
-// Store current software write register content for MAC PHY.
+/* Store current software write register content for MAC PHY. */
u8 dm_shadow[16][256] = {{0}};
-// For Dynamic Rx Path Selection by Signal Strength
+/* For Dynamic Rx Path Selection by Signal Strength */
DRxPathSel DM_RxPathSelTable;
/*------------------------Define global variable-----------------------------*/

@@ -56,24 +57,24 @@ extern void dm_check_fsync(struct net_device *dev);


/*---------------------Define local function prototype-----------------------*/
-// DM --> Rate Adaptive
+/* DM --> Rate Adaptive */
static void dm_check_rate_adaptive(struct net_device *dev);

-// DM --> Bandwidth switch
+/* DM --> Bandwidth switch */
static void dm_init_bandwidth_autoswitch(struct net_device *dev);
static void dm_bandwidth_autoswitch(struct net_device *dev);

-// DM --> TX power control
-//static void dm_initialize_txpower_tracking(struct net_device *dev);
+/* DM --> TX power control */
+/*static void dm_initialize_txpower_tracking(struct net_device *dev);*/

static void dm_check_txpower_tracking(struct net_device *dev);



-//static void dm_txpower_reset_recovery(struct net_device *dev);
+/*static void dm_txpower_reset_recovery(struct net_device *dev);*/


-// DM --> Dynamic Init Gain by RSSI
+/* DM --> Dynamic Init Gain by RSSI */
static void dm_dig_init(struct net_device *dev);
static void dm_ctrl_initgain_byrssi(struct net_device *dev);
static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev);
@@ -84,61 +85,61 @@ static void dm_pd_th(struct net_device *dev);
static void dm_cs_ratio(struct net_device *dev);

static void dm_init_ctstoself(struct net_device *dev);
-// DM --> EDCA turbo mode control
+/* DM --> EDCA turbo mode control */
static void dm_check_edca_turbo(struct net_device *dev);

-//static void dm_gpio_change_rf(struct net_device *dev);
-// DM --> Check PBC
+/*static void dm_gpio_change_rf(struct net_device *dev);*/
+/* DM --> Check PBC */
static void dm_check_pbc_gpio(struct net_device *dev);


-// DM --> Check current RX RF path state
+/* DM --> Check current RX RF path state */
static void dm_check_rx_path_selection(struct net_device *dev);
static void dm_init_rxpath_selection(struct net_device *dev);
static void dm_rxpath_sel_byrssi(struct net_device *dev);


-// DM --> Fsync for broadcom ap
+/* DM --> Fsync for broadcom ap */
static void dm_init_fsync(struct net_device *dev);
static void dm_deInit_fsync(struct net_device *dev);

-//Added by vivi, 20080522
+/* Added by vivi, 20080522 */
static void dm_check_txrateandretrycount(struct net_device *dev);

/*---------------------Define local function prototype-----------------------*/

-/*---------------------Define of Tx Power Control For Near/Far Range --------*/ //Add by Jacken 2008/02/18
+/*---------------------Define of Tx Power Control For Near/Far Range --------*/ /*Add by Jacken 2008/02/18 */
static void dm_init_dynamic_txpower(struct net_device *dev);
static void dm_dynamic_txpower(struct net_device *dev);


-// DM --> For rate adaptive and DIG, we must send RSSI to firmware
+/* DM --> For rate adaptive and DIG, we must send RSSI to firmware */
static void dm_send_rssi_tofw(struct net_device *dev);
static void dm_ctstoself(struct net_device *dev);
/*---------------------------Define function prototype------------------------*/
-//================================================================================
-// HW Dynamic mechanism interface.
-//================================================================================
-
-//
-// Description:
-// Prepare SW resource for HW dynamic mechanism.
-//
-// Assumption:
-// This function is only invoked at driver intialization once.
-//
-//
+/*
+ * ================================================================================
+ * HW Dynamic mechanism interface.
+ * ================================================================================
+ *
+ *
+ * Description:
+ * Prepare SW resource for HW dynamic mechanism.
+ *
+ * Assumption:
+ * This function is only invoked at driver intialization once.
+ */
void init_hal_dm(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);

- // Undecorated Smoothed Signal Strength, it can utilized to dynamic mechanism.
+ /* Undecorated Smoothed Signal Strength, it can utilized to dynamic mechanism. */
priv->undecorated_smoothed_pwdb = -1;

- //Initial TX Power Control for near/far range , add by amy 2008/05/15, porting from windows code.
+ /* Initial TX Power Control for near/far range , add by amy 2008/05/15, porting from windows code. */
dm_init_dynamic_txpower(dev);
init_rate_adaptive(dev);
- //dm_initialize_txpower_tracking(dev);
+ /*dm_initialize_txpower_tracking(dev);*/
dm_dig_init(dev);
dm_init_edca_turbo(dev);
dm_init_bandwidth_autoswitch(dev);
@@ -146,7 +147,7 @@ void init_hal_dm(struct net_device *dev)
dm_init_rxpath_selection(dev);
dm_init_ctstoself(dev);

-} // InitHalDm
+} /* InitHalDm */

void deinit_hal_dm(struct net_device *dev)
{
@@ -208,16 +209,16 @@ void dm_CheckRxAggregation(struct net_device *dev) {

lastTxOkCnt = priv->stats.txbytesunicast;
lastRxOkCnt = priv->stats.rxbytesunicast;
-} // dm_CheckEdcaTurbo
+} /* dm_CheckEdcaTurbo */
#endif



void hal_dm_watchdog(struct net_device *dev)
{
- //struct r8192_priv *priv = ieee80211_priv(dev);
+ /*struct r8192_priv *priv = ieee80211_priv(dev);*/

- //static u8 previous_bssid[6] ={0};
+ /*static u8 previous_bssid[6] ={0};*/

/*Add by amy 2008/05/15 ,porting from windows code.*/
dm_check_rate_adaptive(dev);
@@ -230,22 +231,22 @@ void hal_dm_watchdog(struct net_device *dev)
dm_check_rx_path_selection(dev);
dm_check_fsync(dev);

- // Add by amy 2008-05-15 porting from windows code.
+ /* Add by amy 2008-05-15 porting from windows code. */
dm_check_pbc_gpio(dev);
dm_send_rssi_tofw(dev);
dm_ctstoself(dev);
#ifdef USB_RX_AGGREGATION_SUPPORT
dm_CheckRxAggregation(dev);
#endif
-} //HalDmWatchDog
+} /* HalDmWatchDog */


/*
- * Decide Rate Adaptive Set according to distance (signal strength)
- * 01/11/2008 MHC Modify input arguments and RATR table level.
- * 01/16/2008 MHC RF_Type is assigned in ReadAdapterInfo(). We must call
- * the function after making sure RF_Type.
- */
+ * Decide Rate Adaptive Set according to distance (signal strength)
+ * 01/11/2008 MHC Modify input arguments and RATR table level.
+ * 01/16/2008 MHC RF_Type is assigned in ReadAdapterInfo(). We must call
+ * the function after making sure RF_Type.
+ */
void init_rate_adaptive(struct net_device *dev)
{

@@ -270,14 +271,16 @@ void init_rate_adaptive(struct net_device *dev)

if (priv->rf_type == RF_2T4R)
{
- // 07/10/08 MH Modify for RA smooth scheme.
- /* 2008/01/11 MH Modify 2T RATR table for different RSSI. 080515 porting by amy from windows code.*/
+ /*
+ * 07/10/08 MH Modify for RA smooth scheme.
+ * 2008/01/11 MH Modify 2T RATR table for different RSSI. 080515 porting by amy from windows code.
+ */
pra->upper_rssi_threshold_ratr = 0x8f0f0000;
pra->middle_rssi_threshold_ratr = 0x8f0ff000;
pra->low_rssi_threshold_ratr = 0x8f0ff001;
pra->low_rssi_threshold_ratr_40M = 0x8f0ff005;
pra->low_rssi_threshold_ratr_20M = 0x8f0ff001;
- pra->ping_rssi_ratr = 0x0000000d;//cosa add for test
+ pra->ping_rssi_ratr = 0x0000000d;/* cosa add for test */
}
else if (priv->rf_type == RF_1T2R)
{
@@ -286,10 +289,10 @@ void init_rate_adaptive(struct net_device *dev)
pra->low_rssi_threshold_ratr = 0x000ff001;
pra->low_rssi_threshold_ratr_40M = 0x000ff005;
pra->low_rssi_threshold_ratr_20M = 0x000ff001;
- pra->ping_rssi_ratr = 0x0000000d;//cosa add for test
+ pra->ping_rssi_ratr = 0x0000000d;/* cosa add for test */
}

-} // InitRateAdaptive
+} /* InitRateAdaptive */


/*-----------------------------------------------------------------------------
@@ -325,21 +328,21 @@ static void dm_check_rate_adaptive(struct net_device *dev)
return;
}

- if(pra->rate_adaptive_disabled)//this variable is set by ioctl.
+ if(pra->rate_adaptive_disabled) /* this variable is set by ioctl. */
return;

- // TODO: Only 11n mode is implemented currently,
+ /* TODO: Only 11n mode is implemented currently, */
if(!(priv->ieee80211->mode == WIRELESS_MODE_N_24G ||
priv->ieee80211->mode == WIRELESS_MODE_N_5G))
return;

if(priv->ieee80211->state == IEEE80211_LINKED)
{
- // RT_TRACE(COMP_RATE, "dm_CheckRateAdaptive(): \t");
+ /*RT_TRACE(COMP_RATE, "dm_CheckRateAdaptive(): \t");*/

- //
- // Check whether Short GI is enabled
- //
+ /*
+ * Check whether Short GI is enabled
+ */
bshort_gi_enabled = (pHTInfo->bCurTxBW40MHz && pHTInfo->bCurShortGI40MHz) ||
(!pHTInfo->bCurTxBW40MHz && pHTInfo->bCurShortGI20MHz);

@@ -360,7 +363,7 @@ static void dm_check_rate_adaptive(struct net_device *dev)
pra->low_rssi_threshold_ratr =
(pra->low_rssi_threshold_ratr_20M & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ;
}
- //cosa add for test
+ /* cosa add for test */
pra->ping_rssi_ratr =
(pra->ping_rssi_ratr & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ;

@@ -387,56 +390,57 @@ static void dm_check_rate_adaptive(struct net_device *dev)
(pra->low_rssi_thresh_for_ra40M):(pra->low_rssi_thresh_for_ra20M);
}

- //DbgPrint("[DM] THresh H/L=%d/%d\n\r", RATR.HighRSSIThreshForRA, RATR.LowRSSIThreshForRA);
+ /*DbgPrint("[DM] THresh H/L=%d/%d\n\r", RATR.HighRSSIThreshForRA, RATR.LowRSSIThreshForRA);*/
if(priv->undecorated_smoothed_pwdb >= (long)HighRSSIThreshForRA)
{
- //DbgPrint("[DM] RSSI=%d STA=HIGH\n\r", pHalData->UndecoratedSmoothedPWDB);
+ /*DbgPrint("[DM] RSSI=%d STA=HIGH\n\r", pHalData->UndecoratedSmoothedPWDB);*/
pra->ratr_state = DM_RATR_STA_HIGH;
targetRATR = pra->upper_rssi_threshold_ratr;
}else if(priv->undecorated_smoothed_pwdb >= (long)LowRSSIThreshForRA)
{
- //DbgPrint("[DM] RSSI=%d STA=Middle\n\r", pHalData->UndecoratedSmoothedPWDB);
+ /*DbgPrint("[DM] RSSI=%d STA=Middle\n\r", pHalData->UndecoratedSmoothedPWDB);*/
pra->ratr_state = DM_RATR_STA_MIDDLE;
targetRATR = pra->middle_rssi_threshold_ratr;
}else
{
- //DbgPrint("[DM] RSSI=%d STA=LOW\n\r", pHalData->UndecoratedSmoothedPWDB);
+ /*DbgPrint("[DM] RSSI=%d STA=LOW\n\r", pHalData->UndecoratedSmoothedPWDB);*/
pra->ratr_state = DM_RATR_STA_LOW;
targetRATR = pra->low_rssi_threshold_ratr;
}

- //cosa add for test
- if(pra->ping_rssi_enable)
- {
- //pHalData->UndecoratedSmoothedPWDB = 19;
+ /* cosa add for test */
+ if(pra->ping_rssi_enable) {
+ /*pHalData->UndecoratedSmoothedPWDB = 19;*/
if(priv->undecorated_smoothed_pwdb < (long)(pra->ping_rssi_thresh_for_ra+5))
{
if((priv->undecorated_smoothed_pwdb < (long)pra->ping_rssi_thresh_for_ra) ||
ping_rssi_state)
{
- //DbgPrint("TestRSSI = %d, set RATR to 0x%x \n", pHalData->UndecoratedSmoothedPWDB, pRA->TestRSSIRATR);
+ /*DbgPrint("TestRSSI = %d, set RATR to 0x%x \n", pHalData->UndecoratedSmoothedPWDB, pRA->TestRSSIRATR);*/
pra->ratr_state = DM_RATR_STA_LOW;
targetRATR = pra->ping_rssi_ratr;
ping_rssi_state = 1;
}
- //else
- // DbgPrint("TestRSSI is between the range. \n");
+ /*else
+ DbgPrint("TestRSSI is between the range. \n");*/
}
else
{
- //DbgPrint("TestRSSI Recover to 0x%x \n", targetRATR);
+ /*DbgPrint("TestRSSI Recover to 0x%x \n", targetRATR);*/
ping_rssi_state = 0;
}
}

- // 2008.04.01
- // For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7.
+ /*
+ * 2008.04.01
+ * For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7.
+ */
if(priv->ieee80211->GetHalfNmodeSupportByAPsHandler(dev))
targetRATR &= 0xf00fffff;

- //
- // Check whether updating of RATR0 is required
- //
+ /*
+ * Check whether updating of RATR0 is required
+ */
read_nic_dword(dev, RATR0, &currentRATR);
if(targetRATR != currentRATR)
{
@@ -459,7 +463,7 @@ static void dm_check_rate_adaptive(struct net_device *dev)
pra->ratr_state = DM_RATR_STA_MAX;
}

-} // dm_CheckRateAdaptive
+} /* dm_CheckRateAdaptive */


static void dm_init_bandwidth_autoswitch(struct net_device *dev)
@@ -471,7 +475,7 @@ static void dm_init_bandwidth_autoswitch(struct net_device *dev)
priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;
priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable = false;

-} // dm_init_bandwidth_autoswitch
+} /* dm_init_bandwidth_autoswitch */


static void dm_bandwidth_autoswitch(struct net_device *dev)
@@ -481,68 +485,68 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)
if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ||!priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable){
return;
}else{
- if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40
+ if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){ /* If send packets in 40 Mhz in 20/40 */
if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
- }else{//in force send packets in 20 Mhz in 20/40
+ }else{ /* in force send packets in 20 Mhz in 20/40 */
if(priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;

}
}
-} // dm_BandwidthAutoSwitch
+} /* dm_BandwidthAutoSwitch */

-//OFDM default at 0db, index=6.
+/* OFDM default at 0db, index=6. */
static u32 OFDMSwingTable[OFDM_Table_Length] = {
- 0x7f8001fe, // 0, +6db
- 0x71c001c7, // 1, +5db
- 0x65400195, // 2, +4db
- 0x5a400169, // 3, +3db
- 0x50800142, // 4, +2db
- 0x47c0011f, // 5, +1db
- 0x40000100, // 6, +0db ===> default, upper for higher temperature, lower for low temperature
- 0x390000e4, // 7, -1db
- 0x32c000cb, // 8, -2db
- 0x2d4000b5, // 9, -3db
- 0x288000a2, // 10, -4db
- 0x24000090, // 11, -5db
- 0x20000080, // 12, -6db
- 0x1c800072, // 13, -7db
- 0x19800066, // 14, -8db
- 0x26c0005b, // 15, -9db
- 0x24400051, // 16, -10db
- 0x12000048, // 17, -11db
- 0x10000040 // 18, -12db
+ 0x7f8001fe, /* 0, +6db */
+ 0x71c001c7, /* 1, +5db */
+ 0x65400195, /* 2, +4db */
+ 0x5a400169, /* 3, +3db */
+ 0x50800142, /* 4, +2db */
+ 0x47c0011f, /* 5, +1db */
+ 0x40000100, /* 6, +0db ===> default, upper for higher temperature, lower for low temperature */
+ 0x390000e4, /* 7, -1db */
+ 0x32c000cb, /* 8, -2db */
+ 0x2d4000b5, /* 9, -3db */
+ 0x288000a2, /* 10, -4db */
+ 0x24000090, /* 11, -5db */
+ 0x20000080, /* 12, -6db */
+ 0x1c800072, /* 13, -7db */
+ 0x19800066, /* 14, -8db */
+ 0x26c0005b, /* 15, -9db */
+ 0x24400051, /* 16, -10db */
+ 0x12000048, /* 17, -11db */
+ 0x10000040 /* 18, -12db */
};

static u8 CCKSwingTable_Ch1_Ch13[CCK_Table_length][8] = {
- {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, // 0, +0db ===> CCK40M default
- {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 1, -1db
- {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 2, -2db
- {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 3, -3db
- {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 4, -4db
- {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 5, -5db
- {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 6, -6db ===> CCK20M default
- {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 7, -7db
- {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 8, -8db
- {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 9, -9db
- {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 10, -10db
- {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01} // 11, -11db
+ {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, /* 0, +0db ===> CCK40M default */
+ {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, /* 1, -1db */
+ {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, /* 2, -2db */
+ {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, /* 3, -3db */
+ {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, /* 4, -4db */
+ {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, /* 5, -5db */
+ {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, /* 6, -6db ===> CCK20M default */
+ {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, /* 7, -7db */
+ {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, /* 8, -8db */
+ {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, /* 9, -9db */
+ {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 10, -10db */
+ {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01} /* 11, -11db */
};

static u8 CCKSwingTable_Ch14[CCK_Table_length][8] = {
- {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, // 0, +0db ===> CCK40M default
- {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 1, -1db
- {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 2, -2db
- {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 3, -3db
- {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 4, -4db
- {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 5, -5db
- {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 6, -6db ===> CCK20M default
- {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 7, -7db
- {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 8, -8db
- {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 9, -9db
- {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 10, -10db
- {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00} // 11, -11db
+ {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, /* 0, +0db ===> CCK40M default */
+ {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, /* 1, -1db */
+ {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, /* 2, -2db */
+ {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, /* 3, -3db */
+ {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, /* 4, -4db */
+ {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, /* 5, -5db */
+ {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 6, -6db ===> CCK20M default */
+ {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, /* 7, -7db */
+ {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 8, -8db */
+ {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 9, -9db */
+ {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 10, -10db */
+ {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00} /* 11, -11db */
};

static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
@@ -556,7 +560,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
u32 Value;
u8 Pwr_Flag;
u16 Avg_TSSI_Meas, TSSI_13dBm, Avg_TSSI_Meas_from_driver=0;
- //RT_STATUS rtStatus = RT_STATUS_SUCCESS;
+ /*RT_STATUS rtStatus = RT_STATUS_SUCCESS;*/
bool rtStatus = true;
u32 delta=0;

@@ -571,9 +575,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)

RT_TRACE(COMP_POWER_TRACKING, "powerlevelOFDM24G = %x\n", powerlevelOFDM24G);

- for(j = 0; j<=30; j++)
-{ //fill tx_cmd
-
+ for(j = 0; j<=30; j++) { /* fill tx_cmd */
tx_cmd.Op = TXCMD_SET_TX_PWR_TRACKING;
tx_cmd.Length = 4;
tx_cmd.Value = Value;
@@ -583,7 +585,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
RT_TRACE(COMP_POWER_TRACKING, "Set configuration with tx cmd queue fail!\n");
}
mdelay(1);
- //DbgPrint("hi, vivi, strange\n");
+ /*DbgPrint("hi, vivi, strange\n");*/
for(i = 0;i <= 30; i++)
{
read_nic_byte(dev, 0x1ba, &Pwr_Flag);
@@ -609,7 +611,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
RT_TRACE(COMP_POWER_TRACKING, "TSSI_report_value = %d\n", tmp_report[k]);
}

- //check if the report value is right
+ /* check if the report value is right */
for(k = 0;k < 5; k++)
{
if(tmp_report[k] <= 20)
@@ -638,8 +640,8 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
TSSI_13dBm = priv->TSSI_13dBm;
RT_TRACE(COMP_POWER_TRACKING, "TSSI_13dBm = %d\n", TSSI_13dBm);

- //if(abs(Avg_TSSI_Meas_from_driver - TSSI_13dBm) <= E_FOR_TX_POWER_TRACK)
- // For MacOS-compatible
+ /*if(abs(Avg_TSSI_Meas_from_driver - TSSI_13dBm) <= E_FOR_TX_POWER_TRACK)*/
+ /* For MacOS-compatible */
if(Avg_TSSI_Meas_from_driver > TSSI_13dBm)
delta = Avg_TSSI_Meas_from_driver - TSSI_13dBm;
else
@@ -741,9 +743,9 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)

if(!priv->btxpower_trackingInit)
{
- //Query OFDM default setting
+ /* Query OFDM default setting */
tmpRegA= rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord);
- for(i=0; i<OFDM_Table_Length; i++) //find the index
+ for(i=0; i<OFDM_Table_Length; i++) /* find the index */
{
if(tmpRegA == OFDMSwingTable[i])
{
@@ -753,7 +755,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
}
}

- //Query CCK default setting From 0xa22
+ /* Query CCK default setting From 0xa22 */
TempCCk = rtl8192_QueryBBReg(dev, rCCK0_TxFilter1, bMaskByte2);
for(i=0 ; i<CCK_Table_length ; i++)
{
@@ -766,27 +768,28 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
}
}
priv->btxpower_trackingInit = TRUE;
- //pHalData->TXPowercount = 0;
+ /*pHalData->TXPowercount = 0;*/
return;
}

- //==========================
- // this is only for test, should be masked
- //==========================
+ /*==========================
+ * this is only for test, should be masked
+ *==========================
+ */

- // read and filter out unreasonable value
- tmpRegA = rtl8192_phy_QueryRFReg(dev, RF90_PATH_A, 0x12, 0x078); // 0x12: RF Reg[10:7]
+ /* read and filter out unreasonable value */
+ tmpRegA = rtl8192_phy_QueryRFReg(dev, RF90_PATH_A, 0x12, 0x078); /* 0x12: RF Reg[10:7] */
RT_TRACE(COMP_POWER_TRACKING, "Readback ThermalMeterA = %d \n", tmpRegA);
if(tmpRegA < 3 || tmpRegA > 13)
return;
- if(tmpRegA >= 12) // if over 12, TP will be bad when high temperature
+ if(tmpRegA >= 12) /* if over 12, TP will be bad when high temperature */
tmpRegA = 12;
RT_TRACE(COMP_POWER_TRACKING, "Valid ThermalMeterA = %d \n", tmpRegA);
- priv->ThermalMeter[0] = ThermalMeterVal; //We use fixed value by Bryant's suggestion
- priv->ThermalMeter[1] = ThermalMeterVal; //We use fixed value by Bryant's suggestion
+ priv->ThermalMeter[0] = ThermalMeterVal; /* We use fixed value by Bryant's suggestion */
+ priv->ThermalMeter[1] = ThermalMeterVal; /* We use fixed value by Bryant's suggestion */

- //Get current RF-A temperature index
- if(priv->ThermalMeter[0] >= (u8)tmpRegA) //lower temperature
+ /* Get current RF-A temperature index */
+ if(priv->ThermalMeter[0] >= (u8)tmpRegA) /* lower temperature */
{
tmpOFDMindex = tmpCCK20Mindex = 6+(priv->ThermalMeter[0]-(u8)tmpRegA);
tmpCCK40Mindex = tmpCCK20Mindex - 6;
@@ -800,16 +803,16 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
else
{
tmpval = ((u8)tmpRegA - priv->ThermalMeter[0]);
- if(tmpval >= 6) // higher temperature
- tmpOFDMindex = tmpCCK20Mindex = 0; // max to +6dB
+ if(tmpval >= 6) /* higher temperature */
+ tmpOFDMindex = tmpCCK20Mindex = 0; /* max to +6dB */
else
tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval;
tmpCCK40Mindex = 0;
}
- //DbgPrint("%ddb, tmpOFDMindex = %d, tmpCCK20Mindex = %d, tmpCCK40Mindex = %d",
- //((u1Byte)tmpRegA - pHalData->ThermalMeter[0]),
- //tmpOFDMindex, tmpCCK20Mindex, tmpCCK40Mindex);
- if(priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) //40M
+ /*DbgPrint("%ddb, tmpOFDMindex = %d, tmpCCK20Mindex = %d, tmpCCK40Mindex = %d",
+ ((u1Byte)tmpRegA - pHalData->ThermalMeter[0]),
+ tmpOFDMindex, tmpCCK20Mindex, tmpCCK40Mindex);*/
+ if(priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) /* 40M */
tmpCCKindex = tmpCCK40Mindex;
else
tmpCCKindex = tmpCCK20Mindex;
@@ -833,7 +836,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)

if(CCKSwingNeedUpdate)
{
- //DbgPrint("Update CCK Swing, CCK_index = %d\n", pHalData->CCK_index);
+ /*DbgPrint("Update CCK Swing, CCK_index = %d\n", pHalData->CCK_index);*/
dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
}
if(priv->OFDM_index != tmpOFDMindex)
@@ -864,7 +867,7 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev)

struct r8192_priv *priv = ieee80211_priv(dev);

- //Initial the Tx BB index and mapping value
+ /* Initial the Tx BB index and mapping value */
priv->txbbgain_table[0].txbb_iq_amplifygain = 12;
priv->txbbgain_table[0].txbbgain_value=0x7f8001fe;
priv->txbbgain_table[1].txbb_iq_amplifygain = 11;
@@ -940,8 +943,10 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev)
priv->txbbgain_table[36].txbb_iq_amplifygain = -24;
priv->txbbgain_table[36].txbbgain_value=0x10000040;

- //ccktxbb_valuearray[0] is 0xA22 [1] is 0xA24 ...[7] is 0xA29
- //This Table is for CH1~CH13
+ /*
+ * ccktxbb_valuearray[0] is 0xA22 [1] is 0xA24 ...[7] is 0xA29
+ * This Table is for CH1~CH13
+ */
priv->cck_txbbgain_table[0].ccktxbb_valuearray[0] = 0x36;
priv->cck_txbbgain_table[0].ccktxbb_valuearray[1] = 0x35;
priv->cck_txbbgain_table[0].ccktxbb_valuearray[2] = 0x2e;
@@ -1149,8 +1154,10 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev)
priv->cck_txbbgain_table[22].ccktxbb_valuearray[6] = 0x03;
priv->cck_txbbgain_table[22].ccktxbb_valuearray[7] = 0x01;

- //ccktxbb_valuearray[0] is 0xA22 [1] is 0xA24 ...[7] is 0xA29
- //This Table is for CH14
+ /*
+ * ccktxbb_valuearray[0] is 0xA22 [1] is 0xA24 ...[7] is 0xA29
+ * This Table is for CH14
+ */
priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[0] = 0x36;
priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[1] = 0x35;
priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[2] = 0x2e;
@@ -1368,9 +1375,11 @@ static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);

- // Tx Power tracking by Thermal Meter requires Firmware R/W 3-wire. This mechanism
- // can be enabled only when Firmware R/W 3-wire is enabled. Otherwise, frequent r/w
- // 3-wire by driver causes RF to go into a wrong state.
+ /*
+ * Tx Power tracking by Thermal Meter requires Firmware R/W 3-wire. This mechanism
+ * can be enabled only when Firmware R/W 3-wire is enabled. Otherwise, frequent r/w
+ * 3-wire by driver causes RF to go into a wrong state.
+ */
if(priv->ieee80211->FwRWRF)
priv->btxpower_tracking = TRUE;
else
@@ -1387,7 +1396,7 @@ void dm_initialize_txpower_tracking(struct net_device *dev)
dm_InitializeTXPowerTracking_TSSI(dev);
else
dm_InitializeTXPowerTracking_ThermalMeter(dev);
-}// dm_InitializeTXPowerTracking
+} /* dm_InitializeTXPowerTracking */


static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev)
@@ -1413,7 +1422,7 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
static u8 TM_Trigger;
- //DbgPrint("dm_CheckTXPowerTracking() \n");
+ /*DbgPrint("dm_CheckTXPowerTracking() \n");*/
if(!priv->btxpower_tracking)
return;
else
@@ -1427,9 +1436,11 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)

if(!TM_Trigger)
{
- //Attention!! You have to write all 12bits of data to RF, or it may cause RF to crash
- //actually write reg0x02 bit1=0, then bit1=1.
- //DbgPrint("Trigger ThermalMeter, write RF reg0x2 = 0x4d to 0x4f\n");
+ /*
+ * Attention!! You have to write all 12bits of data to RF, or it may cause RF to crash
+ * actually write reg0x02 bit1=0, then bit1=1.
+ * DbgPrint("Trigger ThermalMeter, write RF reg0x2 = 0x4d to 0x4f\n");
+ */
rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
@@ -1439,7 +1450,7 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
}
else
{
- //DbgPrint("Schedule TxPowerTrackingWorkItem\n");
+ /*DbgPrint("Schedule TxPowerTrackingWorkItem\n");*/
queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
TM_Trigger = 0;
}
@@ -1449,7 +1460,7 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
static void dm_check_txpower_tracking(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
- //static u32 tx_power_track_counter = 0;
+ /*static u32 tx_power_track_counter = 0;*/

#ifdef RTL8190P
dm_CheckTXPowerTracking_TSSI(dev);
@@ -1460,28 +1471,28 @@ static void dm_check_txpower_tracking(struct net_device *dev)
dm_CheckTXPowerTracking_ThermalMeter(dev);
#endif

-} // dm_CheckTXPowerTracking
+} /* dm_CheckTXPowerTracking */


static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14)
{
u32 TempVal;
struct r8192_priv *priv = ieee80211_priv(dev);
- //Write 0xa22 0xa23
+ /* Write 0xa22 0xa23 */
TempVal = 0;
if(!bInCH14){
- //Write 0xa22 0xa23
+ /* Write 0xa22 0xa23 */
TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[0] +
(priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[1]<<8) ;

rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
- //Write 0xa24 ~ 0xa27
+ /* Write 0xa24 ~ 0xa27 */
TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[2] +
(priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[3]<<8) +
(priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[4]<<16)+
(priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[5]<<24);
rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal);
- //Write 0xa28 0xa29
+ /* Write 0xa28 0xa29 */
TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[6] +
(priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[7]<<8) ;

@@ -1493,13 +1504,13 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14)
(priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[1]<<8) ;

rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
- //Write 0xa24 ~ 0xa27
+ /* Write 0xa24 ~ 0xa27 */
TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[2] +
(priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[3]<<8) +
(priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[4]<<16)+
(priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[5]<<24);
rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal);
- //Write 0xa28 0xa29
+ /* Write 0xa28 0xa29 */
TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[6] +
(priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[7]<<8) ;

@@ -1517,13 +1528,13 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH
TempVal = 0;
if(!bInCH14)
{
- //Write 0xa22 0xa23
+ /* Write 0xa22 0xa23 */
TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][0] +
(CCKSwingTable_Ch1_Ch13[priv->CCK_index][1]<<8) ;
rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n",
rCCK0_TxFilter1, TempVal);
- //Write 0xa24 ~ 0xa27
+ /* Write 0xa24 ~ 0xa27 */
TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][2] +
(CCKSwingTable_Ch1_Ch13[priv->CCK_index][3]<<8) +
(CCKSwingTable_Ch1_Ch13[priv->CCK_index][4]<<16)+
@@ -1531,7 +1542,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH
rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal);
RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n",
rCCK0_TxFilter2, TempVal);
- //Write 0xa28 0xa29
+ /* Write 0xa28 0xa29 */
TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][6] +
(CCKSwingTable_Ch1_Ch13[priv->CCK_index][7]<<8) ;

@@ -1541,15 +1552,15 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH
}
else
{
-// priv->CCKTxPowerAdjustCntNotCh14++; //cosa add for debug.
- //Write 0xa22 0xa23
+ /*priv->CCKTxPowerAdjustCntNotCh14++; cosa add for debug.*/
+ /* Write 0xa22 0xa23 */
TempVal = CCKSwingTable_Ch14[priv->CCK_index][0] +
(CCKSwingTable_Ch14[priv->CCK_index][1]<<8) ;

rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n",
rCCK0_TxFilter1, TempVal);
- //Write 0xa24 ~ 0xa27
+ /* Write 0xa24 ~ 0xa27 */
TempVal = CCKSwingTable_Ch14[priv->CCK_index][2] +
(CCKSwingTable_Ch14[priv->CCK_index][3]<<8) +
(CCKSwingTable_Ch14[priv->CCK_index][4]<<16)+
@@ -1557,7 +1568,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH
rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal);
RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n",
rCCK0_TxFilter2, TempVal);
- //Write 0xa28 0xa29
+ /* Write 0xa28 0xa29 */
TempVal = CCKSwingTable_Ch14[priv->CCK_index][6] +
(CCKSwingTable_Ch14[priv->CCK_index][7]<<8) ;

@@ -1570,7 +1581,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH


void dm_cck_txpower_adjust(struct net_device *dev, bool binch14)
-{ // dm_CCKTxPowerAdjust
+{ /* dm_CCKTxPowerAdjust */

struct r8192_priv *priv = ieee80211_priv(dev);
if(priv->bDcut == TRUE)
@@ -1600,7 +1611,7 @@ static void dm_txpower_reset_recovery(
RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in RFC_txPowerTrackingIndex is %x\n",priv->rfc_txpowertrackingindex);
RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery : RF C I/Q Amplify Gain is %ld\n",priv->txbbgain_table[priv->rfc_txpowertrackingindex].txbb_iq_amplifygain);

-} // dm_TXPowerResetRecovery
+} /* dm_TXPowerResetRecovery */

void dm_restore_dynamic_mechanism_state(struct net_device *dev)
{
@@ -1613,12 +1624,12 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev)
return;
}

- //
- // Restore previous state for rate adaptive
- //
+ /*
+ * Restore previous state for rate adaptive
+ */
if(priv->rate_adaptive.rate_adaptive_disabled)
return;
- // TODO: Only 11n mode is implemented currently,
+ /* TODO: Only 11n mode is implemented currently, */
if(!(priv->ieee80211->mode==WIRELESS_MODE_N_24G ||
priv->ieee80211->mode==WIRELESS_MODE_N_5G))
return;
@@ -1626,38 +1637,38 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev)
/* 2007/11/15 MH Copy from 8190PCI. */
u32 ratr_value;
ratr_value = reg_ratr;
- if(priv->rf_type == RF_1T2R) // 1T2R, Spatial Stream 2 should be disabled
+ if(priv->rf_type == RF_1T2R) /* 1T2R, Spatial Stream 2 should be disabled */
{
ratr_value &= ~(RATE_ALL_OFDM_2SS);
- //DbgPrint("HW_VAR_TATR_0 from 0x%x ==> 0x%x\n", ((pu4Byte)(val))[0], ratr_value);
+ /*DbgPrint("HW_VAR_TATR_0 from 0x%x ==> 0x%x\n", ((pu4Byte)(val))[0], ratr_value);*/
}
- //DbgPrint("set HW_VAR_TATR_0 = 0x%x\n", ratr_value);
- //cosa PlatformEFIOWrite4Byte(Adapter, RATR0, ((pu4Byte)(val))[0]);
+ /*DbgPrint("set HW_VAR_TATR_0 = 0x%x\n", ratr_value);*/
+ /*cosa PlatformEFIOWrite4Byte(Adapter, RATR0, ((pu4Byte)(val))[0]);*/
write_nic_dword(dev, RATR0, ratr_value);
write_nic_byte(dev, UFWP, 1);
}
- //Restore TX Power Tracking Index
+ /* Restore TX Power Tracking Index */
if (priv->btxpower_trackingInit && priv->btxpower_tracking)
dm_txpower_reset_recovery(dev);

- //
- //Restore BB Initial Gain
- //
+ /*
+ * Restore BB Initial Gain
+ */
dm_bb_initialgain_restore(dev);

-} // DM_RestoreDynamicMechanismState
+} /* DM_RestoreDynamicMechanismState */

static void dm_bb_initialgain_restore(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
- u32 bit_mask = 0x7f; //Bit0~ Bit6
+ u32 bit_mask = 0x7f; /* Bit0~ Bit6 */

if(dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
return;

- //Disable Initial Gain
- //PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800);
- rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // Only clear byte 1 and rewrite.
+ /* Disable Initial Gain */
+ /*PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800);*/
+ rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); /* Only clear byte 1 and rewrite. */
rtl8192_setBBreg(dev, rOFDM0_XAAGCCore1, bit_mask, (u32)priv->initgain_backup.xaagccore1);
rtl8192_setBBreg(dev, rOFDM0_XBAGCCore1, bit_mask, (u32)priv->initgain_backup.xbagccore1);
rtl8192_setBBreg(dev, rOFDM0_XCAGCCore1, bit_mask, (u32)priv->initgain_backup.xcagccore1);
@@ -1670,36 +1681,36 @@ static void dm_bb_initialgain_restore(struct net_device *dev)
RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc60 is %x\n",priv->initgain_backup.xcagccore1);
RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc68 is %x\n",priv->initgain_backup.xdagccore1);
RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xa0a is %x\n",priv->initgain_backup.cca);
- //Enable Initial Gain
- //PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x100);
- rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); // Only clear byte 1 and rewrite.
+ /* Enable Initial Gain */
+ /*PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x100);*/
+ rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); /* Only clear byte 1 and rewrite. */

-} // dm_BBInitialGainRestore
+} /* dm_BBInitialGainRestore */


void dm_backup_dynamic_mechanism_state(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);

- // Fsync to avoid reset
+ /* Fsync to avoid reset */
priv->bswitch_fsync = false;
priv->bfsync_processing = false;
- //Backup BB InitialGain
+ /* Backup BB InitialGain */
dm_bb_initialgain_backup(dev);

-} // DM_BackupDynamicMechanismState
+} /* DM_BackupDynamicMechanismState */


static void dm_bb_initialgain_backup(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
- u32 bit_mask = bMaskByte0; //Bit0~ Bit6
+ u32 bit_mask = bMaskByte0; /* Bit0~ Bit6 */

if(dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
return;

- //PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800);
- rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // Only clear byte 1 and rewrite.
+ /*PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800);*/
+ rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); /* Only clear byte 1 and rewrite. */
priv->initgain_backup.xaagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XAAGCCore1, bit_mask);
priv->initgain_backup.xbagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XBAGCCore1, bit_mask);
priv->initgain_backup.xcagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XCAGCCore1, bit_mask);
@@ -1713,7 +1724,7 @@ static void dm_bb_initialgain_backup(struct net_device *dev)
RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc68 is %x\n",priv->initgain_backup.xdagccore1);
RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xa0a is %x\n",priv->initgain_backup.cca);

-} // dm_BBInitialGainBakcup
+} /* dm_BBInitialGainBakcup */

#endif
/*-----------------------------------------------------------------------------
@@ -1824,7 +1835,7 @@ static void dm_dig_init(struct net_device *dev)
/* 2007/10/05 MH Disable DIG scheme now. Not tested. */
dm_digtable.dig_enable_flag = true;
dm_digtable.dig_algorithm = DIG_ALGO_BY_RSSI;
- dm_digtable.dbg_mode = DM_DBG_OFF; //off=by real rssi value, on=by DM_DigTable.Rssi_val for new dig
+ dm_digtable.dbg_mode = DM_DBG_OFF; /* off=by real rssi value, on=by DM_DigTable.Rssi_val for new dig */
dm_digtable.dig_algorithm_switch = 0;

/* 2007/10/04 MH Define init gain threshold. */
@@ -1838,7 +1849,7 @@ static void dm_dig_init(struct net_device *dev)
dm_digtable.rssi_high_power_lowthresh = DM_DIG_HIGH_PWR_THRESH_LOW;
dm_digtable.rssi_high_power_highthresh = DM_DIG_HIGH_PWR_THRESH_HIGH;

- dm_digtable.rssi_val = 50; //for new dig debug rssi value
+ dm_digtable.rssi_val = 50; /* for new dig debug rssi value */
dm_digtable.backoff_val = DM_DIG_BACKOFF;
dm_digtable.rx_gain_range_max = DM_DIG_MAX;
if(priv->CustomerID == RT_CID_819x_Netcore)
@@ -1876,7 +1887,7 @@ static void dm_ctrl_initgain_byrssi(struct net_device *dev)
dm_ctrl_initgain_byrssi_by_fwfalse_alarm(dev);
else if(dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
dm_ctrl_initgain_byrssi_by_driverrssi(dev);
-// ;
+ /* ; */
else
return;
}
@@ -1892,15 +1903,15 @@ static void dm_ctrl_initgain_byrssi_by_driverrssi(
if (dm_digtable.dig_enable_flag == false)
return;

- //DbgPrint("Dig by Sw Rssi \n");
- if(dm_digtable.dig_algorithm_switch) // if switched algorithm, we have to disable FW Dig.
+ /*DbgPrint("Dig by Sw Rssi \n");*/
+ if(dm_digtable.dig_algorithm_switch) /* if switched algorithm, we have to disable FW Dig. */
fw_dig = 0;
- if(fw_dig <= 3) // execute several times to make sure the FW Dig is disabled
- {// FW DIG Off
+ if(fw_dig <= 3) { /* execute several times to make sure the FW Dig is disabled */
+ /* FW DIG Off */
for(i=0; i<3; i++)
- rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // Only clear byte 1 and rewrite.
+ rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); /* Only clear byte 1 and rewrite. */
fw_dig++;
- dm_digtable.dig_state = DM_STA_DIG_OFF; //fw dig off.
+ dm_digtable.dig_state = DM_STA_DIG_OFF; /* fw dig off. */
}

if(priv->ieee80211->state == IEEE80211_LINKED)
@@ -1908,12 +1919,12 @@ static void dm_ctrl_initgain_byrssi_by_driverrssi(
else
dm_digtable.cur_connect_state = DIG_DISCONNECT;

- //DbgPrint("DM_DigTable.PreConnectState = %d, DM_DigTable.CurConnectState = %d \n",
- //DM_DigTable.PreConnectState, DM_DigTable.CurConnectState);
+ /*DbgPrint("DM_DigTable.PreConnectState = %d, DM_DigTable.CurConnectState = %d \n",
+ DM_DigTable.PreConnectState, DM_DigTable.CurConnectState);*/

if(dm_digtable.dbg_mode == DM_DBG_OFF)
dm_digtable.rssi_val = priv->undecorated_smoothed_pwdb;
- //DbgPrint("DM_DigTable.Rssi_val = %d \n", DM_DigTable.Rssi_val);
+ /*DbgPrint("DM_DigTable.Rssi_val = %d \n", DM_DigTable.Rssi_val);*/
dm_initial_gain(dev);
dm_pd_th(dev);
dm_cs_ratio(dev);
@@ -1936,23 +1947,23 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
if(dm_digtable.dig_algorithm_switch)
{
dm_digtable.dig_state = DM_STA_DIG_MAX;
- // Fw DIG On.
+ /* Fw DIG On. */
for(i=0; i<3; i++)
- rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); // Only clear byte 1 and rewrite.
+ rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); /* Only clear byte 1 and rewrite.*/
dm_digtable.dig_algorithm_switch = 0;
}

if (priv->ieee80211->state != IEEE80211_LINKED)
return;

- // For smooth, we can not change DIG state.
+ /* For smooth, we can not change DIG state. */
if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_low_thresh) &&
(priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_thresh))
{
return;
}
- //DbgPrint("Dig by Fw False Alarm\n");
- //if (DM_DigTable.Dig_State == DM_STA_DIG_OFF)
+ /*DbgPrint("Dig by Fw False Alarm\n");*/
+ /*if (DM_DigTable.Dig_State == DM_STA_DIG_OFF)*/
/*DbgPrint("DIG Check\n\r RSSI=%d LOW=%d HIGH=%d STATE=%d",
pHalData->UndecoratedSmoothedPWDB, DM_DigTable.RssiLowThresh,
DM_DigTable.RssiHighThresh, DM_DigTable.Dig_State);*/
@@ -1972,42 +1983,42 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
reset_cnt = priv->reset_count;
}

- // If DIG is off, DIG high power state must reset.
+ /* If DIG is off, DIG high power state must reset. */
dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX;
dm_digtable.dig_state = DM_STA_DIG_OFF;

- // 1.1 DIG Off.
- rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // Only clear byte 1 and rewrite.
+ /* 1.1 DIG Off. */
+ rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); /* Only clear byte 1 and rewrite. */

- // 1.2 Set initial gain.
+ /* 1.2 Set initial gain. */
write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x17);
write_nic_byte(dev, rOFDM0_XBAGCCore1, 0x17);
write_nic_byte(dev, rOFDM0_XCAGCCore1, 0x17);
write_nic_byte(dev, rOFDM0_XDAGCCore1, 0x17);

- // 1.3 Lower PD_TH for OFDM.
+ /* 1.3 Lower PD_TH for OFDM. */
if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
{
- /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */
- // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
+ /*
+ * 2008/01/11 MH 40MHZ 90/92 register are not the same.
+ * 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
+ */
write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00);
/*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
write_nic_byte(pAdapter, rOFDM0_RxDetector1, 0x40);
+ else if (pAdapter->HardwareType == HARDWARE_TYPE_RTL8192E)
+ else
+ PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x40);
*/
- //else if (pAdapter->HardwareType == HARDWARE_TYPE_RTL8192E)
-
-
- //else
- //PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x40);
}
else
write_nic_byte(dev, rOFDM0_RxDetector1, 0x42);

- // 1.4 Lower CS ratio for CCK.
+ /* 1.4 Lower CS ratio for CCK. */
write_nic_byte(dev, 0xa0a, 0x08);

- // 1.5 Higher EDCCA.
- //PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 0x325);
+ /* 1.5 Higher EDCCA. */
+ /*PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 0x325);*/
return;

}
@@ -2033,10 +2044,12 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
}

dm_digtable.dig_state = DM_STA_DIG_ON;
- //DbgPrint("DIG ON\n\r");
+ /*DbgPrint("DIG ON\n\r");*/

- // 2.1 Set initial gain.
- // 2008/02/26 MH SD3-Jerry suggest to prevent dirty environment.
+ /*
+ * 2.1 Set initial gain.
+ * 2008/02/26 MH SD3-Jerry suggest to prevent dirty environment.
+ */
if (reset_flag == 1)
{
write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x2c);
@@ -2052,33 +2065,36 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
write_nic_byte(dev, rOFDM0_XDAGCCore1, 0x20);
}

- // 2.2 Higher PD_TH for OFDM.
+ /* 2.2 Higher PD_TH for OFDM. */
if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
{
- /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */
- // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
+ /*
+ * 2008/01/11 MH 40MHZ 90/92 register are not the same.
+ * 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
+ */
write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20);
/*
else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
write_nic_byte(dev, rOFDM0_RxDetector1, 0x42);
+ else if (pAdapter->HardwareType == HARDWARE_TYPE_RTL8192E)
+ else
+ PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x42);
*/
- //else if (pAdapter->HardwareType == HARDWARE_TYPE_RTL8192E)
-
- //else
- //PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x42);
}
else
write_nic_byte(dev, rOFDM0_RxDetector1, 0x44);

- // 2.3 Higher CS ratio for CCK.
+ /* 2.3 Higher CS ratio for CCK. */
write_nic_byte(dev, 0xa0a, 0xcd);

- // 2.4 Lower EDCCA.
- /* 2008/01/11 MH 90/92 series are the same. */
- //PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 0x346);
+ /*
+ * 2.4 Lower EDCCA.
+ * 2008/01/11 MH 90/92 series are the same.
+ */
+ /*PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 0x346);*/

- // 2.5 DIG On.
- rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); // Only clear byte 1 and rewrite.
+ /* 2.5 DIG On. */
+ rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); /* Only clear byte 1 and rewrite. */

}

@@ -2109,16 +2125,19 @@ static void dm_ctrl_initgain_byrssi_highpwr(
struct r8192_priv *priv = ieee80211_priv(dev);
static u32 reset_cnt_highpwr;

- // For smooth, we can not change high power DIG state in the range.
+ /* For smooth, we can not change high power DIG state in the range. */
if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_high_power_lowthresh) &&
(priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_highthresh))
{
return;
}

- /* 3. When RSSI >75% or <70%, it is a high power issue. We have to judge if
- it is larger than a threshold and then execute the step below. */
- // 2008/02/05 MH SD3-Jerry Modify PD_TH for high power issue.
+ /*
+ * 3. When RSSI >75% or <70%, it is a high power issue. We have to judge if
+ * it is larger than a threshold and then execute the step below.
+ *
+ * 2008/02/05 MH SD3-Jerry Modify PD_TH for high power issue.
+ */
if (priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_power_highthresh)
{
if (dm_digtable.dig_highpwr_state == DM_STA_DIG_ON &&
@@ -2127,7 +2146,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(
else
dm_digtable.dig_highpwr_state = DM_STA_DIG_ON;

- // 3.1 Higher PD_TH for OFDM for high power state.
+ /* 3.1 Higher PD_TH for OFDM for high power state. */
if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
{
write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10);
@@ -2151,7 +2170,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(
if (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_lowthresh &&
priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh)
{
- // 3.2 Recover PD_TH for OFDM for normal power region.
+ /* 3.2 Recover PD_TH for OFDM for normal power region. */
if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
{
write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20);
@@ -2196,7 +2215,7 @@ static void dm_initial_gain(
else
dm_digtable.cur_ig_value = dm_digtable.rssi_val+10-dm_digtable.backoff_val;
}
- else //current state is disconnected
+ else /* current state is disconnected */
{
if(dm_digtable.cur_ig_value == 0)
dm_digtable.cur_ig_value = priv->DefaultInitialGain[0];
@@ -2204,14 +2223,14 @@ static void dm_initial_gain(
dm_digtable.cur_ig_value = dm_digtable.pre_ig_value;
}
}
- else // disconnected -> connected or connected -> disconnected
+ else /* disconnected -> connected or connected -> disconnected */
{
dm_digtable.cur_ig_value = priv->DefaultInitialGain[0];
dm_digtable.pre_ig_value = 0;
}
- //DbgPrint("DM_DigTable.CurIGValue = 0x%x, DM_DigTable.PreIGValue = 0x%x\n", DM_DigTable.CurIGValue, DM_DigTable.PreIGValue);
+ /*DbgPrint("DM_DigTable.CurIGValue = 0x%x, DM_DigTable.PreIGValue = 0x%x\n", DM_DigTable.CurIGValue, DM_DigTable.PreIGValue);*/

- // if silent reset happened, we should rewrite the values back
+ /* if silent reset happened, we should rewrite the values back */
if(priv->reset_count != reset_cnt)
{
force_write = 1;
@@ -2227,8 +2246,8 @@ static void dm_initial_gain(
|| !initialized || force_write)
{
initial_gain = (u8)dm_digtable.cur_ig_value;
- //DbgPrint("Write initial gain = 0x%x\n", initial_gain);
- // Set initial gain.
+ /*DbgPrint("Write initial gain = 0x%x\n", initial_gain);*/
+ /* Set initial gain. */
write_nic_byte(dev, rOFDM0_XAAGCCore1, initial_gain);
write_nic_byte(dev, rOFDM0_XBAGCCore1, initial_gain);
write_nic_byte(dev, rOFDM0_XCAGCCore1, initial_gain);
@@ -2272,12 +2291,12 @@ static void dm_pd_th(
dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER;
}
}
- else // disconnected -> connected or connected -> disconnected
+ else /* disconnected -> connected or connected -> disconnected */
{
dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER;
}

- // if silent reset happened, we should rewrite the values back
+ /* if silent reset happened, we should rewrite the values back */
if(priv->reset_count != reset_cnt)
{
force_write = 1;
@@ -2288,14 +2307,16 @@ static void dm_pd_th(
if((dm_digtable.prepd_thstate != dm_digtable.curpd_thstate) ||
(initialized<=3) || force_write)
{
- //DbgPrint("Write PD_TH state = %d\n", DM_DigTable.CurPD_THState);
+ /*DbgPrint("Write PD_TH state = %d\n", DM_DigTable.CurPD_THState);*/
if(dm_digtable.curpd_thstate == DIG_PD_AT_LOW_POWER)
{
- // Lower PD_TH for OFDM.
+ /* Lower PD_TH for OFDM. */
if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
{
- /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */
- // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
+ /*
+ * 2008/01/11 MH 40MHZ 90/92 register are not the same.
+ * 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
+ */
write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00);
/*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
write_nic_byte(dev, rOFDM0_RxDetector1, 0x40);
@@ -2306,11 +2327,13 @@ static void dm_pd_th(
}
else if(dm_digtable.curpd_thstate == DIG_PD_AT_NORMAL_POWER)
{
- // Higher PD_TH for OFDM.
+ /* Higher PD_TH for OFDM. */
if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
{
- /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */
- // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
+ /*
+ * 2008/01/11 MH 40MHZ 90/92 register are not the same.
+ * 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
+ */
write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20);
/*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
write_nic_byte(dev, rOFDM0_RxDetector1, 0x42);
@@ -2321,7 +2344,7 @@ static void dm_pd_th(
}
else if(dm_digtable.curpd_thstate == DIG_PD_AT_HIGH_POWER)
{
- // Higher PD_TH for OFDM for high power state.
+ /* Higher PD_TH for OFDM for high power state. */
if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
{
write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10);
@@ -2369,12 +2392,12 @@ static void dm_cs_ratio(
dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER;
}
}
- else // disconnected -> connected or connected -> disconnected
+ else /* disconnected -> connected or connected -> disconnected */
{
dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER;
}

- // if silent reset happened, we should rewrite the values back
+ /* if silent reset happened, we should rewrite the values back */
if(priv->reset_count != reset_cnt)
{
force_write = 1;
@@ -2386,15 +2409,15 @@ static void dm_cs_ratio(
if((dm_digtable.precs_ratio_state != dm_digtable.curcs_ratio_state) ||
!initialized || force_write)
{
- //DbgPrint("Write CS_ratio state = %d\n", DM_DigTable.CurCS_ratioState);
+ /*DbgPrint("Write CS_ratio state = %d\n", DM_DigTable.CurCS_ratioState);*/
if(dm_digtable.curcs_ratio_state == DIG_CS_RATIO_LOWER)
{
- // Lower CS ratio for CCK.
+ /* Lower CS ratio for CCK. */
write_nic_byte(dev, 0xa0a, 0x08);
}
else if(dm_digtable.curcs_ratio_state == DIG_CS_RATIO_HIGHER)
{
- // Higher CS ratio for CCK.
+ /* Higher CS ratio for CCK. */
write_nic_byte(dev, 0xa0a, 0xcd);
}
dm_digtable.precs_ratio_state = dm_digtable.curcs_ratio_state;
@@ -2411,41 +2434,41 @@ void dm_init_edca_turbo(struct net_device *dev)
priv->bcurrent_turbo_EDCA = false;
priv->ieee80211->bis_any_nonbepkts = false;
priv->bis_cur_rdlstate = false;
-} // dm_init_edca_turbo
+} /* dm_init_edca_turbo */

static void dm_check_edca_turbo(
struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo;
- //PSTA_QOS pStaQos = pMgntInfo->pStaQos;
+ /*PSTA_QOS pStaQos = pMgntInfo->pStaQos;*/

- // Keep past Tx/Rx packet count for RT-to-RT EDCA turbo.
+ /* Keep past Tx/Rx packet count for RT-to-RT EDCA turbo. */
static unsigned long lastTxOkCnt;
static unsigned long lastRxOkCnt;
unsigned long curTxOkCnt = 0;
unsigned long curRxOkCnt = 0;

- //
- // Do not be Turbo if it's under WiFi config and Qos Enabled, because the EDCA parameters
- // should follow the settings from QAP. By Bruce, 2007-12-07.
- //
+ /*
+ * Do not be Turbo if it's under WiFi config and Qos Enabled, because the EDCA parameters
+ * should follow the settings from QAP. By Bruce, 2007-12-07.
+ */
if(priv->ieee80211->state != IEEE80211_LINKED)
goto dm_CheckEdcaTurbo_EXIT;
- // We do not turn on EDCA turbo mode for some AP that has IOT issue
+ /* We do not turn on EDCA turbo mode for some AP that has IOT issue */
if(priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO)
goto dm_CheckEdcaTurbo_EXIT;

-// printk("========>%s():bis_any_nonbepkts is %d\n",__func__,priv->bis_any_nonbepkts);
- // Check the status for current condition.
+ /*printk("========>%s():bis_any_nonbepkts is %d\n",__func__,priv->bis_any_nonbepkts);*/
+ /* Check the status for current condition. */
if(!priv->ieee80211->bis_any_nonbepkts)
{
curTxOkCnt = priv->stats.txbytesunicast - lastTxOkCnt;
curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt;
- // For RT-AP, we needs to turn it on when Rx>Tx
+ /* For RT-AP, we needs to turn it on when Rx>Tx */
if(curRxOkCnt > 4*curTxOkCnt)
{
- //printk("%s():curRxOkCnt > 4*curTxOkCnt\n");
+ /*printk("%s():curRxOkCnt > 4*curTxOkCnt\n");*/
if(!priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA)
{
write_nic_dword(dev, EDCAPARA_BE, edca_setting_DL[pHTInfo->IOTPeer]);
@@ -2455,7 +2478,7 @@ static void dm_check_edca_turbo(
else
{

- //printk("%s():curRxOkCnt < 4*curTxOkCnt\n");
+ /*printk("%s():curRxOkCnt < 4*curTxOkCnt\n");*/
if(priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA)
{
write_nic_dword(dev, EDCAPARA_BE, edca_setting_UL[pHTInfo->IOTPeer]);
@@ -2468,10 +2491,10 @@ static void dm_check_edca_turbo(
}
else
{
- //
- // Turn Off EDCA turbo here.
- // Restore original EDCA according to the declaration of AP.
- //
+ /*
+ * Turn Off EDCA turbo here.
+ * Restore original EDCA according to the declaration of AP.
+ */
if(priv->bcurrent_turbo_EDCA)
{

@@ -2481,30 +2504,29 @@ static void dm_check_edca_turbo(
struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
u8 mode = priv->ieee80211->mode;

- // For Each time updating EDCA parameter, reset EDCA turbo mode status.
+ /* For Each time updating EDCA parameter, reset EDCA turbo mode status. */
dm_init_edca_turbo(dev);
u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ?9:20) + aSifsTime;
u4bAcParam = ((((u32)(qos_parameters->tx_op_limit[0]))<< AC_PARAM_TXOP_LIMIT_OFFSET)|
(((u32)(qos_parameters->cw_max[0]))<< AC_PARAM_ECW_MAX_OFFSET)|
(((u32)(qos_parameters->cw_min[0]))<< AC_PARAM_ECW_MIN_OFFSET)|
((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET));
- //write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);
+ /*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/
write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);

- // Check ACM bit.
- // If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13.
+ /*
+ * Check ACM bit.
+ * If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13.
+ */
{
- // TODO: Modified this part and try to set acm control in only 1 IO processing!!
+ /* TODO: Modified this part and try to set acm control in only 1 IO processing!! */

PACI_AIFSN pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]);
u8 AcmCtrl;
read_nic_byte(dev, AcmHwCtrl, &AcmCtrl);
- if(pAciAifsn->f.ACM)
- { // ACM bit is 1.
+ if(pAciAifsn->f.ACM) { /* ACM bit is 1. */
AcmCtrl |= AcmHw_BeqEn;
- }
- else
- { // ACM bit is 0.
+ } else { /* ACM bit is 0. */
AcmCtrl &= (~AcmHw_BeqEn);
}

@@ -2518,11 +2540,11 @@ static void dm_check_edca_turbo(


dm_CheckEdcaTurbo_EXIT:
- // Set variables for next time.
+ /* Set variables for next time. */
priv->ieee80211->bis_any_nonbepkts = false;
lastTxOkCnt = priv->stats.txbytesunicast;
lastRxOkCnt = priv->stats.rxbytesunicast;
-} // dm_CheckEdcaTurbo
+} /* dm_CheckEdcaTurbo */

static void dm_init_ctstoself(struct net_device *dev)
{
@@ -2556,12 +2578,12 @@ static void dm_ctstoself(struct net_device *dev)
{
curTxOkCnt = priv->stats.txbytesunicast - lastTxOkCnt;
curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt;
- if(curRxOkCnt > 4*curTxOkCnt) //downlink, disable CTS to self
+ if(curRxOkCnt > 4*curTxOkCnt) /* downlink, disable CTS to self */
{
pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF;
- //DbgPrint("dm_CTSToSelf() ==> CTS to self disabled -- downlink\n");
+ /*DbgPrint("dm_CTSToSelf() ==> CTS to self disabled -- downlink\n");*/
}
- else //uplink
+ else /* uplink */
{
pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF;
}
@@ -2599,8 +2621,10 @@ static void dm_check_pbc_gpio(struct net_device *dev)

if (tmp1byte&BIT6 || tmp1byte&BIT0)
{
- // Here we only set bPbcPressed to TRUE
- // After trigger PBC, the variable will be set to FALSE
+ /*
+ * Here we only set bPbcPressed to TRUE
+ * After trigger PBC, the variable will be set to FALSE
+ */
RT_TRACE(COMP_IO, "CheckPbcGPIO - PBC is pressed\n");
priv->bpbc_pressed = true;
}
@@ -2628,7 +2652,7 @@ void dm_rf_pathcheck_workitemcallback(struct work_struct *work)
struct delayed_work *dwork = container_of(work,struct delayed_work,work);
struct r8192_priv *priv = container_of(dwork,struct r8192_priv,rfpath_check_wq);
struct net_device *dev =priv->ieee80211->dev;
- //bool bactually_set = false;
+ /*bool bactually_set = false;*/
u8 rfpath = 0, i;


@@ -2636,7 +2660,7 @@ void dm_rf_pathcheck_workitemcallback(struct work_struct *work)
always be the same. We only read 0xc04 now. */
read_nic_byte(dev, 0xc04, &rfpath);

- // Check Bit 0-3, it means if RF A-D is enabled.
+ /* Check Bit 0-3, it means if RF A-D is enabled. */
for (i = 0; i < RF90_PATH_MAX; i++)
{
if (rfpath & (0x01<<i))
@@ -2654,7 +2678,7 @@ static void dm_init_rxpath_selection(struct net_device *dev)
{
u8 i;
struct r8192_priv *priv = ieee80211_priv(dev);
- DM_RxPathSelTable.Enable = 1; //default enabled
+ DM_RxPathSelTable.Enable = 1; /* default enabled */
DM_RxPathSelTable.SS_TH_low = RxPathSelection_SS_TH_low;
DM_RxPathSelTable.diff_TH = RxPathSelection_diff_TH;
if(priv->CustomerID == RT_CID_819x_Netcore)
@@ -2676,8 +2700,8 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
struct r8192_priv *priv = ieee80211_priv(dev);
u8 i, max_rssi_index=0, min_rssi_index=0, sec_rssi_index=0, rf_num=0;
u8 tmp_max_rssi=0, tmp_min_rssi=0, tmp_sec_rssi=0;
- u8 cck_default_Rx=0x2; //RF-C
- u8 cck_optional_Rx=0x3;//RF-D
+ u8 cck_default_Rx=0x2; /* RF-C */
+ u8 cck_optional_Rx=0x3; /* RF-D */
long tmp_cck_max_pwdb=0, tmp_cck_min_pwdb=0, tmp_cck_sec_pwdb=0;
u8 cck_rx_ver2_max_index=0, cck_rx_ver2_min_index=0, cck_rx_ver2_sec_index=0;
u8 cur_rf_rssi;
@@ -2700,11 +2724,11 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)

if(priv->ieee80211->mode == WIRELESS_MODE_B)
{
- DM_RxPathSelTable.cck_method = CCK_Rx_Version_2; //pure B mode, fixed cck version2
- //DbgPrint("Pure B mode, use cck rx version2 \n");
+ DM_RxPathSelTable.cck_method = CCK_Rx_Version_2; /* pure B mode, fixed cck version2 */
+ /*DbgPrint("Pure B mode, use cck rx version2 \n");*/
}

- //decide max/sec/min rssi index
+ /* decide max/sec/min rssi index */
for (i=0; i<RF90_PATH_MAX; i++)
{
if(!DM_RxPathSelTable.DbgMode)
@@ -2715,13 +2739,13 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
rf_num++;
cur_rf_rssi = DM_RxPathSelTable.rf_rssi[i];

- if(rf_num == 1) // find first enabled rf path and the rssi values
- { //initialize, set all rssi index to the same one
+ if(rf_num == 1) { /* find first enabled rf path and the rssi values */
+ /* initialize, set all rssi index to the same one */
max_rssi_index = min_rssi_index = sec_rssi_index = i;
tmp_max_rssi = tmp_min_rssi = tmp_sec_rssi = cur_rf_rssi;
}
else if(rf_num == 2)
- { // we pick up the max index first, and let sec and min to be the same one
+ { /* we pick up the max index first, and let sec and min to be the same one */
if(cur_rf_rssi >= tmp_max_rssi)
{
tmp_max_rssi = cur_rf_rssi;
@@ -2743,7 +2767,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
max_rssi_index = i;
}
else if(cur_rf_rssi == tmp_max_rssi)
- { // let sec and min point to the different index
+ { /* let sec and min point to the different index */
tmp_sec_rssi = cur_rf_rssi;
sec_rssi_index = i;
}
@@ -2754,30 +2778,30 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
}
else if(cur_rf_rssi == tmp_sec_rssi)
{
- if(tmp_sec_rssi == tmp_min_rssi)
- { // let sec and min point to the different index
+ if(tmp_sec_rssi == tmp_min_rssi) {
+ /* let sec and min point to the different index */
tmp_sec_rssi = cur_rf_rssi;
sec_rssi_index = i;
}
else
{
- // This case we don't need to set any index
+ /* This case we don't need to set any index */
}
}
else if((cur_rf_rssi < tmp_sec_rssi) && (cur_rf_rssi > tmp_min_rssi))
{
- // This case we don't need to set any index
+ /* This case we don't need to set any index */
}
else if(cur_rf_rssi == tmp_min_rssi)
{
- if(tmp_sec_rssi == tmp_min_rssi)
- { // let sec and min point to the different index
+ if(tmp_sec_rssi == tmp_min_rssi) {
+ /* let sec and min point to the different index */
tmp_min_rssi = cur_rf_rssi;
min_rssi_index = i;
}
else
{
- // This case we don't need to set any index
+ /* This case we don't need to set any index */
}
}
else if(cur_rf_rssi < tmp_min_rssi)
@@ -2790,7 +2814,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
}

rf_num = 0;
- // decide max/sec/min cck pwdb index
+ /* decide max/sec/min cck pwdb index */
if(DM_RxPathSelTable.cck_method == CCK_Rx_Version_2)
{
for (i=0; i<RF90_PATH_MAX; i++)
@@ -2800,13 +2824,12 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
rf_num++;
cur_cck_pwdb = DM_RxPathSelTable.cck_pwdb_sta[i];

- if(rf_num == 1) // find first enabled rf path and the rssi values
- { //initialize, set all rssi index to the same one
+ if(rf_num == 1) /* find first enabled rf path and the rssi values */
+ { /* initialize, set all rssi index to the same one */
cck_rx_ver2_max_index = cck_rx_ver2_min_index = cck_rx_ver2_sec_index = i;
tmp_cck_max_pwdb = tmp_cck_min_pwdb = tmp_cck_sec_pwdb = cur_cck_pwdb;
}
- else if(rf_num == 2)
- { // we pick up the max index first, and let sec and min to be the same one
+ else if(rf_num == 2) { /* we pick up the max index first, and let sec and min to be the same one */
if(cur_cck_pwdb >= tmp_cck_max_pwdb)
{
tmp_cck_max_pwdb = cur_cck_pwdb;
@@ -2827,8 +2850,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
tmp_cck_max_pwdb = cur_cck_pwdb;
cck_rx_ver2_max_index = i;
}
- else if(cur_cck_pwdb == tmp_cck_max_pwdb)
- { // let sec and min point to the different index
+ else if(cur_cck_pwdb == tmp_cck_max_pwdb) { /* let sec and min point to the different index */
tmp_cck_sec_pwdb = cur_cck_pwdb;
cck_rx_ver2_sec_index = i;
}
@@ -2839,30 +2861,28 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
}
else if(cur_cck_pwdb == tmp_cck_sec_pwdb)
{
- if(tmp_cck_sec_pwdb == tmp_cck_min_pwdb)
- { // let sec and min point to the different index
+ if(tmp_cck_sec_pwdb == tmp_cck_min_pwdb) { /* let sec and min point to the different index */
tmp_cck_sec_pwdb = cur_cck_pwdb;
cck_rx_ver2_sec_index = i;
}
else
{
- // This case we don't need to set any index
+ /* This case we don't need to set any index */
}
}
else if((cur_cck_pwdb < tmp_cck_sec_pwdb) && (cur_cck_pwdb > tmp_cck_min_pwdb))
{
- // This case we don't need to set any index
+ /* This case we don't need to set any index */
}
else if(cur_cck_pwdb == tmp_cck_min_pwdb)
{
- if(tmp_cck_sec_pwdb == tmp_cck_min_pwdb)
- { // let sec and min point to the different index
+ if(tmp_cck_sec_pwdb == tmp_cck_min_pwdb) { /* let sec and min point to the different index */
tmp_cck_min_pwdb = cur_cck_pwdb;
cck_rx_ver2_min_index = i;
}
else
{
- // This case we don't need to set any index
+ /* This case we don't need to set any index */
}
}
else if(cur_cck_pwdb < tmp_cck_min_pwdb)
@@ -2877,8 +2897,10 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
}


- // Set CCK Rx path
- // reg0xA07[3:2]=cck default rx path, reg0xa07[1:0]=cck optional rx path.
+ /*
+ * Set CCK Rx path
+ * reg0xA07[3:2]=cck default rx path, reg0xa07[1:0]=cck optional rx path.
+ */
update_cck_rx_path = 0;
if(DM_RxPathSelTable.cck_method == CCK_Rx_Version_2)
{
@@ -2892,11 +2914,11 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
{
if((tmp_max_rssi - tmp_min_rssi) >= DM_RxPathSelTable.diff_TH)
{
- //record the enabled rssi threshold
+ /* record the enabled rssi threshold */
DM_RxPathSelTable.rf_enable_rssi_th[min_rssi_index] = tmp_max_rssi+5;
- //disable the BB Rx path, OFDM
- rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x1<<min_rssi_index, 0x0); // 0xc04[3:0]
- rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x1<<min_rssi_index, 0x0); // 0xd04[3:0]
+ /* disable the BB Rx path, OFDM */
+ rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x1<<min_rssi_index, 0x0); /* 0xc04[3:0] */
+ rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x1<<min_rssi_index, 0x0); /* 0xd04[3:0] */
disabled_rf_cnt++;
}
if(DM_RxPathSelTable.cck_method == CCK_Rx_Version_1)
@@ -2918,14 +2940,14 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
{
for(i=0; i<4; i++)
{
- if((DM_RxPathSelTable.disabledRF>>i) & 0x1) //disabled rf
+ if((DM_RxPathSelTable.disabledRF>>i) & 0x1) /* disabled rf */
{
if(tmp_max_rssi >= DM_RxPathSelTable.rf_enable_rssi_th[i])
{
- //enable the BB Rx path
- //DbgPrint("RF-%d is enabled. \n", 0x1<<i);
- rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x1<<i, 0x1); // 0xc04[3:0]
- rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x1<<i, 0x1); // 0xd04[3:0]
+ /* enable the BB Rx path */
+ /*DbgPrint("RF-%d is enabled. \n", 0x1<<i);*/
+ rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x1<<i, 0x1); /* 0xc04[3:0] */
+ rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x1<<i, 0x1); /* 0xd04[3:0] */
DM_RxPathSelTable.rf_enable_rssi_th[i] = 100;
disabled_rf_cnt--;
}
@@ -2969,7 +2991,7 @@ static void dm_init_fsync (struct net_device *dev)
priv->ieee80211->fsync_firstdiff_ratethreshold= 100;
priv->ieee80211->fsync_seconddiff_ratethreshold= 200;
priv->ieee80211->fsync_state = Default_Fsync;
- priv->framesyncMonitor = 1; // current default 0xc38 monitor on
+ priv->framesyncMonitor = 1; /* current default 0xc38 monitor on */

init_timer(&priv->fsync_timer);
priv->fsync_timer.data = (unsigned long)dev;
@@ -2995,7 +3017,7 @@ void dm_fsync_timer_callback(unsigned long data)
priv->ieee80211->bfsync_enable &&
(priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_CDD_FSYNC))
{
- // Count rate 54, MCS [7], [12, 13, 14, 15]
+ /* Count rate 54, MCS [7], [12, 13, 14, 15] */
u32 rate_bitmap;
for(rate_index = 0; rate_index <= 27; rate_index++)
{
@@ -3012,13 +3034,13 @@ void dm_fsync_timer_callback(unsigned long data)
{

u32 DiffNum = priv->rateCountDiffRecord - rate_count_diff;
- // Continue count
+ /* Continue count */
if(DiffNum >= priv->ieee80211->fsync_seconddiff_ratethreshold)
priv->ContinueDiffCount++;
else
priv->ContinueDiffCount = 0;

- // Continue count over
+ /* Continue count over */
if(priv->ContinueDiffCount >=2)
{
bSwitchFromCountDiff = true;
@@ -3027,11 +3049,11 @@ void dm_fsync_timer_callback(unsigned long data)
}
else
{
- // Stop the continued count
+ /* Stop the continued count */
priv->ContinueDiffCount = 0;
}

- //If Count diff <= FsyncRateCountThreshold
+ /* If Count diff <= FsyncRateCountThreshold */
if(rate_count_diff <= priv->ieee80211->fsync_firstdiff_ratethreshold)
{
bSwitchFromCountDiff = true;
@@ -3040,7 +3062,7 @@ void dm_fsync_timer_callback(unsigned long data)
priv->rate_record = rate_count;
priv->rateCountDiffRecord = rate_count_diff;
RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", priv->rate_record, rate_count, rate_count_diff , priv->bswitch_fsync);
- // if we never receive those mcs rate and rssi > 30 % then switch fsyn
+ /* if we never receive those mcs rate and rssi > 30 % then switch fsyn */
if(priv->undecorated_smoothed_pwdb > priv->ieee80211->fsync_rssi_threshold && bSwitchFromCountDiff)
{
bDoubleTimeInterval = true;
@@ -3080,7 +3102,7 @@ void dm_fsync_timer_callback(unsigned long data)
}
else
{
- // Let Register return to default value;
+ /* Let Register return to default value; */
if(priv->bswitch_fsync)
{
priv->bswitch_fsync = false;
@@ -3108,7 +3130,7 @@ static void dm_EndSWFsync(struct net_device *dev)
RT_TRACE(COMP_HALDM, "%s\n", __func__);
del_timer_sync(&(priv->fsync_timer));

- // Let Register return to default value;
+ /* Let Register return to default value; */
if(priv->bswitch_fsync)
{
priv->bswitch_fsync = false;
@@ -3130,9 +3152,9 @@ static void dm_StartSWFsync(struct net_device *dev)
u32 rateBitmap;

RT_TRACE(COMP_HALDM, "%s\n", __func__);
- // Initial rate record to zero, start to record.
+ /* Initial rate record to zero, start to record. */
priv->rate_record = 0;
- // Initialize continue diff count to zero, start to record.
+ /* Initialize continue diff count to zero, start to record. */
priv->ContinueDiffCount = 0;
priv->rateCountDiffRecord = 0;
priv->bswitch_fsync = false;
@@ -3176,7 +3198,7 @@ void dm_check_fsync(struct net_device *dev)
#define RegC38_NonFsync_Other_AP 1
#define RegC38_Fsync_AP_BCM 2
struct r8192_priv *priv = ieee80211_priv(dev);
- //u32 framesyncC34;
+ /*u32 framesyncC34;*/
static u8 reg_c38_State=RegC38_Default;
static u32 reset_cnt;

@@ -3226,7 +3248,7 @@ void dm_check_fsync(struct net_device *dev)
if(priv->framesyncMonitor)
{
if(reg_c38_State != RegC38_Fsync_AP_BCM)
- { //For broadcom AP we write different default value
+ { /* For broadcom AP we write different default value */
write_nic_byte(dev, rOFDM0_RxDetector3, 0x95);

reg_c38_State = RegC38_Fsync_AP_BCM;
@@ -3269,7 +3291,7 @@ void dm_check_fsync(struct net_device *dev)
{
write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync);
reg_c38_State = RegC38_Default;
- //DbgPrint("Fsync is idle, rssi>=40, write 0xc38 = 0x%x \n", pHalData->framesync);
+ /*DbgPrint("Fsync is idle, rssi>=40, write 0xc38 = 0x%x \n", pHalData->framesync);*/
}
}
}
@@ -3279,19 +3301,18 @@ void dm_check_fsync(struct net_device *dev)
{
write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync);
reg_c38_State = RegC38_Default;
- //DbgPrint("Fsync is idle, not connected, write 0xc38 = 0x%x \n", pHalData->framesync);
+ /*DbgPrint("Fsync is idle, not connected, write 0xc38 = 0x%x \n", pHalData->framesync);*/
}
}
}
}
if(priv->framesyncMonitor)
{
- if(priv->reset_count != reset_cnt)
- { //After silent reset, the reg_c38_State will be returned to default value
+ if(priv->reset_count != reset_cnt) { /* After silent reset, the reg_c38_State will be returned to default value */
write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync);
reg_c38_State = RegC38_Default;
reset_cnt = priv->reset_count;
- //DbgPrint("reg_c38_State = 0 for silent reset. \n");
+ /*DbgPrint("reg_c38_State = 0 for silent reset. \n");*/
}
}
else
@@ -3300,7 +3321,7 @@ void dm_check_fsync(struct net_device *dev)
{
write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync);
reg_c38_State = RegC38_Default;
- //DbgPrint("framesync no monitor, write 0xc38 = 0x%x \n", pHalData->framesync);
+ /*DbgPrint("framesync no monitor, write 0xc38 = 0x%x \n", pHalData->framesync);*/
}
}
}
@@ -3331,7 +3352,7 @@ void dm_shadow_init(struct net_device *dev)
for (offset = 0; offset < 256; offset++)
{
read_nic_byte(dev, offset+page*256, &dm_shadow[page][offset]);
- //DbgPrint("P-%d/O-%02x=%02x\r\n", page, offset, DM_Shadow[page][offset]);
+ /*DbgPrint("P-%d/O-%02x=%02x\r\n", page, offset, DM_Shadow[page][offset]);*/
}

for (page = 8; page < 11; page++)
@@ -3366,8 +3387,8 @@ static void dm_init_dynamic_txpower(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);

- //Initial TX Power Control for near/far range , add by amy 2008/05/15, porting from windows code.
- priv->ieee80211->bdynamic_txpower_enable = true; //Default to enable Tx Power Control
+ /* Initial TX Power Control for near/far range , add by amy 2008/05/15, porting from windows code. */
+ priv->ieee80211->bdynamic_txpower_enable = true; /* Default to enable Tx Power Control */
priv->bLastDTPFlag_High = false;
priv->bLastDTPFlag_Low = false;
priv->bDynamicTxHighPower = false;
@@ -3385,7 +3406,7 @@ static void dm_dynamic_txpower(struct net_device *dev)
priv->bDynamicTxLowPower = false;
return;
}
- //printk("priv->ieee80211->current_network.unknown_cap_exist is %d ,priv->ieee80211->current_network.broadcom_cap_exist is %d\n",priv->ieee80211->current_network.unknown_cap_exist,priv->ieee80211->current_network.broadcom_cap_exist);
+ /*printk("priv->ieee80211->current_network.unknown_cap_exist is %d ,priv->ieee80211->current_network.broadcom_cap_exist is %d\n",priv->ieee80211->current_network.unknown_cap_exist,priv->ieee80211->current_network.broadcom_cap_exist);*/
if((priv->ieee80211->current_network.atheros_cap_exist) && (priv->ieee80211->mode == IEEE_G)){
txhipower_threshhold = TX_POWER_ATHEROAP_THRESH_HIGH;
txlowpower_threshold = TX_POWER_ATHEROAP_THRESH_LOW;
@@ -3396,7 +3417,7 @@ static void dm_dynamic_txpower(struct net_device *dev)
txlowpower_threshold = TX_POWER_NEAR_FIELD_THRESH_LOW;
}

-// printk("=======>%s(): txhipower_threshhold is %d,txlowpower_threshold is %d\n",__func__,txhipower_threshhold,txlowpower_threshold);
+ /*printk("=======>%s(): txhipower_threshhold is %d,txlowpower_threshold is %d\n",__func__,txhipower_threshhold,txlowpower_threshold);*/
RT_TRACE(COMP_TXAGC,"priv->undecorated_smoothed_pwdb = %ld \n" , priv->undecorated_smoothed_pwdb);

if(priv->ieee80211->state == IEEE80211_LINKED)
@@ -3408,12 +3429,12 @@ static void dm_dynamic_txpower(struct net_device *dev)
}
else
{
- // high power state check
+ /* high power state check */
if(priv->undecorated_smoothed_pwdb < txlowpower_threshold && priv->bDynamicTxHighPower == true)
{
priv->bDynamicTxHighPower = false;
}
- // low power state check
+ /* low power state check */
if(priv->undecorated_smoothed_pwdb < 35)
{
priv->bDynamicTxLowPower = true;
@@ -3426,7 +3447,7 @@ static void dm_dynamic_txpower(struct net_device *dev)
}
else
{
- //pHalData->bTXPowerCtrlforNearFarRange = !pHalData->bTXPowerCtrlforNearFarRange;
+ /*pHalData->bTXPowerCtrlforNearFarRange = !pHalData->bTXPowerCtrlforNearFarRange;*/
priv->bDynamicTxHighPower = false;
priv->bDynamicTxLowPower = false;
}
@@ -3441,27 +3462,27 @@ static void dm_dynamic_txpower(struct net_device *dev)
#endif

rtl8192_phy_setTxPower(dev,priv->ieee80211->current_network.channel);
- //pHalData->bStartTxCtrlByTPCNFR = FALSE; //Clear th flag of Set TX Power from Sitesurvey
+ /*pHalData->bStartTxCtrlByTPCNFR = FALSE; Clear th flag of Set TX Power from Sitesurvey*/
}
priv->bLastDTPFlag_High = priv->bDynamicTxHighPower;
priv->bLastDTPFlag_Low = priv->bDynamicTxLowPower;

} /* dm_dynamic_txpower */

-//added by vivi, for read tx rate and retrycount
+/*added by vivi, for read tx rate and retrycount */
static void dm_check_txrateandretrycount(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
struct ieee80211_device *ieee = priv->ieee80211;
- //for 11n tx rate
-// priv->stats.CurrentShowTxate = read_nic_byte(dev, Current_Tx_Rate_Reg);
+ /* for 11n tx rate */
+ /*priv->stats.CurrentShowTxate = read_nic_byte(dev, Current_Tx_Rate_Reg);*/
read_nic_byte(dev, Current_Tx_Rate_Reg, &ieee->softmac_stats.CurrentShowTxate);
- //printk("=============>tx_rate_reg:%x\n", ieee->softmac_stats.CurrentShowTxate);
- //for initial tx rate
-// priv->stats.last_packet_rate = read_nic_byte(dev, Initial_Tx_Rate_Reg);
+ /*printk("=============>tx_rate_reg:%x\n", ieee->softmac_stats.CurrentShowTxate);*/
+ /* for initial tx rate */
+ /*priv->stats.last_packet_rate = read_nic_byte(dev, Initial_Tx_Rate_Reg);*/
read_nic_byte(dev, Initial_Tx_Rate_Reg, &ieee->softmac_stats.last_packet_rate);
- //for tx tx retry count
-// priv->stats.txretrycount = read_nic_dword(dev, Tx_Retry_Count_Reg);
+ /* for tx tx retry count */
+ /*priv->stats.txretrycount = read_nic_dword(dev, Tx_Retry_Count_Reg);*/
read_nic_dword(dev, Tx_Retry_Count_Reg, &ieee->softmac_stats.txretrycount);
}

@@ -3469,9 +3490,11 @@ static void dm_send_rssi_tofw(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);

- // If we test chariot, we should stop the TX command ?
- // Because 92E will always silent reset when we send tx command. We use register
- // 0x1e0(byte) to notify driver.
+ /*
+ * If we test chariot, we should stop the TX command ?
+ * Because 92E will always silent reset when we send tx command. We use register
+ * 0x1e0(byte) to notify driver.
+ */
write_nic_byte(dev, DRIVER_RSSI, (u8)priv->undecorated_smoothed_pwdb);
return;
}
--
2.2.1


2014-12-31 18:43:45

by Lorenzo Stoakes

[permalink] [raw]
Subject: [PATCH 2/4] staging: rtl8192u: fix whitespace

This patch fixes warnings/errors raised by checkpatch.pl relating to whitespace
in r8192U_dm.c.

Signed-off-by: Lorenzo Stoakes <[email protected]>
---
drivers/staging/rtl8192u/r8192U_dm.c | 1409 +++++++++++++---------------------
1 file changed, 530 insertions(+), 879 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 44f4c38..bf141c6 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -25,7 +25,7 @@ Major Change History:
* Indicate different AP vendor for IOT issue.
*/
static u32 edca_setting_DL[HT_IOT_PEER_MAX] = {
- 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f
+ 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f
};
static u32 edca_setting_UL[HT_IOT_PEER_MAX] = {
0x5e4322, 0xa44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f
@@ -40,7 +40,7 @@ static u32 edca_setting_UL[HT_IOT_PEER_MAX] = {
/* Debug variable ? */
dig_t dm_digtable;
/* Store current software write register content for MAC PHY. */
-u8 dm_shadow[16][256] = {{0}};
+u8 dm_shadow[16][256] = { {0} };
/* For Dynamic Rx Path Selection by Signal Strength */
DRxPathSel DM_RxPathSelTable;
/*------------------------Define global variable-----------------------------*/
@@ -69,11 +69,8 @@ static void dm_bandwidth_autoswitch(struct net_device *dev);

static void dm_check_txpower_tracking(struct net_device *dev);

-
-
/*static void dm_txpower_reset_recovery(struct net_device *dev);*/

-
/* DM --> Dynamic Init Gain by RSSI */
static void dm_dig_init(struct net_device *dev);
static void dm_ctrl_initgain_byrssi(struct net_device *dev);
@@ -92,13 +89,11 @@ static void dm_check_edca_turbo(struct net_device *dev);
/* DM --> Check PBC */
static void dm_check_pbc_gpio(struct net_device *dev);

-
/* DM --> Check current RX RF path state */
static void dm_check_rx_path_selection(struct net_device *dev);
static void dm_init_rxpath_selection(struct net_device *dev);
static void dm_rxpath_sel_byrssi(struct net_device *dev);

-
/* DM --> Fsync for broadcom ap */
static void dm_init_fsync(struct net_device *dev);
static void dm_deInit_fsync(struct net_device *dev);
@@ -112,7 +107,6 @@ static void dm_check_txrateandretrycount(struct net_device *dev);
static void dm_init_dynamic_txpower(struct net_device *dev);
static void dm_dynamic_txpower(struct net_device *dev);

-
/* DM --> For rate adaptive and DIG, we must send RSSI to firmware */
static void dm_send_rssi_tofw(struct net_device *dev);
static void dm_ctstoself(struct net_device *dev);
@@ -151,14 +145,12 @@ void init_hal_dm(struct net_device *dev)

void deinit_hal_dm(struct net_device *dev)
{
-
dm_deInit_fsync(dev);
-
}

-
#ifdef USB_RX_AGGREGATION_SUPPORT
-void dm_CheckRxAggregation(struct net_device *dev) {
+void dm_CheckRxAggregation(struct net_device *dev)
+{
struct r8192_priv *priv = ieee80211_priv((struct net_device *)dev);
PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo;
static unsigned long lastTxOkCnt;
@@ -187,14 +179,15 @@ void dm_CheckRxAggregation(struct net_device *dev) {
if ((curTxOkCnt + curRxOkCnt) < 15000000)
return;

- if(curTxOkCnt > 4*curRxOkCnt) {
+ if (curTxOkCnt > 4*curRxOkCnt) {
if (priv->bCurrentRxAggrEnable) {
write_nic_dword(dev, 0x1a8, 0);
priv->bCurrentRxAggrEnable = false;
}
- }else{
+ } else {
if (!priv->bCurrentRxAggrEnable && !pHTInfo->bCurrentRT2RTAggregation) {
u32 ulValue;
+
ulValue = (pHTInfo->UsbRxFwAggrEn<<24) | (pHTInfo->UsbRxFwAggrPageNum<<16) |
(pHTInfo->UsbRxFwAggrPacketNum<<8) | (pHTInfo->UsbRxFwAggrTimeout);
/*
@@ -212,8 +205,6 @@ void dm_CheckRxAggregation(struct net_device *dev) {
} /* dm_CheckEdcaTurbo */
#endif

-
-
void hal_dm_watchdog(struct net_device *dev)
{
/*struct r8192_priv *priv = ieee80211_priv(dev);*/
@@ -240,7 +231,6 @@ void hal_dm_watchdog(struct net_device *dev)
#endif
} /* HalDmWatchDog */

-
/*
* Decide Rate Adaptive Set according to distance (signal strength)
* 01/11/2008 MHC Modify input arguments and RATR table level.
@@ -249,7 +239,6 @@ void hal_dm_watchdog(struct net_device *dev)
*/
void init_rate_adaptive(struct net_device *dev)
{
-
struct r8192_priv *priv = ieee80211_priv(dev);
prate_adaptive pra = (prate_adaptive)&priv->rate_adaptive;

@@ -262,15 +251,13 @@ void init_rate_adaptive(struct net_device *dev)
pra->low_rssi_thresh_for_ra20M = RateAdaptiveTH_Low_20M;
pra->low_rssi_thresh_for_ra40M = RateAdaptiveTH_Low_40M;

- if(priv->CustomerID == RT_CID_819x_Netcore)
+ if (priv->CustomerID == RT_CID_819x_Netcore)
pra->ping_rssi_enable = 1;
else
pra->ping_rssi_enable = 0;
pra->ping_rssi_thresh_for_ra = 15;

-
- if (priv->rf_type == RF_2T4R)
- {
+ if (priv->rf_type == RF_2T4R) {
/*
* 07/10/08 MH Modify for RA smooth scheme.
* 2008/01/11 MH Modify 2T RATR table for different RSSI. 080515 porting by amy from windows code.
@@ -281,9 +268,7 @@ void init_rate_adaptive(struct net_device *dev)
pra->low_rssi_threshold_ratr_40M = 0x8f0ff005;
pra->low_rssi_threshold_ratr_20M = 0x8f0ff001;
pra->ping_rssi_ratr = 0x0000000d;/* cosa add for test */
- }
- else if (priv->rf_type == RF_1T2R)
- {
+ } else if (priv->rf_type == RF_1T2R) {
pra->upper_rssi_threshold_ratr = 0x000f0000;
pra->middle_rssi_threshold_ratr = 0x000ff000;
pra->low_rssi_threshold_ratr = 0x000ff001;
@@ -294,7 +279,6 @@ void init_rate_adaptive(struct net_device *dev)

} /* InitRateAdaptive */

-
/*-----------------------------------------------------------------------------
* Function: dm_check_rate_adaptive()
*
@@ -321,23 +305,20 @@ static void dm_check_rate_adaptive(struct net_device *dev)
bool bshort_gi_enabled = false;
static u8 ping_rssi_state;

-
- if(!priv->up)
- {
+ if (!priv->up) {
RT_TRACE(COMP_RATE, "<---- dm_check_rate_adaptive(): driver is going to unload\n");
return;
}

- if(pra->rate_adaptive_disabled) /* this variable is set by ioctl. */
+ if (pra->rate_adaptive_disabled) /* this variable is set by ioctl. */
return;

/* TODO: Only 11n mode is implemented currently, */
- if(!(priv->ieee80211->mode == WIRELESS_MODE_N_24G ||
- priv->ieee80211->mode == WIRELESS_MODE_N_5G))
- return;
+ if (!(priv->ieee80211->mode == WIRELESS_MODE_N_24G ||
+ priv->ieee80211->mode == WIRELESS_MODE_N_5G))
+ return;

- if(priv->ieee80211->state == IEEE80211_LINKED)
- {
+ if (priv->ieee80211->state == IEEE80211_LINKED) {
/*RT_TRACE(COMP_RATE, "dm_CheckRateAdaptive(): \t");*/

/*
@@ -346,87 +327,71 @@ static void dm_check_rate_adaptive(struct net_device *dev)
bshort_gi_enabled = (pHTInfo->bCurTxBW40MHz && pHTInfo->bCurShortGI40MHz) ||
(!pHTInfo->bCurTxBW40MHz && pHTInfo->bCurShortGI20MHz);

-
pra->upper_rssi_threshold_ratr =
- (pra->upper_rssi_threshold_ratr & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ;
+ (pra->upper_rssi_threshold_ratr & (~BIT31)) | ((bshort_gi_enabled) ? BIT31:0);

pra->middle_rssi_threshold_ratr =
- (pra->middle_rssi_threshold_ratr & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ;
+ (pra->middle_rssi_threshold_ratr & (~BIT31)) | ((bshort_gi_enabled) ? BIT31:0);

- if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
- {
+ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) {
pra->low_rssi_threshold_ratr =
- (pra->low_rssi_threshold_ratr_40M & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ;
- }
- else
- {
+ (pra->low_rssi_threshold_ratr_40M & (~BIT31)) | ((bshort_gi_enabled) ? BIT31:0);
+ } else {
pra->low_rssi_threshold_ratr =
- (pra->low_rssi_threshold_ratr_20M & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ;
+ (pra->low_rssi_threshold_ratr_20M & (~BIT31)) | ((bshort_gi_enabled) ? BIT31:0);
}
/* cosa add for test */
pra->ping_rssi_ratr =
- (pra->ping_rssi_ratr & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ;
+ (pra->ping_rssi_ratr & (~BIT31)) | ((bshort_gi_enabled) ? BIT31:0);

/* 2007/10/08 MH We support RA smooth scheme now. When it is the first
time to link with AP. We will not change upper/lower threshold. If
STA stay in high or low level, we must change two different threshold
to prevent jumping frequently. */
- if (pra->ratr_state == DM_RATR_STA_HIGH)
- {
+ if (pra->ratr_state == DM_RATR_STA_HIGH) {
HighRSSIThreshForRA = pra->high2low_rssi_thresh_for_ra;
- LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)?
+ LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) ?
(pra->low_rssi_thresh_for_ra40M):(pra->low_rssi_thresh_for_ra20M);
- }
- else if (pra->ratr_state == DM_RATR_STA_LOW)
- {
+ } else if (pra->ratr_state == DM_RATR_STA_LOW) {
HighRSSIThreshForRA = pra->high_rssi_thresh_for_ra;
- LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)?
+ LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) ?
(pra->low2high_rssi_thresh_for_ra40M):(pra->low2high_rssi_thresh_for_ra20M);
- }
- else
- {
+ } else {
HighRSSIThreshForRA = pra->high_rssi_thresh_for_ra;
- LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)?
+ LowRSSIThreshForRA = (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) ?
(pra->low_rssi_thresh_for_ra40M):(pra->low_rssi_thresh_for_ra20M);
}

/*DbgPrint("[DM] THresh H/L=%d/%d\n\r", RATR.HighRSSIThreshForRA, RATR.LowRSSIThreshForRA);*/
- if(priv->undecorated_smoothed_pwdb >= (long)HighRSSIThreshForRA)
- {
+ if (priv->undecorated_smoothed_pwdb >= (long)HighRSSIThreshForRA) {
/*DbgPrint("[DM] RSSI=%d STA=HIGH\n\r", pHalData->UndecoratedSmoothedPWDB);*/
pra->ratr_state = DM_RATR_STA_HIGH;
targetRATR = pra->upper_rssi_threshold_ratr;
- }else if(priv->undecorated_smoothed_pwdb >= (long)LowRSSIThreshForRA)
- {
+ } else if (priv->undecorated_smoothed_pwdb >= (long)LowRSSIThreshForRA) {
/*DbgPrint("[DM] RSSI=%d STA=Middle\n\r", pHalData->UndecoratedSmoothedPWDB);*/
pra->ratr_state = DM_RATR_STA_MIDDLE;
targetRATR = pra->middle_rssi_threshold_ratr;
- }else
- {
+ } else {
/*DbgPrint("[DM] RSSI=%d STA=LOW\n\r", pHalData->UndecoratedSmoothedPWDB);*/
pra->ratr_state = DM_RATR_STA_LOW;
targetRATR = pra->low_rssi_threshold_ratr;
}

/* cosa add for test */
- if(pra->ping_rssi_enable) {
+ if (pra->ping_rssi_enable) {
/*pHalData->UndecoratedSmoothedPWDB = 19;*/
- if(priv->undecorated_smoothed_pwdb < (long)(pra->ping_rssi_thresh_for_ra+5))
- {
- if((priv->undecorated_smoothed_pwdb < (long)pra->ping_rssi_thresh_for_ra) ||
- ping_rssi_state)
- {
- /*DbgPrint("TestRSSI = %d, set RATR to 0x%x \n", pHalData->UndecoratedSmoothedPWDB, pRA->TestRSSIRATR);*/
+ if (priv->undecorated_smoothed_pwdb < (long)(pra->ping_rssi_thresh_for_ra+5)) {
+ if ((priv->undecorated_smoothed_pwdb < (long)pra->ping_rssi_thresh_for_ra) ||
+ ping_rssi_state) {
+ /*DbgPrint("TestRSSI = %d, set RATR to 0x%x\n", pHalData->UndecoratedSmoothedPWDB, pRA->TestRSSIRATR);*/
pra->ratr_state = DM_RATR_STA_LOW;
targetRATR = pra->ping_rssi_ratr;
ping_rssi_state = 1;
}
/*else
- DbgPrint("TestRSSI is between the range. \n");*/
- }
- else
- {
- /*DbgPrint("TestRSSI Recover to 0x%x \n", targetRATR);*/
+ DbgPrint("TestRSSI is between the range.\n");*/
+ } else {
+ /*DbgPrint("TestRSSI Recover to 0x%x\n", targetRATR);*/
ping_rssi_state = 0;
}
}
@@ -435,20 +400,19 @@ static void dm_check_rate_adaptive(struct net_device *dev)
* 2008.04.01
* For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7.
*/
- if(priv->ieee80211->GetHalfNmodeSupportByAPsHandler(dev))
- targetRATR &= 0xf00fffff;
+ if (priv->ieee80211->GetHalfNmodeSupportByAPsHandler(dev))
+ targetRATR &= 0xf00fffff;

/*
* Check whether updating of RATR0 is required
*/
read_nic_dword(dev, RATR0, &currentRATR);
- if(targetRATR != currentRATR)
- {
+ if (targetRATR != currentRATR) {
u32 ratr_value;
+
ratr_value = targetRATR;
- RT_TRACE(COMP_RATE,"currentRATR = %x, targetRATR = %x\n", currentRATR, targetRATR);
- if(priv->rf_type == RF_1T2R)
- {
+ RT_TRACE(COMP_RATE, "currentRATR = %x, targetRATR = %x\n", currentRATR, targetRATR);
+ if (priv->rf_type == RF_1T2R) {
ratr_value &= ~(RATE_ALL_OFDM_2SS);
}
write_nic_dword(dev, RATR0, ratr_value);
@@ -457,15 +421,12 @@ static void dm_check_rate_adaptive(struct net_device *dev)
pra->last_ratr = targetRATR;
}

- }
- else
- {
+ } else {
pra->ratr_state = DM_RATR_STA_MAX;
}

} /* dm_CheckRateAdaptive */

-
static void dm_init_bandwidth_autoswitch(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
@@ -477,19 +438,18 @@ static void dm_init_bandwidth_autoswitch(struct net_device *dev)

} /* dm_init_bandwidth_autoswitch */

-
static void dm_bandwidth_autoswitch(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);

- if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ||!priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable){
+ if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 || !priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable) {
return;
- }else{
- if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){ /* If send packets in 40 Mhz in 20/40 */
- if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
+ } else {
+ if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false) { /* If send packets in 40 Mhz in 20/40 */
+ if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
- }else{ /* in force send packets in 20 Mhz in 20/40 */
- if(priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
+ } else { /* in force send packets in 20 Mhz in 20/40 */
+ if (priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;

}
@@ -555,14 +515,14 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
bool bHighpowerstate, viviflag = FALSE;
DCMD_TXCMD_T tx_cmd;
u8 powerlevelOFDM24G;
- int i =0, j = 0, k = 0;
- u8 RF_Type, tmp_report[5]={0, 0, 0, 0, 0};
+ int i = 0, j = 0, k = 0;
+ u8 RF_Type, tmp_report[5] = {0, 0, 0, 0, 0};
u32 Value;
u8 Pwr_Flag;
- u16 Avg_TSSI_Meas, TSSI_13dBm, Avg_TSSI_Meas_from_driver=0;
+ u16 Avg_TSSI_Meas, TSSI_13dBm, Avg_TSSI_Meas_from_driver = 0;
/*RT_STATUS rtStatus = RT_STATUS_SUCCESS;*/
bool rtStatus = true;
- u32 delta=0;
+ u32 delta = 0;

write_nic_byte(dev, 0x1ba, 0);

@@ -575,36 +535,31 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)

RT_TRACE(COMP_POWER_TRACKING, "powerlevelOFDM24G = %x\n", powerlevelOFDM24G);

- for(j = 0; j<=30; j++) { /* fill tx_cmd */
+ for (j = 0; j <= 30; j++) { /* fill tx_cmd */
tx_cmd.Op = TXCMD_SET_TX_PWR_TRACKING;
tx_cmd.Length = 4;
tx_cmd.Value = Value;
rtStatus = SendTxCommandPacket(dev, &tx_cmd, 12);
- if (rtStatus == RT_STATUS_FAILURE)
- {
+ if (rtStatus == RT_STATUS_FAILURE) {
RT_TRACE(COMP_POWER_TRACKING, "Set configuration with tx cmd queue fail!\n");
}
mdelay(1);
/*DbgPrint("hi, vivi, strange\n");*/
- for(i = 0;i <= 30; i++)
- {
+ for (i = 0; i <= 30; i++) {
read_nic_byte(dev, 0x1ba, &Pwr_Flag);

- if (Pwr_Flag == 0)
- {
+ if (Pwr_Flag == 0) {
mdelay(1);
continue;
}
read_nic_word(dev, 0x13c, &Avg_TSSI_Meas);
- if(Avg_TSSI_Meas == 0)
- {
+ if (Avg_TSSI_Meas == 0) {
write_nic_byte(dev, 0x1ba, 0);
break;
}

- for(k = 0;k < 5; k++)
- {
- if(k !=4)
+ for (k = 0; k < 5; k++) {
+ if (k != 4)
read_nic_byte(dev, 0x134+k, &tmp_report[k]);
else
read_nic_byte(dev, 0x13e, &tmp_report[k]);
@@ -612,26 +567,22 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
}

/* check if the report value is right */
- for(k = 0;k < 5; k++)
- {
- if(tmp_report[k] <= 20)
- {
- viviflag =TRUE;
+ for (k = 0; k < 5; k++) {
+ if (tmp_report[k] <= 20) {
+ viviflag = TRUE;
break;
}
}
- if(viviflag ==TRUE)
- {
+ if (viviflag == TRUE) {
write_nic_byte(dev, 0x1ba, 0);
viviflag = FALSE;
RT_TRACE(COMP_POWER_TRACKING, "we filtered the data\n");
- for(k = 0;k < 5; k++)
+ for (k = 0; k < 5; k++)
tmp_report[k] = 0;
break;
}

- for(k = 0;k < 5; k++)
- {
+ for (k = 0; k < 5; k++) {
Avg_TSSI_Meas_from_driver += tmp_report[k];
}

@@ -640,15 +591,14 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
TSSI_13dBm = priv->TSSI_13dBm;
RT_TRACE(COMP_POWER_TRACKING, "TSSI_13dBm = %d\n", TSSI_13dBm);

- /*if(abs(Avg_TSSI_Meas_from_driver - TSSI_13dBm) <= E_FOR_TX_POWER_TRACK)*/
+ /*if (abs(Avg_TSSI_Meas_from_driver - TSSI_13dBm) <= E_FOR_TX_POWER_TRACK)*/
/* For MacOS-compatible */
- if(Avg_TSSI_Meas_from_driver > TSSI_13dBm)
+ if (Avg_TSSI_Meas_from_driver > TSSI_13dBm)
delta = Avg_TSSI_Meas_from_driver - TSSI_13dBm;
else
delta = TSSI_13dBm - Avg_TSSI_Meas_from_driver;

- if(delta <= E_FOR_TX_POWER_TRACK)
- {
+ if (delta <= E_FOR_TX_POWER_TRACK) {
priv->ieee80211->bdynamic_txpower_enable = TRUE;
write_nic_byte(dev, 0x1ba, 0);
RT_TRACE(COMP_POWER_TRACKING, "tx power track is done\n");
@@ -657,25 +607,17 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation_difference = %d\n", priv->cck_present_attentuation_difference);
RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation = %d\n", priv->cck_present_attentuation);
return;
- }
- else
- {
- if(Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK)
- {
- if (priv->rfa_txpowertrackingindex > 0)
- {
+ } else {
+ if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) {
+ if (priv->rfa_txpowertrackingindex > 0) {
priv->rfa_txpowertrackingindex--;
- if(priv->rfa_txpowertrackingindex_real > 4)
- {
+ if (priv->rfa_txpowertrackingindex_real > 4) {
priv->rfa_txpowertrackingindex_real--;
rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value);
}
}
- }
- else
- {
- if (priv->rfa_txpowertrackingindex < 36)
- {
+ } else {
+ if (priv->rfa_txpowertrackingindex < 36) {
priv->rfa_txpowertrackingindex++;
priv->rfa_txpowertrackingindex_real++;
rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value);
@@ -685,46 +627,39 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
priv->cck_present_attentuation_difference
= priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default;

- if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20)
+ if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20)
priv->cck_present_attentuation
= priv->cck_present_attentuation_20Mdefault + priv->cck_present_attentuation_difference;
else
priv->cck_present_attentuation
= priv->cck_present_attentuation_40Mdefault + priv->cck_present_attentuation_difference;

- if(priv->cck_present_attentuation > -1&&priv->cck_present_attentuation <23)
- {
- if(priv->ieee80211->current_network.channel == 14 && !priv->bcck_in_ch14)
- {
+ if (priv->cck_present_attentuation > -1 && priv->cck_present_attentuation < 23) {
+ if (priv->ieee80211->current_network.channel == 14 && !priv->bcck_in_ch14) {
priv->bcck_in_ch14 = TRUE;
- dm_cck_txpower_adjust(dev,priv->bcck_in_ch14);
- }
- else if(priv->ieee80211->current_network.channel != 14 && priv->bcck_in_ch14)
- {
+ dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
+ } else if (priv->ieee80211->current_network.channel != 14 && priv->bcck_in_ch14) {
priv->bcck_in_ch14 = FALSE;
- dm_cck_txpower_adjust(dev,priv->bcck_in_ch14);
- }
- else
- dm_cck_txpower_adjust(dev,priv->bcck_in_ch14);
+ dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
+ } else
+ dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
}
RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex = %d\n", priv->rfa_txpowertrackingindex);
RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex_real = %d\n", priv->rfa_txpowertrackingindex_real);
RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation_difference = %d\n", priv->cck_present_attentuation_difference);
RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation = %d\n", priv->cck_present_attentuation);

- if (priv->cck_present_attentuation_difference <= -12||priv->cck_present_attentuation_difference >= 24)
- {
+ if (priv->cck_present_attentuation_difference <= -12 || priv->cck_present_attentuation_difference >= 24) {
priv->ieee80211->bdynamic_txpower_enable = TRUE;
write_nic_byte(dev, 0x1ba, 0);
RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n");
return;
}

-
}
write_nic_byte(dev, 0x1ba, 0);
Avg_TSSI_Meas_from_driver = 0;
- for(k = 0;k < 5; k++)
+ for (k = 0; k < 5; k++)
tmp_report[k] = 0;
break;
}
@@ -739,17 +674,14 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
struct r8192_priv *priv = ieee80211_priv(dev);
u32 tmpRegA, TempCCk;
u8 tmpOFDMindex, tmpCCKindex, tmpCCK20Mindex, tmpCCK40Mindex, tmpval;
- int i =0, CCKSwingNeedUpdate=0;
+ int i = 0, CCKSwingNeedUpdate = 0;

- if(!priv->btxpower_trackingInit)
- {
+ if (!priv->btxpower_trackingInit) {
/* Query OFDM default setting */
- tmpRegA= rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord);
- for(i=0; i<OFDM_Table_Length; i++) /* find the index */
- {
- if(tmpRegA == OFDMSwingTable[i])
- {
- priv->OFDM_index= (u8)i;
+ tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord);
+ for (i = 0; i < OFDM_Table_Length; i++) { /* find the index */
+ if (tmpRegA == OFDMSwingTable[i]) {
+ priv->OFDM_index = (u8)i;
RT_TRACE(COMP_POWER_TRACKING, "Initial reg0x%x = 0x%x, OFDM_index=0x%x\n",
rOFDM0_XATxIQImbalance, tmpRegA, priv->OFDM_index);
}
@@ -757,11 +689,9 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)

/* Query CCK default setting From 0xa22 */
TempCCk = rtl8192_QueryBBReg(dev, rCCK0_TxFilter1, bMaskByte2);
- for(i=0 ; i<CCK_Table_length ; i++)
- {
- if(TempCCk == (u32)CCKSwingTable_Ch1_Ch13[i][0])
- {
- priv->CCK_index =(u8) i;
+ for (i = 0; i < CCK_Table_length; i++) {
+ if (TempCCk == (u32)CCKSwingTable_Ch1_Ch13[i][0]) {
+ priv->CCK_index = (u8) i;
RT_TRACE(COMP_POWER_TRACKING, "Initial reg0x%x = 0x%x, CCK_index=0x%x\n",
rCCK0_TxFilter1, TempCCk, priv->CCK_index);
break;
@@ -779,31 +709,28 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)

/* read and filter out unreasonable value */
tmpRegA = rtl8192_phy_QueryRFReg(dev, RF90_PATH_A, 0x12, 0x078); /* 0x12: RF Reg[10:7] */
- RT_TRACE(COMP_POWER_TRACKING, "Readback ThermalMeterA = %d \n", tmpRegA);
- if(tmpRegA < 3 || tmpRegA > 13)
+ RT_TRACE(COMP_POWER_TRACKING, "Readback ThermalMeterA = %d\n", tmpRegA);
+ if (tmpRegA < 3 || tmpRegA > 13)
return;
- if(tmpRegA >= 12) /* if over 12, TP will be bad when high temperature */
+ if (tmpRegA >= 12) /* if over 12, TP will be bad when high temperature */
tmpRegA = 12;
- RT_TRACE(COMP_POWER_TRACKING, "Valid ThermalMeterA = %d \n", tmpRegA);
+ RT_TRACE(COMP_POWER_TRACKING, "Valid ThermalMeterA = %d\n", tmpRegA);
priv->ThermalMeter[0] = ThermalMeterVal; /* We use fixed value by Bryant's suggestion */
priv->ThermalMeter[1] = ThermalMeterVal; /* We use fixed value by Bryant's suggestion */

/* Get current RF-A temperature index */
- if(priv->ThermalMeter[0] >= (u8)tmpRegA) /* lower temperature */
- {
+ if (priv->ThermalMeter[0] >= (u8)tmpRegA) { /* lower temperature */
tmpOFDMindex = tmpCCK20Mindex = 6+(priv->ThermalMeter[0]-(u8)tmpRegA);
tmpCCK40Mindex = tmpCCK20Mindex - 6;
- if(tmpOFDMindex >= OFDM_Table_Length)
+ if (tmpOFDMindex >= OFDM_Table_Length)
tmpOFDMindex = OFDM_Table_Length-1;
- if(tmpCCK20Mindex >= CCK_Table_length)
+ if (tmpCCK20Mindex >= CCK_Table_length)
tmpCCK20Mindex = CCK_Table_length-1;
- if(tmpCCK40Mindex >= CCK_Table_length)
+ if (tmpCCK40Mindex >= CCK_Table_length)
tmpCCK40Mindex = CCK_Table_length-1;
- }
- else
- {
+ } else {
tmpval = ((u8)tmpRegA - priv->ThermalMeter[0]);
- if(tmpval >= 6) /* higher temperature */
+ if (tmpval >= 6) /* higher temperature */
tmpOFDMindex = tmpCCK20Mindex = 0; /* max to +6dB */
else
tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval;
@@ -812,35 +739,29 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
/*DbgPrint("%ddb, tmpOFDMindex = %d, tmpCCK20Mindex = %d, tmpCCK40Mindex = %d",
((u1Byte)tmpRegA - pHalData->ThermalMeter[0]),
tmpOFDMindex, tmpCCK20Mindex, tmpCCK40Mindex);*/
- if(priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) /* 40M */
+ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) /* 40M */
tmpCCKindex = tmpCCK40Mindex;
else
tmpCCKindex = tmpCCK20Mindex;

- if(priv->ieee80211->current_network.channel == 14 && !priv->bcck_in_ch14)
- {
+ if (priv->ieee80211->current_network.channel == 14 && !priv->bcck_in_ch14) {
priv->bcck_in_ch14 = TRUE;
CCKSwingNeedUpdate = 1;
- }
- else if(priv->ieee80211->current_network.channel != 14 && priv->bcck_in_ch14)
- {
+ } else if (priv->ieee80211->current_network.channel != 14 && priv->bcck_in_ch14) {
priv->bcck_in_ch14 = FALSE;
CCKSwingNeedUpdate = 1;
}

- if(priv->CCK_index != tmpCCKindex)
- {
+ if (priv->CCK_index != tmpCCKindex) {
priv->CCK_index = tmpCCKindex;
CCKSwingNeedUpdate = 1;
}

- if(CCKSwingNeedUpdate)
- {
+ if (CCKSwingNeedUpdate) {
/*DbgPrint("Update CCK Swing, CCK_index = %d\n", pHalData->CCK_index);*/
dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
}
- if(priv->OFDM_index != tmpOFDMindex)
- {
+ if (priv->OFDM_index != tmpOFDMindex) {
priv->OFDM_index = tmpOFDMindex;
rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, OFDMSwingTable[priv->OFDM_index]);
RT_TRACE(COMP_POWER_TRACKING, "Update OFDMSwing[%d] = 0x%x\n",
@@ -851,97 +772,95 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)

void dm_txpower_trackingcallback(struct work_struct *work)
{
- struct delayed_work *dwork = container_of(work,struct delayed_work,work);
- struct r8192_priv *priv = container_of(dwork,struct r8192_priv,txpower_tracking_wq);
- struct net_device *dev = priv->ieee80211->dev;
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct r8192_priv *priv = container_of(dwork, struct r8192_priv, txpower_tracking_wq);
+ struct net_device *dev = priv->ieee80211->dev;

- if(priv->bDcut == TRUE)
+ if (priv->bDcut == TRUE)
dm_TXPowerTrackingCallback_TSSI(dev);
else
dm_TXPowerTrackingCallback_ThermalMeter(dev);
}

-
static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev)
{
-
struct r8192_priv *priv = ieee80211_priv(dev);

/* Initial the Tx BB index and mapping value */
priv->txbbgain_table[0].txbb_iq_amplifygain = 12;
- priv->txbbgain_table[0].txbbgain_value=0x7f8001fe;
+ priv->txbbgain_table[0].txbbgain_value = 0x7f8001fe;
priv->txbbgain_table[1].txbb_iq_amplifygain = 11;
- priv->txbbgain_table[1].txbbgain_value=0x788001e2;
+ priv->txbbgain_table[1].txbbgain_value = 0x788001e2;
priv->txbbgain_table[2].txbb_iq_amplifygain = 10;
- priv->txbbgain_table[2].txbbgain_value=0x71c001c7;
+ priv->txbbgain_table[2].txbbgain_value = 0x71c001c7;
priv->txbbgain_table[3].txbb_iq_amplifygain = 9;
- priv->txbbgain_table[3].txbbgain_value=0x6b8001ae;
+ priv->txbbgain_table[3].txbbgain_value = 0x6b8001ae;
priv->txbbgain_table[4].txbb_iq_amplifygain = 8;
- priv->txbbgain_table[4].txbbgain_value=0x65400195;
+ priv->txbbgain_table[4].txbbgain_value = 0x65400195;
priv->txbbgain_table[5].txbb_iq_amplifygain = 7;
- priv->txbbgain_table[5].txbbgain_value=0x5fc0017f;
+ priv->txbbgain_table[5].txbbgain_value = 0x5fc0017f;
priv->txbbgain_table[6].txbb_iq_amplifygain = 6;
- priv->txbbgain_table[6].txbbgain_value=0x5a400169;
+ priv->txbbgain_table[6].txbbgain_value = 0x5a400169;
priv->txbbgain_table[7].txbb_iq_amplifygain = 5;
- priv->txbbgain_table[7].txbbgain_value=0x55400155;
+ priv->txbbgain_table[7].txbbgain_value = 0x55400155;
priv->txbbgain_table[8].txbb_iq_amplifygain = 4;
- priv->txbbgain_table[8].txbbgain_value=0x50800142;
+ priv->txbbgain_table[8].txbbgain_value = 0x50800142;
priv->txbbgain_table[9].txbb_iq_amplifygain = 3;
- priv->txbbgain_table[9].txbbgain_value=0x4c000130;
+ priv->txbbgain_table[9].txbbgain_value = 0x4c000130;
priv->txbbgain_table[10].txbb_iq_amplifygain = 2;
- priv->txbbgain_table[10].txbbgain_value=0x47c0011f;
+ priv->txbbgain_table[10].txbbgain_value = 0x47c0011f;
priv->txbbgain_table[11].txbb_iq_amplifygain = 1;
- priv->txbbgain_table[11].txbbgain_value=0x43c0010f;
+ priv->txbbgain_table[11].txbbgain_value = 0x43c0010f;
priv->txbbgain_table[12].txbb_iq_amplifygain = 0;
- priv->txbbgain_table[12].txbbgain_value=0x40000100;
+ priv->txbbgain_table[12].txbbgain_value = 0x40000100;
priv->txbbgain_table[13].txbb_iq_amplifygain = -1;
- priv->txbbgain_table[13].txbbgain_value=0x3c8000f2;
+ priv->txbbgain_table[13].txbbgain_value = 0x3c8000f2;
priv->txbbgain_table[14].txbb_iq_amplifygain = -2;
- priv->txbbgain_table[14].txbbgain_value=0x390000e4;
+ priv->txbbgain_table[14].txbbgain_value = 0x390000e4;
priv->txbbgain_table[15].txbb_iq_amplifygain = -3;
- priv->txbbgain_table[15].txbbgain_value=0x35c000d7;
+ priv->txbbgain_table[15].txbbgain_value = 0x35c000d7;
priv->txbbgain_table[16].txbb_iq_amplifygain = -4;
- priv->txbbgain_table[16].txbbgain_value=0x32c000cb;
+ priv->txbbgain_table[16].txbbgain_value = 0x32c000cb;
priv->txbbgain_table[17].txbb_iq_amplifygain = -5;
- priv->txbbgain_table[17].txbbgain_value=0x300000c0;
+ priv->txbbgain_table[17].txbbgain_value = 0x300000c0;
priv->txbbgain_table[18].txbb_iq_amplifygain = -6;
- priv->txbbgain_table[18].txbbgain_value=0x2d4000b5;
+ priv->txbbgain_table[18].txbbgain_value = 0x2d4000b5;
priv->txbbgain_table[19].txbb_iq_amplifygain = -7;
- priv->txbbgain_table[19].txbbgain_value=0x2ac000ab;
+ priv->txbbgain_table[19].txbbgain_value = 0x2ac000ab;
priv->txbbgain_table[20].txbb_iq_amplifygain = -8;
- priv->txbbgain_table[20].txbbgain_value=0x288000a2;
+ priv->txbbgain_table[20].txbbgain_value = 0x288000a2;
priv->txbbgain_table[21].txbb_iq_amplifygain = -9;
- priv->txbbgain_table[21].txbbgain_value=0x26000098;
+ priv->txbbgain_table[21].txbbgain_value = 0x26000098;
priv->txbbgain_table[22].txbb_iq_amplifygain = -10;
- priv->txbbgain_table[22].txbbgain_value=0x24000090;
+ priv->txbbgain_table[22].txbbgain_value = 0x24000090;
priv->txbbgain_table[23].txbb_iq_amplifygain = -11;
- priv->txbbgain_table[23].txbbgain_value=0x22000088;
+ priv->txbbgain_table[23].txbbgain_value = 0x22000088;
priv->txbbgain_table[24].txbb_iq_amplifygain = -12;
- priv->txbbgain_table[24].txbbgain_value=0x20000080;
+ priv->txbbgain_table[24].txbbgain_value = 0x20000080;
priv->txbbgain_table[25].txbb_iq_amplifygain = -13;
- priv->txbbgain_table[25].txbbgain_value=0x1a00006c;
+ priv->txbbgain_table[25].txbbgain_value = 0x1a00006c;
priv->txbbgain_table[26].txbb_iq_amplifygain = -14;
- priv->txbbgain_table[26].txbbgain_value=0x1c800072;
+ priv->txbbgain_table[26].txbbgain_value = 0x1c800072;
priv->txbbgain_table[27].txbb_iq_amplifygain = -15;
- priv->txbbgain_table[27].txbbgain_value=0x18000060;
+ priv->txbbgain_table[27].txbbgain_value = 0x18000060;
priv->txbbgain_table[28].txbb_iq_amplifygain = -16;
- priv->txbbgain_table[28].txbbgain_value=0x19800066;
+ priv->txbbgain_table[28].txbbgain_value = 0x19800066;
priv->txbbgain_table[29].txbb_iq_amplifygain = -17;
- priv->txbbgain_table[29].txbbgain_value=0x15800056;
+ priv->txbbgain_table[29].txbbgain_value = 0x15800056;
priv->txbbgain_table[30].txbb_iq_amplifygain = -18;
- priv->txbbgain_table[30].txbbgain_value=0x26c0005b;
+ priv->txbbgain_table[30].txbbgain_value = 0x26c0005b;
priv->txbbgain_table[31].txbb_iq_amplifygain = -19;
- priv->txbbgain_table[31].txbbgain_value=0x14400051;
+ priv->txbbgain_table[31].txbbgain_value = 0x14400051;
priv->txbbgain_table[32].txbb_iq_amplifygain = -20;
- priv->txbbgain_table[32].txbbgain_value=0x24400051;
+ priv->txbbgain_table[32].txbbgain_value = 0x24400051;
priv->txbbgain_table[33].txbb_iq_amplifygain = -21;
- priv->txbbgain_table[33].txbbgain_value=0x1300004c;
+ priv->txbbgain_table[33].txbbgain_value = 0x1300004c;
priv->txbbgain_table[34].txbb_iq_amplifygain = -22;
- priv->txbbgain_table[34].txbbgain_value=0x12000048;
+ priv->txbbgain_table[34].txbbgain_value = 0x12000048;
priv->txbbgain_table[35].txbb_iq_amplifygain = -23;
- priv->txbbgain_table[35].txbbgain_value=0x11000044;
+ priv->txbbgain_table[35].txbbgain_value = 0x11000044;
priv->txbbgain_table[36].txbb_iq_amplifygain = -24;
- priv->txbbgain_table[36].txbbgain_value=0x10000040;
+ priv->txbbgain_table[36].txbbgain_value = 0x10000040;

/*
* ccktxbb_valuearray[0] is 0xA22 [1] is 0xA24 ...[7] is 0xA29
@@ -1380,7 +1299,7 @@ static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev)
* can be enabled only when Firmware R/W 3-wire is enabled. Otherwise, frequent r/w
* 3-wire by driver causes RF to go into a wrong state.
*/
- if(priv->ieee80211->FwRWRF)
+ if (priv->ieee80211->FwRWRF)
priv->btxpower_tracking = TRUE;
else
priv->btxpower_tracking = FALSE;
@@ -1388,54 +1307,46 @@ static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev)
priv->btxpower_trackingInit = FALSE;
}

-
void dm_initialize_txpower_tracking(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
- if(priv->bDcut == TRUE)
+
+ if (priv->bDcut == TRUE)
dm_InitializeTXPowerTracking_TSSI(dev);
else
dm_InitializeTXPowerTracking_ThermalMeter(dev);
} /* dm_InitializeTXPowerTracking */

-
static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
static u32 tx_power_track_counter;

- if(!priv->btxpower_tracking)
+ if (!priv->btxpower_tracking)
return;
- else
- {
- if((tx_power_track_counter % 30 == 0)&&(tx_power_track_counter != 0))
- {
- queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
+ else {
+ if ((tx_power_track_counter % 30 == 0) && (tx_power_track_counter != 0)) {
+ queue_delayed_work(priv->priv_wq, &priv->txpower_tracking_wq, 0);
}
tx_power_track_counter++;
}
-
}

-
static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
static u8 TM_Trigger;
- /*DbgPrint("dm_CheckTXPowerTracking() \n");*/
- if(!priv->btxpower_tracking)
+ /*DbgPrint("dm_CheckTXPowerTracking()\n");*/
+ if (!priv->btxpower_tracking)
return;
- else
- {
- if(priv->txpower_count <= 2)
- {
+ else {
+ if (priv->txpower_count <= 2) {
priv->txpower_count++;
return;
}
}

- if(!TM_Trigger)
- {
+ if (!TM_Trigger) {
/*
* Attention!! You have to write all 12bits of data to RF, or it may cause RF to crash
* actually write reg0x02 bit1=0, then bit1=1.
@@ -1447,25 +1358,22 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
TM_Trigger = 1;
return;
- }
- else
- {
+ } else {
/*DbgPrint("Schedule TxPowerTrackingWorkItem\n");*/
- queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
+ queue_delayed_work(priv->priv_wq, &priv->txpower_tracking_wq, 0);
TM_Trigger = 0;
}
}

-
static void dm_check_txpower_tracking(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
/*static u32 tx_power_track_counter = 0;*/

-#ifdef RTL8190P
+#ifdef RTL8190P
dm_CheckTXPowerTracking_TSSI(dev);
#else
- if(priv->bDcut == TRUE)
+ if (priv->bDcut == TRUE)
dm_CheckTXPowerTracking_TSSI(dev);
else
dm_CheckTXPowerTracking_ThermalMeter(dev);
@@ -1473,17 +1381,17 @@ static void dm_check_txpower_tracking(struct net_device *dev)

} /* dm_CheckTXPowerTracking */

-
static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14)
{
u32 TempVal;
struct r8192_priv *priv = ieee80211_priv(dev);
+
/* Write 0xa22 0xa23 */
TempVal = 0;
- if(!bInCH14){
+ if (!bInCH14) {
/* Write 0xa22 0xa23 */
TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[0] +
- (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[1]<<8) ;
+ (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[1]<<8);

rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
/* Write 0xa24 ~ 0xa27 */
@@ -1494,14 +1402,12 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14)
rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal);
/* Write 0xa28 0xa29 */
TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[6] +
- (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[7]<<8) ;
+ (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[7]<<8);

rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal);
- }
- else
- {
+ } else {
TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[0] +
- (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[1]<<8) ;
+ (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[1]<<8);

rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
/* Write 0xa24 ~ 0xa27 */
@@ -1512,25 +1418,22 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14)
rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal);
/* Write 0xa28 0xa29 */
TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[6] +
- (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[7]<<8) ;
+ (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[7]<<8);

rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal);
}
-
-
}

-static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH14)
+static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH14)
{
u32 TempVal;
struct r8192_priv *priv = ieee80211_priv(dev);

TempVal = 0;
- if(!bInCH14)
- {
+ if (!bInCH14) {
/* Write 0xa22 0xa23 */
TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][0] +
- (CCKSwingTable_Ch1_Ch13[priv->CCK_index][1]<<8) ;
+ (CCKSwingTable_Ch1_Ch13[priv->CCK_index][1]<<8);
rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n",
rCCK0_TxFilter1, TempVal);
@@ -1544,18 +1447,16 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH
rCCK0_TxFilter2, TempVal);
/* Write 0xa28 0xa29 */
TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][6] +
- (CCKSwingTable_Ch1_Ch13[priv->CCK_index][7]<<8) ;
+ (CCKSwingTable_Ch1_Ch13[priv->CCK_index][7]<<8);

rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal);
RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n",
rCCK0_DebugPort, TempVal);
- }
- else
- {
+ } else {
/*priv->CCKTxPowerAdjustCntNotCh14++; cosa add for debug.*/
/* Write 0xa22 0xa23 */
TempVal = CCKSwingTable_Ch14[priv->CCK_index][0] +
- (CCKSwingTable_Ch14[priv->CCK_index][1]<<8) ;
+ (CCKSwingTable_Ch14[priv->CCK_index][1]<<8);

rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n",
@@ -1570,7 +1471,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH
rCCK0_TxFilter2, TempVal);
/* Write 0xa28 0xa29 */
TempVal = CCKSwingTable_Ch14[priv->CCK_index][6] +
- (CCKSwingTable_Ch14[priv->CCK_index][7]<<8) ;
+ (CCKSwingTable_Ch14[priv->CCK_index][7]<<8);

rtl8192_setBBreg(dev, rCCK0_DebugPort, bMaskLWord, TempVal);
RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n",
@@ -1578,20 +1479,17 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH
}
}

-
-
void dm_cck_txpower_adjust(struct net_device *dev, bool binch14)
{ /* dm_CCKTxPowerAdjust */
-
struct r8192_priv *priv = ieee80211_priv(dev);
- if(priv->bDcut == TRUE)
+
+ if (priv->bDcut == TRUE)
dm_CCKTxPowerAdjust_TSSI(dev, binch14);
else
dm_CCKTxPowerAdjust_ThermalMeter(dev, binch14);
}

-
-#ifndef RTL8192U
+#ifndef RTL8192U
static void dm_txpower_reset_recovery(
struct net_device *dev
)
@@ -1600,16 +1498,16 @@ static void dm_txpower_reset_recovery(

RT_TRACE(COMP_POWER_TRACKING, "Start Reset Recovery ==>\n");
rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex].txbbgain_value);
- RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in 0xc80 is %08x\n",priv->txbbgain_table[priv->rfa_txpowertrackingindex].txbbgain_value);
- RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in RFA_txPowerTrackingIndex is %x\n",priv->rfa_txpowertrackingindex);
- RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery : RF A I/Q Amplify Gain is %ld\n",priv->txbbgain_table[priv->rfa_txpowertrackingindex].txbb_iq_amplifygain);
- RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: CCK Attenuation is %d dB\n",priv->cck_present_attentuation);
+ RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in 0xc80 is %08x\n", priv->txbbgain_table[priv->rfa_txpowertrackingindex].txbbgain_value);
+ RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in RFA_txPowerTrackingIndex is %x\n", priv->rfa_txpowertrackingindex);
+ RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery : RF A I/Q Amplify Gain is %ld\n", priv->txbbgain_table[priv->rfa_txpowertrackingindex].txbb_iq_amplifygain);
+ RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: CCK Attenuation is %d dB\n", priv->cck_present_attentuation);
dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);

rtl8192_setBBreg(dev, rOFDM0_XCTxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfc_txpowertrackingindex].txbbgain_value);
- RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in 0xc90 is %08x\n",priv->txbbgain_table[priv->rfc_txpowertrackingindex].txbbgain_value);
- RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in RFC_txPowerTrackingIndex is %x\n",priv->rfc_txpowertrackingindex);
- RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery : RF C I/Q Amplify Gain is %ld\n",priv->txbbgain_table[priv->rfc_txpowertrackingindex].txbb_iq_amplifygain);
+ RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in 0xc90 is %08x\n", priv->txbbgain_table[priv->rfc_txpowertrackingindex].txbbgain_value);
+ RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in RFC_txPowerTrackingIndex is %x\n", priv->rfc_txpowertrackingindex);
+ RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery : RF C I/Q Amplify Gain is %ld\n", priv->txbbgain_table[priv->rfc_txpowertrackingindex].txbb_iq_amplifygain);

} /* dm_TXPowerResetRecovery */

@@ -1618,8 +1516,7 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev)
struct r8192_priv *priv = ieee80211_priv(dev);
u32 reg_ratr = priv->rate_adaptive.last_ratr;

- if(!priv->up)
- {
+ if (!priv->up) {
RT_TRACE(COMP_RATE, "<---- dm_restore_dynamic_mechanism_state(): driver is going to unload\n");
return;
}
@@ -1627,18 +1524,19 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev)
/*
* Restore previous state for rate adaptive
*/
- if(priv->rate_adaptive.rate_adaptive_disabled)
+ if (priv->rate_adaptive.rate_adaptive_disabled)
return;
/* TODO: Only 11n mode is implemented currently, */
- if(!(priv->ieee80211->mode==WIRELESS_MODE_N_24G ||
- priv->ieee80211->mode==WIRELESS_MODE_N_5G))
- return;
+ if (!(priv->ieee80211->mode == WIRELESS_MODE_N_24G ||
+ priv->ieee80211->mode == WIRELESS_MODE_N_5G))
+ return;
+
{
/* 2007/11/15 MH Copy from 8190PCI. */
u32 ratr_value;
+
ratr_value = reg_ratr;
- if(priv->rf_type == RF_1T2R) /* 1T2R, Spatial Stream 2 should be disabled */
- {
+ if (priv->rf_type == RF_1T2R) { /* 1T2R, Spatial Stream 2 should be disabled */
ratr_value &= ~(RATE_ALL_OFDM_2SS);
/*DbgPrint("HW_VAR_TATR_0 from 0x%x ==> 0x%x\n", ((pu4Byte)(val))[0], ratr_value);*/
}
@@ -1663,7 +1561,7 @@ static void dm_bb_initialgain_restore(struct net_device *dev)
struct r8192_priv *priv = ieee80211_priv(dev);
u32 bit_mask = 0x7f; /* Bit0~ Bit6 */

- if(dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
+ if (dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
return;

/* Disable Initial Gain */
@@ -1676,18 +1574,17 @@ static void dm_bb_initialgain_restore(struct net_device *dev)
bit_mask = bMaskByte2;
rtl8192_setBBreg(dev, rCCK0_CCA, bit_mask, (u32)priv->initgain_backup.cca);

- RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc50 is %x\n",priv->initgain_backup.xaagccore1);
- RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc58 is %x\n",priv->initgain_backup.xbagccore1);
- RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc60 is %x\n",priv->initgain_backup.xcagccore1);
- RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc68 is %x\n",priv->initgain_backup.xdagccore1);
- RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xa0a is %x\n",priv->initgain_backup.cca);
+ RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc50 is %x\n", priv->initgain_backup.xaagccore1);
+ RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc58 is %x\n", priv->initgain_backup.xbagccore1);
+ RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc60 is %x\n", priv->initgain_backup.xcagccore1);
+ RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc68 is %x\n", priv->initgain_backup.xdagccore1);
+ RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xa0a is %x\n", priv->initgain_backup.cca);
/* Enable Initial Gain */
/*PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x100);*/
rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); /* Only clear byte 1 and rewrite. */

} /* dm_BBInitialGainRestore */

-
void dm_backup_dynamic_mechanism_state(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
@@ -1700,13 +1597,12 @@ void dm_backup_dynamic_mechanism_state(struct net_device *dev)

} /* DM_BackupDynamicMechanismState */

-
static void dm_bb_initialgain_backup(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
u32 bit_mask = bMaskByte0; /* Bit0~ Bit6 */

- if(dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
+ if (dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
return;

/*PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800);*/
@@ -1718,11 +1614,11 @@ static void dm_bb_initialgain_backup(struct net_device *dev)
bit_mask = bMaskByte2;
priv->initgain_backup.cca = (u8)rtl8192_QueryBBReg(dev, rCCK0_CCA, bit_mask);

- RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc50 is %x\n",priv->initgain_backup.xaagccore1);
- RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc58 is %x\n",priv->initgain_backup.xbagccore1);
- RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc60 is %x\n",priv->initgain_backup.xcagccore1);
- RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc68 is %x\n",priv->initgain_backup.xdagccore1);
- RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xa0a is %x\n",priv->initgain_backup.cca);
+ RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc50 is %x\n", priv->initgain_backup.xaagccore1);
+ RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc58 is %x\n", priv->initgain_backup.xbagccore1);
+ RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc60 is %x\n", priv->initgain_backup.xcagccore1);
+ RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc68 is %x\n", priv->initgain_backup.xdagccore1);
+ RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xa0a is %x\n", priv->initgain_backup.cca);

} /* dm_BBInitialGainBakcup */

@@ -1747,67 +1643,44 @@ static void dm_bb_initialgain_backup(struct net_device *dev)
void dm_change_dynamic_initgain_thresh(struct net_device *dev, u32 dm_type,
u32 dm_value)
{
- if (dm_type == DIG_TYPE_THRESH_HIGH)
- {
+ if (dm_type == DIG_TYPE_THRESH_HIGH) {
dm_digtable.rssi_high_thresh = dm_value;
- }
- else if (dm_type == DIG_TYPE_THRESH_LOW)
- {
+ } else if (dm_type == DIG_TYPE_THRESH_LOW) {
dm_digtable.rssi_low_thresh = dm_value;
- }
- else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH)
- {
+ } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH) {
dm_digtable.rssi_high_power_highthresh = dm_value;
- }
- else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH)
- {
+ } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH) {
dm_digtable.rssi_high_power_highthresh = dm_value;
- }
- else if (dm_type == DIG_TYPE_ENABLE)
- {
+ } else if (dm_type == DIG_TYPE_ENABLE) {
dm_digtable.dig_state = DM_STA_DIG_MAX;
dm_digtable.dig_enable_flag = true;
- }
- else if (dm_type == DIG_TYPE_DISABLE)
- {
+ } else if (dm_type == DIG_TYPE_DISABLE) {
dm_digtable.dig_state = DM_STA_DIG_MAX;
dm_digtable.dig_enable_flag = false;
- }
- else if (dm_type == DIG_TYPE_DBG_MODE)
- {
- if(dm_value >= DM_DBG_MAX)
+ } else if (dm_type == DIG_TYPE_DBG_MODE) {
+ if (dm_value >= DM_DBG_MAX)
dm_value = DM_DBG_OFF;
dm_digtable.dbg_mode = (u8)dm_value;
- }
- else if (dm_type == DIG_TYPE_RSSI)
- {
- if(dm_value > 100)
+ } else if (dm_type == DIG_TYPE_RSSI) {
+ if (dm_value > 100)
dm_value = 30;
dm_digtable.rssi_val = (long)dm_value;
- }
- else if (dm_type == DIG_TYPE_ALGORITHM)
- {
+ } else if (dm_type == DIG_TYPE_ALGORITHM) {
if (dm_value >= DIG_ALGO_MAX)
dm_value = DIG_ALGO_BY_FALSE_ALARM;
- if(dm_digtable.dig_algorithm != (u8)dm_value)
+ if (dm_digtable.dig_algorithm != (u8)dm_value)
dm_digtable.dig_algorithm_switch = 1;
dm_digtable.dig_algorithm = (u8)dm_value;
- }
- else if (dm_type == DIG_TYPE_BACKOFF)
- {
- if(dm_value > 30)
+ } else if (dm_type == DIG_TYPE_BACKOFF) {
+ if (dm_value > 30)
dm_value = 30;
dm_digtable.backoff_val = (u8)dm_value;
- }
- else if(dm_type == DIG_TYPE_RX_GAIN_MIN)
- {
- if(dm_value == 0)
+ } else if (dm_type == DIG_TYPE_RX_GAIN_MIN) {
+ if (dm_value == 0)
dm_value = 0x1;
dm_digtable.rx_gain_range_min = (u8)dm_value;
- }
- else if(dm_type == DIG_TYPE_RX_GAIN_MAX)
- {
- if(dm_value > 0x50)
+ } else if (dm_type == DIG_TYPE_RX_GAIN_MAX) {
+ if (dm_value > 0x50)
dm_value = 0x50;
dm_digtable.rx_gain_range_max = (u8)dm_value;
}
@@ -1852,14 +1725,13 @@ static void dm_dig_init(struct net_device *dev)
dm_digtable.rssi_val = 50; /* for new dig debug rssi value */
dm_digtable.backoff_val = DM_DIG_BACKOFF;
dm_digtable.rx_gain_range_max = DM_DIG_MAX;
- if(priv->CustomerID == RT_CID_819x_Netcore)
+ if (priv->CustomerID == RT_CID_819x_Netcore)
dm_digtable.rx_gain_range_min = DM_DIG_MIN_Netcore;
else
dm_digtable.rx_gain_range_min = DM_DIG_MIN;

} /* dm_dig_init */

-
/*-----------------------------------------------------------------------------
* Function: dm_ctrl_initgain_byrssi()
*
@@ -1879,20 +1751,18 @@ static void dm_dig_init(struct net_device *dev)
*---------------------------------------------------------------------------*/
static void dm_ctrl_initgain_byrssi(struct net_device *dev)
{
-
if (dm_digtable.dig_enable_flag == false)
return;

- if(dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM)
+ if (dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM)
dm_ctrl_initgain_byrssi_by_fwfalse_alarm(dev);
- else if(dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
+ else if (dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
dm_ctrl_initgain_byrssi_by_driverrssi(dev);
/* ; */
else
return;
}

-
static void dm_ctrl_initgain_byrssi_by_driverrssi(
struct net_device *dev)
{
@@ -1903,32 +1773,32 @@ static void dm_ctrl_initgain_byrssi_by_driverrssi(
if (dm_digtable.dig_enable_flag == false)
return;

- /*DbgPrint("Dig by Sw Rssi \n");*/
- if(dm_digtable.dig_algorithm_switch) /* if switched algorithm, we have to disable FW Dig. */
+ /*DbgPrint("Dig by Sw Rssi\n");*/
+ if (dm_digtable.dig_algorithm_switch) /* if switched algorithm, we have to disable FW Dig. */
fw_dig = 0;
- if(fw_dig <= 3) { /* execute several times to make sure the FW Dig is disabled */
+ if (fw_dig <= 3) { /* execute several times to make sure the FW Dig is disabled */
/* FW DIG Off */
- for(i=0; i<3; i++)
+ for (i = 0; i < 3; i++)
rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); /* Only clear byte 1 and rewrite. */
fw_dig++;
dm_digtable.dig_state = DM_STA_DIG_OFF; /* fw dig off. */
}

- if(priv->ieee80211->state == IEEE80211_LINKED)
+ if (priv->ieee80211->state == IEEE80211_LINKED)
dm_digtable.cur_connect_state = DIG_CONNECT;
else
dm_digtable.cur_connect_state = DIG_DISCONNECT;

- /*DbgPrint("DM_DigTable.PreConnectState = %d, DM_DigTable.CurConnectState = %d \n",
+ /*DbgPrint("DM_DigTable.PreConnectState = %d, DM_DigTable.CurConnectState = %d\n",
DM_DigTable.PreConnectState, DM_DigTable.CurConnectState);*/

- if(dm_digtable.dbg_mode == DM_DBG_OFF)
+ if (dm_digtable.dbg_mode == DM_DBG_OFF)
dm_digtable.rssi_val = priv->undecorated_smoothed_pwdb;
- /*DbgPrint("DM_DigTable.Rssi_val = %d \n", DM_DigTable.Rssi_val);*/
+ /*DbgPrint("DM_DigTable.Rssi_val = %d\n", DM_DigTable.Rssi_val);*/
dm_initial_gain(dev);
dm_pd_th(dev);
dm_cs_ratio(dev);
- if(dm_digtable.dig_algorithm_switch)
+ if (dm_digtable.dig_algorithm_switch)
dm_digtable.dig_algorithm_switch = 0;
dm_digtable.pre_connect_state = dm_digtable.cur_connect_state;

@@ -1944,11 +1814,10 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
if (dm_digtable.dig_enable_flag == false)
return;

- if(dm_digtable.dig_algorithm_switch)
- {
+ if (dm_digtable.dig_algorithm_switch) {
dm_digtable.dig_state = DM_STA_DIG_MAX;
/* Fw DIG On. */
- for(i=0; i<3; i++)
+ for (i = 0; i < 3; i++)
rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); /* Only clear byte 1 and rewrite.*/
dm_digtable.dig_algorithm_switch = 0;
}
@@ -1959,9 +1828,8 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
/* For smooth, we can not change DIG state. */
if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_low_thresh) &&
(priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_thresh))
- {
return;
- }
+
/*DbgPrint("Dig by Fw False Alarm\n");*/
/*if (DM_DigTable.Dig_State == DM_STA_DIG_OFF)*/
/*DbgPrint("DIG Check\n\r RSSI=%d LOW=%d HIGH=%d STATE=%d",
@@ -1969,17 +1837,13 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
DM_DigTable.RssiHighThresh, DM_DigTable.Dig_State);*/
/* 1. When RSSI decrease, We have to judge if it is smaller than a threshold
and then execute the step below. */
- if ((priv->undecorated_smoothed_pwdb <= dm_digtable.rssi_low_thresh))
- {
+ if ((priv->undecorated_smoothed_pwdb <= dm_digtable.rssi_low_thresh)) {
/* 2008/02/05 MH When we execute silent reset, the DIG PHY parameters
will be reset to init value. We must prevent the condition. */
if (dm_digtable.dig_state == DM_STA_DIG_OFF &&
- (priv->reset_count == reset_cnt))
- {
+ (priv->reset_count == reset_cnt)) {
return;
- }
- else
- {
+ } else {
reset_cnt = priv->reset_count;
}

@@ -1997,8 +1861,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
write_nic_byte(dev, rOFDM0_XDAGCCore1, 0x17);

/* 1.3 Lower PD_TH for OFDM. */
- if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
- {
+ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) {
/*
* 2008/01/11 MH 40MHZ 90/92 register are not the same.
* 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
@@ -2010,8 +1873,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
else
PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x40);
*/
- }
- else
+ } else
write_nic_byte(dev, rOFDM0_RxDetector1, 0x42);

/* 1.4 Lower CS ratio for CCK. */
@@ -2025,18 +1887,14 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(

/* 2. When RSSI increase, We have to judge if it is larger than a threshold
and then execute the step below. */
- if ((priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh))
- {
+ if ((priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh)) {
u8 reset_flag = 0;

if (dm_digtable.dig_state == DM_STA_DIG_ON &&
- (priv->reset_count == reset_cnt))
- {
+ (priv->reset_count == reset_cnt)) {
dm_ctrl_initgain_byrssi_highpwr(dev);
return;
- }
- else
- {
+ } else {
if (priv->reset_count != reset_cnt)
reset_flag = 1;

@@ -2050,15 +1908,12 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
* 2.1 Set initial gain.
* 2008/02/26 MH SD3-Jerry suggest to prevent dirty environment.
*/
- if (reset_flag == 1)
- {
+ if (reset_flag == 1) {
write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x2c);
write_nic_byte(dev, rOFDM0_XBAGCCore1, 0x2c);
write_nic_byte(dev, rOFDM0_XCAGCCore1, 0x2c);
write_nic_byte(dev, rOFDM0_XDAGCCore1, 0x2c);
- }
- else
- {
+ } else {
write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x20);
write_nic_byte(dev, rOFDM0_XBAGCCore1, 0x20);
write_nic_byte(dev, rOFDM0_XCAGCCore1, 0x20);
@@ -2066,8 +1921,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
}

/* 2.2 Higher PD_TH for OFDM. */
- if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
- {
+ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) {
/*
* 2008/01/11 MH 40MHZ 90/92 register are not the same.
* 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
@@ -2080,8 +1934,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
else
PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x42);
*/
- }
- else
+ } else
write_nic_byte(dev, rOFDM0_RxDetector1, 0x44);

/* 2.3 Higher CS ratio for CCK. */
@@ -2102,7 +1955,6 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(

} /* dm_CtrlInitGainByRssi */

-
/*-----------------------------------------------------------------------------
* Function: dm_ctrl_initgain_byrssi_highpwr()
*
@@ -2128,9 +1980,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(
/* For smooth, we can not change high power DIG state in the range. */
if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_high_power_lowthresh) &&
(priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_highthresh))
- {
return;
- }

/*
* 3. When RSSI >75% or <70%, it is a high power issue. We have to judge if
@@ -2138,8 +1988,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(
*
* 2008/02/05 MH SD3-Jerry Modify PD_TH for high power issue.
*/
- if (priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_power_highthresh)
- {
+ if (priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_power_highthresh) {
if (dm_digtable.dig_highpwr_state == DM_STA_DIG_ON &&
(priv->reset_count == reset_cnt_highpwr))
return;
@@ -2147,39 +1996,32 @@ static void dm_ctrl_initgain_byrssi_highpwr(
dm_digtable.dig_highpwr_state = DM_STA_DIG_ON;

/* 3.1 Higher PD_TH for OFDM for high power state. */
- if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
- {
+ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) {
write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10);

/*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
write_nic_byte(dev, rOFDM0_RxDetector1, 0x41);
*/

- }
- else
+ } else
write_nic_byte(dev, rOFDM0_RxDetector1, 0x43);
- }
- else
- {
- if (dm_digtable.dig_highpwr_state == DM_STA_DIG_OFF&&
+ } else {
+ if (dm_digtable.dig_highpwr_state == DM_STA_DIG_OFF &&
(priv->reset_count == reset_cnt_highpwr))
return;
else
dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF;

if (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_lowthresh &&
- priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh)
- {
+ priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) {
/* 3.2 Recover PD_TH for OFDM for normal power region. */
- if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
- {
+ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) {
write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20);
/*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
write_nic_byte(dev, rOFDM0_RxDetector1, 0x42);
*/

- }
- else
+ } else
write_nic_byte(dev, rOFDM0_RxDetector1, 0x44);
}
}
@@ -2188,51 +2030,42 @@ static void dm_ctrl_initgain_byrssi_highpwr(

} /* dm_CtrlInitGainByRssiHighPwr */

-
static void dm_initial_gain(
struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
- u8 initial_gain=0;
+ u8 initial_gain = 0;
static u8 initialized, force_write;
static u32 reset_cnt;
u8 tmp;

- if(dm_digtable.dig_algorithm_switch)
- {
+ if (dm_digtable.dig_algorithm_switch) {
initialized = 0;
reset_cnt = 0;
}

- if(dm_digtable.pre_connect_state == dm_digtable.cur_connect_state)
- {
- if(dm_digtable.cur_connect_state == DIG_CONNECT)
- {
- if((dm_digtable.rssi_val+10-dm_digtable.backoff_val) > dm_digtable.rx_gain_range_max)
+ if (dm_digtable.pre_connect_state == dm_digtable.cur_connect_state) {
+ if (dm_digtable.cur_connect_state == DIG_CONNECT) {
+ if ((dm_digtable.rssi_val+10-dm_digtable.backoff_val) > dm_digtable.rx_gain_range_max)
dm_digtable.cur_ig_value = dm_digtable.rx_gain_range_max;
- else if((dm_digtable.rssi_val+10-dm_digtable.backoff_val) < dm_digtable.rx_gain_range_min)
+ else if ((dm_digtable.rssi_val+10-dm_digtable.backoff_val) < dm_digtable.rx_gain_range_min)
dm_digtable.cur_ig_value = dm_digtable.rx_gain_range_min;
else
dm_digtable.cur_ig_value = dm_digtable.rssi_val+10-dm_digtable.backoff_val;
- }
- else /* current state is disconnected */
- {
- if(dm_digtable.cur_ig_value == 0)
+ } else { /* current state is disconnected */
+ if (dm_digtable.cur_ig_value == 0)
dm_digtable.cur_ig_value = priv->DefaultInitialGain[0];
else
dm_digtable.cur_ig_value = dm_digtable.pre_ig_value;
}
- }
- else /* disconnected -> connected or connected -> disconnected */
- {
+ } else { /* disconnected -> connected or connected -> disconnected */
dm_digtable.cur_ig_value = priv->DefaultInitialGain[0];
dm_digtable.pre_ig_value = 0;
}
/*DbgPrint("DM_DigTable.CurIGValue = 0x%x, DM_DigTable.PreIGValue = 0x%x\n", DM_DigTable.CurIGValue, DM_DigTable.PreIGValue);*/

/* if silent reset happened, we should rewrite the values back */
- if(priv->reset_count != reset_cnt)
- {
+ if (priv->reset_count != reset_cnt) {
force_write = 1;
reset_cnt = priv->reset_count;
}
@@ -2242,9 +2075,8 @@ static void dm_initial_gain(
force_write = 1;

{
- if((dm_digtable.pre_ig_value != dm_digtable.cur_ig_value)
- || !initialized || force_write)
- {
+ if ((dm_digtable.pre_ig_value != dm_digtable.cur_ig_value)
+ || !initialized || force_write) {
initial_gain = (u8)dm_digtable.cur_ig_value;
/*DbgPrint("Write initial gain = 0x%x\n", initial_gain);*/
/* Set initial gain. */
@@ -2266,16 +2098,13 @@ static void dm_pd_th(
static u8 initialized, force_write;
static u32 reset_cnt;

- if(dm_digtable.dig_algorithm_switch)
- {
+ if (dm_digtable.dig_algorithm_switch) {
initialized = 0;
reset_cnt = 0;
}

- if(dm_digtable.pre_connect_state == dm_digtable.cur_connect_state)
- {
- if(dm_digtable.cur_connect_state == DIG_CONNECT)
- {
+ if (dm_digtable.pre_connect_state == dm_digtable.cur_connect_state) {
+ if (dm_digtable.cur_connect_state == DIG_CONNECT) {
if (dm_digtable.rssi_val >= dm_digtable.rssi_high_power_highthresh)
dm_digtable.curpd_thstate = DIG_PD_AT_HIGH_POWER;
else if ((dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh))
@@ -2285,34 +2114,26 @@ static void dm_pd_th(
dm_digtable.curpd_thstate = DIG_PD_AT_NORMAL_POWER;
else
dm_digtable.curpd_thstate = dm_digtable.prepd_thstate;
- }
- else
- {
+ } else {
dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER;
}
- }
- else /* disconnected -> connected or connected -> disconnected */
- {
+ } else { /* disconnected -> connected or connected -> disconnected */
dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER;
}

/* if silent reset happened, we should rewrite the values back */
- if(priv->reset_count != reset_cnt)
- {
+ if (priv->reset_count != reset_cnt) {
force_write = 1;
reset_cnt = priv->reset_count;
}

{
- if((dm_digtable.prepd_thstate != dm_digtable.curpd_thstate) ||
- (initialized<=3) || force_write)
- {
+ if ((dm_digtable.prepd_thstate != dm_digtable.curpd_thstate) ||
+ (initialized <= 3) || force_write) {
/*DbgPrint("Write PD_TH state = %d\n", DM_DigTable.CurPD_THState);*/
- if(dm_digtable.curpd_thstate == DIG_PD_AT_LOW_POWER)
- {
+ if (dm_digtable.curpd_thstate == DIG_PD_AT_LOW_POWER) {
/* Lower PD_TH for OFDM. */
- if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
- {
+ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) {
/*
* 2008/01/11 MH 40MHZ 90/92 register are not the same.
* 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
@@ -2321,15 +2142,11 @@ static void dm_pd_th(
/*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
write_nic_byte(dev, rOFDM0_RxDetector1, 0x40);
*/
- }
- else
+ } else
write_nic_byte(dev, rOFDM0_RxDetector1, 0x42);
- }
- else if(dm_digtable.curpd_thstate == DIG_PD_AT_NORMAL_POWER)
- {
+ } else if (dm_digtable.curpd_thstate == DIG_PD_AT_NORMAL_POWER) {
/* Higher PD_TH for OFDM. */
- if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
- {
+ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) {
/*
* 2008/01/11 MH 40MHZ 90/92 register are not the same.
* 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
@@ -2338,25 +2155,20 @@ static void dm_pd_th(
/*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
write_nic_byte(dev, rOFDM0_RxDetector1, 0x42);
*/
- }
- else
+ } else
write_nic_byte(dev, rOFDM0_RxDetector1, 0x44);
- }
- else if(dm_digtable.curpd_thstate == DIG_PD_AT_HIGH_POWER)
- {
+ } else if (dm_digtable.curpd_thstate == DIG_PD_AT_HIGH_POWER) {
/* Higher PD_TH for OFDM for high power state. */
- if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
- {
+ if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) {
write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10);
/*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
write_nic_byte(dev, rOFDM0_RxDetector1, 0x41);
*/
- }
- else
+ } else
write_nic_byte(dev, rOFDM0_RxDetector1, 0x43);
}
dm_digtable.prepd_thstate = dm_digtable.curpd_thstate;
- if(initialized <= 3)
+ if (initialized <= 3)
initialized++;
force_write = 0;
}
@@ -2370,53 +2182,39 @@ static void dm_cs_ratio(
static u8 initialized, force_write;
static u32 reset_cnt;

- if(dm_digtable.dig_algorithm_switch)
- {
+ if (dm_digtable.dig_algorithm_switch) {
initialized = 0;
reset_cnt = 0;
}

- if(dm_digtable.pre_connect_state == dm_digtable.cur_connect_state)
- {
- if(dm_digtable.cur_connect_state == DIG_CONNECT)
- {
+ if (dm_digtable.pre_connect_state == dm_digtable.cur_connect_state) {
+ if (dm_digtable.cur_connect_state == DIG_CONNECT) {
if ((dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh))
dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER;
else if ((dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh))
dm_digtable.curcs_ratio_state = DIG_CS_RATIO_HIGHER;
else
dm_digtable.curcs_ratio_state = dm_digtable.precs_ratio_state;
- }
- else
- {
+ } else {
dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER;
}
- }
- else /* disconnected -> connected or connected -> disconnected */
- {
+ } else /* disconnected -> connected or connected -> disconnected */
dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER;
- }

/* if silent reset happened, we should rewrite the values back */
- if(priv->reset_count != reset_cnt)
- {
+ if (priv->reset_count != reset_cnt) {
force_write = 1;
reset_cnt = priv->reset_count;
}

-
{
- if((dm_digtable.precs_ratio_state != dm_digtable.curcs_ratio_state) ||
- !initialized || force_write)
- {
+ if ((dm_digtable.precs_ratio_state != dm_digtable.curcs_ratio_state) ||
+ !initialized || force_write) {
/*DbgPrint("Write CS_ratio state = %d\n", DM_DigTable.CurCS_ratioState);*/
- if(dm_digtable.curcs_ratio_state == DIG_CS_RATIO_LOWER)
- {
+ if (dm_digtable.curcs_ratio_state == DIG_CS_RATIO_LOWER) {
/* Lower CS ratio for CCK. */
write_nic_byte(dev, 0xa0a, 0x08);
- }
- else if(dm_digtable.curcs_ratio_state == DIG_CS_RATIO_HIGHER)
- {
+ } else if (dm_digtable.curcs_ratio_state == DIG_CS_RATIO_HIGHER) {
/* Higher CS ratio for CCK. */
write_nic_byte(dev, 0xa0a, 0xcd);
}
@@ -2453,34 +2251,27 @@ static void dm_check_edca_turbo(
* Do not be Turbo if it's under WiFi config and Qos Enabled, because the EDCA parameters
* should follow the settings from QAP. By Bruce, 2007-12-07.
*/
- if(priv->ieee80211->state != IEEE80211_LINKED)
+ if (priv->ieee80211->state != IEEE80211_LINKED)
goto dm_CheckEdcaTurbo_EXIT;
/* We do not turn on EDCA turbo mode for some AP that has IOT issue */
- if(priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO)
+ if (priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO)
goto dm_CheckEdcaTurbo_EXIT;

- /*printk("========>%s():bis_any_nonbepkts is %d\n",__func__,priv->bis_any_nonbepkts);*/
+ /*printk("========>%s():bis_any_nonbepkts is %d\n", __func__, priv->bis_any_nonbepkts);*/
/* Check the status for current condition. */
- if(!priv->ieee80211->bis_any_nonbepkts)
- {
+ if (!priv->ieee80211->bis_any_nonbepkts) {
curTxOkCnt = priv->stats.txbytesunicast - lastTxOkCnt;
curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt;
/* For RT-AP, we needs to turn it on when Rx>Tx */
- if(curRxOkCnt > 4*curTxOkCnt)
- {
+ if (curRxOkCnt > 4*curTxOkCnt) {
/*printk("%s():curRxOkCnt > 4*curTxOkCnt\n");*/
- if(!priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA)
- {
+ if (!priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) {
write_nic_dword(dev, EDCAPARA_BE, edca_setting_DL[pHTInfo->IOTPeer]);
priv->bis_cur_rdlstate = true;
}
- }
- else
- {
-
+ } else {
/*printk("%s():curRxOkCnt < 4*curTxOkCnt\n");*/
- if(priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA)
- {
+ if (priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) {
write_nic_dword(dev, EDCAPARA_BE, edca_setting_UL[pHTInfo->IOTPeer]);
priv->bis_cur_rdlstate = false;
}
@@ -2488,16 +2279,12 @@ static void dm_check_edca_turbo(
}

priv->bcurrent_turbo_EDCA = true;
- }
- else
- {
+ } else {
/*
* Turn Off EDCA turbo here.
* Restore original EDCA according to the declaration of AP.
*/
- if(priv->bcurrent_turbo_EDCA)
- {
-
+ if (priv->bcurrent_turbo_EDCA) {
{
u8 u1bAIFS;
u32 u4bAcParam;
@@ -2506,10 +2293,10 @@ static void dm_check_edca_turbo(

/* For Each time updating EDCA parameter, reset EDCA turbo mode status. */
dm_init_edca_turbo(dev);
- u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ?9:20) + aSifsTime;
- u4bAcParam = ((((u32)(qos_parameters->tx_op_limit[0]))<< AC_PARAM_TXOP_LIMIT_OFFSET)|
- (((u32)(qos_parameters->cw_max[0]))<< AC_PARAM_ECW_MAX_OFFSET)|
- (((u32)(qos_parameters->cw_min[0]))<< AC_PARAM_ECW_MIN_OFFSET)|
+ u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ? 9 : 20) + aSifsTime;
+ u4bAcParam = ((((u32)(qos_parameters->tx_op_limit[0])) << AC_PARAM_TXOP_LIMIT_OFFSET)|
+ (((u32)(qos_parameters->cw_max[0])) << AC_PARAM_ECW_MAX_OFFSET)|
+ (((u32)(qos_parameters->cw_min[0])) << AC_PARAM_ECW_MIN_OFFSET)|
((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET));
/*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/
write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);
@@ -2523,14 +2310,15 @@ static void dm_check_edca_turbo(

PACI_AIFSN pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]);
u8 AcmCtrl;
+
read_nic_byte(dev, AcmHwCtrl, &AcmCtrl);
- if(pAciAifsn->f.ACM) { /* ACM bit is 1. */
+ if (pAciAifsn->f.ACM) { /* ACM bit is 1. */
AcmCtrl |= AcmHw_BeqEn;
} else { /* ACM bit is 0. */
AcmCtrl &= (~AcmHw_BeqEn);
}

- RT_TRACE(COMP_QOS,"SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl) ;
+ RT_TRACE(COMP_QOS, "SetHwReg8190pci(): [HW_VAR_ACM_CTRL] Write 0x%X\n", AcmCtrl);
write_nic_byte(dev, AcmHwCtrl, AcmCtrl);
}
}
@@ -2538,7 +2326,6 @@ static void dm_check_edca_turbo(
}
}

-
dm_CheckEdcaTurbo_EXIT:
/* Set variables for next time. */
priv->ieee80211->bis_any_nonbepkts = false;
@@ -2563,8 +2350,7 @@ static void dm_ctstoself(struct net_device *dev)
unsigned long curTxOkCnt = 0;
unsigned long curRxOkCnt = 0;

- if(priv->ieee80211->bCTSToSelfEnable != TRUE)
- {
+ if (priv->ieee80211->bCTSToSelfEnable != TRUE) {
pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF;
return;
}
@@ -2574,17 +2360,13 @@ static void dm_ctstoself(struct net_device *dev)
3. <50 disable, >55 enable
*/

- if(pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM)
- {
+ if (pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM) {
curTxOkCnt = priv->stats.txbytesunicast - lastTxOkCnt;
curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt;
- if(curRxOkCnt > 4*curTxOkCnt) /* downlink, disable CTS to self */
- {
+ if (curRxOkCnt > 4*curTxOkCnt) { /* downlink, disable CTS to self */
pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF;
/*DbgPrint("dm_CTSToSelf() ==> CTS to self disabled -- downlink\n");*/
- }
- else /* uplink */
- {
+ } else { /* uplink */
pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF;
}

@@ -2614,13 +2396,11 @@ static void dm_check_pbc_gpio(struct net_device *dev)
struct r8192_priv *priv = ieee80211_priv(dev);
u8 tmp1byte;

-
read_nic_byte(dev, GPI, &tmp1byte);
- if(tmp1byte == 0xff)
+ if (tmp1byte == 0xff)
return;

- if (tmp1byte&BIT6 || tmp1byte&BIT0)
- {
+ if (tmp1byte&BIT6 || tmp1byte&BIT0) {
/*
* Here we only set bPbcPressed to TRUE
* After trigger PBC, the variable will be set to FALSE
@@ -2649,26 +2429,24 @@ static void dm_check_pbc_gpio(struct net_device *dev)
*---------------------------------------------------------------------------*/
void dm_rf_pathcheck_workitemcallback(struct work_struct *work)
{
- struct delayed_work *dwork = container_of(work,struct delayed_work,work);
- struct r8192_priv *priv = container_of(dwork,struct r8192_priv,rfpath_check_wq);
- struct net_device *dev =priv->ieee80211->dev;
- /*bool bactually_set = false;*/
+ struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+ struct r8192_priv *priv = container_of(dwork, struct r8192_priv, rfpath_check_wq);
+ struct net_device *dev = priv->ieee80211->dev;
+ /*bool bactually_set = false;*/
u8 rfpath = 0, i;

-
/* 2008/01/30 MH After discussing with SD3 Jerry, 0xc04/0xd04 register will
always be the same. We only read 0xc04 now. */
read_nic_byte(dev, 0xc04, &rfpath);

/* Check Bit 0-3, it means if RF A-D is enabled. */
- for (i = 0; i < RF90_PATH_MAX; i++)
- {
+ for (i = 0; i < RF90_PATH_MAX; i++) {
if (rfpath & (0x01<<i))
priv->brfpath_rxenable[i] = 1;
else
priv->brfpath_rxenable[i] = 0;
}
- if(!DM_RxPathSelTable.Enable)
+ if (!DM_RxPathSelTable.Enable)
return;

dm_rxpath_sel_byrssi(dev);
@@ -2678,17 +2456,17 @@ static void dm_init_rxpath_selection(struct net_device *dev)
{
u8 i;
struct r8192_priv *priv = ieee80211_priv(dev);
+
DM_RxPathSelTable.Enable = 1; /* default enabled */
DM_RxPathSelTable.SS_TH_low = RxPathSelection_SS_TH_low;
DM_RxPathSelTable.diff_TH = RxPathSelection_diff_TH;
- if(priv->CustomerID == RT_CID_819x_Netcore)
+ if (priv->CustomerID == RT_CID_819x_Netcore)
DM_RxPathSelTable.cck_method = CCK_Rx_Version_2;
else
DM_RxPathSelTable.cck_method = CCK_Rx_Version_1;
DM_RxPathSelTable.DbgMode = DM_DBG_OFF;
DM_RxPathSelTable.disabledRF = 0;
- for(i=0; i<4; i++)
- {
+ for (i = 0; i < 4; i++) {
DM_RxPathSelTable.rf_rssi[i] = 50;
DM_RxPathSelTable.cck_pwdb_sta[i] = -64;
DM_RxPathSelTable.rf_enable_rssi_th[i] = 100;
@@ -2698,22 +2476,21 @@ static void dm_init_rxpath_selection(struct net_device *dev)
static void dm_rxpath_sel_byrssi(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
- u8 i, max_rssi_index=0, min_rssi_index=0, sec_rssi_index=0, rf_num=0;
- u8 tmp_max_rssi=0, tmp_min_rssi=0, tmp_sec_rssi=0;
- u8 cck_default_Rx=0x2; /* RF-C */
- u8 cck_optional_Rx=0x3; /* RF-D */
- long tmp_cck_max_pwdb=0, tmp_cck_min_pwdb=0, tmp_cck_sec_pwdb=0;
- u8 cck_rx_ver2_max_index=0, cck_rx_ver2_min_index=0, cck_rx_ver2_sec_index=0;
+ u8 i, max_rssi_index = 0, min_rssi_index = 0, sec_rssi_index = 0, rf_num = 0;
+ u8 tmp_max_rssi = 0, tmp_min_rssi = 0, tmp_sec_rssi = 0;
+ u8 cck_default_Rx = 0x2; /* RF-C */
+ u8 cck_optional_Rx = 0x3; /* RF-D */
+ long tmp_cck_max_pwdb = 0, tmp_cck_min_pwdb = 0, tmp_cck_sec_pwdb = 0;
+ u8 cck_rx_ver2_max_index = 0, cck_rx_ver2_min_index = 0, cck_rx_ver2_sec_index = 0;
u8 cur_rf_rssi;
long cur_cck_pwdb;
static u8 disabled_rf_cnt, cck_Rx_Path_initialized;
u8 update_cck_rx_path;

- if(priv->rf_type != RF_2T4R)
+ if (priv->rf_type != RF_2T4R)
return;

- if(!cck_Rx_Path_initialized)
- {
+ if (!cck_Rx_Path_initialized) {
read_nic_byte(dev, 0xa07, &DM_RxPathSelTable.cck_Rx_path);
DM_RxPathSelTable.cck_Rx_path &= 0xf;
cck_Rx_Path_initialized = 1;
@@ -2722,90 +2499,63 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
read_nic_byte(dev, 0xc04, &DM_RxPathSelTable.disabledRF);
DM_RxPathSelTable.disabledRF = ~DM_RxPathSelTable.disabledRF & 0xf;

- if(priv->ieee80211->mode == WIRELESS_MODE_B)
- {
+ if (priv->ieee80211->mode == WIRELESS_MODE_B) {
DM_RxPathSelTable.cck_method = CCK_Rx_Version_2; /* pure B mode, fixed cck version2 */
- /*DbgPrint("Pure B mode, use cck rx version2 \n");*/
+ /*DbgPrint("Pure B mode, use cck rx version2\n");*/
}

/* decide max/sec/min rssi index */
- for (i=0; i<RF90_PATH_MAX; i++)
- {
- if(!DM_RxPathSelTable.DbgMode)
+ for (i = 0; i < RF90_PATH_MAX; i++) {
+ if (!DM_RxPathSelTable.DbgMode)
DM_RxPathSelTable.rf_rssi[i] = priv->stats.rx_rssi_percentage[i];

- if(priv->brfpath_rxenable[i])
- {
+ if (priv->brfpath_rxenable[i]) {
rf_num++;
cur_rf_rssi = DM_RxPathSelTable.rf_rssi[i];

- if(rf_num == 1) { /* find first enabled rf path and the rssi values */
+ if (rf_num == 1) { /* find first enabled rf path and the rssi values */
/* initialize, set all rssi index to the same one */
max_rssi_index = min_rssi_index = sec_rssi_index = i;
tmp_max_rssi = tmp_min_rssi = tmp_sec_rssi = cur_rf_rssi;
- }
- else if(rf_num == 2)
- { /* we pick up the max index first, and let sec and min to be the same one */
- if(cur_rf_rssi >= tmp_max_rssi)
- {
+ } else if (rf_num == 2) { /* we pick up the max index first, and let sec and min to be the same one */
+ if (cur_rf_rssi >= tmp_max_rssi) {
tmp_max_rssi = cur_rf_rssi;
max_rssi_index = i;
- }
- else
- {
+ } else {
tmp_sec_rssi = tmp_min_rssi = cur_rf_rssi;
sec_rssi_index = min_rssi_index = i;
}
- }
- else
- {
- if(cur_rf_rssi > tmp_max_rssi)
- {
+ } else {
+ if (cur_rf_rssi > tmp_max_rssi) {
tmp_sec_rssi = tmp_max_rssi;
sec_rssi_index = max_rssi_index;
tmp_max_rssi = cur_rf_rssi;
max_rssi_index = i;
- }
- else if(cur_rf_rssi == tmp_max_rssi)
- { /* let sec and min point to the different index */
+ } else if (cur_rf_rssi == tmp_max_rssi) { /* let sec and min point to the different index */
tmp_sec_rssi = cur_rf_rssi;
sec_rssi_index = i;
- }
- else if((cur_rf_rssi < tmp_max_rssi) &&(cur_rf_rssi > tmp_sec_rssi))
- {
+ } else if ((cur_rf_rssi < tmp_max_rssi) && (cur_rf_rssi > tmp_sec_rssi)) {
tmp_sec_rssi = cur_rf_rssi;
sec_rssi_index = i;
- }
- else if(cur_rf_rssi == tmp_sec_rssi)
- {
- if(tmp_sec_rssi == tmp_min_rssi) {
+ } else if (cur_rf_rssi == tmp_sec_rssi) {
+ if (tmp_sec_rssi == tmp_min_rssi) {
/* let sec and min point to the different index */
tmp_sec_rssi = cur_rf_rssi;
sec_rssi_index = i;
- }
- else
- {
+ } else {
/* This case we don't need to set any index */
}
- }
- else if((cur_rf_rssi < tmp_sec_rssi) && (cur_rf_rssi > tmp_min_rssi))
- {
+ } else if ((cur_rf_rssi < tmp_sec_rssi) && (cur_rf_rssi > tmp_min_rssi)) {
/* This case we don't need to set any index */
- }
- else if(cur_rf_rssi == tmp_min_rssi)
- {
- if(tmp_sec_rssi == tmp_min_rssi) {
+ } else if (cur_rf_rssi == tmp_min_rssi) {
+ if (tmp_sec_rssi == tmp_min_rssi) {
/* let sec and min point to the different index */
tmp_min_rssi = cur_rf_rssi;
min_rssi_index = i;
- }
- else
- {
+ } else {
/* This case we don't need to set any index */
}
- }
- else if(cur_rf_rssi < tmp_min_rssi)
- {
+ } else if (cur_rf_rssi < tmp_min_rssi) {
tmp_min_rssi = cur_rf_rssi;
min_rssi_index = i;
}
@@ -2815,78 +2565,53 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)

rf_num = 0;
/* decide max/sec/min cck pwdb index */
- if(DM_RxPathSelTable.cck_method == CCK_Rx_Version_2)
- {
- for (i=0; i<RF90_PATH_MAX; i++)
- {
- if(priv->brfpath_rxenable[i])
- {
+ if (DM_RxPathSelTable.cck_method == CCK_Rx_Version_2) {
+ for (i = 0; i < RF90_PATH_MAX; i++) {
+ if (priv->brfpath_rxenable[i]) {
rf_num++;
cur_cck_pwdb = DM_RxPathSelTable.cck_pwdb_sta[i];

- if(rf_num == 1) /* find first enabled rf path and the rssi values */
- { /* initialize, set all rssi index to the same one */
+ if (rf_num == 1) { /* find first enabled rf path and the rssi values */
+ /* initialize, set all rssi index to the same one */
cck_rx_ver2_max_index = cck_rx_ver2_min_index = cck_rx_ver2_sec_index = i;
tmp_cck_max_pwdb = tmp_cck_min_pwdb = tmp_cck_sec_pwdb = cur_cck_pwdb;
- }
- else if(rf_num == 2) { /* we pick up the max index first, and let sec and min to be the same one */
- if(cur_cck_pwdb >= tmp_cck_max_pwdb)
- {
+ } else if (rf_num == 2) { /* we pick up the max index first, and let sec and min to be the same one */
+ if (cur_cck_pwdb >= tmp_cck_max_pwdb) {
tmp_cck_max_pwdb = cur_cck_pwdb;
cck_rx_ver2_max_index = i;
- }
- else
- {
+ } else {
tmp_cck_sec_pwdb = tmp_cck_min_pwdb = cur_cck_pwdb;
cck_rx_ver2_sec_index = cck_rx_ver2_min_index = i;
}
- }
- else
- {
- if(cur_cck_pwdb > tmp_cck_max_pwdb)
- {
+ } else {
+ if (cur_cck_pwdb > tmp_cck_max_pwdb) {
tmp_cck_sec_pwdb = tmp_cck_max_pwdb;
cck_rx_ver2_sec_index = cck_rx_ver2_max_index;
tmp_cck_max_pwdb = cur_cck_pwdb;
cck_rx_ver2_max_index = i;
- }
- else if(cur_cck_pwdb == tmp_cck_max_pwdb) { /* let sec and min point to the different index */
+ } else if (cur_cck_pwdb == tmp_cck_max_pwdb) { /* let sec and min point to the different index */
tmp_cck_sec_pwdb = cur_cck_pwdb;
cck_rx_ver2_sec_index = i;
- }
- else if((cur_cck_pwdb < tmp_cck_max_pwdb) &&(cur_cck_pwdb > tmp_cck_sec_pwdb))
- {
+ } else if ((cur_cck_pwdb < tmp_cck_max_pwdb) && (cur_cck_pwdb > tmp_cck_sec_pwdb)) {
tmp_cck_sec_pwdb = cur_cck_pwdb;
cck_rx_ver2_sec_index = i;
- }
- else if(cur_cck_pwdb == tmp_cck_sec_pwdb)
- {
- if(tmp_cck_sec_pwdb == tmp_cck_min_pwdb) { /* let sec and min point to the different index */
+ } else if (cur_cck_pwdb == tmp_cck_sec_pwdb) {
+ if (tmp_cck_sec_pwdb == tmp_cck_min_pwdb) { /* let sec and min point to the different index */
tmp_cck_sec_pwdb = cur_cck_pwdb;
cck_rx_ver2_sec_index = i;
- }
- else
- {
+ } else {
/* This case we don't need to set any index */
}
- }
- else if((cur_cck_pwdb < tmp_cck_sec_pwdb) && (cur_cck_pwdb > tmp_cck_min_pwdb))
- {
+ } else if ((cur_cck_pwdb < tmp_cck_sec_pwdb) && (cur_cck_pwdb > tmp_cck_min_pwdb)) {
/* This case we don't need to set any index */
- }
- else if(cur_cck_pwdb == tmp_cck_min_pwdb)
- {
- if(tmp_cck_sec_pwdb == tmp_cck_min_pwdb) { /* let sec and min point to the different index */
+ } else if (cur_cck_pwdb == tmp_cck_min_pwdb) {
+ if (tmp_cck_sec_pwdb == tmp_cck_min_pwdb) { /* let sec and min point to the different index */
tmp_cck_min_pwdb = cur_cck_pwdb;
cck_rx_ver2_min_index = i;
- }
- else
- {
+ } else {
/* This case we don't need to set any index */
}
- }
- else if(cur_cck_pwdb < tmp_cck_min_pwdb)
- {
+ } else if (cur_cck_pwdb < tmp_cck_min_pwdb) {
tmp_cck_min_pwdb = cur_cck_pwdb;
cck_rx_ver2_min_index = i;
}
@@ -2896,24 +2621,20 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
}
}

-
/*
* Set CCK Rx path
* reg0xA07[3:2]=cck default rx path, reg0xa07[1:0]=cck optional rx path.
*/
update_cck_rx_path = 0;
- if(DM_RxPathSelTable.cck_method == CCK_Rx_Version_2)
- {
+ if (DM_RxPathSelTable.cck_method == CCK_Rx_Version_2) {
cck_default_Rx = cck_rx_ver2_max_index;
cck_optional_Rx = cck_rx_ver2_sec_index;
- if(tmp_cck_max_pwdb != -64)
+ if (tmp_cck_max_pwdb != -64)
update_cck_rx_path = 1;
}

- if(tmp_min_rssi < DM_RxPathSelTable.SS_TH_low && disabled_rf_cnt < 2)
- {
- if((tmp_max_rssi - tmp_min_rssi) >= DM_RxPathSelTable.diff_TH)
- {
+ if (tmp_min_rssi < DM_RxPathSelTable.SS_TH_low && disabled_rf_cnt < 2) {
+ if ((tmp_max_rssi - tmp_min_rssi) >= DM_RxPathSelTable.diff_TH) {
/* record the enabled rssi threshold */
DM_RxPathSelTable.rf_enable_rssi_th[min_rssi_index] = tmp_max_rssi+5;
/* disable the BB Rx path, OFDM */
@@ -2921,31 +2642,25 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x1<<min_rssi_index, 0x0); /* 0xd04[3:0] */
disabled_rf_cnt++;
}
- if(DM_RxPathSelTable.cck_method == CCK_Rx_Version_1)
- {
+ if (DM_RxPathSelTable.cck_method == CCK_Rx_Version_1) {
cck_default_Rx = max_rssi_index;
cck_optional_Rx = sec_rssi_index;
- if(tmp_max_rssi)
+ if (tmp_max_rssi)
update_cck_rx_path = 1;
}
}

- if(update_cck_rx_path)
- {
+ if (update_cck_rx_path) {
DM_RxPathSelTable.cck_Rx_path = (cck_default_Rx<<2)|(cck_optional_Rx);
rtl8192_setBBreg(dev, rCCK0_AFESetting, 0x0f000000, DM_RxPathSelTable.cck_Rx_path);
}

- if(DM_RxPathSelTable.disabledRF)
- {
- for(i=0; i<4; i++)
- {
- if((DM_RxPathSelTable.disabledRF>>i) & 0x1) /* disabled rf */
- {
- if(tmp_max_rssi >= DM_RxPathSelTable.rf_enable_rssi_th[i])
- {
+ if (DM_RxPathSelTable.disabledRF) {
+ for (i = 0; i < 4; i++) {
+ if ((DM_RxPathSelTable.disabledRF>>i) & 0x1) { /* disabled rf */
+ if (tmp_max_rssi >= DM_RxPathSelTable.rf_enable_rssi_th[i]) {
/* enable the BB Rx path */
- /*DbgPrint("RF-%d is enabled. \n", 0x1<<i);*/
+ /*DbgPrint("RF-%d is enabled.\n", 0x1<<i);*/
rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x1<<i, 0x1); /* 0xc04[3:0] */
rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x1<<i, 0x1); /* 0xd04[3:0] */
DM_RxPathSelTable.rf_enable_rssi_th[i] = 100;
@@ -2972,14 +2687,14 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
* 05/28/2008 amy Create Version 0 porting from windows code.
*
*---------------------------------------------------------------------------*/
-static void dm_check_rx_path_selection(struct net_device *dev)
+static void dm_check_rx_path_selection(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
- queue_delayed_work(priv->priv_wq,&priv->rfpath_check_wq,0);
-} /* dm_CheckRxRFPath */

+ queue_delayed_work(priv->priv_wq, &priv->rfpath_check_wq, 0);
+} /* dm_CheckRxRFPath */

-static void dm_init_fsync (struct net_device *dev)
+static void dm_init_fsync(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);

@@ -2988,8 +2703,8 @@ static void dm_init_fsync (struct net_device *dev)
priv->ieee80211->fsync_rssi_threshold = 30;
priv->ieee80211->bfsync_enable = false;
priv->ieee80211->fsync_multiple_timeinterval = 3;
- priv->ieee80211->fsync_firstdiff_ratethreshold= 100;
- priv->ieee80211->fsync_seconddiff_ratethreshold= 200;
+ priv->ieee80211->fsync_firstdiff_ratethreshold = 100;
+ priv->ieee80211->fsync_seconddiff_ratethreshold = 200;
priv->ieee80211->fsync_state = Default_Fsync;
priv->framesyncMonitor = 1; /* current default 0xc38 monitor on */

@@ -2998,10 +2713,10 @@ static void dm_init_fsync (struct net_device *dev)
priv->fsync_timer.function = dm_fsync_timer_callback;
}

-
static void dm_deInit_fsync(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
+
del_timer_sync(&priv->fsync_timer);
}

@@ -3009,102 +2724,84 @@ void dm_fsync_timer_callback(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct r8192_priv *priv = ieee80211_priv((struct net_device *)data);
- u32 rate_index, rate_count = 0, rate_count_diff=0;
+ u32 rate_index, rate_count = 0, rate_count_diff = 0;
bool bSwitchFromCountDiff = false;
bool bDoubleTimeInterval = false;

- if(priv->ieee80211->state == IEEE80211_LINKED &&
+ if (priv->ieee80211->state == IEEE80211_LINKED &&
priv->ieee80211->bfsync_enable &&
- (priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_CDD_FSYNC))
- {
+ (priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_CDD_FSYNC)) {
/* Count rate 54, MCS [7], [12, 13, 14, 15] */
u32 rate_bitmap;
- for(rate_index = 0; rate_index <= 27; rate_index++)
- {
+
+ for (rate_index = 0; rate_index <= 27; rate_index++) {
rate_bitmap = 1 << rate_index;
- if(priv->ieee80211->fsync_rate_bitmap & rate_bitmap)
- rate_count+= priv->stats.received_rate_histogram[1][rate_index];
+ if (priv->ieee80211->fsync_rate_bitmap & rate_bitmap)
+ rate_count += priv->stats.received_rate_histogram[1][rate_index];
}

- if(rate_count < priv->rate_record)
+ if (rate_count < priv->rate_record)
rate_count_diff = 0xffffffff - rate_count + priv->rate_record;
else
rate_count_diff = rate_count - priv->rate_record;
- if(rate_count_diff < priv->rateCountDiffRecord)
- {
-
+ if (rate_count_diff < priv->rateCountDiffRecord) {
u32 DiffNum = priv->rateCountDiffRecord - rate_count_diff;
/* Continue count */
- if(DiffNum >= priv->ieee80211->fsync_seconddiff_ratethreshold)
+ if (DiffNum >= priv->ieee80211->fsync_seconddiff_ratethreshold)
priv->ContinueDiffCount++;
else
priv->ContinueDiffCount = 0;

/* Continue count over */
- if(priv->ContinueDiffCount >=2)
- {
+ if (priv->ContinueDiffCount >= 2) {
bSwitchFromCountDiff = true;
priv->ContinueDiffCount = 0;
}
- }
- else
- {
+ } else {
/* Stop the continued count */
priv->ContinueDiffCount = 0;
}

/* If Count diff <= FsyncRateCountThreshold */
- if(rate_count_diff <= priv->ieee80211->fsync_firstdiff_ratethreshold)
- {
+ if (rate_count_diff <= priv->ieee80211->fsync_firstdiff_ratethreshold) {
bSwitchFromCountDiff = true;
priv->ContinueDiffCount = 0;
}
priv->rate_record = rate_count;
priv->rateCountDiffRecord = rate_count_diff;
- RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", priv->rate_record, rate_count, rate_count_diff , priv->bswitch_fsync);
+ RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", priv->rate_record, rate_count, rate_count_diff, priv->bswitch_fsync);
/* if we never receive those mcs rate and rssi > 30 % then switch fsyn */
- if(priv->undecorated_smoothed_pwdb > priv->ieee80211->fsync_rssi_threshold && bSwitchFromCountDiff)
- {
+ if (priv->undecorated_smoothed_pwdb > priv->ieee80211->fsync_rssi_threshold && bSwitchFromCountDiff) {
bDoubleTimeInterval = true;
priv->bswitch_fsync = !priv->bswitch_fsync;
- if(priv->bswitch_fsync)
- {
+ if (priv->bswitch_fsync) {
write_nic_byte(dev, 0xC36, 0x1c);
write_nic_byte(dev, 0xC3e, 0x90);
- }
- else
- {
+ } else {
write_nic_byte(dev, 0xC36, 0x5c);
write_nic_byte(dev, 0xC3e, 0x96);
}
- }
- else if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->fsync_rssi_threshold)
- {
- if(priv->bswitch_fsync)
- {
+ } else if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->fsync_rssi_threshold) {
+ if (priv->bswitch_fsync) {
priv->bswitch_fsync = false;
write_nic_byte(dev, 0xC36, 0x5c);
write_nic_byte(dev, 0xC3e, 0x96);
}
}
- if(bDoubleTimeInterval){
- if(timer_pending(&priv->fsync_timer))
+ if (bDoubleTimeInterval) {
+ if (timer_pending(&priv->fsync_timer))
del_timer_sync(&priv->fsync_timer);
priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval*priv->ieee80211->fsync_multiple_timeinterval);
add_timer(&priv->fsync_timer);
- }
- else{
- if(timer_pending(&priv->fsync_timer))
+ } else {
+ if (timer_pending(&priv->fsync_timer))
del_timer_sync(&priv->fsync_timer);
priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval);
add_timer(&priv->fsync_timer);
}
- }
- else
- {
+ } else {
/* Let Register return to default value; */
- if(priv->bswitch_fsync)
- {
+ if (priv->bswitch_fsync) {
priv->bswitch_fsync = false;
write_nic_byte(dev, 0xC36, 0x5c);
write_nic_byte(dev, 0xC3e, 0x96);
@@ -3113,7 +2810,7 @@ void dm_fsync_timer_callback(unsigned long data)
write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd);
}
RT_TRACE(COMP_HALDM, "ContinueDiffCount %d\n", priv->ContinueDiffCount);
- RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", priv->rate_record, rate_count, rate_count_diff , priv->bswitch_fsync);
+ RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", priv->rate_record, rate_count, rate_count_diff, priv->bswitch_fsync);
}

static void dm_StartHWFsync(struct net_device *dev)
@@ -3131,8 +2828,7 @@ static void dm_EndSWFsync(struct net_device *dev)
del_timer_sync(&(priv->fsync_timer));

/* Let Register return to default value; */
- if(priv->bswitch_fsync)
- {
+ if (priv->bswitch_fsync) {
priv->bswitch_fsync = false;

write_nic_byte(dev, 0xC36, 0x5c);
@@ -3159,23 +2855,19 @@ static void dm_StartSWFsync(struct net_device *dev)
priv->rateCountDiffRecord = 0;
priv->bswitch_fsync = false;

- if(priv->ieee80211->mode == WIRELESS_MODE_N_24G)
- {
- priv->ieee80211->fsync_firstdiff_ratethreshold= 600;
+ if (priv->ieee80211->mode == WIRELESS_MODE_N_24G) {
+ priv->ieee80211->fsync_firstdiff_ratethreshold = 600;
priv->ieee80211->fsync_seconddiff_ratethreshold = 0xffff;
- }
- else
- {
- priv->ieee80211->fsync_firstdiff_ratethreshold= 200;
+ } else {
+ priv->ieee80211->fsync_firstdiff_ratethreshold = 200;
priv->ieee80211->fsync_seconddiff_ratethreshold = 200;
}
- for(rateIndex = 0; rateIndex <= 27; rateIndex++)
- {
- rateBitmap = 1 << rateIndex;
- if(priv->ieee80211->fsync_rate_bitmap & rateBitmap)
+ for (rateIndex = 0; rateIndex <= 27; rateIndex++) {
+ rateBitmap = 1 << rateIndex;
+ if (priv->ieee80211->fsync_rate_bitmap & rateBitmap)
priv->rate_record += priv->stats.received_rate_histogram[1][rateIndex];
}
- if(timer_pending(&priv->fsync_timer))
+ if (timer_pending(&priv->fsync_timer))
del_timer_sync(&priv->fsync_timer);
priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval);
add_timer(&priv->fsync_timer);
@@ -3195,138 +2887,111 @@ static void dm_EndHWFsync(struct net_device *dev)
void dm_check_fsync(struct net_device *dev)
{
#define RegC38_Default 0
-#define RegC38_NonFsync_Other_AP 1
-#define RegC38_Fsync_AP_BCM 2
+#define RegC38_NonFsync_Other_AP 1
+#define RegC38_Fsync_AP_BCM 2
struct r8192_priv *priv = ieee80211_priv(dev);
/*u32 framesyncC34;*/
- static u8 reg_c38_State=RegC38_Default;
+ static u8 reg_c38_State = RegC38_Default;
static u32 reset_cnt;

RT_TRACE(COMP_HALDM, "RSSI %d TimeInterval %d MultipleTimeInterval %d\n", priv->ieee80211->fsync_rssi_threshold, priv->ieee80211->fsync_time_interval, priv->ieee80211->fsync_multiple_timeinterval);
RT_TRACE(COMP_HALDM, "RateBitmap 0x%x FirstDiffRateThreshold %d SecondDiffRateThreshold %d\n", priv->ieee80211->fsync_rate_bitmap, priv->ieee80211->fsync_firstdiff_ratethreshold, priv->ieee80211->fsync_seconddiff_ratethreshold);

- if(priv->ieee80211->state == IEEE80211_LINKED &&
- (priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_CDD_FSYNC))
- {
- if(priv->ieee80211->bfsync_enable == 0)
- {
- switch (priv->ieee80211->fsync_state)
- {
- case Default_Fsync:
- dm_StartHWFsync(dev);
- priv->ieee80211->fsync_state = HW_Fsync;
- break;
- case SW_Fsync:
- dm_EndSWFsync(dev);
- dm_StartHWFsync(dev);
- priv->ieee80211->fsync_state = HW_Fsync;
- break;
- case HW_Fsync:
- default:
- break;
+ if (priv->ieee80211->state == IEEE80211_LINKED &&
+ (priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_CDD_FSYNC)) {
+ if (priv->ieee80211->bfsync_enable == 0) {
+ switch (priv->ieee80211->fsync_state) {
+ case Default_Fsync:
+ dm_StartHWFsync(dev);
+ priv->ieee80211->fsync_state = HW_Fsync;
+ break;
+ case SW_Fsync:
+ dm_EndSWFsync(dev);
+ dm_StartHWFsync(dev);
+ priv->ieee80211->fsync_state = HW_Fsync;
+ break;
+ case HW_Fsync:
+ default:
+ break;
}
- }
- else
- {
- switch (priv->ieee80211->fsync_state)
- {
- case Default_Fsync:
- dm_StartSWFsync(dev);
- priv->ieee80211->fsync_state = SW_Fsync;
- break;
- case HW_Fsync:
- dm_EndHWFsync(dev);
- dm_StartSWFsync(dev);
- priv->ieee80211->fsync_state = SW_Fsync;
- break;
- case SW_Fsync:
- default:
- break;
-
+ } else {
+ switch (priv->ieee80211->fsync_state) {
+ case Default_Fsync:
+ dm_StartSWFsync(dev);
+ priv->ieee80211->fsync_state = SW_Fsync;
+ break;
+ case HW_Fsync:
+ dm_EndHWFsync(dev);
+ dm_StartSWFsync(dev);
+ priv->ieee80211->fsync_state = SW_Fsync;
+ break;
+ case SW_Fsync:
+ default:
+ break;
}
}
- if(priv->framesyncMonitor)
- {
- if(reg_c38_State != RegC38_Fsync_AP_BCM)
- { /* For broadcom AP we write different default value */
+ if (priv->framesyncMonitor) {
+ if (reg_c38_State != RegC38_Fsync_AP_BCM) { /* For broadcom AP we write different default value */
write_nic_byte(dev, rOFDM0_RxDetector3, 0x95);

reg_c38_State = RegC38_Fsync_AP_BCM;
}
}
- }
- else
- {
- switch (priv->ieee80211->fsync_state)
- {
- case HW_Fsync:
- dm_EndHWFsync(dev);
- priv->ieee80211->fsync_state = Default_Fsync;
- break;
- case SW_Fsync:
- dm_EndSWFsync(dev);
- priv->ieee80211->fsync_state = Default_Fsync;
- break;
- case Default_Fsync:
- default:
- break;
+ } else {
+ switch (priv->ieee80211->fsync_state) {
+ case HW_Fsync:
+ dm_EndHWFsync(dev);
+ priv->ieee80211->fsync_state = Default_Fsync;
+ break;
+ case SW_Fsync:
+ dm_EndSWFsync(dev);
+ priv->ieee80211->fsync_state = Default_Fsync;
+ break;
+ case Default_Fsync:
+ default:
+ break;
}

- if(priv->framesyncMonitor)
- {
- if(priv->ieee80211->state == IEEE80211_LINKED)
- {
- if(priv->undecorated_smoothed_pwdb <= RegC38_TH)
- {
- if(reg_c38_State != RegC38_NonFsync_Other_AP)
- {
+ if (priv->framesyncMonitor) {
+ if (priv->ieee80211->state == IEEE80211_LINKED) {
+ if (priv->undecorated_smoothed_pwdb <= RegC38_TH) {
+ if (reg_c38_State != RegC38_NonFsync_Other_AP) {
write_nic_byte(dev, rOFDM0_RxDetector3, 0x90);

reg_c38_State = RegC38_NonFsync_Other_AP;
}
- }
- else if(priv->undecorated_smoothed_pwdb >= (RegC38_TH+5))
- {
- if(reg_c38_State)
- {
+ } else if (priv->undecorated_smoothed_pwdb >= (RegC38_TH+5)) {
+ if (reg_c38_State) {
write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync);
reg_c38_State = RegC38_Default;
- /*DbgPrint("Fsync is idle, rssi>=40, write 0xc38 = 0x%x \n", pHalData->framesync);*/
+ /*DbgPrint("Fsync is idle, rssi>=40, write 0xc38 = 0x%x\n", pHalData->framesync);*/
}
}
- }
- else
- {
- if(reg_c38_State)
- {
+ } else {
+ if (reg_c38_State) {
write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync);
reg_c38_State = RegC38_Default;
- /*DbgPrint("Fsync is idle, not connected, write 0xc38 = 0x%x \n", pHalData->framesync);*/
+ /*DbgPrint("Fsync is idle, not connected, write 0xc38 = 0x%x\n", pHalData->framesync);*/
}
}
}
}
- if(priv->framesyncMonitor)
- {
- if(priv->reset_count != reset_cnt) { /* After silent reset, the reg_c38_State will be returned to default value */
+ if (priv->framesyncMonitor) {
+ if (priv->reset_count != reset_cnt) { /* After silent reset, the reg_c38_State will be returned to default value */
write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync);
reg_c38_State = RegC38_Default;
reset_cnt = priv->reset_count;
- /*DbgPrint("reg_c38_State = 0 for silent reset. \n");*/
+ /*DbgPrint("reg_c38_State = 0 for silent reset.\n");*/
}
- }
- else
- {
- if(reg_c38_State)
- {
+ } else {
+ if (reg_c38_State) {
write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync);
reg_c38_State = RegC38_Default;
- /*DbgPrint("framesync no monitor, write 0xc38 = 0x%x \n", pHalData->framesync);*/
+ /*DbgPrint("framesync no monitor, write 0xc38 = 0x%x\n", pHalData->framesync);*/
}
}
}

-
/*-----------------------------------------------------------------------------
* Function: dm_shadow_init()
*
@@ -3349,8 +3014,7 @@ void dm_shadow_init(struct net_device *dev)
u16 offset;

for (page = 0; page < 5; page++)
- for (offset = 0; offset < 256; offset++)
- {
+ for (offset = 0; offset < 256; offset++) {
read_nic_byte(dev, offset+page*256, &dm_shadow[page][offset]);
/*DbgPrint("P-%d/O-%02x=%02x\r\n", page, offset, DM_Shadow[page][offset]);*/
}
@@ -3398,70 +3062,57 @@ static void dm_init_dynamic_txpower(struct net_device *dev)
static void dm_dynamic_txpower(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);
- unsigned int txhipower_threshhold=0;
- unsigned int txlowpower_threshold=0;
- if(priv->ieee80211->bdynamic_txpower_enable != true)
- {
+ unsigned int txhipower_threshhold = 0;
+ unsigned int txlowpower_threshold = 0;
+
+ if (priv->ieee80211->bdynamic_txpower_enable != true) {
priv->bDynamicTxHighPower = false;
priv->bDynamicTxLowPower = false;
return;
}
- /*printk("priv->ieee80211->current_network.unknown_cap_exist is %d ,priv->ieee80211->current_network.broadcom_cap_exist is %d\n",priv->ieee80211->current_network.unknown_cap_exist,priv->ieee80211->current_network.broadcom_cap_exist);*/
- if((priv->ieee80211->current_network.atheros_cap_exist) && (priv->ieee80211->mode == IEEE_G)){
+ /*printk("priv->ieee80211->current_network.unknown_cap_exist is %d , priv->ieee80211->current_network.broadcom_cap_exist is %d\n", priv->ieee80211->current_network.unknown_cap_exist, priv->ieee80211->current_network.broadcom_cap_exist);*/
+ if ((priv->ieee80211->current_network.atheros_cap_exist) && (priv->ieee80211->mode == IEEE_G)) {
txhipower_threshhold = TX_POWER_ATHEROAP_THRESH_HIGH;
txlowpower_threshold = TX_POWER_ATHEROAP_THRESH_LOW;
- }
- else
- {
+ } else {
txhipower_threshhold = TX_POWER_NEAR_FIELD_THRESH_HIGH;
txlowpower_threshold = TX_POWER_NEAR_FIELD_THRESH_LOW;
}

- /*printk("=======>%s(): txhipower_threshhold is %d,txlowpower_threshold is %d\n",__func__,txhipower_threshhold,txlowpower_threshold);*/
- RT_TRACE(COMP_TXAGC,"priv->undecorated_smoothed_pwdb = %ld \n" , priv->undecorated_smoothed_pwdb);
+ /*printk("=======>%s(): txhipower_threshhold is %d, txlowpower_threshold is %d\n", __func__, txhipower_threshhold, txlowpower_threshold);*/
+ RT_TRACE(COMP_TXAGC, "priv->undecorated_smoothed_pwdb = %ld\n", priv->undecorated_smoothed_pwdb);

- if(priv->ieee80211->state == IEEE80211_LINKED)
- {
- if(priv->undecorated_smoothed_pwdb >= txhipower_threshhold)
- {
+ if (priv->ieee80211->state == IEEE80211_LINKED) {
+ if (priv->undecorated_smoothed_pwdb >= txhipower_threshhold) {
priv->bDynamicTxHighPower = true;
priv->bDynamicTxLowPower = false;
- }
- else
- {
+ } else {
/* high power state check */
- if(priv->undecorated_smoothed_pwdb < txlowpower_threshold && priv->bDynamicTxHighPower == true)
- {
+ if (priv->undecorated_smoothed_pwdb < txlowpower_threshold && priv->bDynamicTxHighPower == true)
priv->bDynamicTxHighPower = false;
- }
+
/* low power state check */
- if(priv->undecorated_smoothed_pwdb < 35)
- {
+ if (priv->undecorated_smoothed_pwdb < 35) {
priv->bDynamicTxLowPower = true;
- }
- else if(priv->undecorated_smoothed_pwdb >= 40)
- {
+ } else if (priv->undecorated_smoothed_pwdb >= 40) {
priv->bDynamicTxLowPower = false;
}
}
- }
- else
- {
+ } else {
/*pHalData->bTXPowerCtrlforNearFarRange = !pHalData->bTXPowerCtrlforNearFarRange;*/
priv->bDynamicTxHighPower = false;
priv->bDynamicTxLowPower = false;
}

- if((priv->bDynamicTxHighPower != priv->bLastDTPFlag_High) ||
- (priv->bDynamicTxLowPower != priv->bLastDTPFlag_Low))
- {
- RT_TRACE(COMP_TXAGC,"SetTxPowerLevel8190() channel = %d \n" , priv->ieee80211->current_network.channel);
+ if ((priv->bDynamicTxHighPower != priv->bLastDTPFlag_High) ||
+ (priv->bDynamicTxLowPower != priv->bLastDTPFlag_Low)) {
+ RT_TRACE(COMP_TXAGC, "SetTxPowerLevel8190() channel = %d\n", priv->ieee80211->current_network.channel);

#if defined(RTL8190P) || defined(RTL8192E)
- SetTxPowerLevel8190(Adapter,pHalData->CurrentChannel);
+ SetTxPowerLevel8190(Adapter, pHalData->CurrentChannel);
#endif

- rtl8192_phy_setTxPower(dev,priv->ieee80211->current_network.channel);
+ rtl8192_phy_setTxPower(dev, priv->ieee80211->current_network.channel);
/*pHalData->bStartTxCtrlByTPCNFR = FALSE; Clear th flag of Set TX Power from Sitesurvey*/
}
priv->bLastDTPFlag_High = priv->bDynamicTxHighPower;
--
2.2.1

2014-12-31 18:50:52

by Lorenzo Stoakes

[permalink] [raw]
Subject: [PATCH 3/4] staging: rtl8192u: remove redundant code

This patch fixes warnings/errors raised by checkpatch.pl relating to redundant
code in r8192U_dm.c.

Signed-off-by: Lorenzo Stoakes <[email protected]>
---
drivers/staging/rtl8192u/r8192U_dm.c | 160 +++++++++++++++++------------------
1 file changed, 77 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index bf141c6..0839ea7 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -412,9 +412,9 @@ static void dm_check_rate_adaptive(struct net_device *dev)

ratr_value = targetRATR;
RT_TRACE(COMP_RATE, "currentRATR = %x, targetRATR = %x\n", currentRATR, targetRATR);
- if (priv->rf_type == RF_1T2R) {
+ if (priv->rf_type == RF_1T2R)
ratr_value &= ~(RATE_ALL_OFDM_2SS);
- }
+
write_nic_dword(dev, RATR0, ratr_value);
write_nic_byte(dev, UFWP, 1);

@@ -442,18 +442,17 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)
{
struct r8192_priv *priv = ieee80211_priv(dev);

- if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 || !priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable) {
+ if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 || !priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable)
return;
- } else {
- if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false) { /* If send packets in 40 Mhz in 20/40 */
- if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
- priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
- } else { /* in force send packets in 20 Mhz in 20/40 */
- if (priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
- priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;

- }
+ if (priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false) { /* If send packets in 40 Mhz in 20/40 */
+ if (priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
+ priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
+ } else { /* in force send packets in 20 Mhz in 20/40 */
+ if (priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
+ priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;
}
+
} /* dm_BandwidthAutoSwitch */

/* OFDM default at 0db, index=6. */
@@ -540,9 +539,9 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
tx_cmd.Length = 4;
tx_cmd.Value = Value;
rtStatus = SendTxCommandPacket(dev, &tx_cmd, 12);
- if (rtStatus == RT_STATUS_FAILURE) {
+ if (rtStatus == RT_STATUS_FAILURE)
RT_TRACE(COMP_POWER_TRACKING, "Set configuration with tx cmd queue fail!\n");
- }
+
mdelay(1);
/*DbgPrint("hi, vivi, strange\n");*/
for (i = 0; i <= 30; i++) {
@@ -582,9 +581,8 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
break;
}

- for (k = 0; k < 5; k++) {
+ for (k = 0; k < 5; k++)
Avg_TSSI_Meas_from_driver += tmp_report[k];
- }

Avg_TSSI_Meas_from_driver = Avg_TSSI_Meas_from_driver*100/5;
RT_TRACE(COMP_POWER_TRACKING, "Avg_TSSI_Meas_from_driver = %d\n", Avg_TSSI_Meas_from_driver);
@@ -607,43 +605,44 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation_difference = %d\n", priv->cck_present_attentuation_difference);
RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation = %d\n", priv->cck_present_attentuation);
return;
- } else {
- if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) {
- if (priv->rfa_txpowertrackingindex > 0) {
- priv->rfa_txpowertrackingindex--;
- if (priv->rfa_txpowertrackingindex_real > 4) {
- priv->rfa_txpowertrackingindex_real--;
- rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value);
- }
- }
- } else {
- if (priv->rfa_txpowertrackingindex < 36) {
- priv->rfa_txpowertrackingindex++;
- priv->rfa_txpowertrackingindex_real++;
- rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value);
+ }

+ if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) {
+ if (priv->rfa_txpowertrackingindex > 0) {
+ priv->rfa_txpowertrackingindex--;
+ if (priv->rfa_txpowertrackingindex_real > 4) {
+ priv->rfa_txpowertrackingindex_real--;
+ rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value);
}
}
- priv->cck_present_attentuation_difference
- = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default;
+ } else {
+ if (priv->rfa_txpowertrackingindex < 36) {
+ priv->rfa_txpowertrackingindex++;
+ priv->rfa_txpowertrackingindex_real++;
+ rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value);

- if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20)
- priv->cck_present_attentuation
- = priv->cck_present_attentuation_20Mdefault + priv->cck_present_attentuation_difference;
- else
- priv->cck_present_attentuation
- = priv->cck_present_attentuation_40Mdefault + priv->cck_present_attentuation_difference;
-
- if (priv->cck_present_attentuation > -1 && priv->cck_present_attentuation < 23) {
- if (priv->ieee80211->current_network.channel == 14 && !priv->bcck_in_ch14) {
- priv->bcck_in_ch14 = TRUE;
- dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
- } else if (priv->ieee80211->current_network.channel != 14 && priv->bcck_in_ch14) {
- priv->bcck_in_ch14 = FALSE;
- dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
- } else
- dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
}
+ }
+ priv->cck_present_attentuation_difference
+ = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default;
+
+ if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20)
+ priv->cck_present_attentuation
+ = priv->cck_present_attentuation_20Mdefault + priv->cck_present_attentuation_difference;
+ else
+ priv->cck_present_attentuation
+ = priv->cck_present_attentuation_40Mdefault + priv->cck_present_attentuation_difference;
+
+ if (priv->cck_present_attentuation > -1 && priv->cck_present_attentuation < 23) {
+ if (priv->ieee80211->current_network.channel == 14 && !priv->bcck_in_ch14) {
+ priv->bcck_in_ch14 = TRUE;
+ dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
+ } else if (priv->ieee80211->current_network.channel != 14 && priv->bcck_in_ch14) {
+ priv->bcck_in_ch14 = FALSE;
+ dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
+ } else
+ dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
+ }
RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex = %d\n", priv->rfa_txpowertrackingindex);
RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex_real = %d\n", priv->rfa_txpowertrackingindex_real);
RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation_difference = %d\n", priv->cck_present_attentuation_difference);
@@ -656,7 +655,6 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
return;
}

- }
write_nic_byte(dev, 0x1ba, 0);
Avg_TSSI_Meas_from_driver = 0;
for (k = 0; k < 5; k++)
@@ -1324,12 +1322,11 @@ static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev)

if (!priv->btxpower_tracking)
return;
- else {
- if ((tx_power_track_counter % 30 == 0) && (tx_power_track_counter != 0)) {
- queue_delayed_work(priv->priv_wq, &priv->txpower_tracking_wq, 0);
- }
- tx_power_track_counter++;
- }
+
+ if ((tx_power_track_counter % 30 == 0) && (tx_power_track_counter != 0))
+ queue_delayed_work(priv->priv_wq, &priv->txpower_tracking_wq, 0);
+
+ tx_power_track_counter++;
}

static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
@@ -1339,11 +1336,10 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
/*DbgPrint("dm_CheckTXPowerTracking()\n");*/
if (!priv->btxpower_tracking)
return;
- else {
- if (priv->txpower_count <= 2) {
- priv->txpower_count++;
- return;
- }
+
+ if (priv->txpower_count <= 2) {
+ priv->txpower_count++;
+ return;
}

if (!TM_Trigger) {
@@ -1358,11 +1354,11 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
TM_Trigger = 1;
return;
- } else {
- /*DbgPrint("Schedule TxPowerTrackingWorkItem\n");*/
- queue_delayed_work(priv->priv_wq, &priv->txpower_tracking_wq, 0);
- TM_Trigger = 0;
}
+
+ /*DbgPrint("Schedule TxPowerTrackingWorkItem\n");*/
+ queue_delayed_work(priv->priv_wq, &priv->txpower_tracking_wq, 0);
+ TM_Trigger = 0;
}

static void dm_check_txpower_tracking(struct net_device *dev)
@@ -1837,16 +1833,16 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
DM_DigTable.RssiHighThresh, DM_DigTable.Dig_State);*/
/* 1. When RSSI decrease, We have to judge if it is smaller than a threshold
and then execute the step below. */
- if ((priv->undecorated_smoothed_pwdb <= dm_digtable.rssi_low_thresh)) {
+ if (priv->undecorated_smoothed_pwdb <= dm_digtable.rssi_low_thresh) {
/* 2008/02/05 MH When we execute silent reset, the DIG PHY parameters
will be reset to init value. We must prevent the condition. */
if (dm_digtable.dig_state == DM_STA_DIG_OFF &&
(priv->reset_count == reset_cnt)) {
return;
- } else {
- reset_cnt = priv->reset_count;
}

+ reset_cnt = priv->reset_count;
+
/* If DIG is off, DIG high power state must reset. */
dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX;
dm_digtable.dig_state = DM_STA_DIG_OFF;
@@ -1887,20 +1883,20 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(

/* 2. When RSSI increase, We have to judge if it is larger than a threshold
and then execute the step below. */
- if ((priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh)) {
+ if (priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) {
u8 reset_flag = 0;

if (dm_digtable.dig_state == DM_STA_DIG_ON &&
(priv->reset_count == reset_cnt)) {
dm_ctrl_initgain_byrssi_highpwr(dev);
return;
- } else {
- if (priv->reset_count != reset_cnt)
- reset_flag = 1;
-
- reset_cnt = priv->reset_count;
}

+ if (priv->reset_count != reset_cnt)
+ reset_flag = 1;
+
+ reset_cnt = priv->reset_count;
+
dm_digtable.dig_state = DM_STA_DIG_ON;
/*DbgPrint("DIG ON\n\r");*/

@@ -1992,8 +1988,8 @@ static void dm_ctrl_initgain_byrssi_highpwr(
if (dm_digtable.dig_highpwr_state == DM_STA_DIG_ON &&
(priv->reset_count == reset_cnt_highpwr))
return;
- else
- dm_digtable.dig_highpwr_state = DM_STA_DIG_ON;
+
+ dm_digtable.dig_highpwr_state = DM_STA_DIG_ON;

/* 3.1 Higher PD_TH for OFDM for high power state. */
if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) {
@@ -2009,8 +2005,8 @@ static void dm_ctrl_initgain_byrssi_highpwr(
if (dm_digtable.dig_highpwr_state == DM_STA_DIG_OFF &&
(priv->reset_count == reset_cnt_highpwr))
return;
- else
- dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF;
+
+ dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF;

if (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_lowthresh &&
priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) {
@@ -2107,7 +2103,7 @@ static void dm_pd_th(
if (dm_digtable.cur_connect_state == DIG_CONNECT) {
if (dm_digtable.rssi_val >= dm_digtable.rssi_high_power_highthresh)
dm_digtable.curpd_thstate = DIG_PD_AT_HIGH_POWER;
- else if ((dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh))
+ else if (dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh)
dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER;
else if ((dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh) &&
(dm_digtable.rssi_val < dm_digtable.rssi_high_power_lowthresh))
@@ -2189,9 +2185,9 @@ static void dm_cs_ratio(

if (dm_digtable.pre_connect_state == dm_digtable.cur_connect_state) {
if (dm_digtable.cur_connect_state == DIG_CONNECT) {
- if ((dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh))
+ if (dm_digtable.rssi_val <= dm_digtable.rssi_low_thresh)
dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER;
- else if ((dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh))
+ else if (dm_digtable.rssi_val >= dm_digtable.rssi_high_thresh)
dm_digtable.curcs_ratio_state = DIG_CS_RATIO_HIGHER;
else
dm_digtable.curcs_ratio_state = dm_digtable.precs_ratio_state;
@@ -3092,11 +3088,10 @@ static void dm_dynamic_txpower(struct net_device *dev)
priv->bDynamicTxHighPower = false;

/* low power state check */
- if (priv->undecorated_smoothed_pwdb < 35) {
+ if (priv->undecorated_smoothed_pwdb < 35)
priv->bDynamicTxLowPower = true;
- } else if (priv->undecorated_smoothed_pwdb >= 40) {
+ else if (priv->undecorated_smoothed_pwdb >= 40)
priv->bDynamicTxLowPower = false;
- }
}
} else {
/*pHalData->bTXPowerCtrlforNearFarRange = !pHalData->bTXPowerCtrlforNearFarRange;*/
@@ -3147,7 +3142,6 @@ static void dm_send_rssi_tofw(struct net_device *dev)
* 0x1e0(byte) to notify driver.
*/
write_nic_byte(dev, DRIVER_RSSI, (u8)priv->undecorated_smoothed_pwdb);
- return;
}

/*---------------------------Define function prototype------------------------*/
--
2.2.1

2014-12-31 18:51:08

by Lorenzo Stoakes

[permalink] [raw]
Subject: [PATCH 4/4] staging: rtl8192u: Refactor heavy nesting

This patch fixes warnings raised by checkpatch.pl relating to heavily indented
lines in r8192U_dm.c. It refactors a couple of else if cases to achieve the same
outcome indented by one fewer tab. It additionally updateds comment positioning
to be consistent across these cases.

Signed-off-by: Lorenzo Stoakes <[email protected]>
---
drivers/staging/rtl8192u/r8192U_dm.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 0839ea7..72d1f47 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2585,28 +2585,25 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
cck_rx_ver2_sec_index = cck_rx_ver2_max_index;
tmp_cck_max_pwdb = cur_cck_pwdb;
cck_rx_ver2_max_index = i;
- } else if (cur_cck_pwdb == tmp_cck_max_pwdb) { /* let sec and min point to the different index */
+ } else if (cur_cck_pwdb == tmp_cck_max_pwdb) {
+ /* let sec and min point to the different index */
tmp_cck_sec_pwdb = cur_cck_pwdb;
cck_rx_ver2_sec_index = i;
} else if ((cur_cck_pwdb < tmp_cck_max_pwdb) && (cur_cck_pwdb > tmp_cck_sec_pwdb)) {
tmp_cck_sec_pwdb = cur_cck_pwdb;
cck_rx_ver2_sec_index = i;
- } else if (cur_cck_pwdb == tmp_cck_sec_pwdb) {
- if (tmp_cck_sec_pwdb == tmp_cck_min_pwdb) { /* let sec and min point to the different index */
- tmp_cck_sec_pwdb = cur_cck_pwdb;
- cck_rx_ver2_sec_index = i;
- } else {
- /* This case we don't need to set any index */
- }
+ } else if (cur_cck_pwdb == tmp_cck_sec_pwdb && tmp_cck_sec_pwdb == tmp_cck_min_pwdb) {
+ /* let sec and min point to the different index */
+ tmp_cck_sec_pwdb = cur_cck_pwdb;
+ cck_rx_ver2_sec_index = i;
+ /* otherwise we don't need to set any index */
} else if ((cur_cck_pwdb < tmp_cck_sec_pwdb) && (cur_cck_pwdb > tmp_cck_min_pwdb)) {
/* This case we don't need to set any index */
- } else if (cur_cck_pwdb == tmp_cck_min_pwdb) {
- if (tmp_cck_sec_pwdb == tmp_cck_min_pwdb) { /* let sec and min point to the different index */
- tmp_cck_min_pwdb = cur_cck_pwdb;
- cck_rx_ver2_min_index = i;
- } else {
- /* This case we don't need to set any index */
- }
+ } else if (cur_cck_pwdb == tmp_cck_min_pwdb && tmp_cck_sec_pwdb == tmp_cck_min_pwdb) {
+ /* let sec and min point to the different index */
+ tmp_cck_min_pwdb = cur_cck_pwdb;
+ cck_rx_ver2_min_index = i;
+ /* otherwise we don't need to set any index */
} else if (cur_cck_pwdb < tmp_cck_min_pwdb) {
tmp_cck_min_pwdb = cur_cck_pwdb;
cck_rx_ver2_min_index = i;
--
2.2.1

2014-12-31 19:00:53

by Konrad Zapalowicz

[permalink] [raw]
Subject: Re: [PATCH 1/4] staging: rtl8192u: fix comments

On 12/31, Lorenzo Stoakes wrote:
> This patch fixes errors raised by checkpatch.pl relating to use of C99 comments
> in r8192U_dm.c.
>
> Signed-off-by: Lorenzo Stoakes <[email protected]>
> ---
> drivers/staging/rtl8192u/r8192U_dm.c | 841 ++++++++++++++++++-----------------
> 1 file changed, 432 insertions(+), 409 deletions(-)
>
> diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
> index 936565d..44f4c38 100644
> --- a/drivers/staging/rtl8192u/r8192U_dm.c
> +++ b/drivers/staging/rtl8192u/r8192U_dm.c
> @@ -21,14 +21,15 @@ Major Change History:
> #include "r8190_rtl8256.h"
> #include "r819xU_cmdpkt.h"
> /*---------------------------Define Local Constant---------------------------*/
> -//
> -// Indicate different AP vendor for IOT issue.
> -//
> -static u32 edca_setting_DL[HT_IOT_PEER_MAX] =
> - { 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f};
> -static u32 edca_setting_UL[HT_IOT_PEER_MAX] =
> - { 0x5e4322, 0xa44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f};
> -
> +/*
> + * Indicate different AP vendor for IOT issue.
> + */
> +static u32 edca_setting_DL[HT_IOT_PEER_MAX] = {
> + 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f
> +};
> +static u32 edca_setting_UL[HT_IOT_PEER_MAX] = {
> + 0x5e4322, 0xa44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f
> +};

You also fix the line length here which shall be the subject of a
separate patch as this is not C99 comments related change.

Thanks,
Konrad

> #define RTK_UL_EDCA 0xa44f
> #define RTK_DL_EDCA 0x5e4322
> @@ -36,11 +37,11 @@ static u32 edca_setting_UL[HT_IOT_PEER_MAX] =
>
>
> /*------------------------Define global variable-----------------------------*/
> -// Debug variable ?
> +/* Debug variable ? */
> dig_t dm_digtable;
> -// Store current software write register content for MAC PHY.
> +/* Store current software write register content for MAC PHY. */
> u8 dm_shadow[16][256] = {{0}};
> -// For Dynamic Rx Path Selection by Signal Strength
> +/* For Dynamic Rx Path Selection by Signal Strength */
> DRxPathSel DM_RxPathSelTable;
> /*------------------------Define global variable-----------------------------*/
>
> @@ -56,24 +57,24 @@ extern void dm_check_fsync(struct net_device *dev);
>
>
> /*---------------------Define local function prototype-----------------------*/
> -// DM --> Rate Adaptive
> +/* DM --> Rate Adaptive */
> static void dm_check_rate_adaptive(struct net_device *dev);
>
> -// DM --> Bandwidth switch
> +/* DM --> Bandwidth switch */
> static void dm_init_bandwidth_autoswitch(struct net_device *dev);
> static void dm_bandwidth_autoswitch(struct net_device *dev);
>
> -// DM --> TX power control
> -//static void dm_initialize_txpower_tracking(struct net_device *dev);
> +/* DM --> TX power control */
> +/*static void dm_initialize_txpower_tracking(struct net_device *dev);*/
>
> static void dm_check_txpower_tracking(struct net_device *dev);
>
>
>
> -//static void dm_txpower_reset_recovery(struct net_device *dev);
> +/*static void dm_txpower_reset_recovery(struct net_device *dev);*/
>
>
> -// DM --> Dynamic Init Gain by RSSI
> +/* DM --> Dynamic Init Gain by RSSI */
> static void dm_dig_init(struct net_device *dev);
> static void dm_ctrl_initgain_byrssi(struct net_device *dev);
> static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev);
> @@ -84,61 +85,61 @@ static void dm_pd_th(struct net_device *dev);
> static void dm_cs_ratio(struct net_device *dev);
>
> static void dm_init_ctstoself(struct net_device *dev);
> -// DM --> EDCA turbo mode control
> +/* DM --> EDCA turbo mode control */
> static void dm_check_edca_turbo(struct net_device *dev);
>
> -//static void dm_gpio_change_rf(struct net_device *dev);
> -// DM --> Check PBC
> +/*static void dm_gpio_change_rf(struct net_device *dev);*/
> +/* DM --> Check PBC */
> static void dm_check_pbc_gpio(struct net_device *dev);
>
>
> -// DM --> Check current RX RF path state
> +/* DM --> Check current RX RF path state */
> static void dm_check_rx_path_selection(struct net_device *dev);
> static void dm_init_rxpath_selection(struct net_device *dev);
> static void dm_rxpath_sel_byrssi(struct net_device *dev);
>
>
> -// DM --> Fsync for broadcom ap
> +/* DM --> Fsync for broadcom ap */
> static void dm_init_fsync(struct net_device *dev);
> static void dm_deInit_fsync(struct net_device *dev);
>
> -//Added by vivi, 20080522
> +/* Added by vivi, 20080522 */
> static void dm_check_txrateandretrycount(struct net_device *dev);
>
> /*---------------------Define local function prototype-----------------------*/
>
> -/*---------------------Define of Tx Power Control For Near/Far Range --------*/ //Add by Jacken 2008/02/18
> +/*---------------------Define of Tx Power Control For Near/Far Range --------*/ /*Add by Jacken 2008/02/18 */
> static void dm_init_dynamic_txpower(struct net_device *dev);
> static void dm_dynamic_txpower(struct net_device *dev);
>
>
> -// DM --> For rate adaptive and DIG, we must send RSSI to firmware
> +/* DM --> For rate adaptive and DIG, we must send RSSI to firmware */
> static void dm_send_rssi_tofw(struct net_device *dev);
> static void dm_ctstoself(struct net_device *dev);
> /*---------------------------Define function prototype------------------------*/
> -//================================================================================
> -// HW Dynamic mechanism interface.
> -//================================================================================
> -
> -//
> -// Description:
> -// Prepare SW resource for HW dynamic mechanism.
> -//
> -// Assumption:
> -// This function is only invoked at driver intialization once.
> -//
> -//
> +/*
> + * ================================================================================
> + * HW Dynamic mechanism interface.
> + * ================================================================================
> + *
> + *
> + * Description:
> + * Prepare SW resource for HW dynamic mechanism.
> + *
> + * Assumption:
> + * This function is only invoked at driver intialization once.
> + */
> void init_hal_dm(struct net_device *dev)
> {
> struct r8192_priv *priv = ieee80211_priv(dev);
>
> - // Undecorated Smoothed Signal Strength, it can utilized to dynamic mechanism.
> + /* Undecorated Smoothed Signal Strength, it can utilized to dynamic mechanism. */
> priv->undecorated_smoothed_pwdb = -1;
>
> - //Initial TX Power Control for near/far range , add by amy 2008/05/15, porting from windows code.
> + /* Initial TX Power Control for near/far range , add by amy 2008/05/15, porting from windows code. */
> dm_init_dynamic_txpower(dev);
> init_rate_adaptive(dev);
> - //dm_initialize_txpower_tracking(dev);
> + /*dm_initialize_txpower_tracking(dev);*/
> dm_dig_init(dev);
> dm_init_edca_turbo(dev);
> dm_init_bandwidth_autoswitch(dev);
> @@ -146,7 +147,7 @@ void init_hal_dm(struct net_device *dev)
> dm_init_rxpath_selection(dev);
> dm_init_ctstoself(dev);
>
> -} // InitHalDm
> +} /* InitHalDm */
>
> void deinit_hal_dm(struct net_device *dev)
> {
> @@ -208,16 +209,16 @@ void dm_CheckRxAggregation(struct net_device *dev) {
>
> lastTxOkCnt = priv->stats.txbytesunicast;
> lastRxOkCnt = priv->stats.rxbytesunicast;
> -} // dm_CheckEdcaTurbo
> +} /* dm_CheckEdcaTurbo */
> #endif
>
>
>
> void hal_dm_watchdog(struct net_device *dev)
> {
> - //struct r8192_priv *priv = ieee80211_priv(dev);
> + /*struct r8192_priv *priv = ieee80211_priv(dev);*/
>
> - //static u8 previous_bssid[6] ={0};
> + /*static u8 previous_bssid[6] ={0};*/
>
> /*Add by amy 2008/05/15 ,porting from windows code.*/
> dm_check_rate_adaptive(dev);
> @@ -230,22 +231,22 @@ void hal_dm_watchdog(struct net_device *dev)
> dm_check_rx_path_selection(dev);
> dm_check_fsync(dev);
>
> - // Add by amy 2008-05-15 porting from windows code.
> + /* Add by amy 2008-05-15 porting from windows code. */
> dm_check_pbc_gpio(dev);
> dm_send_rssi_tofw(dev);
> dm_ctstoself(dev);
> #ifdef USB_RX_AGGREGATION_SUPPORT
> dm_CheckRxAggregation(dev);
> #endif
> -} //HalDmWatchDog
> +} /* HalDmWatchDog */
>
>
> /*
> - * Decide Rate Adaptive Set according to distance (signal strength)
> - * 01/11/2008 MHC Modify input arguments and RATR table level.
> - * 01/16/2008 MHC RF_Type is assigned in ReadAdapterInfo(). We must call
> - * the function after making sure RF_Type.
> - */
> + * Decide Rate Adaptive Set according to distance (signal strength)
> + * 01/11/2008 MHC Modify input arguments and RATR table level.
> + * 01/16/2008 MHC RF_Type is assigned in ReadAdapterInfo(). We must call
> + * the function after making sure RF_Type.
> + */
> void init_rate_adaptive(struct net_device *dev)
> {
>
> @@ -270,14 +271,16 @@ void init_rate_adaptive(struct net_device *dev)
>
> if (priv->rf_type == RF_2T4R)
> {
> - // 07/10/08 MH Modify for RA smooth scheme.
> - /* 2008/01/11 MH Modify 2T RATR table for different RSSI. 080515 porting by amy from windows code.*/
> + /*
> + * 07/10/08 MH Modify for RA smooth scheme.
> + * 2008/01/11 MH Modify 2T RATR table for different RSSI. 080515 porting by amy from windows code.
> + */
> pra->upper_rssi_threshold_ratr = 0x8f0f0000;
> pra->middle_rssi_threshold_ratr = 0x8f0ff000;
> pra->low_rssi_threshold_ratr = 0x8f0ff001;
> pra->low_rssi_threshold_ratr_40M = 0x8f0ff005;
> pra->low_rssi_threshold_ratr_20M = 0x8f0ff001;
> - pra->ping_rssi_ratr = 0x0000000d;//cosa add for test
> + pra->ping_rssi_ratr = 0x0000000d;/* cosa add for test */
> }
> else if (priv->rf_type == RF_1T2R)
> {
> @@ -286,10 +289,10 @@ void init_rate_adaptive(struct net_device *dev)
> pra->low_rssi_threshold_ratr = 0x000ff001;
> pra->low_rssi_threshold_ratr_40M = 0x000ff005;
> pra->low_rssi_threshold_ratr_20M = 0x000ff001;
> - pra->ping_rssi_ratr = 0x0000000d;//cosa add for test
> + pra->ping_rssi_ratr = 0x0000000d;/* cosa add for test */
> }
>
> -} // InitRateAdaptive
> +} /* InitRateAdaptive */
>
>
> /*-----------------------------------------------------------------------------
> @@ -325,21 +328,21 @@ static void dm_check_rate_adaptive(struct net_device *dev)
> return;
> }
>
> - if(pra->rate_adaptive_disabled)//this variable is set by ioctl.
> + if(pra->rate_adaptive_disabled) /* this variable is set by ioctl. */
> return;
>
> - // TODO: Only 11n mode is implemented currently,
> + /* TODO: Only 11n mode is implemented currently, */
> if(!(priv->ieee80211->mode == WIRELESS_MODE_N_24G ||
> priv->ieee80211->mode == WIRELESS_MODE_N_5G))
> return;
>
> if(priv->ieee80211->state == IEEE80211_LINKED)
> {
> - // RT_TRACE(COMP_RATE, "dm_CheckRateAdaptive(): \t");
> + /*RT_TRACE(COMP_RATE, "dm_CheckRateAdaptive(): \t");*/
>
> - //
> - // Check whether Short GI is enabled
> - //
> + /*
> + * Check whether Short GI is enabled
> + */
> bshort_gi_enabled = (pHTInfo->bCurTxBW40MHz && pHTInfo->bCurShortGI40MHz) ||
> (!pHTInfo->bCurTxBW40MHz && pHTInfo->bCurShortGI20MHz);
>
> @@ -360,7 +363,7 @@ static void dm_check_rate_adaptive(struct net_device *dev)
> pra->low_rssi_threshold_ratr =
> (pra->low_rssi_threshold_ratr_20M & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ;
> }
> - //cosa add for test
> + /* cosa add for test */
> pra->ping_rssi_ratr =
> (pra->ping_rssi_ratr & (~BIT31)) | ((bshort_gi_enabled)? BIT31:0) ;
>
> @@ -387,56 +390,57 @@ static void dm_check_rate_adaptive(struct net_device *dev)
> (pra->low_rssi_thresh_for_ra40M):(pra->low_rssi_thresh_for_ra20M);
> }
>
> - //DbgPrint("[DM] THresh H/L=%d/%d\n\r", RATR.HighRSSIThreshForRA, RATR.LowRSSIThreshForRA);
> + /*DbgPrint("[DM] THresh H/L=%d/%d\n\r", RATR.HighRSSIThreshForRA, RATR.LowRSSIThreshForRA);*/
> if(priv->undecorated_smoothed_pwdb >= (long)HighRSSIThreshForRA)
> {
> - //DbgPrint("[DM] RSSI=%d STA=HIGH\n\r", pHalData->UndecoratedSmoothedPWDB);
> + /*DbgPrint("[DM] RSSI=%d STA=HIGH\n\r", pHalData->UndecoratedSmoothedPWDB);*/
> pra->ratr_state = DM_RATR_STA_HIGH;
> targetRATR = pra->upper_rssi_threshold_ratr;
> }else if(priv->undecorated_smoothed_pwdb >= (long)LowRSSIThreshForRA)
> {
> - //DbgPrint("[DM] RSSI=%d STA=Middle\n\r", pHalData->UndecoratedSmoothedPWDB);
> + /*DbgPrint("[DM] RSSI=%d STA=Middle\n\r", pHalData->UndecoratedSmoothedPWDB);*/
> pra->ratr_state = DM_RATR_STA_MIDDLE;
> targetRATR = pra->middle_rssi_threshold_ratr;
> }else
> {
> - //DbgPrint("[DM] RSSI=%d STA=LOW\n\r", pHalData->UndecoratedSmoothedPWDB);
> + /*DbgPrint("[DM] RSSI=%d STA=LOW\n\r", pHalData->UndecoratedSmoothedPWDB);*/
> pra->ratr_state = DM_RATR_STA_LOW;
> targetRATR = pra->low_rssi_threshold_ratr;
> }
>
> - //cosa add for test
> - if(pra->ping_rssi_enable)
> - {
> - //pHalData->UndecoratedSmoothedPWDB = 19;
> + /* cosa add for test */
> + if(pra->ping_rssi_enable) {
> + /*pHalData->UndecoratedSmoothedPWDB = 19;*/
> if(priv->undecorated_smoothed_pwdb < (long)(pra->ping_rssi_thresh_for_ra+5))
> {
> if((priv->undecorated_smoothed_pwdb < (long)pra->ping_rssi_thresh_for_ra) ||
> ping_rssi_state)
> {
> - //DbgPrint("TestRSSI = %d, set RATR to 0x%x \n", pHalData->UndecoratedSmoothedPWDB, pRA->TestRSSIRATR);
> + /*DbgPrint("TestRSSI = %d, set RATR to 0x%x \n", pHalData->UndecoratedSmoothedPWDB, pRA->TestRSSIRATR);*/
> pra->ratr_state = DM_RATR_STA_LOW;
> targetRATR = pra->ping_rssi_ratr;
> ping_rssi_state = 1;
> }
> - //else
> - // DbgPrint("TestRSSI is between the range. \n");
> + /*else
> + DbgPrint("TestRSSI is between the range. \n");*/
> }
> else
> {
> - //DbgPrint("TestRSSI Recover to 0x%x \n", targetRATR);
> + /*DbgPrint("TestRSSI Recover to 0x%x \n", targetRATR);*/
> ping_rssi_state = 0;
> }
> }
>
> - // 2008.04.01
> - // For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7.
> + /*
> + * 2008.04.01
> + * For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7.
> + */
> if(priv->ieee80211->GetHalfNmodeSupportByAPsHandler(dev))
> targetRATR &= 0xf00fffff;
>
> - //
> - // Check whether updating of RATR0 is required
> - //
> + /*
> + * Check whether updating of RATR0 is required
> + */
> read_nic_dword(dev, RATR0, &currentRATR);
> if(targetRATR != currentRATR)
> {
> @@ -459,7 +463,7 @@ static void dm_check_rate_adaptive(struct net_device *dev)
> pra->ratr_state = DM_RATR_STA_MAX;
> }
>
> -} // dm_CheckRateAdaptive
> +} /* dm_CheckRateAdaptive */
>
>
> static void dm_init_bandwidth_autoswitch(struct net_device *dev)
> @@ -471,7 +475,7 @@ static void dm_init_bandwidth_autoswitch(struct net_device *dev)
> priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;
> priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable = false;
>
> -} // dm_init_bandwidth_autoswitch
> +} /* dm_init_bandwidth_autoswitch */
>
>
> static void dm_bandwidth_autoswitch(struct net_device *dev)
> @@ -481,68 +485,68 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)
> if(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ||!priv->ieee80211->bandwidth_auto_switch.bautoswitch_enable){
> return;
> }else{
> - if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){//If send packets in 40 Mhz in 20/40
> + if(priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz == false){ /* If send packets in 40 Mhz in 20/40 */
> if(priv->undecorated_smoothed_pwdb <= priv->ieee80211->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
> priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = true;
> - }else{//in force send packets in 20 Mhz in 20/40
> + }else{ /* in force send packets in 20 Mhz in 20/40 */
> if(priv->undecorated_smoothed_pwdb >= priv->ieee80211->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
> priv->ieee80211->bandwidth_auto_switch.bforced_tx20Mhz = false;
>
> }
> }
> -} // dm_BandwidthAutoSwitch
> +} /* dm_BandwidthAutoSwitch */
>
> -//OFDM default at 0db, index=6.
> +/* OFDM default at 0db, index=6. */
> static u32 OFDMSwingTable[OFDM_Table_Length] = {
> - 0x7f8001fe, // 0, +6db
> - 0x71c001c7, // 1, +5db
> - 0x65400195, // 2, +4db
> - 0x5a400169, // 3, +3db
> - 0x50800142, // 4, +2db
> - 0x47c0011f, // 5, +1db
> - 0x40000100, // 6, +0db ===> default, upper for higher temperature, lower for low temperature
> - 0x390000e4, // 7, -1db
> - 0x32c000cb, // 8, -2db
> - 0x2d4000b5, // 9, -3db
> - 0x288000a2, // 10, -4db
> - 0x24000090, // 11, -5db
> - 0x20000080, // 12, -6db
> - 0x1c800072, // 13, -7db
> - 0x19800066, // 14, -8db
> - 0x26c0005b, // 15, -9db
> - 0x24400051, // 16, -10db
> - 0x12000048, // 17, -11db
> - 0x10000040 // 18, -12db
> + 0x7f8001fe, /* 0, +6db */
> + 0x71c001c7, /* 1, +5db */
> + 0x65400195, /* 2, +4db */
> + 0x5a400169, /* 3, +3db */
> + 0x50800142, /* 4, +2db */
> + 0x47c0011f, /* 5, +1db */
> + 0x40000100, /* 6, +0db ===> default, upper for higher temperature, lower for low temperature */
> + 0x390000e4, /* 7, -1db */
> + 0x32c000cb, /* 8, -2db */
> + 0x2d4000b5, /* 9, -3db */
> + 0x288000a2, /* 10, -4db */
> + 0x24000090, /* 11, -5db */
> + 0x20000080, /* 12, -6db */
> + 0x1c800072, /* 13, -7db */
> + 0x19800066, /* 14, -8db */
> + 0x26c0005b, /* 15, -9db */
> + 0x24400051, /* 16, -10db */
> + 0x12000048, /* 17, -11db */
> + 0x10000040 /* 18, -12db */
> };
>
> static u8 CCKSwingTable_Ch1_Ch13[CCK_Table_length][8] = {
> - {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, // 0, +0db ===> CCK40M default
> - {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 1, -1db
> - {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 2, -2db
> - {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 3, -3db
> - {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 4, -4db
> - {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 5, -5db
> - {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 6, -6db ===> CCK20M default
> - {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 7, -7db
> - {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 8, -8db
> - {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 9, -9db
> - {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 10, -10db
> - {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01} // 11, -11db
> + {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04}, /* 0, +0db ===> CCK40M default */
> + {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, /* 1, -1db */
> + {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, /* 2, -2db */
> + {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, /* 3, -3db */
> + {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, /* 4, -4db */
> + {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, /* 5, -5db */
> + {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, /* 6, -6db ===> CCK20M default */
> + {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, /* 7, -7db */
> + {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, /* 8, -8db */
> + {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, /* 9, -9db */
> + {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, /* 10, -10db */
> + {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01} /* 11, -11db */
> };
>
> static u8 CCKSwingTable_Ch14[CCK_Table_length][8] = {
> - {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, // 0, +0db ===> CCK40M default
> - {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 1, -1db
> - {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 2, -2db
> - {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 3, -3db
> - {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 4, -4db
> - {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 5, -5db
> - {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 6, -6db ===> CCK20M default
> - {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 7, -7db
> - {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 8, -8db
> - {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 9, -9db
> - {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 10, -10db
> - {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00} // 11, -11db
> + {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00}, /* 0, +0db ===> CCK40M default */
> + {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, /* 1, -1db */
> + {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, /* 2, -2db */
> + {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, /* 3, -3db */
> + {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, /* 4, -4db */
> + {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, /* 5, -5db */
> + {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, /* 6, -6db ===> CCK20M default */
> + {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, /* 7, -7db */
> + {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, /* 8, -8db */
> + {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, /* 9, -9db */
> + {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, /* 10, -10db */
> + {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00} /* 11, -11db */
> };
>
> static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
> @@ -556,7 +560,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
> u32 Value;
> u8 Pwr_Flag;
> u16 Avg_TSSI_Meas, TSSI_13dBm, Avg_TSSI_Meas_from_driver=0;
> - //RT_STATUS rtStatus = RT_STATUS_SUCCESS;
> + /*RT_STATUS rtStatus = RT_STATUS_SUCCESS;*/
> bool rtStatus = true;
> u32 delta=0;
>
> @@ -571,9 +575,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
>
> RT_TRACE(COMP_POWER_TRACKING, "powerlevelOFDM24G = %x\n", powerlevelOFDM24G);
>
> - for(j = 0; j<=30; j++)
> -{ //fill tx_cmd
> -
> + for(j = 0; j<=30; j++) { /* fill tx_cmd */
> tx_cmd.Op = TXCMD_SET_TX_PWR_TRACKING;
> tx_cmd.Length = 4;
> tx_cmd.Value = Value;
> @@ -583,7 +585,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
> RT_TRACE(COMP_POWER_TRACKING, "Set configuration with tx cmd queue fail!\n");
> }
> mdelay(1);
> - //DbgPrint("hi, vivi, strange\n");
> + /*DbgPrint("hi, vivi, strange\n");*/
> for(i = 0;i <= 30; i++)
> {
> read_nic_byte(dev, 0x1ba, &Pwr_Flag);
> @@ -609,7 +611,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
> RT_TRACE(COMP_POWER_TRACKING, "TSSI_report_value = %d\n", tmp_report[k]);
> }
>
> - //check if the report value is right
> + /* check if the report value is right */
> for(k = 0;k < 5; k++)
> {
> if(tmp_report[k] <= 20)
> @@ -638,8 +640,8 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
> TSSI_13dBm = priv->TSSI_13dBm;
> RT_TRACE(COMP_POWER_TRACKING, "TSSI_13dBm = %d\n", TSSI_13dBm);
>
> - //if(abs(Avg_TSSI_Meas_from_driver - TSSI_13dBm) <= E_FOR_TX_POWER_TRACK)
> - // For MacOS-compatible
> + /*if(abs(Avg_TSSI_Meas_from_driver - TSSI_13dBm) <= E_FOR_TX_POWER_TRACK)*/
> + /* For MacOS-compatible */
> if(Avg_TSSI_Meas_from_driver > TSSI_13dBm)
> delta = Avg_TSSI_Meas_from_driver - TSSI_13dBm;
> else
> @@ -741,9 +743,9 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
>
> if(!priv->btxpower_trackingInit)
> {
> - //Query OFDM default setting
> + /* Query OFDM default setting */
> tmpRegA= rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord);
> - for(i=0; i<OFDM_Table_Length; i++) //find the index
> + for(i=0; i<OFDM_Table_Length; i++) /* find the index */
> {
> if(tmpRegA == OFDMSwingTable[i])
> {
> @@ -753,7 +755,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
> }
> }
>
> - //Query CCK default setting From 0xa22
> + /* Query CCK default setting From 0xa22 */
> TempCCk = rtl8192_QueryBBReg(dev, rCCK0_TxFilter1, bMaskByte2);
> for(i=0 ; i<CCK_Table_length ; i++)
> {
> @@ -766,27 +768,28 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
> }
> }
> priv->btxpower_trackingInit = TRUE;
> - //pHalData->TXPowercount = 0;
> + /*pHalData->TXPowercount = 0;*/
> return;
> }
>
> - //==========================
> - // this is only for test, should be masked
> - //==========================
> + /*==========================
> + * this is only for test, should be masked
> + *==========================
> + */
>
> - // read and filter out unreasonable value
> - tmpRegA = rtl8192_phy_QueryRFReg(dev, RF90_PATH_A, 0x12, 0x078); // 0x12: RF Reg[10:7]
> + /* read and filter out unreasonable value */
> + tmpRegA = rtl8192_phy_QueryRFReg(dev, RF90_PATH_A, 0x12, 0x078); /* 0x12: RF Reg[10:7] */
> RT_TRACE(COMP_POWER_TRACKING, "Readback ThermalMeterA = %d \n", tmpRegA);
> if(tmpRegA < 3 || tmpRegA > 13)
> return;
> - if(tmpRegA >= 12) // if over 12, TP will be bad when high temperature
> + if(tmpRegA >= 12) /* if over 12, TP will be bad when high temperature */
> tmpRegA = 12;
> RT_TRACE(COMP_POWER_TRACKING, "Valid ThermalMeterA = %d \n", tmpRegA);
> - priv->ThermalMeter[0] = ThermalMeterVal; //We use fixed value by Bryant's suggestion
> - priv->ThermalMeter[1] = ThermalMeterVal; //We use fixed value by Bryant's suggestion
> + priv->ThermalMeter[0] = ThermalMeterVal; /* We use fixed value by Bryant's suggestion */
> + priv->ThermalMeter[1] = ThermalMeterVal; /* We use fixed value by Bryant's suggestion */
>
> - //Get current RF-A temperature index
> - if(priv->ThermalMeter[0] >= (u8)tmpRegA) //lower temperature
> + /* Get current RF-A temperature index */
> + if(priv->ThermalMeter[0] >= (u8)tmpRegA) /* lower temperature */
> {
> tmpOFDMindex = tmpCCK20Mindex = 6+(priv->ThermalMeter[0]-(u8)tmpRegA);
> tmpCCK40Mindex = tmpCCK20Mindex - 6;
> @@ -800,16 +803,16 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
> else
> {
> tmpval = ((u8)tmpRegA - priv->ThermalMeter[0]);
> - if(tmpval >= 6) // higher temperature
> - tmpOFDMindex = tmpCCK20Mindex = 0; // max to +6dB
> + if(tmpval >= 6) /* higher temperature */
> + tmpOFDMindex = tmpCCK20Mindex = 0; /* max to +6dB */
> else
> tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval;
> tmpCCK40Mindex = 0;
> }
> - //DbgPrint("%ddb, tmpOFDMindex = %d, tmpCCK20Mindex = %d, tmpCCK40Mindex = %d",
> - //((u1Byte)tmpRegA - pHalData->ThermalMeter[0]),
> - //tmpOFDMindex, tmpCCK20Mindex, tmpCCK40Mindex);
> - if(priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) //40M
> + /*DbgPrint("%ddb, tmpOFDMindex = %d, tmpCCK20Mindex = %d, tmpCCK40Mindex = %d",
> + ((u1Byte)tmpRegA - pHalData->ThermalMeter[0]),
> + tmpOFDMindex, tmpCCK20Mindex, tmpCCK40Mindex);*/
> + if(priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) /* 40M */
> tmpCCKindex = tmpCCK40Mindex;
> else
> tmpCCKindex = tmpCCK20Mindex;
> @@ -833,7 +836,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
>
> if(CCKSwingNeedUpdate)
> {
> - //DbgPrint("Update CCK Swing, CCK_index = %d\n", pHalData->CCK_index);
> + /*DbgPrint("Update CCK Swing, CCK_index = %d\n", pHalData->CCK_index);*/
> dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
> }
> if(priv->OFDM_index != tmpOFDMindex)
> @@ -864,7 +867,7 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev)
>
> struct r8192_priv *priv = ieee80211_priv(dev);
>
> - //Initial the Tx BB index and mapping value
> + /* Initial the Tx BB index and mapping value */
> priv->txbbgain_table[0].txbb_iq_amplifygain = 12;
> priv->txbbgain_table[0].txbbgain_value=0x7f8001fe;
> priv->txbbgain_table[1].txbb_iq_amplifygain = 11;
> @@ -940,8 +943,10 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev)
> priv->txbbgain_table[36].txbb_iq_amplifygain = -24;
> priv->txbbgain_table[36].txbbgain_value=0x10000040;
>
> - //ccktxbb_valuearray[0] is 0xA22 [1] is 0xA24 ...[7] is 0xA29
> - //This Table is for CH1~CH13
> + /*
> + * ccktxbb_valuearray[0] is 0xA22 [1] is 0xA24 ...[7] is 0xA29
> + * This Table is for CH1~CH13
> + */
> priv->cck_txbbgain_table[0].ccktxbb_valuearray[0] = 0x36;
> priv->cck_txbbgain_table[0].ccktxbb_valuearray[1] = 0x35;
> priv->cck_txbbgain_table[0].ccktxbb_valuearray[2] = 0x2e;
> @@ -1149,8 +1154,10 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev)
> priv->cck_txbbgain_table[22].ccktxbb_valuearray[6] = 0x03;
> priv->cck_txbbgain_table[22].ccktxbb_valuearray[7] = 0x01;
>
> - //ccktxbb_valuearray[0] is 0xA22 [1] is 0xA24 ...[7] is 0xA29
> - //This Table is for CH14
> + /*
> + * ccktxbb_valuearray[0] is 0xA22 [1] is 0xA24 ...[7] is 0xA29
> + * This Table is for CH14
> + */
> priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[0] = 0x36;
> priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[1] = 0x35;
> priv->cck_txbbgain_ch14_table[0].ccktxbb_valuearray[2] = 0x2e;
> @@ -1368,9 +1375,11 @@ static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev)
> {
> struct r8192_priv *priv = ieee80211_priv(dev);
>
> - // Tx Power tracking by Thermal Meter requires Firmware R/W 3-wire. This mechanism
> - // can be enabled only when Firmware R/W 3-wire is enabled. Otherwise, frequent r/w
> - // 3-wire by driver causes RF to go into a wrong state.
> + /*
> + * Tx Power tracking by Thermal Meter requires Firmware R/W 3-wire. This mechanism
> + * can be enabled only when Firmware R/W 3-wire is enabled. Otherwise, frequent r/w
> + * 3-wire by driver causes RF to go into a wrong state.
> + */
> if(priv->ieee80211->FwRWRF)
> priv->btxpower_tracking = TRUE;
> else
> @@ -1387,7 +1396,7 @@ void dm_initialize_txpower_tracking(struct net_device *dev)
> dm_InitializeTXPowerTracking_TSSI(dev);
> else
> dm_InitializeTXPowerTracking_ThermalMeter(dev);
> -}// dm_InitializeTXPowerTracking
> +} /* dm_InitializeTXPowerTracking */
>
>
> static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev)
> @@ -1413,7 +1422,7 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
> {
> struct r8192_priv *priv = ieee80211_priv(dev);
> static u8 TM_Trigger;
> - //DbgPrint("dm_CheckTXPowerTracking() \n");
> + /*DbgPrint("dm_CheckTXPowerTracking() \n");*/
> if(!priv->btxpower_tracking)
> return;
> else
> @@ -1427,9 +1436,11 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
>
> if(!TM_Trigger)
> {
> - //Attention!! You have to write all 12bits of data to RF, or it may cause RF to crash
> - //actually write reg0x02 bit1=0, then bit1=1.
> - //DbgPrint("Trigger ThermalMeter, write RF reg0x2 = 0x4d to 0x4f\n");
> + /*
> + * Attention!! You have to write all 12bits of data to RF, or it may cause RF to crash
> + * actually write reg0x02 bit1=0, then bit1=1.
> + * DbgPrint("Trigger ThermalMeter, write RF reg0x2 = 0x4d to 0x4f\n");
> + */
> rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
> rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4f);
> rtl8192_phy_SetRFReg(dev, RF90_PATH_A, 0x02, bMask12Bits, 0x4d);
> @@ -1439,7 +1450,7 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
> }
> else
> {
> - //DbgPrint("Schedule TxPowerTrackingWorkItem\n");
> + /*DbgPrint("Schedule TxPowerTrackingWorkItem\n");*/
> queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
> TM_Trigger = 0;
> }
> @@ -1449,7 +1460,7 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
> static void dm_check_txpower_tracking(struct net_device *dev)
> {
> struct r8192_priv *priv = ieee80211_priv(dev);
> - //static u32 tx_power_track_counter = 0;
> + /*static u32 tx_power_track_counter = 0;*/
>
> #ifdef RTL8190P
> dm_CheckTXPowerTracking_TSSI(dev);
> @@ -1460,28 +1471,28 @@ static void dm_check_txpower_tracking(struct net_device *dev)
> dm_CheckTXPowerTracking_ThermalMeter(dev);
> #endif
>
> -} // dm_CheckTXPowerTracking
> +} /* dm_CheckTXPowerTracking */
>
>
> static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14)
> {
> u32 TempVal;
> struct r8192_priv *priv = ieee80211_priv(dev);
> - //Write 0xa22 0xa23
> + /* Write 0xa22 0xa23 */
> TempVal = 0;
> if(!bInCH14){
> - //Write 0xa22 0xa23
> + /* Write 0xa22 0xa23 */
> TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[0] +
> (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[1]<<8) ;
>
> rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
> - //Write 0xa24 ~ 0xa27
> + /* Write 0xa24 ~ 0xa27 */
> TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[2] +
> (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[3]<<8) +
> (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[4]<<16)+
> (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[5]<<24);
> rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal);
> - //Write 0xa28 0xa29
> + /* Write 0xa28 0xa29 */
> TempVal = priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[6] +
> (priv->cck_txbbgain_table[priv->cck_present_attentuation].ccktxbb_valuearray[7]<<8) ;
>
> @@ -1493,13 +1504,13 @@ static void dm_CCKTxPowerAdjust_TSSI(struct net_device *dev, bool bInCH14)
> (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[1]<<8) ;
>
> rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
> - //Write 0xa24 ~ 0xa27
> + /* Write 0xa24 ~ 0xa27 */
> TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[2] +
> (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[3]<<8) +
> (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[4]<<16)+
> (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[5]<<24);
> rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal);
> - //Write 0xa28 0xa29
> + /* Write 0xa28 0xa29 */
> TempVal = priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[6] +
> (priv->cck_txbbgain_ch14_table[priv->cck_present_attentuation].ccktxbb_valuearray[7]<<8) ;
>
> @@ -1517,13 +1528,13 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH
> TempVal = 0;
> if(!bInCH14)
> {
> - //Write 0xa22 0xa23
> + /* Write 0xa22 0xa23 */
> TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][0] +
> (CCKSwingTable_Ch1_Ch13[priv->CCK_index][1]<<8) ;
> rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
> RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n",
> rCCK0_TxFilter1, TempVal);
> - //Write 0xa24 ~ 0xa27
> + /* Write 0xa24 ~ 0xa27 */
> TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][2] +
> (CCKSwingTable_Ch1_Ch13[priv->CCK_index][3]<<8) +
> (CCKSwingTable_Ch1_Ch13[priv->CCK_index][4]<<16)+
> @@ -1531,7 +1542,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH
> rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal);
> RT_TRACE(COMP_POWER_TRACKING, "CCK not chnl 14, reg 0x%x = 0x%x\n",
> rCCK0_TxFilter2, TempVal);
> - //Write 0xa28 0xa29
> + /* Write 0xa28 0xa29 */
> TempVal = CCKSwingTable_Ch1_Ch13[priv->CCK_index][6] +
> (CCKSwingTable_Ch1_Ch13[priv->CCK_index][7]<<8) ;
>
> @@ -1541,15 +1552,15 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH
> }
> else
> {
> -// priv->CCKTxPowerAdjustCntNotCh14++; //cosa add for debug.
> - //Write 0xa22 0xa23
> + /*priv->CCKTxPowerAdjustCntNotCh14++; cosa add for debug.*/
> + /* Write 0xa22 0xa23 */
> TempVal = CCKSwingTable_Ch14[priv->CCK_index][0] +
> (CCKSwingTable_Ch14[priv->CCK_index][1]<<8) ;
>
> rtl8192_setBBreg(dev, rCCK0_TxFilter1, bMaskHWord, TempVal);
> RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n",
> rCCK0_TxFilter1, TempVal);
> - //Write 0xa24 ~ 0xa27
> + /* Write 0xa24 ~ 0xa27 */
> TempVal = CCKSwingTable_Ch14[priv->CCK_index][2] +
> (CCKSwingTable_Ch14[priv->CCK_index][3]<<8) +
> (CCKSwingTable_Ch14[priv->CCK_index][4]<<16)+
> @@ -1557,7 +1568,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH
> rtl8192_setBBreg(dev, rCCK0_TxFilter2, bMaskDWord, TempVal);
> RT_TRACE(COMP_POWER_TRACKING, "CCK chnl 14, reg 0x%x = 0x%x\n",
> rCCK0_TxFilter2, TempVal);
> - //Write 0xa28 0xa29
> + /* Write 0xa28 0xa29 */
> TempVal = CCKSwingTable_Ch14[priv->CCK_index][6] +
> (CCKSwingTable_Ch14[priv->CCK_index][7]<<8) ;
>
> @@ -1570,7 +1581,7 @@ static void dm_CCKTxPowerAdjust_ThermalMeter(struct net_device *dev, bool bInCH
>
>
> void dm_cck_txpower_adjust(struct net_device *dev, bool binch14)
> -{ // dm_CCKTxPowerAdjust
> +{ /* dm_CCKTxPowerAdjust */
>
> struct r8192_priv *priv = ieee80211_priv(dev);
> if(priv->bDcut == TRUE)
> @@ -1600,7 +1611,7 @@ static void dm_txpower_reset_recovery(
> RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery: Fill in RFC_txPowerTrackingIndex is %x\n",priv->rfc_txpowertrackingindex);
> RT_TRACE(COMP_POWER_TRACKING, "Reset Recovery : RF C I/Q Amplify Gain is %ld\n",priv->txbbgain_table[priv->rfc_txpowertrackingindex].txbb_iq_amplifygain);
>
> -} // dm_TXPowerResetRecovery
> +} /* dm_TXPowerResetRecovery */
>
> void dm_restore_dynamic_mechanism_state(struct net_device *dev)
> {
> @@ -1613,12 +1624,12 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev)
> return;
> }
>
> - //
> - // Restore previous state for rate adaptive
> - //
> + /*
> + * Restore previous state for rate adaptive
> + */
> if(priv->rate_adaptive.rate_adaptive_disabled)
> return;
> - // TODO: Only 11n mode is implemented currently,
> + /* TODO: Only 11n mode is implemented currently, */
> if(!(priv->ieee80211->mode==WIRELESS_MODE_N_24G ||
> priv->ieee80211->mode==WIRELESS_MODE_N_5G))
> return;
> @@ -1626,38 +1637,38 @@ void dm_restore_dynamic_mechanism_state(struct net_device *dev)
> /* 2007/11/15 MH Copy from 8190PCI. */
> u32 ratr_value;
> ratr_value = reg_ratr;
> - if(priv->rf_type == RF_1T2R) // 1T2R, Spatial Stream 2 should be disabled
> + if(priv->rf_type == RF_1T2R) /* 1T2R, Spatial Stream 2 should be disabled */
> {
> ratr_value &= ~(RATE_ALL_OFDM_2SS);
> - //DbgPrint("HW_VAR_TATR_0 from 0x%x ==> 0x%x\n", ((pu4Byte)(val))[0], ratr_value);
> + /*DbgPrint("HW_VAR_TATR_0 from 0x%x ==> 0x%x\n", ((pu4Byte)(val))[0], ratr_value);*/
> }
> - //DbgPrint("set HW_VAR_TATR_0 = 0x%x\n", ratr_value);
> - //cosa PlatformEFIOWrite4Byte(Adapter, RATR0, ((pu4Byte)(val))[0]);
> + /*DbgPrint("set HW_VAR_TATR_0 = 0x%x\n", ratr_value);*/
> + /*cosa PlatformEFIOWrite4Byte(Adapter, RATR0, ((pu4Byte)(val))[0]);*/
> write_nic_dword(dev, RATR0, ratr_value);
> write_nic_byte(dev, UFWP, 1);
> }
> - //Restore TX Power Tracking Index
> + /* Restore TX Power Tracking Index */
> if (priv->btxpower_trackingInit && priv->btxpower_tracking)
> dm_txpower_reset_recovery(dev);
>
> - //
> - //Restore BB Initial Gain
> - //
> + /*
> + * Restore BB Initial Gain
> + */
> dm_bb_initialgain_restore(dev);
>
> -} // DM_RestoreDynamicMechanismState
> +} /* DM_RestoreDynamicMechanismState */
>
> static void dm_bb_initialgain_restore(struct net_device *dev)
> {
> struct r8192_priv *priv = ieee80211_priv(dev);
> - u32 bit_mask = 0x7f; //Bit0~ Bit6
> + u32 bit_mask = 0x7f; /* Bit0~ Bit6 */
>
> if(dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
> return;
>
> - //Disable Initial Gain
> - //PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800);
> - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // Only clear byte 1 and rewrite.
> + /* Disable Initial Gain */
> + /*PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800);*/
> + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); /* Only clear byte 1 and rewrite. */
> rtl8192_setBBreg(dev, rOFDM0_XAAGCCore1, bit_mask, (u32)priv->initgain_backup.xaagccore1);
> rtl8192_setBBreg(dev, rOFDM0_XBAGCCore1, bit_mask, (u32)priv->initgain_backup.xbagccore1);
> rtl8192_setBBreg(dev, rOFDM0_XCAGCCore1, bit_mask, (u32)priv->initgain_backup.xcagccore1);
> @@ -1670,36 +1681,36 @@ static void dm_bb_initialgain_restore(struct net_device *dev)
> RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc60 is %x\n",priv->initgain_backup.xcagccore1);
> RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xc68 is %x\n",priv->initgain_backup.xdagccore1);
> RT_TRACE(COMP_DIG, "dm_BBInitialGainRestore 0xa0a is %x\n",priv->initgain_backup.cca);
> - //Enable Initial Gain
> - //PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x100);
> - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); // Only clear byte 1 and rewrite.
> + /* Enable Initial Gain */
> + /*PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x100);*/
> + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); /* Only clear byte 1 and rewrite. */
>
> -} // dm_BBInitialGainRestore
> +} /* dm_BBInitialGainRestore */
>
>
> void dm_backup_dynamic_mechanism_state(struct net_device *dev)
> {
> struct r8192_priv *priv = ieee80211_priv(dev);
>
> - // Fsync to avoid reset
> + /* Fsync to avoid reset */
> priv->bswitch_fsync = false;
> priv->bfsync_processing = false;
> - //Backup BB InitialGain
> + /* Backup BB InitialGain */
> dm_bb_initialgain_backup(dev);
>
> -} // DM_BackupDynamicMechanismState
> +} /* DM_BackupDynamicMechanismState */
>
>
> static void dm_bb_initialgain_backup(struct net_device *dev)
> {
> struct r8192_priv *priv = ieee80211_priv(dev);
> - u32 bit_mask = bMaskByte0; //Bit0~ Bit6
> + u32 bit_mask = bMaskByte0; /* Bit0~ Bit6 */
>
> if(dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
> return;
>
> - //PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800);
> - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // Only clear byte 1 and rewrite.
> + /*PHY_SetBBReg(Adapter, UFWP, bMaskLWord, 0x800);*/
> + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); /* Only clear byte 1 and rewrite. */
> priv->initgain_backup.xaagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XAAGCCore1, bit_mask);
> priv->initgain_backup.xbagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XBAGCCore1, bit_mask);
> priv->initgain_backup.xcagccore1 = (u8)rtl8192_QueryBBReg(dev, rOFDM0_XCAGCCore1, bit_mask);
> @@ -1713,7 +1724,7 @@ static void dm_bb_initialgain_backup(struct net_device *dev)
> RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xc68 is %x\n",priv->initgain_backup.xdagccore1);
> RT_TRACE(COMP_DIG, "BBInitialGainBackup 0xa0a is %x\n",priv->initgain_backup.cca);
>
> -} // dm_BBInitialGainBakcup
> +} /* dm_BBInitialGainBakcup */
>
> #endif
> /*-----------------------------------------------------------------------------
> @@ -1824,7 +1835,7 @@ static void dm_dig_init(struct net_device *dev)
> /* 2007/10/05 MH Disable DIG scheme now. Not tested. */
> dm_digtable.dig_enable_flag = true;
> dm_digtable.dig_algorithm = DIG_ALGO_BY_RSSI;
> - dm_digtable.dbg_mode = DM_DBG_OFF; //off=by real rssi value, on=by DM_DigTable.Rssi_val for new dig
> + dm_digtable.dbg_mode = DM_DBG_OFF; /* off=by real rssi value, on=by DM_DigTable.Rssi_val for new dig */
> dm_digtable.dig_algorithm_switch = 0;
>
> /* 2007/10/04 MH Define init gain threshold. */
> @@ -1838,7 +1849,7 @@ static void dm_dig_init(struct net_device *dev)
> dm_digtable.rssi_high_power_lowthresh = DM_DIG_HIGH_PWR_THRESH_LOW;
> dm_digtable.rssi_high_power_highthresh = DM_DIG_HIGH_PWR_THRESH_HIGH;
>
> - dm_digtable.rssi_val = 50; //for new dig debug rssi value
> + dm_digtable.rssi_val = 50; /* for new dig debug rssi value */
> dm_digtable.backoff_val = DM_DIG_BACKOFF;
> dm_digtable.rx_gain_range_max = DM_DIG_MAX;
> if(priv->CustomerID == RT_CID_819x_Netcore)
> @@ -1876,7 +1887,7 @@ static void dm_ctrl_initgain_byrssi(struct net_device *dev)
> dm_ctrl_initgain_byrssi_by_fwfalse_alarm(dev);
> else if(dm_digtable.dig_algorithm == DIG_ALGO_BY_RSSI)
> dm_ctrl_initgain_byrssi_by_driverrssi(dev);
> -// ;
> + /* ; */
> else
> return;
> }
> @@ -1892,15 +1903,15 @@ static void dm_ctrl_initgain_byrssi_by_driverrssi(
> if (dm_digtable.dig_enable_flag == false)
> return;
>
> - //DbgPrint("Dig by Sw Rssi \n");
> - if(dm_digtable.dig_algorithm_switch) // if switched algorithm, we have to disable FW Dig.
> + /*DbgPrint("Dig by Sw Rssi \n");*/
> + if(dm_digtable.dig_algorithm_switch) /* if switched algorithm, we have to disable FW Dig. */
> fw_dig = 0;
> - if(fw_dig <= 3) // execute several times to make sure the FW Dig is disabled
> - {// FW DIG Off
> + if(fw_dig <= 3) { /* execute several times to make sure the FW Dig is disabled */
> + /* FW DIG Off */
> for(i=0; i<3; i++)
> - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // Only clear byte 1 and rewrite.
> + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); /* Only clear byte 1 and rewrite. */
> fw_dig++;
> - dm_digtable.dig_state = DM_STA_DIG_OFF; //fw dig off.
> + dm_digtable.dig_state = DM_STA_DIG_OFF; /* fw dig off. */
> }
>
> if(priv->ieee80211->state == IEEE80211_LINKED)
> @@ -1908,12 +1919,12 @@ static void dm_ctrl_initgain_byrssi_by_driverrssi(
> else
> dm_digtable.cur_connect_state = DIG_DISCONNECT;
>
> - //DbgPrint("DM_DigTable.PreConnectState = %d, DM_DigTable.CurConnectState = %d \n",
> - //DM_DigTable.PreConnectState, DM_DigTable.CurConnectState);
> + /*DbgPrint("DM_DigTable.PreConnectState = %d, DM_DigTable.CurConnectState = %d \n",
> + DM_DigTable.PreConnectState, DM_DigTable.CurConnectState);*/
>
> if(dm_digtable.dbg_mode == DM_DBG_OFF)
> dm_digtable.rssi_val = priv->undecorated_smoothed_pwdb;
> - //DbgPrint("DM_DigTable.Rssi_val = %d \n", DM_DigTable.Rssi_val);
> + /*DbgPrint("DM_DigTable.Rssi_val = %d \n", DM_DigTable.Rssi_val);*/
> dm_initial_gain(dev);
> dm_pd_th(dev);
> dm_cs_ratio(dev);
> @@ -1936,23 +1947,23 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
> if(dm_digtable.dig_algorithm_switch)
> {
> dm_digtable.dig_state = DM_STA_DIG_MAX;
> - // Fw DIG On.
> + /* Fw DIG On. */
> for(i=0; i<3; i++)
> - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); // Only clear byte 1 and rewrite.
> + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); /* Only clear byte 1 and rewrite.*/
> dm_digtable.dig_algorithm_switch = 0;
> }
>
> if (priv->ieee80211->state != IEEE80211_LINKED)
> return;
>
> - // For smooth, we can not change DIG state.
> + /* For smooth, we can not change DIG state. */
> if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_low_thresh) &&
> (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_thresh))
> {
> return;
> }
> - //DbgPrint("Dig by Fw False Alarm\n");
> - //if (DM_DigTable.Dig_State == DM_STA_DIG_OFF)
> + /*DbgPrint("Dig by Fw False Alarm\n");*/
> + /*if (DM_DigTable.Dig_State == DM_STA_DIG_OFF)*/
> /*DbgPrint("DIG Check\n\r RSSI=%d LOW=%d HIGH=%d STATE=%d",
> pHalData->UndecoratedSmoothedPWDB, DM_DigTable.RssiLowThresh,
> DM_DigTable.RssiHighThresh, DM_DigTable.Dig_State);*/
> @@ -1972,42 +1983,42 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
> reset_cnt = priv->reset_count;
> }
>
> - // If DIG is off, DIG high power state must reset.
> + /* If DIG is off, DIG high power state must reset. */
> dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX;
> dm_digtable.dig_state = DM_STA_DIG_OFF;
>
> - // 1.1 DIG Off.
> - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); // Only clear byte 1 and rewrite.
> + /* 1.1 DIG Off. */
> + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x8); /* Only clear byte 1 and rewrite. */
>
> - // 1.2 Set initial gain.
> + /* 1.2 Set initial gain. */
> write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x17);
> write_nic_byte(dev, rOFDM0_XBAGCCore1, 0x17);
> write_nic_byte(dev, rOFDM0_XCAGCCore1, 0x17);
> write_nic_byte(dev, rOFDM0_XDAGCCore1, 0x17);
>
> - // 1.3 Lower PD_TH for OFDM.
> + /* 1.3 Lower PD_TH for OFDM. */
> if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
> {
> - /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */
> - // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
> + /*
> + * 2008/01/11 MH 40MHZ 90/92 register are not the same.
> + * 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
> + */
> write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00);
> /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
> write_nic_byte(pAdapter, rOFDM0_RxDetector1, 0x40);
> + else if (pAdapter->HardwareType == HARDWARE_TYPE_RTL8192E)
> + else
> + PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x40);
> */
> - //else if (pAdapter->HardwareType == HARDWARE_TYPE_RTL8192E)
> -
> -
> - //else
> - //PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x40);
> }
> else
> write_nic_byte(dev, rOFDM0_RxDetector1, 0x42);
>
> - // 1.4 Lower CS ratio for CCK.
> + /* 1.4 Lower CS ratio for CCK. */
> write_nic_byte(dev, 0xa0a, 0x08);
>
> - // 1.5 Higher EDCCA.
> - //PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 0x325);
> + /* 1.5 Higher EDCCA. */
> + /*PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 0x325);*/
> return;
>
> }
> @@ -2033,10 +2044,12 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
> }
>
> dm_digtable.dig_state = DM_STA_DIG_ON;
> - //DbgPrint("DIG ON\n\r");
> + /*DbgPrint("DIG ON\n\r");*/
>
> - // 2.1 Set initial gain.
> - // 2008/02/26 MH SD3-Jerry suggest to prevent dirty environment.
> + /*
> + * 2.1 Set initial gain.
> + * 2008/02/26 MH SD3-Jerry suggest to prevent dirty environment.
> + */
> if (reset_flag == 1)
> {
> write_nic_byte(dev, rOFDM0_XAAGCCore1, 0x2c);
> @@ -2052,33 +2065,36 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
> write_nic_byte(dev, rOFDM0_XDAGCCore1, 0x20);
> }
>
> - // 2.2 Higher PD_TH for OFDM.
> + /* 2.2 Higher PD_TH for OFDM. */
> if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
> {
> - /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */
> - // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
> + /*
> + * 2008/01/11 MH 40MHZ 90/92 register are not the same.
> + * 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
> + */
> write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20);
> /*
> else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
> write_nic_byte(dev, rOFDM0_RxDetector1, 0x42);
> + else if (pAdapter->HardwareType == HARDWARE_TYPE_RTL8192E)
> + else
> + PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x42);
> */
> - //else if (pAdapter->HardwareType == HARDWARE_TYPE_RTL8192E)
> -
> - //else
> - //PlatformEFIOWrite1Byte(pAdapter, rOFDM0_RxDetector1, 0x42);
> }
> else
> write_nic_byte(dev, rOFDM0_RxDetector1, 0x44);
>
> - // 2.3 Higher CS ratio for CCK.
> + /* 2.3 Higher CS ratio for CCK. */
> write_nic_byte(dev, 0xa0a, 0xcd);
>
> - // 2.4 Lower EDCCA.
> - /* 2008/01/11 MH 90/92 series are the same. */
> - //PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 0x346);
> + /*
> + * 2.4 Lower EDCCA.
> + * 2008/01/11 MH 90/92 series are the same.
> + */
> + /*PlatformEFIOWrite4Byte(pAdapter, rOFDM0_ECCAThreshold, 0x346);*/
>
> - // 2.5 DIG On.
> - rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); // Only clear byte 1 and rewrite.
> + /* 2.5 DIG On. */
> + rtl8192_setBBreg(dev, UFWP, bMaskByte1, 0x1); /* Only clear byte 1 and rewrite. */
>
> }
>
> @@ -2109,16 +2125,19 @@ static void dm_ctrl_initgain_byrssi_highpwr(
> struct r8192_priv *priv = ieee80211_priv(dev);
> static u32 reset_cnt_highpwr;
>
> - // For smooth, we can not change high power DIG state in the range.
> + /* For smooth, we can not change high power DIG state in the range. */
> if ((priv->undecorated_smoothed_pwdb > dm_digtable.rssi_high_power_lowthresh) &&
> (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_highthresh))
> {
> return;
> }
>
> - /* 3. When RSSI >75% or <70%, it is a high power issue. We have to judge if
> - it is larger than a threshold and then execute the step below. */
> - // 2008/02/05 MH SD3-Jerry Modify PD_TH for high power issue.
> + /*
> + * 3. When RSSI >75% or <70%, it is a high power issue. We have to judge if
> + * it is larger than a threshold and then execute the step below.
> + *
> + * 2008/02/05 MH SD3-Jerry Modify PD_TH for high power issue.
> + */
> if (priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_power_highthresh)
> {
> if (dm_digtable.dig_highpwr_state == DM_STA_DIG_ON &&
> @@ -2127,7 +2146,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(
> else
> dm_digtable.dig_highpwr_state = DM_STA_DIG_ON;
>
> - // 3.1 Higher PD_TH for OFDM for high power state.
> + /* 3.1 Higher PD_TH for OFDM for high power state. */
> if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
> {
> write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10);
> @@ -2151,7 +2170,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(
> if (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_lowthresh &&
> priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh)
> {
> - // 3.2 Recover PD_TH for OFDM for normal power region.
> + /* 3.2 Recover PD_TH for OFDM for normal power region. */
> if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
> {
> write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20);
> @@ -2196,7 +2215,7 @@ static void dm_initial_gain(
> else
> dm_digtable.cur_ig_value = dm_digtable.rssi_val+10-dm_digtable.backoff_val;
> }
> - else //current state is disconnected
> + else /* current state is disconnected */
> {
> if(dm_digtable.cur_ig_value == 0)
> dm_digtable.cur_ig_value = priv->DefaultInitialGain[0];
> @@ -2204,14 +2223,14 @@ static void dm_initial_gain(
> dm_digtable.cur_ig_value = dm_digtable.pre_ig_value;
> }
> }
> - else // disconnected -> connected or connected -> disconnected
> + else /* disconnected -> connected or connected -> disconnected */
> {
> dm_digtable.cur_ig_value = priv->DefaultInitialGain[0];
> dm_digtable.pre_ig_value = 0;
> }
> - //DbgPrint("DM_DigTable.CurIGValue = 0x%x, DM_DigTable.PreIGValue = 0x%x\n", DM_DigTable.CurIGValue, DM_DigTable.PreIGValue);
> + /*DbgPrint("DM_DigTable.CurIGValue = 0x%x, DM_DigTable.PreIGValue = 0x%x\n", DM_DigTable.CurIGValue, DM_DigTable.PreIGValue);*/
>
> - // if silent reset happened, we should rewrite the values back
> + /* if silent reset happened, we should rewrite the values back */
> if(priv->reset_count != reset_cnt)
> {
> force_write = 1;
> @@ -2227,8 +2246,8 @@ static void dm_initial_gain(
> || !initialized || force_write)
> {
> initial_gain = (u8)dm_digtable.cur_ig_value;
> - //DbgPrint("Write initial gain = 0x%x\n", initial_gain);
> - // Set initial gain.
> + /*DbgPrint("Write initial gain = 0x%x\n", initial_gain);*/
> + /* Set initial gain. */
> write_nic_byte(dev, rOFDM0_XAAGCCore1, initial_gain);
> write_nic_byte(dev, rOFDM0_XBAGCCore1, initial_gain);
> write_nic_byte(dev, rOFDM0_XCAGCCore1, initial_gain);
> @@ -2272,12 +2291,12 @@ static void dm_pd_th(
> dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER;
> }
> }
> - else // disconnected -> connected or connected -> disconnected
> + else /* disconnected -> connected or connected -> disconnected */
> {
> dm_digtable.curpd_thstate = DIG_PD_AT_LOW_POWER;
> }
>
> - // if silent reset happened, we should rewrite the values back
> + /* if silent reset happened, we should rewrite the values back */
> if(priv->reset_count != reset_cnt)
> {
> force_write = 1;
> @@ -2288,14 +2307,16 @@ static void dm_pd_th(
> if((dm_digtable.prepd_thstate != dm_digtable.curpd_thstate) ||
> (initialized<=3) || force_write)
> {
> - //DbgPrint("Write PD_TH state = %d\n", DM_DigTable.CurPD_THState);
> + /*DbgPrint("Write PD_TH state = %d\n", DM_DigTable.CurPD_THState);*/
> if(dm_digtable.curpd_thstate == DIG_PD_AT_LOW_POWER)
> {
> - // Lower PD_TH for OFDM.
> + /* Lower PD_TH for OFDM. */
> if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
> {
> - /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */
> - // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
> + /*
> + * 2008/01/11 MH 40MHZ 90/92 register are not the same.
> + * 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
> + */
> write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00);
> /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
> write_nic_byte(dev, rOFDM0_RxDetector1, 0x40);
> @@ -2306,11 +2327,13 @@ static void dm_pd_th(
> }
> else if(dm_digtable.curpd_thstate == DIG_PD_AT_NORMAL_POWER)
> {
> - // Higher PD_TH for OFDM.
> + /* Higher PD_TH for OFDM. */
> if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
> {
> - /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */
> - // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
> + /*
> + * 2008/01/11 MH 40MHZ 90/92 register are not the same.
> + * 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same.
> + */
> write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20);
> /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P)
> write_nic_byte(dev, rOFDM0_RxDetector1, 0x42);
> @@ -2321,7 +2344,7 @@ static void dm_pd_th(
> }
> else if(dm_digtable.curpd_thstate == DIG_PD_AT_HIGH_POWER)
> {
> - // Higher PD_TH for OFDM for high power state.
> + /* Higher PD_TH for OFDM for high power state. */
> if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
> {
> write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10);
> @@ -2369,12 +2392,12 @@ static void dm_cs_ratio(
> dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER;
> }
> }
> - else // disconnected -> connected or connected -> disconnected
> + else /* disconnected -> connected or connected -> disconnected */
> {
> dm_digtable.curcs_ratio_state = DIG_CS_RATIO_LOWER;
> }
>
> - // if silent reset happened, we should rewrite the values back
> + /* if silent reset happened, we should rewrite the values back */
> if(priv->reset_count != reset_cnt)
> {
> force_write = 1;
> @@ -2386,15 +2409,15 @@ static void dm_cs_ratio(
> if((dm_digtable.precs_ratio_state != dm_digtable.curcs_ratio_state) ||
> !initialized || force_write)
> {
> - //DbgPrint("Write CS_ratio state = %d\n", DM_DigTable.CurCS_ratioState);
> + /*DbgPrint("Write CS_ratio state = %d\n", DM_DigTable.CurCS_ratioState);*/
> if(dm_digtable.curcs_ratio_state == DIG_CS_RATIO_LOWER)
> {
> - // Lower CS ratio for CCK.
> + /* Lower CS ratio for CCK. */
> write_nic_byte(dev, 0xa0a, 0x08);
> }
> else if(dm_digtable.curcs_ratio_state == DIG_CS_RATIO_HIGHER)
> {
> - // Higher CS ratio for CCK.
> + /* Higher CS ratio for CCK. */
> write_nic_byte(dev, 0xa0a, 0xcd);
> }
> dm_digtable.precs_ratio_state = dm_digtable.curcs_ratio_state;
> @@ -2411,41 +2434,41 @@ void dm_init_edca_turbo(struct net_device *dev)
> priv->bcurrent_turbo_EDCA = false;
> priv->ieee80211->bis_any_nonbepkts = false;
> priv->bis_cur_rdlstate = false;
> -} // dm_init_edca_turbo
> +} /* dm_init_edca_turbo */
>
> static void dm_check_edca_turbo(
> struct net_device *dev)
> {
> struct r8192_priv *priv = ieee80211_priv(dev);
> PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo;
> - //PSTA_QOS pStaQos = pMgntInfo->pStaQos;
> + /*PSTA_QOS pStaQos = pMgntInfo->pStaQos;*/
>
> - // Keep past Tx/Rx packet count for RT-to-RT EDCA turbo.
> + /* Keep past Tx/Rx packet count for RT-to-RT EDCA turbo. */
> static unsigned long lastTxOkCnt;
> static unsigned long lastRxOkCnt;
> unsigned long curTxOkCnt = 0;
> unsigned long curRxOkCnt = 0;
>
> - //
> - // Do not be Turbo if it's under WiFi config and Qos Enabled, because the EDCA parameters
> - // should follow the settings from QAP. By Bruce, 2007-12-07.
> - //
> + /*
> + * Do not be Turbo if it's under WiFi config and Qos Enabled, because the EDCA parameters
> + * should follow the settings from QAP. By Bruce, 2007-12-07.
> + */
> if(priv->ieee80211->state != IEEE80211_LINKED)
> goto dm_CheckEdcaTurbo_EXIT;
> - // We do not turn on EDCA turbo mode for some AP that has IOT issue
> + /* We do not turn on EDCA turbo mode for some AP that has IOT issue */
> if(priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_DISABLE_EDCA_TURBO)
> goto dm_CheckEdcaTurbo_EXIT;
>
> -// printk("========>%s():bis_any_nonbepkts is %d\n",__func__,priv->bis_any_nonbepkts);
> - // Check the status for current condition.
> + /*printk("========>%s():bis_any_nonbepkts is %d\n",__func__,priv->bis_any_nonbepkts);*/
> + /* Check the status for current condition. */
> if(!priv->ieee80211->bis_any_nonbepkts)
> {
> curTxOkCnt = priv->stats.txbytesunicast - lastTxOkCnt;
> curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt;
> - // For RT-AP, we needs to turn it on when Rx>Tx
> + /* For RT-AP, we needs to turn it on when Rx>Tx */
> if(curRxOkCnt > 4*curTxOkCnt)
> {
> - //printk("%s():curRxOkCnt > 4*curTxOkCnt\n");
> + /*printk("%s():curRxOkCnt > 4*curTxOkCnt\n");*/
> if(!priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA)
> {
> write_nic_dword(dev, EDCAPARA_BE, edca_setting_DL[pHTInfo->IOTPeer]);
> @@ -2455,7 +2478,7 @@ static void dm_check_edca_turbo(
> else
> {
>
> - //printk("%s():curRxOkCnt < 4*curTxOkCnt\n");
> + /*printk("%s():curRxOkCnt < 4*curTxOkCnt\n");*/
> if(priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA)
> {
> write_nic_dword(dev, EDCAPARA_BE, edca_setting_UL[pHTInfo->IOTPeer]);
> @@ -2468,10 +2491,10 @@ static void dm_check_edca_turbo(
> }
> else
> {
> - //
> - // Turn Off EDCA turbo here.
> - // Restore original EDCA according to the declaration of AP.
> - //
> + /*
> + * Turn Off EDCA turbo here.
> + * Restore original EDCA according to the declaration of AP.
> + */
> if(priv->bcurrent_turbo_EDCA)
> {
>
> @@ -2481,30 +2504,29 @@ static void dm_check_edca_turbo(
> struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
> u8 mode = priv->ieee80211->mode;
>
> - // For Each time updating EDCA parameter, reset EDCA turbo mode status.
> + /* For Each time updating EDCA parameter, reset EDCA turbo mode status. */
> dm_init_edca_turbo(dev);
> u1bAIFS = qos_parameters->aifs[0] * ((mode&(IEEE_G|IEEE_N_24G)) ?9:20) + aSifsTime;
> u4bAcParam = ((((u32)(qos_parameters->tx_op_limit[0]))<< AC_PARAM_TXOP_LIMIT_OFFSET)|
> (((u32)(qos_parameters->cw_max[0]))<< AC_PARAM_ECW_MAX_OFFSET)|
> (((u32)(qos_parameters->cw_min[0]))<< AC_PARAM_ECW_MIN_OFFSET)|
> ((u32)u1bAIFS << AC_PARAM_AIFS_OFFSET));
> - //write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);
> + /*write_nic_dword(dev, WDCAPARA_ADD[i], u4bAcParam);*/
> write_nic_dword(dev, EDCAPARA_BE, u4bAcParam);
>
> - // Check ACM bit.
> - // If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13.
> + /*
> + * Check ACM bit.
> + * If it is set, immediately set ACM control bit to downgrading AC for passing WMM testplan. Annie, 2005-12-13.
> + */
> {
> - // TODO: Modified this part and try to set acm control in only 1 IO processing!!
> + /* TODO: Modified this part and try to set acm control in only 1 IO processing!! */
>
> PACI_AIFSN pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]);
> u8 AcmCtrl;
> read_nic_byte(dev, AcmHwCtrl, &AcmCtrl);
> - if(pAciAifsn->f.ACM)
> - { // ACM bit is 1.
> + if(pAciAifsn->f.ACM) { /* ACM bit is 1. */
> AcmCtrl |= AcmHw_BeqEn;
> - }
> - else
> - { // ACM bit is 0.
> + } else { /* ACM bit is 0. */
> AcmCtrl &= (~AcmHw_BeqEn);
> }
>
> @@ -2518,11 +2540,11 @@ static void dm_check_edca_turbo(
>
>
> dm_CheckEdcaTurbo_EXIT:
> - // Set variables for next time.
> + /* Set variables for next time. */
> priv->ieee80211->bis_any_nonbepkts = false;
> lastTxOkCnt = priv->stats.txbytesunicast;
> lastRxOkCnt = priv->stats.rxbytesunicast;
> -} // dm_CheckEdcaTurbo
> +} /* dm_CheckEdcaTurbo */
>
> static void dm_init_ctstoself(struct net_device *dev)
> {
> @@ -2556,12 +2578,12 @@ static void dm_ctstoself(struct net_device *dev)
> {
> curTxOkCnt = priv->stats.txbytesunicast - lastTxOkCnt;
> curRxOkCnt = priv->stats.rxbytesunicast - lastRxOkCnt;
> - if(curRxOkCnt > 4*curTxOkCnt) //downlink, disable CTS to self
> + if(curRxOkCnt > 4*curTxOkCnt) /* downlink, disable CTS to self */
> {
> pHTInfo->IOTAction &= ~HT_IOT_ACT_FORCED_CTS2SELF;
> - //DbgPrint("dm_CTSToSelf() ==> CTS to self disabled -- downlink\n");
> + /*DbgPrint("dm_CTSToSelf() ==> CTS to self disabled -- downlink\n");*/
> }
> - else //uplink
> + else /* uplink */
> {
> pHTInfo->IOTAction |= HT_IOT_ACT_FORCED_CTS2SELF;
> }
> @@ -2599,8 +2621,10 @@ static void dm_check_pbc_gpio(struct net_device *dev)
>
> if (tmp1byte&BIT6 || tmp1byte&BIT0)
> {
> - // Here we only set bPbcPressed to TRUE
> - // After trigger PBC, the variable will be set to FALSE
> + /*
> + * Here we only set bPbcPressed to TRUE
> + * After trigger PBC, the variable will be set to FALSE
> + */
> RT_TRACE(COMP_IO, "CheckPbcGPIO - PBC is pressed\n");
> priv->bpbc_pressed = true;
> }
> @@ -2628,7 +2652,7 @@ void dm_rf_pathcheck_workitemcallback(struct work_struct *work)
> struct delayed_work *dwork = container_of(work,struct delayed_work,work);
> struct r8192_priv *priv = container_of(dwork,struct r8192_priv,rfpath_check_wq);
> struct net_device *dev =priv->ieee80211->dev;
> - //bool bactually_set = false;
> + /*bool bactually_set = false;*/
> u8 rfpath = 0, i;
>
>
> @@ -2636,7 +2660,7 @@ void dm_rf_pathcheck_workitemcallback(struct work_struct *work)
> always be the same. We only read 0xc04 now. */
> read_nic_byte(dev, 0xc04, &rfpath);
>
> - // Check Bit 0-3, it means if RF A-D is enabled.
> + /* Check Bit 0-3, it means if RF A-D is enabled. */
> for (i = 0; i < RF90_PATH_MAX; i++)
> {
> if (rfpath & (0x01<<i))
> @@ -2654,7 +2678,7 @@ static void dm_init_rxpath_selection(struct net_device *dev)
> {
> u8 i;
> struct r8192_priv *priv = ieee80211_priv(dev);
> - DM_RxPathSelTable.Enable = 1; //default enabled
> + DM_RxPathSelTable.Enable = 1; /* default enabled */
> DM_RxPathSelTable.SS_TH_low = RxPathSelection_SS_TH_low;
> DM_RxPathSelTable.diff_TH = RxPathSelection_diff_TH;
> if(priv->CustomerID == RT_CID_819x_Netcore)
> @@ -2676,8 +2700,8 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
> struct r8192_priv *priv = ieee80211_priv(dev);
> u8 i, max_rssi_index=0, min_rssi_index=0, sec_rssi_index=0, rf_num=0;
> u8 tmp_max_rssi=0, tmp_min_rssi=0, tmp_sec_rssi=0;
> - u8 cck_default_Rx=0x2; //RF-C
> - u8 cck_optional_Rx=0x3;//RF-D
> + u8 cck_default_Rx=0x2; /* RF-C */
> + u8 cck_optional_Rx=0x3; /* RF-D */
> long tmp_cck_max_pwdb=0, tmp_cck_min_pwdb=0, tmp_cck_sec_pwdb=0;
> u8 cck_rx_ver2_max_index=0, cck_rx_ver2_min_index=0, cck_rx_ver2_sec_index=0;
> u8 cur_rf_rssi;
> @@ -2700,11 +2724,11 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
>
> if(priv->ieee80211->mode == WIRELESS_MODE_B)
> {
> - DM_RxPathSelTable.cck_method = CCK_Rx_Version_2; //pure B mode, fixed cck version2
> - //DbgPrint("Pure B mode, use cck rx version2 \n");
> + DM_RxPathSelTable.cck_method = CCK_Rx_Version_2; /* pure B mode, fixed cck version2 */
> + /*DbgPrint("Pure B mode, use cck rx version2 \n");*/
> }
>
> - //decide max/sec/min rssi index
> + /* decide max/sec/min rssi index */
> for (i=0; i<RF90_PATH_MAX; i++)
> {
> if(!DM_RxPathSelTable.DbgMode)
> @@ -2715,13 +2739,13 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
> rf_num++;
> cur_rf_rssi = DM_RxPathSelTable.rf_rssi[i];
>
> - if(rf_num == 1) // find first enabled rf path and the rssi values
> - { //initialize, set all rssi index to the same one
> + if(rf_num == 1) { /* find first enabled rf path and the rssi values */
> + /* initialize, set all rssi index to the same one */
> max_rssi_index = min_rssi_index = sec_rssi_index = i;
> tmp_max_rssi = tmp_min_rssi = tmp_sec_rssi = cur_rf_rssi;
> }
> else if(rf_num == 2)
> - { // we pick up the max index first, and let sec and min to be the same one
> + { /* we pick up the max index first, and let sec and min to be the same one */
> if(cur_rf_rssi >= tmp_max_rssi)
> {
> tmp_max_rssi = cur_rf_rssi;
> @@ -2743,7 +2767,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
> max_rssi_index = i;
> }
> else if(cur_rf_rssi == tmp_max_rssi)
> - { // let sec and min point to the different index
> + { /* let sec and min point to the different index */
> tmp_sec_rssi = cur_rf_rssi;
> sec_rssi_index = i;
> }
> @@ -2754,30 +2778,30 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
> }
> else if(cur_rf_rssi == tmp_sec_rssi)
> {
> - if(tmp_sec_rssi == tmp_min_rssi)
> - { // let sec and min point to the different index
> + if(tmp_sec_rssi == tmp_min_rssi) {
> + /* let sec and min point to the different index */
> tmp_sec_rssi = cur_rf_rssi;
> sec_rssi_index = i;
> }
> else
> {
> - // This case we don't need to set any index
> + /* This case we don't need to set any index */
> }
> }
> else if((cur_rf_rssi < tmp_sec_rssi) && (cur_rf_rssi > tmp_min_rssi))
> {
> - // This case we don't need to set any index
> + /* This case we don't need to set any index */
> }
> else if(cur_rf_rssi == tmp_min_rssi)
> {
> - if(tmp_sec_rssi == tmp_min_rssi)
> - { // let sec and min point to the different index
> + if(tmp_sec_rssi == tmp_min_rssi) {
> + /* let sec and min point to the different index */
> tmp_min_rssi = cur_rf_rssi;
> min_rssi_index = i;
> }
> else
> {
> - // This case we don't need to set any index
> + /* This case we don't need to set any index */
> }
> }
> else if(cur_rf_rssi < tmp_min_rssi)
> @@ -2790,7 +2814,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
> }
>
> rf_num = 0;
> - // decide max/sec/min cck pwdb index
> + /* decide max/sec/min cck pwdb index */
> if(DM_RxPathSelTable.cck_method == CCK_Rx_Version_2)
> {
> for (i=0; i<RF90_PATH_MAX; i++)
> @@ -2800,13 +2824,12 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
> rf_num++;
> cur_cck_pwdb = DM_RxPathSelTable.cck_pwdb_sta[i];
>
> - if(rf_num == 1) // find first enabled rf path and the rssi values
> - { //initialize, set all rssi index to the same one
> + if(rf_num == 1) /* find first enabled rf path and the rssi values */
> + { /* initialize, set all rssi index to the same one */
> cck_rx_ver2_max_index = cck_rx_ver2_min_index = cck_rx_ver2_sec_index = i;
> tmp_cck_max_pwdb = tmp_cck_min_pwdb = tmp_cck_sec_pwdb = cur_cck_pwdb;
> }
> - else if(rf_num == 2)
> - { // we pick up the max index first, and let sec and min to be the same one
> + else if(rf_num == 2) { /* we pick up the max index first, and let sec and min to be the same one */
> if(cur_cck_pwdb >= tmp_cck_max_pwdb)
> {
> tmp_cck_max_pwdb = cur_cck_pwdb;
> @@ -2827,8 +2850,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
> tmp_cck_max_pwdb = cur_cck_pwdb;
> cck_rx_ver2_max_index = i;
> }
> - else if(cur_cck_pwdb == tmp_cck_max_pwdb)
> - { // let sec and min point to the different index
> + else if(cur_cck_pwdb == tmp_cck_max_pwdb) { /* let sec and min point to the different index */
> tmp_cck_sec_pwdb = cur_cck_pwdb;
> cck_rx_ver2_sec_index = i;
> }
> @@ -2839,30 +2861,28 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
> }
> else if(cur_cck_pwdb == tmp_cck_sec_pwdb)
> {
> - if(tmp_cck_sec_pwdb == tmp_cck_min_pwdb)
> - { // let sec and min point to the different index
> + if(tmp_cck_sec_pwdb == tmp_cck_min_pwdb) { /* let sec and min point to the different index */
> tmp_cck_sec_pwdb = cur_cck_pwdb;
> cck_rx_ver2_sec_index = i;
> }
> else
> {
> - // This case we don't need to set any index
> + /* This case we don't need to set any index */
> }
> }
> else if((cur_cck_pwdb < tmp_cck_sec_pwdb) && (cur_cck_pwdb > tmp_cck_min_pwdb))
> {
> - // This case we don't need to set any index
> + /* This case we don't need to set any index */
> }
> else if(cur_cck_pwdb == tmp_cck_min_pwdb)
> {
> - if(tmp_cck_sec_pwdb == tmp_cck_min_pwdb)
> - { // let sec and min point to the different index
> + if(tmp_cck_sec_pwdb == tmp_cck_min_pwdb) { /* let sec and min point to the different index */
> tmp_cck_min_pwdb = cur_cck_pwdb;
> cck_rx_ver2_min_index = i;
> }
> else
> {
> - // This case we don't need to set any index
> + /* This case we don't need to set any index */
> }
> }
> else if(cur_cck_pwdb < tmp_cck_min_pwdb)
> @@ -2877,8 +2897,10 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
> }
>
>
> - // Set CCK Rx path
> - // reg0xA07[3:2]=cck default rx path, reg0xa07[1:0]=cck optional rx path.
> + /*
> + * Set CCK Rx path
> + * reg0xA07[3:2]=cck default rx path, reg0xa07[1:0]=cck optional rx path.
> + */
> update_cck_rx_path = 0;
> if(DM_RxPathSelTable.cck_method == CCK_Rx_Version_2)
> {
> @@ -2892,11 +2914,11 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
> {
> if((tmp_max_rssi - tmp_min_rssi) >= DM_RxPathSelTable.diff_TH)
> {
> - //record the enabled rssi threshold
> + /* record the enabled rssi threshold */
> DM_RxPathSelTable.rf_enable_rssi_th[min_rssi_index] = tmp_max_rssi+5;
> - //disable the BB Rx path, OFDM
> - rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x1<<min_rssi_index, 0x0); // 0xc04[3:0]
> - rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x1<<min_rssi_index, 0x0); // 0xd04[3:0]
> + /* disable the BB Rx path, OFDM */
> + rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x1<<min_rssi_index, 0x0); /* 0xc04[3:0] */
> + rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x1<<min_rssi_index, 0x0); /* 0xd04[3:0] */
> disabled_rf_cnt++;
> }
> if(DM_RxPathSelTable.cck_method == CCK_Rx_Version_1)
> @@ -2918,14 +2940,14 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
> {
> for(i=0; i<4; i++)
> {
> - if((DM_RxPathSelTable.disabledRF>>i) & 0x1) //disabled rf
> + if((DM_RxPathSelTable.disabledRF>>i) & 0x1) /* disabled rf */
> {
> if(tmp_max_rssi >= DM_RxPathSelTable.rf_enable_rssi_th[i])
> {
> - //enable the BB Rx path
> - //DbgPrint("RF-%d is enabled. \n", 0x1<<i);
> - rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x1<<i, 0x1); // 0xc04[3:0]
> - rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x1<<i, 0x1); // 0xd04[3:0]
> + /* enable the BB Rx path */
> + /*DbgPrint("RF-%d is enabled. \n", 0x1<<i);*/
> + rtl8192_setBBreg(dev, rOFDM0_TRxPathEnable, 0x1<<i, 0x1); /* 0xc04[3:0] */
> + rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 0x1<<i, 0x1); /* 0xd04[3:0] */
> DM_RxPathSelTable.rf_enable_rssi_th[i] = 100;
> disabled_rf_cnt--;
> }
> @@ -2969,7 +2991,7 @@ static void dm_init_fsync (struct net_device *dev)
> priv->ieee80211->fsync_firstdiff_ratethreshold= 100;
> priv->ieee80211->fsync_seconddiff_ratethreshold= 200;
> priv->ieee80211->fsync_state = Default_Fsync;
> - priv->framesyncMonitor = 1; // current default 0xc38 monitor on
> + priv->framesyncMonitor = 1; /* current default 0xc38 monitor on */
>
> init_timer(&priv->fsync_timer);
> priv->fsync_timer.data = (unsigned long)dev;
> @@ -2995,7 +3017,7 @@ void dm_fsync_timer_callback(unsigned long data)
> priv->ieee80211->bfsync_enable &&
> (priv->ieee80211->pHTInfo->IOTAction & HT_IOT_ACT_CDD_FSYNC))
> {
> - // Count rate 54, MCS [7], [12, 13, 14, 15]
> + /* Count rate 54, MCS [7], [12, 13, 14, 15] */
> u32 rate_bitmap;
> for(rate_index = 0; rate_index <= 27; rate_index++)
> {
> @@ -3012,13 +3034,13 @@ void dm_fsync_timer_callback(unsigned long data)
> {
>
> u32 DiffNum = priv->rateCountDiffRecord - rate_count_diff;
> - // Continue count
> + /* Continue count */
> if(DiffNum >= priv->ieee80211->fsync_seconddiff_ratethreshold)
> priv->ContinueDiffCount++;
> else
> priv->ContinueDiffCount = 0;
>
> - // Continue count over
> + /* Continue count over */
> if(priv->ContinueDiffCount >=2)
> {
> bSwitchFromCountDiff = true;
> @@ -3027,11 +3049,11 @@ void dm_fsync_timer_callback(unsigned long data)
> }
> else
> {
> - // Stop the continued count
> + /* Stop the continued count */
> priv->ContinueDiffCount = 0;
> }
>
> - //If Count diff <= FsyncRateCountThreshold
> + /* If Count diff <= FsyncRateCountThreshold */
> if(rate_count_diff <= priv->ieee80211->fsync_firstdiff_ratethreshold)
> {
> bSwitchFromCountDiff = true;
> @@ -3040,7 +3062,7 @@ void dm_fsync_timer_callback(unsigned long data)
> priv->rate_record = rate_count;
> priv->rateCountDiffRecord = rate_count_diff;
> RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", priv->rate_record, rate_count, rate_count_diff , priv->bswitch_fsync);
> - // if we never receive those mcs rate and rssi > 30 % then switch fsyn
> + /* if we never receive those mcs rate and rssi > 30 % then switch fsyn */
> if(priv->undecorated_smoothed_pwdb > priv->ieee80211->fsync_rssi_threshold && bSwitchFromCountDiff)
> {
> bDoubleTimeInterval = true;
> @@ -3080,7 +3102,7 @@ void dm_fsync_timer_callback(unsigned long data)
> }
> else
> {
> - // Let Register return to default value;
> + /* Let Register return to default value; */
> if(priv->bswitch_fsync)
> {
> priv->bswitch_fsync = false;
> @@ -3108,7 +3130,7 @@ static void dm_EndSWFsync(struct net_device *dev)
> RT_TRACE(COMP_HALDM, "%s\n", __func__);
> del_timer_sync(&(priv->fsync_timer));
>
> - // Let Register return to default value;
> + /* Let Register return to default value; */
> if(priv->bswitch_fsync)
> {
> priv->bswitch_fsync = false;
> @@ -3130,9 +3152,9 @@ static void dm_StartSWFsync(struct net_device *dev)
> u32 rateBitmap;
>
> RT_TRACE(COMP_HALDM, "%s\n", __func__);
> - // Initial rate record to zero, start to record.
> + /* Initial rate record to zero, start to record. */
> priv->rate_record = 0;
> - // Initialize continue diff count to zero, start to record.
> + /* Initialize continue diff count to zero, start to record. */
> priv->ContinueDiffCount = 0;
> priv->rateCountDiffRecord = 0;
> priv->bswitch_fsync = false;
> @@ -3176,7 +3198,7 @@ void dm_check_fsync(struct net_device *dev)
> #define RegC38_NonFsync_Other_AP 1
> #define RegC38_Fsync_AP_BCM 2
> struct r8192_priv *priv = ieee80211_priv(dev);
> - //u32 framesyncC34;
> + /*u32 framesyncC34;*/
> static u8 reg_c38_State=RegC38_Default;
> static u32 reset_cnt;
>
> @@ -3226,7 +3248,7 @@ void dm_check_fsync(struct net_device *dev)
> if(priv->framesyncMonitor)
> {
> if(reg_c38_State != RegC38_Fsync_AP_BCM)
> - { //For broadcom AP we write different default value
> + { /* For broadcom AP we write different default value */
> write_nic_byte(dev, rOFDM0_RxDetector3, 0x95);
>
> reg_c38_State = RegC38_Fsync_AP_BCM;
> @@ -3269,7 +3291,7 @@ void dm_check_fsync(struct net_device *dev)
> {
> write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync);
> reg_c38_State = RegC38_Default;
> - //DbgPrint("Fsync is idle, rssi>=40, write 0xc38 = 0x%x \n", pHalData->framesync);
> + /*DbgPrint("Fsync is idle, rssi>=40, write 0xc38 = 0x%x \n", pHalData->framesync);*/
> }
> }
> }
> @@ -3279,19 +3301,18 @@ void dm_check_fsync(struct net_device *dev)
> {
> write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync);
> reg_c38_State = RegC38_Default;
> - //DbgPrint("Fsync is idle, not connected, write 0xc38 = 0x%x \n", pHalData->framesync);
> + /*DbgPrint("Fsync is idle, not connected, write 0xc38 = 0x%x \n", pHalData->framesync);*/
> }
> }
> }
> }
> if(priv->framesyncMonitor)
> {
> - if(priv->reset_count != reset_cnt)
> - { //After silent reset, the reg_c38_State will be returned to default value
> + if(priv->reset_count != reset_cnt) { /* After silent reset, the reg_c38_State will be returned to default value */
> write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync);
> reg_c38_State = RegC38_Default;
> reset_cnt = priv->reset_count;
> - //DbgPrint("reg_c38_State = 0 for silent reset. \n");
> + /*DbgPrint("reg_c38_State = 0 for silent reset. \n");*/
> }
> }
> else
> @@ -3300,7 +3321,7 @@ void dm_check_fsync(struct net_device *dev)
> {
> write_nic_byte(dev, rOFDM0_RxDetector3, priv->framesync);
> reg_c38_State = RegC38_Default;
> - //DbgPrint("framesync no monitor, write 0xc38 = 0x%x \n", pHalData->framesync);
> + /*DbgPrint("framesync no monitor, write 0xc38 = 0x%x \n", pHalData->framesync);*/
> }
> }
> }
> @@ -3331,7 +3352,7 @@ void dm_shadow_init(struct net_device *dev)
> for (offset = 0; offset < 256; offset++)
> {
> read_nic_byte(dev, offset+page*256, &dm_shadow[page][offset]);
> - //DbgPrint("P-%d/O-%02x=%02x\r\n", page, offset, DM_Shadow[page][offset]);
> + /*DbgPrint("P-%d/O-%02x=%02x\r\n", page, offset, DM_Shadow[page][offset]);*/
> }
>
> for (page = 8; page < 11; page++)
> @@ -3366,8 +3387,8 @@ static void dm_init_dynamic_txpower(struct net_device *dev)
> {
> struct r8192_priv *priv = ieee80211_priv(dev);
>
> - //Initial TX Power Control for near/far range , add by amy 2008/05/15, porting from windows code.
> - priv->ieee80211->bdynamic_txpower_enable = true; //Default to enable Tx Power Control
> + /* Initial TX Power Control for near/far range , add by amy 2008/05/15, porting from windows code. */
> + priv->ieee80211->bdynamic_txpower_enable = true; /* Default to enable Tx Power Control */
> priv->bLastDTPFlag_High = false;
> priv->bLastDTPFlag_Low = false;
> priv->bDynamicTxHighPower = false;
> @@ -3385,7 +3406,7 @@ static void dm_dynamic_txpower(struct net_device *dev)
> priv->bDynamicTxLowPower = false;
> return;
> }
> - //printk("priv->ieee80211->current_network.unknown_cap_exist is %d ,priv->ieee80211->current_network.broadcom_cap_exist is %d\n",priv->ieee80211->current_network.unknown_cap_exist,priv->ieee80211->current_network.broadcom_cap_exist);
> + /*printk("priv->ieee80211->current_network.unknown_cap_exist is %d ,priv->ieee80211->current_network.broadcom_cap_exist is %d\n",priv->ieee80211->current_network.unknown_cap_exist,priv->ieee80211->current_network.broadcom_cap_exist);*/
> if((priv->ieee80211->current_network.atheros_cap_exist) && (priv->ieee80211->mode == IEEE_G)){
> txhipower_threshhold = TX_POWER_ATHEROAP_THRESH_HIGH;
> txlowpower_threshold = TX_POWER_ATHEROAP_THRESH_LOW;
> @@ -3396,7 +3417,7 @@ static void dm_dynamic_txpower(struct net_device *dev)
> txlowpower_threshold = TX_POWER_NEAR_FIELD_THRESH_LOW;
> }
>
> -// printk("=======>%s(): txhipower_threshhold is %d,txlowpower_threshold is %d\n",__func__,txhipower_threshhold,txlowpower_threshold);
> + /*printk("=======>%s(): txhipower_threshhold is %d,txlowpower_threshold is %d\n",__func__,txhipower_threshhold,txlowpower_threshold);*/
> RT_TRACE(COMP_TXAGC,"priv->undecorated_smoothed_pwdb = %ld \n" , priv->undecorated_smoothed_pwdb);
>
> if(priv->ieee80211->state == IEEE80211_LINKED)
> @@ -3408,12 +3429,12 @@ static void dm_dynamic_txpower(struct net_device *dev)
> }
> else
> {
> - // high power state check
> + /* high power state check */
> if(priv->undecorated_smoothed_pwdb < txlowpower_threshold && priv->bDynamicTxHighPower == true)
> {
> priv->bDynamicTxHighPower = false;
> }
> - // low power state check
> + /* low power state check */
> if(priv->undecorated_smoothed_pwdb < 35)
> {
> priv->bDynamicTxLowPower = true;
> @@ -3426,7 +3447,7 @@ static void dm_dynamic_txpower(struct net_device *dev)
> }
> else
> {
> - //pHalData->bTXPowerCtrlforNearFarRange = !pHalData->bTXPowerCtrlforNearFarRange;
> + /*pHalData->bTXPowerCtrlforNearFarRange = !pHalData->bTXPowerCtrlforNearFarRange;*/
> priv->bDynamicTxHighPower = false;
> priv->bDynamicTxLowPower = false;
> }
> @@ -3441,27 +3462,27 @@ static void dm_dynamic_txpower(struct net_device *dev)
> #endif
>
> rtl8192_phy_setTxPower(dev,priv->ieee80211->current_network.channel);
> - //pHalData->bStartTxCtrlByTPCNFR = FALSE; //Clear th flag of Set TX Power from Sitesurvey
> + /*pHalData->bStartTxCtrlByTPCNFR = FALSE; Clear th flag of Set TX Power from Sitesurvey*/
> }
> priv->bLastDTPFlag_High = priv->bDynamicTxHighPower;
> priv->bLastDTPFlag_Low = priv->bDynamicTxLowPower;
>
> } /* dm_dynamic_txpower */
>
> -//added by vivi, for read tx rate and retrycount
> +/*added by vivi, for read tx rate and retrycount */
> static void dm_check_txrateandretrycount(struct net_device *dev)
> {
> struct r8192_priv *priv = ieee80211_priv(dev);
> struct ieee80211_device *ieee = priv->ieee80211;
> - //for 11n tx rate
> -// priv->stats.CurrentShowTxate = read_nic_byte(dev, Current_Tx_Rate_Reg);
> + /* for 11n tx rate */
> + /*priv->stats.CurrentShowTxate = read_nic_byte(dev, Current_Tx_Rate_Reg);*/
> read_nic_byte(dev, Current_Tx_Rate_Reg, &ieee->softmac_stats.CurrentShowTxate);
> - //printk("=============>tx_rate_reg:%x\n", ieee->softmac_stats.CurrentShowTxate);
> - //for initial tx rate
> -// priv->stats.last_packet_rate = read_nic_byte(dev, Initial_Tx_Rate_Reg);
> + /*printk("=============>tx_rate_reg:%x\n", ieee->softmac_stats.CurrentShowTxate);*/
> + /* for initial tx rate */
> + /*priv->stats.last_packet_rate = read_nic_byte(dev, Initial_Tx_Rate_Reg);*/
> read_nic_byte(dev, Initial_Tx_Rate_Reg, &ieee->softmac_stats.last_packet_rate);
> - //for tx tx retry count
> -// priv->stats.txretrycount = read_nic_dword(dev, Tx_Retry_Count_Reg);
> + /* for tx tx retry count */
> + /*priv->stats.txretrycount = read_nic_dword(dev, Tx_Retry_Count_Reg);*/
> read_nic_dword(dev, Tx_Retry_Count_Reg, &ieee->softmac_stats.txretrycount);
> }
>
> @@ -3469,9 +3490,11 @@ static void dm_send_rssi_tofw(struct net_device *dev)
> {
> struct r8192_priv *priv = ieee80211_priv(dev);
>
> - // If we test chariot, we should stop the TX command ?
> - // Because 92E will always silent reset when we send tx command. We use register
> - // 0x1e0(byte) to notify driver.
> + /*
> + * If we test chariot, we should stop the TX command ?
> + * Because 92E will always silent reset when we send tx command. We use register
> + * 0x1e0(byte) to notify driver.
> + */
> write_nic_byte(dev, DRIVER_RSSI, (u8)priv->undecorated_smoothed_pwdb);
> return;
> }
> --
> 2.2.1
> _______________________________________________
> devel mailing list
> [email protected]
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

2014-12-31 19:07:04

by Lorenzo Stoakes

[permalink] [raw]
Subject: Re: [PATCH 1/4] staging: rtl8192u: fix comments

On 31 December 2014 at 19:00, Konrad Zapalowicz <[email protected]> wrote:
>
> You also fix the line length here which shall be the subject of a
> separate patch as this is not C99 comments related change.
>

Apologies - I missed this, will prepare a v2 with this separated out
into a different patch. Relatedly, the intent was to fix whitespace
issues rather than line length as I gather a specific line length
limit is still a matter of debate in kernel style? I didn't want to
create additional noise by attempting to address that as well.

Best, Lorenzo

2014-12-31 19:23:08

by Jeremiah Mahler

[permalink] [raw]
Subject: Re: [PATCH 1/4] staging: rtl8192u: fix comments

Lorenzo,

On Wed, Dec 31, 2014 at 06:42:53PM +0000, Lorenzo Stoakes wrote:
> This patch fixes errors raised by checkpatch.pl relating to use of C99 comments
> in r8192U_dm.c.
>
> Signed-off-by: Lorenzo Stoakes <[email protected]>
> ---
> drivers/staging/rtl8192u/r8192U_dm.c | 841 ++++++++++++++++++-----------------
> 1 file changed, 432 insertions(+), 409 deletions(-)
>
> diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
> index 936565d..44f4c38 100644
> --- a/drivers/staging/rtl8192u/r8192U_dm.c
> +++ b/drivers/staging/rtl8192u/r8192U_dm.c
> @@ -21,14 +21,15 @@ Major Change History:
> #include "r8190_rtl8256.h"
> #include "r819xU_cmdpkt.h"
> /*---------------------------Define Local Constant---------------------------*/
> -//
> -// Indicate different AP vendor for IOT issue.
> -//
> -static u32 edca_setting_DL[HT_IOT_PEER_MAX] =
> - { 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f};
> -static u32 edca_setting_UL[HT_IOT_PEER_MAX] =
> - { 0x5e4322, 0xa44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f};
> -
> +/*
> + * Indicate different AP vendor for IOT issue.
> + */
This is OK.

> +static u32 edca_setting_DL[HT_IOT_PEER_MAX] = {
> + 0x5e4322, 0x5e4322, 0x5e4322, 0x604322, 0xa44f, 0x5ea44f
> +};
> +static u32 edca_setting_UL[HT_IOT_PEER_MAX] = {
> + 0x5e4322, 0xa44f, 0x5e4322, 0x604322, 0x5ea44f, 0x5ea44f
> +};
But this change is not related to C99 comments and you didn't
explain why this change was made in your log message.
It should probably be in a separate patch.

[...]

--
- Jeremiah Mahler

2014-12-31 19:28:41

by Lorenzo Stoakes

[permalink] [raw]
Subject: Re: [PATCH 1/4] staging: rtl8192u: fix comments

On 31 December 2014 at 19:23, Jeremiah Mahler <[email protected]> wrote:
> But this change is not related to C99 comments and you didn't
> explain why this change was made in your log message.
> It should probably be in a separate patch.

Absolutely, I am currently fixing this and checking for any other
instances where unrelated changes may have crept in. Apologies for
this, a v2 of this patch set is coming shortly with this fixed.

Best, Lorenzo

2014-12-31 19:34:11

by Konrad Zapalowicz

[permalink] [raw]
Subject: Re: [PATCH 1/4] staging: rtl8192u: fix comments

On 12/31, Lorenzo Stoakes wrote:
> On 31 December 2014 at 19:00, Konrad Zapalowicz <[email protected]> wrote:
> >
> > You also fix the line length here which shall be the subject of a
> > separate patch as this is not C99 comments related change.
> >
>
> Apologies - I missed this, will prepare a v2 with this separated out
> into a different patch. Relatedly, the intent was to fix whitespace
> issues rather than line length as I gather a specific line length
> limit is still a matter of debate in kernel style? I didn't want to

Usually the kernel people like the line length of 80 characters. There
are exceptions like for example for log messages because it makes easier
to search for it however most of the time 80 is good and whenever
possible it shall be applied.

You can read about it in the
https://www.kernel.org/doc/Documentation/CodingStyle document in second
chapter.

cheers,
konrad

> create additional noise by attempting to address that as well.
>
> Best, Lorenzo