staging: rtl8188eu: Rework function ODM_TxPwrTrackAdjust88E()
authornavin patidar <navin.patidar@gmail.com>
Sun, 7 Sep 2014 11:07:40 +0000 (16:37 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Sep 2014 21:04:30 +0000 (14:04 -0700)
Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/hal/HalPhyRf_8188e.c
drivers/staging/rtl8188eu/hal/rf.c
drivers/staging/rtl8188eu/include/HalPhyRf_8188e.h

index be239596ffc22000af41777fb6fe1716e39eb1da..e3fcf8edd74839255d0c66d73715be1be10b05d4 100644 (file)
@@ -43,66 +43,49 @@ static u8 get_right_chnl_for_iqk(u8 chnl)
        return 0;
 }
 
-/* 3 Tx Power Tracking */
-/*
- * Function:   ODM_TxPwrTrackAdjust88E()
- *
- * Overview:   88E we can not write 0xc80/c94/c4c/ 0xa2x. Instead of write TX agc.
- *                             No matter OFDM & CCK use the same method.
- *
- * Revised History:
- *     When            Who             Remark
- *     04/23/2012      MHC             Create Version 0.
- *     04/23/2012      MHC             Adjust TX agc directly not throughput BB digital.
- *
- */
-void ODM_TxPwrTrackAdjust88E(struct odm_dm_struct *dm_odm, u8 Type,/*  0 = OFDM, 1 = CCK */
-       u8 *pDirection,                 /*  1 = +(increase) 2 = -(decrease) */
-       u32 *pOutWriteVal               /*  Tx tracking CCK/OFDM BB swing index adjust */
-       )
+void rtl88eu_dm_txpower_track_adjust(struct odm_dm_struct *dm_odm, u8 type,
+                                    u8 *direction, u32 *out_write_val)
 {
        u8 pwr_value = 0;
        /*  Tx power tracking BB swing table. */
-       /*  The base index = 12. +((12-n)/2)dB 13~?? = decrease tx pwr by -((n-12)/2)dB */
-       if (Type == 0) {                /*  For OFDM afjust */
+       if (type == 0) { /* For OFDM adjust */
                ODM_RT_TRACE(dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
                             ("BbSwingIdxOfdm = %d BbSwingFlagOfdm=%d\n",
                             dm_odm->BbSwingIdxOfdm, dm_odm->BbSwingFlagOfdm));
 
                if (dm_odm->BbSwingIdxOfdm <= dm_odm->BbSwingIdxOfdmBase) {
-                       *pDirection     = 1;
-                       pwr_value               = (dm_odm->BbSwingIdxOfdmBase - dm_odm->BbSwingIdxOfdm);
+                       *direction = 1;
+                       pwr_value = (dm_odm->BbSwingIdxOfdmBase -
+                                    dm_odm->BbSwingIdxOfdm);
                } else {
-                       *pDirection     = 2;
-                       pwr_value               = (dm_odm->BbSwingIdxOfdm - dm_odm->BbSwingIdxOfdmBase);
+                       *direction = 2;
+                       pwr_value = (dm_odm->BbSwingIdxOfdm -
+                                    dm_odm->BbSwingIdxOfdmBase);
                }
 
-               ODM_RT_TRACE(dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
-                            ("BbSwingIdxOfdm = %d BbSwingFlagOfdm=%d\n",
-                            dm_odm->BbSwingIdxOfdm, dm_odm->BbSwingFlagOfdm));
-       } else if (Type == 1) { /*  For CCK adjust. */
+       } else if (type == 1) { /* For CCK adjust. */
                ODM_RT_TRACE(dm_odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD,
                             ("dm_odm->BbSwingIdxCck = %d dm_odm->BbSwingIdxCckBase = %d\n",
                             dm_odm->BbSwingIdxCck, dm_odm->BbSwingIdxCckBase));
 
                if (dm_odm->BbSwingIdxCck <= dm_odm->BbSwingIdxCckBase) {
-                       *pDirection     = 1;
-                       pwr_value               = (dm_odm->BbSwingIdxCckBase - dm_odm->BbSwingIdxCck);
+                       *direction = 1;
+                       pwr_value = (dm_odm->BbSwingIdxCckBase -
+                                    dm_odm->BbSwingIdxCck);
                } else {
-                       *pDirection     = 2;
-                       pwr_value               = (dm_odm->BbSwingIdxCck - dm_odm->BbSwingIdxCckBase);
+                       *direction = 2;
+                       pwr_value = (dm_odm->BbSwingIdxCck -
+                                    dm_odm->BbSwingIdxCckBase);
                }
+
        }
 
-       /*  */
-       /*  2012/04/25 MH According to Ed/Luke.Lees estimate for EVM the max tx power tracking */
-       /*  need to be less than 6 power index for 88E. */
-       /*  */
-       if (pwr_value >= ODM_TXPWRTRACK_MAX_IDX_88E && *pDirection == 1)
+       if (pwr_value >= ODM_TXPWRTRACK_MAX_IDX_88E && *direction == 1)
                pwr_value = ODM_TXPWRTRACK_MAX_IDX_88E;
 
-       *pOutWriteVal = pwr_value | (pwr_value<<8) | (pwr_value<<16) | (pwr_value<<24);
-}      /*  ODM_TxPwrTrackAdjust88E */
+       *out_write_val = pwr_value | (pwr_value<<8) | (pwr_value<<16) |
+                        (pwr_value<<24);
+}
 
 /*
  * Function:   odm_TxPwrTrackSetPwr88E()
index 6ae22b0b08271602e43b97af94b84714cbf7636c..c2fac34c81329e9e6af769e0f35d91ae7c59ea6b 100644 (file)
@@ -101,7 +101,8 @@ void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter *adapt, u8 *powerlevel)
                        ptr++;
                }
        }
-       ODM_TxPwrTrackAdjust88E(&hal_data->odmpriv, 1, &direction, &pwrtrac_value);
+       rtl88eu_dm_txpower_track_adjust(&hal_data->odmpriv, 1, &direction,
+                                       &pwrtrac_value);
 
        if (direction == 1) {
                /*  Increase TX power */
@@ -297,7 +298,8 @@ void rtl88eu_phy_rf6052_set_ofdm_txpower(struct adapter *adapt,
        getpowerbase88e(adapt, pwr_level_ofdm, pwr_level_bw20, pwr_level_bw40,
                        channel, &powerbase0[0], &powerbase1[0]);
 
-       ODM_TxPwrTrackAdjust88E(&hal_data->odmpriv, 0, &direction, &pwrtrac_value);
+       rtl88eu_dm_txpower_track_adjust(&hal_data->odmpriv, 0, &direction,
+                                       &pwrtrac_value);
 
        for (index = 0; index < 6; index++) {
                get_rx_power_val_by_reg(adapt, channel, index,
index 90a26c119d97fcdda187feb07e763bc1136568f7..3425dfa7514159c8898e372b0c44b18d2da09979 100644 (file)
 #define AVG_THERMAL_NUM_88E    4
 #define ODM_TARGET_CHNL_NUM_2G_5G      59
 
-void ODM_TxPwrTrackAdjust88E(struct odm_dm_struct *pDM_Odm,
-                            u8 Type,   /* 0 = OFDM, 1 = CCK */
-                            u8 *pDirection,/* 1 = +(incr) 2 = -(decr) */
-                            u32 *pOutWriteVal); /* Tx tracking CCK/OFDM BB
-                                                    * swing index adjust */
-
+void rtl88eu_dm_txpower_track_adjust(struct odm_dm_struct *dm_odm,
+                                    u8 type, /* 0 = OFDM, 1 = CCK */
+                                    u8 *dir, /* 1 = +(incr), 2 = -(decr) */
+                                    u32 *out_write); /* Tx tracking CCK/OFDM BB
+                                                      * swing index adjust
+                                                      */
 
 void odm_TXPowerTrackingCallback_ThermalMeter_8188E(struct adapter *Adapter);