All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] staging: r8188eu: remove unused code for RF_PATH_B
@ 2022-02-03 20:32 Martin Kaiser
  2022-02-03 20:32 ` [PATCH 1/4] staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E Martin Kaiser
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-02-03 20:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

It seems that the r8188eu driver uses only RF_PATH_A. Remove RF_PATH_B
handling in some places where it's certainly not used.

Martin Kaiser (4):
  staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E
  staging: r8188eu: remove dead code for tx power tracking
  staging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E
  staging: r8188eu: remove constant variable eRFPath

 drivers/staging/r8188eu/hal/HalPhyRf_8188e.c  | 70 ++-----------------
 .../staging/r8188eu/hal/odm_RegConfig8188E.c  |  7 +-
 drivers/staging/r8188eu/hal/rtl8188e_phycfg.c |  5 +-
 3 files changed, 10 insertions(+), 72 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/4] staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E
  2022-02-03 20:32 [PATCH 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
@ 2022-02-03 20:32 ` Martin Kaiser
  2022-02-03 20:32 ` [PATCH 2/4] staging: r8188eu: remove dead code for tx power tracking Martin Kaiser
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-02-03 20:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

The only caller of phy_LCCalibrate_8188E sets is2t to false.
Remove this parameter and resulting dead code.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
index 5f7a2668cabb..db87eaafb72f 100644
--- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
+++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
@@ -821,10 +821,10 @@ static void phy_IQCalibrate_8188E(struct adapter *adapt, s32 result[][8], u8 t)
 	}
 }
 
-static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t)
+static void phy_LCCalibrate_8188E(struct adapter *adapt)
 {
 	u8 tmpreg;
-	u32 RF_Amode = 0, RF_Bmode = 0, LC_Cal;
+	u32 RF_Amode = 0, LC_Cal;
 
 	/* Check continuous TX and Packet TX */
 	tmpreg = rtw_read8(adapt, 0xd03);
@@ -839,17 +839,9 @@ static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t)
 		/* Path-A */
 		RF_Amode = rtl8188e_PHY_QueryRFReg(adapt, RF_PATH_A, RF_AC, bMask12Bits);
 
-		/* Path-B */
-		if (is2t)
-			RF_Bmode = rtl8188e_PHY_QueryRFReg(adapt, RF_PATH_B, RF_AC, bMask12Bits);
-
 		/* 2. Set RF mode = standby mode */
 		/* Path-A */
 		rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_AC, bMask12Bits, (RF_Amode & 0x8FFFF) | 0x10000);
-
-		/* Path-B */
-		if (is2t)
-			rtl8188e_PHY_SetRFReg(adapt, RF_PATH_B, RF_AC, bMask12Bits, (RF_Bmode & 0x8FFFF) | 0x10000);
 	}
 
 	/* 3. Read RF reg18 */
@@ -866,10 +858,6 @@ static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t)
 		/* Path-A */
 		rtw_write8(adapt, 0xd03, tmpreg);
 		rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_AC, bMask12Bits, RF_Amode);
-
-		/* Path-B */
-		if (is2t)
-			rtl8188e_PHY_SetRFReg(adapt, RF_PATH_B, RF_AC, bMask12Bits, RF_Bmode);
 	} else {
 		/*  Deal with Packet TX case */
 		rtw_write8(adapt, REG_TXPAUSE, 0x00);
@@ -999,5 +987,5 @@ void PHY_LCCalibrate_8188E(struct adapter *adapt)
 		timecount += 50;
 	}
 
-	phy_LCCalibrate_8188E(adapt, false);
+	phy_LCCalibrate_8188E(adapt);
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/4] staging: r8188eu: remove dead code for tx power tracking
  2022-02-03 20:32 [PATCH 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
  2022-02-03 20:32 ` [PATCH 1/4] staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E Martin Kaiser
@ 2022-02-03 20:32 ` Martin Kaiser
  2022-02-04  1:30   ` kernel test robot
  2022-02-03 20:32 ` [PATCH 3/4] staging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E Martin Kaiser
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Martin Kaiser @ 2022-02-03 20:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

The odm_TXPowerTrackingCallback_ThermalMeter_8188E contains code
for OFDM paths A and B. It seems that path B is not used, is2t is
always false. Remove resulting dead code.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 52 +-------------------
 1 file changed, 2 insertions(+), 50 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
index db87eaafb72f..8bdd02271203 100644
--- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
+++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
@@ -102,12 +102,11 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
 	u8 ThermalValue = 0, delta, delta_LCK, delta_IQK, offset;
 	u8 ThermalValue_AVG_count = 0;
 	u32 ThermalValue_AVG = 0;
-	s32 ele_A = 0, ele_D, TempCCk, X, value32;
+	s32 ele_A = 0, ele_D, TempCCk, X;
 	s32 Y, ele_C = 0;
 	s8 OFDM_index[2], CCK_index = 0;
 	s8 OFDM_index_old[2] = {0, 0}, CCK_index_old = 0;
 	u32 i = 0, j = 0;
-	bool is2t = false;
 
 	u8 OFDM_min_index = 6, rf; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */
 	s8 OFDM_index_mapping[2][index_mapping_NUM_88E] = {
@@ -139,10 +138,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
 
 	ThermalValue = (u8)rtl8188e_PHY_QueryRFReg(Adapter, RF_PATH_A, RF_T_METER_88E, 0xfc00); /* 0x42: RF Reg[15:10] 88E */
 
-	if (is2t)
-		rf = 2;
-	else
-		rf = 1;
+	rf = 1;
 
 	if (ThermalValue) {
 		/* Query OFDM path A default setting */
@@ -155,17 +151,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
 			}
 		}
 
-		/* Query OFDM path B default setting */
-		if (is2t) {
-			ele_D = rtl8188e_PHY_QueryBBReg(Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord) & bMaskOFDM_D;
-			for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) {	/* find the index */
-				if (ele_D == (OFDMSwingTable[i] & bMaskOFDM_D)) {
-					OFDM_index_old[1] = (u8)i;
-					break;
-				}
-			}
-		}
-
 		/* Query CCK default setting From 0xa24 */
 		TempCCk = dm_odm->RFCalibrateInfo.RegA24;
 
@@ -309,39 +294,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
 					/*  2012/04/23 MH According to Luke's suggestion, we can not write BB digital */
 					/*  to increase TX power. Otherwise, EVM will be bad. */
 				}
-
-				if (is2t) {
-					ele_D = (OFDMSwingTable[(u8)OFDM_index[1]] & 0xFFC00000) >> 22;
-
-					/* new element A = element D x X */
-					X = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][4];
-					Y = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][5];
-
-					if (X != 0) {
-						if ((X & 0x00000200) != 0)	/* consider minus */
-							X = X | 0xFFFFFC00;
-						ele_A = ((X * ele_D) >> 8) & 0x000003FF;
-
-						/* new element C = element D x Y */
-						if ((Y & 0x00000200) != 0)
-							Y = Y | 0xFFFFFC00;
-						ele_C = ((Y * ele_D) >> 8) & 0x00003FF;
-
-						/* wtite new elements A, C, D to regC88 and regC9C, element B is always 0 */
-						value32 = (ele_D << 22) | ((ele_C & 0x3F) << 16) | ele_A;
-						rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord, value32);
-
-						value32 = (ele_C & 0x000003C0) >> 6;
-						rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_XDTxAFE, bMaskH4Bits, value32);
-
-						value32 = ((X * ele_D) >> 7) & 0x01;
-						rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_ECCAThreshold, BIT(28), value32);
-					} else {
-						rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord, OFDMSwingTable[(u8)OFDM_index[1]]);
-						rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_XDTxAFE, bMaskH4Bits, 0x00);
-						rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_ECCAThreshold, BIT(28), 0x00);
-					}
-				}
 			}
 		}
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/4] staging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E
  2022-02-03 20:32 [PATCH 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
  2022-02-03 20:32 ` [PATCH 1/4] staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E Martin Kaiser
  2022-02-03 20:32 ` [PATCH 2/4] staging: r8188eu: remove dead code for tx power tracking Martin Kaiser
@ 2022-02-03 20:32 ` Martin Kaiser
  2022-02-03 20:32 ` [PATCH 4/4] staging: r8188eu: remove constant variable eRFPath Martin Kaiser
  2022-02-04  9:09 ` [PATCH v2 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
  4 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-02-03 20:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

The only caller of odm_ConfigRFReg_8188E sets RF_PATH to RF_PATH_A.
Remove this parameter and use RF_PATH_A inside the function.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/odm_RegConfig8188E.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c b/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c
index 5fb5a88314ed..9059f2533b0b 100644
--- a/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c
+++ b/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c
@@ -4,8 +4,7 @@
 #include "../include/drv_types.h"
 
 static void odm_ConfigRFReg_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr,
-				  u32 Data, enum rf_radio_path RF_PATH,
-				  u32 RegAddr)
+				  u32 Data, u32 RegAddr)
 {
 	if (Addr == 0xffe) {
 		msleep(50);
@@ -20,7 +19,7 @@ static void odm_ConfigRFReg_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr,
 	} else if (Addr == 0xf9) {
 		udelay(1);
 	} else {
-		rtl8188e_PHY_SetRFReg(pDM_Odm->Adapter, RF_PATH, RegAddr, bRFRegOffsetMask, Data);
+		rtl8188e_PHY_SetRFReg(pDM_Odm->Adapter, RF_PATH_A, RegAddr, bRFRegOffsetMask, Data);
 		/*  Add 1us delay between BB/RF register setting. */
 		udelay(1);
 	}
@@ -31,7 +30,7 @@ void odm_ConfigRF_RadioA_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Data
 	u32  content = 0x1000; /*  RF_Content: radioa_txt */
 	u32 maskforPhySet = (u32)(content & 0xE000);
 
-	odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, RF_PATH_A, Addr | maskforPhySet);
+	odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, Addr | maskforPhySet);
 }
 
 void odm_ConfigMAC_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u8 Data)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/4] staging: r8188eu: remove constant variable eRFPath
  2022-02-03 20:32 [PATCH 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
                   ` (2 preceding siblings ...)
  2022-02-03 20:32 ` [PATCH 3/4] staging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E Martin Kaiser
@ 2022-02-03 20:32 ` Martin Kaiser
  2022-02-04  9:09 ` [PATCH v2 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
  4 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-02-03 20:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

In the _PHY_SwChnl8192C function, eRFPath is always zero. Remove the
variable and use 0 in the code. Replace (enum rf_radio_path)0 with
RF_PATH_A.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
index 8279768201b7..6e26359bdda7 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
@@ -712,7 +712,6 @@ void PHY_SetBWMode8188E(struct adapter *Adapter, enum ht_channel_width Bandwidth
 
 static void _PHY_SwChnl8192C(struct adapter *Adapter, u8 channel)
 {
-	u8 eRFPath = 0;
 	u32 param1, param2;
 	struct hal_data_8188e *pHalData = &Adapter->haldata;
 
@@ -725,8 +724,8 @@ static void _PHY_SwChnl8192C(struct adapter *Adapter, u8 channel)
 	/* s2. RF dependent command - CmdID_RF_WriteReg, param1=RF_CHNLBW, param2=channel */
 	param1 = RF_CHNLBW;
 	param2 = channel;
-	pHalData->RfRegChnlVal[eRFPath] = ((pHalData->RfRegChnlVal[eRFPath] & 0xfffffc00) | param2);
-	rtl8188e_PHY_SetRFReg(Adapter, (enum rf_radio_path)eRFPath, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal[eRFPath]);
+	pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffffc00) | param2);
+	rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]);
 }
 
 void PHY_SwChnl8188E(struct adapter *Adapter, u8 channel)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] staging: r8188eu: remove dead code for tx power tracking
  2022-02-03 20:32 ` [PATCH 2/4] staging: r8188eu: remove dead code for tx power tracking Martin Kaiser
@ 2022-02-04  1:30   ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2022-02-04  1:30 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 20560 bytes --]

Hi Martin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]

url:    https://github.com/0day-ci/linux/commits/Martin-Kaiser/staging-r8188eu-remove-unused-code-for-RF_PATH_B/20220204-043516
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git d0d82cb741d0ad42bb776e17011c98fcdab9fee6
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220204/202202040626.c1OWVOQJ-lkp(a)intel.com/config)
compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/91ca3b223f675ccb06197602ffb6a52b01c999b9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Martin-Kaiser/staging-r8188eu-remove-unused-code-for-RF_PATH_B/20220204-043516
        git checkout 91ca3b223f675ccb06197602ffb6a52b01c999b9
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=m68k SHELL=/bin/bash drivers/staging/r8188eu/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/staging/r8188eu/hal/HalPhyRf_8188e.c: In function 'odm_TXPowerTrackingCallback_ThermalMeter_8188E':
>> drivers/staging/r8188eu/hal/HalPhyRf_8188e.c:106:16: warning: variable 'ele_C' set but not used [-Wunused-but-set-variable]
     106 |         s32 Y, ele_C = 0;
         |                ^~~~~
>> drivers/staging/r8188eu/hal/HalPhyRf_8188e.c:105:13: warning: variable 'ele_A' set but not used [-Wunused-but-set-variable]
     105 |         s32 ele_A = 0, ele_D, TempCCk, X;
         |             ^~~~~


vim +/ele_C +106 drivers/staging/r8188eu/hal/HalPhyRf_8188e.c

8cd574e6af5463 Phillip Potter  2021-07-28   94  
8cd574e6af5463 Phillip Potter  2021-07-28   95  /* 091212 chiyokolin */
8cd574e6af5463 Phillip Potter  2021-07-28   96  void
8cd574e6af5463 Phillip Potter  2021-07-28   97  odm_TXPowerTrackingCallback_ThermalMeter_8188E(
8cd574e6af5463 Phillip Potter  2021-07-28   98  	struct adapter *Adapter
8cd574e6af5463 Phillip Potter  2021-07-28   99  	)
8cd574e6af5463 Phillip Potter  2021-07-28  100  {
d904512db6f372 Michael Straube 2021-12-07  101  	struct hal_data_8188e *pHalData = &Adapter->haldata;
8cd574e6af5463 Phillip Potter  2021-07-28  102  	u8 ThermalValue = 0, delta, delta_LCK, delta_IQK, offset;
8cd574e6af5463 Phillip Potter  2021-07-28  103  	u8 ThermalValue_AVG_count = 0;
8cd574e6af5463 Phillip Potter  2021-07-28  104  	u32 ThermalValue_AVG = 0;
91ca3b223f675c Martin Kaiser   2022-02-03 @105  	s32 ele_A = 0, ele_D, TempCCk, X;
8cd574e6af5463 Phillip Potter  2021-07-28 @106  	s32 Y, ele_C = 0;
8cd574e6af5463 Phillip Potter  2021-07-28  107  	s8 OFDM_index[2], CCK_index = 0;
8cd574e6af5463 Phillip Potter  2021-07-28  108  	s8 OFDM_index_old[2] = {0, 0}, CCK_index_old = 0;
8cd574e6af5463 Phillip Potter  2021-07-28  109  	u32 i = 0, j = 0;
8cd574e6af5463 Phillip Potter  2021-07-28  110  
8cd574e6af5463 Phillip Potter  2021-07-28  111  	u8 OFDM_min_index = 6, rf; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */
8cd574e6af5463 Phillip Potter  2021-07-28  112  	s8 OFDM_index_mapping[2][index_mapping_NUM_88E] = {
8cd574e6af5463 Phillip Potter  2021-07-28  113  		{0, 0, 2, 3, 4, 4, 		/* 2.4G, decrease power */
8cd574e6af5463 Phillip Potter  2021-07-28  114  		5, 6, 7, 7, 8, 9,
8cd574e6af5463 Phillip Potter  2021-07-28  115  		10, 10, 11}, /*  For lower temperature, 20120220 updated on 20120220. */
8cd574e6af5463 Phillip Potter  2021-07-28  116  		{0, 0, -1, -2, -3, -4, 		/* 2.4G, increase power */
8cd574e6af5463 Phillip Potter  2021-07-28  117  		-4, -4, -4, -5, -7, -8,
8cd574e6af5463 Phillip Potter  2021-07-28  118  		-9, -9, -10},
8cd574e6af5463 Phillip Potter  2021-07-28  119  	};
8cd574e6af5463 Phillip Potter  2021-07-28  120  	u8 Thermal_mapping[2][index_mapping_NUM_88E] = {
8cd574e6af5463 Phillip Potter  2021-07-28  121  		{0, 2, 4, 6, 8, 10, 		/* 2.4G, decrease power */
8cd574e6af5463 Phillip Potter  2021-07-28  122  		12, 14, 16, 18, 20, 22,
8cd574e6af5463 Phillip Potter  2021-07-28  123  		24, 26, 27},
8cd574e6af5463 Phillip Potter  2021-07-28  124  		{0, 2, 4, 6, 8, 10, 		/* 2.4G,, increase power */
8cd574e6af5463 Phillip Potter  2021-07-28  125  		12, 14, 16, 18, 20, 22,
8cd574e6af5463 Phillip Potter  2021-07-28  126  		25, 25, 25},
8cd574e6af5463 Phillip Potter  2021-07-28  127  	};
8cd574e6af5463 Phillip Potter  2021-07-28  128  	struct odm_dm_struct *dm_odm = &pHalData->odmpriv;
8cd574e6af5463 Phillip Potter  2021-07-28  129  
8cd574e6af5463 Phillip Potter  2021-07-28  130  	/*  2012/04/25 MH Add for tx power tracking to set tx power in tx agc for 88E. */
8cd574e6af5463 Phillip Potter  2021-07-28  131  	odm_TxPwrTrackSetPwr88E(dm_odm);
8cd574e6af5463 Phillip Potter  2021-07-28  132  
8cd574e6af5463 Phillip Potter  2021-07-28  133  	dm_odm->RFCalibrateInfo.TXPowerTrackingCallbackCnt++; /* cosa add for debug */
8cd574e6af5463 Phillip Potter  2021-07-28  134  	dm_odm->RFCalibrateInfo.bTXPowerTrackingInit = true;
8cd574e6af5463 Phillip Potter  2021-07-28  135  
8cd574e6af5463 Phillip Potter  2021-07-28  136  	/*  <Kordan> RFCalibrateInfo.RegA24 will be initialized when ODM HW configuring, but MP configures with para files. */
8cd574e6af5463 Phillip Potter  2021-07-28  137  	dm_odm->RFCalibrateInfo.RegA24 = 0x090e1317;
8cd574e6af5463 Phillip Potter  2021-07-28  138  
e83545b1ae62e4 Michael Straube 2021-12-29  139  	ThermalValue = (u8)rtl8188e_PHY_QueryRFReg(Adapter, RF_PATH_A, RF_T_METER_88E, 0xfc00); /* 0x42: RF Reg[15:10] 88E */
8cd574e6af5463 Phillip Potter  2021-07-28  140  
8cd574e6af5463 Phillip Potter  2021-07-28  141  	rf = 1;
8cd574e6af5463 Phillip Potter  2021-07-28  142  
8cd574e6af5463 Phillip Potter  2021-07-28  143  	if (ThermalValue) {
8cd574e6af5463 Phillip Potter  2021-07-28  144  		/* Query OFDM path A default setting */
8aedc08edfcd0b Michael Straube 2021-12-29  145  		ele_D = rtl8188e_PHY_QueryBBReg(Adapter, rOFDM0_XATxIQImbalance, bMaskDWord) & bMaskOFDM_D;
8cd574e6af5463 Phillip Potter  2021-07-28  146  		for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) {	/* find the index */
8cd574e6af5463 Phillip Potter  2021-07-28  147  			if (ele_D == (OFDMSwingTable[i] & bMaskOFDM_D)) {
8cd574e6af5463 Phillip Potter  2021-07-28  148  				OFDM_index_old[0] = (u8)i;
8cd574e6af5463 Phillip Potter  2021-07-28  149  				dm_odm->BbSwingIdxOfdmBase = (u8)i;
8cd574e6af5463 Phillip Potter  2021-07-28  150  				break;
8cd574e6af5463 Phillip Potter  2021-07-28  151  			}
8cd574e6af5463 Phillip Potter  2021-07-28  152  		}
8cd574e6af5463 Phillip Potter  2021-07-28  153  
8cd574e6af5463 Phillip Potter  2021-07-28  154  		/* Query CCK default setting From 0xa24 */
8cd574e6af5463 Phillip Potter  2021-07-28  155  		TempCCk = dm_odm->RFCalibrateInfo.RegA24;
8cd574e6af5463 Phillip Potter  2021-07-28  156  
8cd574e6af5463 Phillip Potter  2021-07-28  157  		for (i = 0; i < CCK_TABLE_SIZE; i++) {
8cd574e6af5463 Phillip Potter  2021-07-28  158  			if (dm_odm->RFCalibrateInfo.bCCKinCH14) {
85dbc7e3abdc24 Michael Straube 2021-12-29  159  				if (memcmp((void *)&TempCCk, (void *)&CCKSwingTable_Ch14[i][2], 4)) {
8cd574e6af5463 Phillip Potter  2021-07-28  160  					CCK_index_old = (u8)i;
8cd574e6af5463 Phillip Potter  2021-07-28  161  					dm_odm->BbSwingIdxCckBase = (u8)i;
8cd574e6af5463 Phillip Potter  2021-07-28  162  					break;
8cd574e6af5463 Phillip Potter  2021-07-28  163  				}
8cd574e6af5463 Phillip Potter  2021-07-28  164  			} else {
85dbc7e3abdc24 Michael Straube 2021-12-29  165  				if (memcmp((void *)&TempCCk, (void *)&CCKSwingTable_Ch1_Ch13[i][2], 4)) {
8cd574e6af5463 Phillip Potter  2021-07-28  166  					CCK_index_old = (u8)i;
8cd574e6af5463 Phillip Potter  2021-07-28  167  					dm_odm->BbSwingIdxCckBase = (u8)i;
8cd574e6af5463 Phillip Potter  2021-07-28  168  					break;
8cd574e6af5463 Phillip Potter  2021-07-28  169  				}
8cd574e6af5463 Phillip Potter  2021-07-28  170  			}
8cd574e6af5463 Phillip Potter  2021-07-28  171  		}
8cd574e6af5463 Phillip Potter  2021-07-28  172  
8cd574e6af5463 Phillip Potter  2021-07-28  173  		if (!dm_odm->RFCalibrateInfo.ThermalValue) {
8cd574e6af5463 Phillip Potter  2021-07-28  174  			dm_odm->RFCalibrateInfo.ThermalValue = pHalData->EEPROMThermalMeter;
8cd574e6af5463 Phillip Potter  2021-07-28  175  			dm_odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue;
8cd574e6af5463 Phillip Potter  2021-07-28  176  			dm_odm->RFCalibrateInfo.ThermalValue_IQK = ThermalValue;
8cd574e6af5463 Phillip Potter  2021-07-28  177  
8cd574e6af5463 Phillip Potter  2021-07-28  178  			for (i = 0; i < rf; i++)
8cd574e6af5463 Phillip Potter  2021-07-28  179  				dm_odm->RFCalibrateInfo.OFDM_index[i] = OFDM_index_old[i];
8cd574e6af5463 Phillip Potter  2021-07-28  180  			dm_odm->RFCalibrateInfo.CCK_index = CCK_index_old;
8cd574e6af5463 Phillip Potter  2021-07-28  181  		}
8cd574e6af5463 Phillip Potter  2021-07-28  182  
8cd574e6af5463 Phillip Potter  2021-07-28  183  		/* calculate average thermal meter */
8cd574e6af5463 Phillip Potter  2021-07-28  184  		dm_odm->RFCalibrateInfo.ThermalValue_AVG[dm_odm->RFCalibrateInfo.ThermalValue_AVG_index] = ThermalValue;
8cd574e6af5463 Phillip Potter  2021-07-28  185  		dm_odm->RFCalibrateInfo.ThermalValue_AVG_index++;
8cd574e6af5463 Phillip Potter  2021-07-28  186  		if (dm_odm->RFCalibrateInfo.ThermalValue_AVG_index == AVG_THERMAL_NUM_88E)
8cd574e6af5463 Phillip Potter  2021-07-28  187  			dm_odm->RFCalibrateInfo.ThermalValue_AVG_index = 0;
8cd574e6af5463 Phillip Potter  2021-07-28  188  
8cd574e6af5463 Phillip Potter  2021-07-28  189  		for (i = 0; i < AVG_THERMAL_NUM_88E; i++) {
8cd574e6af5463 Phillip Potter  2021-07-28  190  			if (dm_odm->RFCalibrateInfo.ThermalValue_AVG[i]) {
8cd574e6af5463 Phillip Potter  2021-07-28  191  				ThermalValue_AVG += dm_odm->RFCalibrateInfo.ThermalValue_AVG[i];
8cd574e6af5463 Phillip Potter  2021-07-28  192  				ThermalValue_AVG_count++;
8cd574e6af5463 Phillip Potter  2021-07-28  193  			}
8cd574e6af5463 Phillip Potter  2021-07-28  194  		}
8cd574e6af5463 Phillip Potter  2021-07-28  195  
73f1e06f55d44e Phillip Potter  2021-07-31  196  		if (ThermalValue_AVG_count)
8cd574e6af5463 Phillip Potter  2021-07-28  197  			ThermalValue = (u8)(ThermalValue_AVG / ThermalValue_AVG_count);
8cd574e6af5463 Phillip Potter  2021-07-28  198  
8cd574e6af5463 Phillip Potter  2021-07-28  199  		if (dm_odm->RFCalibrateInfo.bReloadtxpowerindex) {
8cd574e6af5463 Phillip Potter  2021-07-28  200  			delta = ThermalValue > pHalData->EEPROMThermalMeter ?
8cd574e6af5463 Phillip Potter  2021-07-28  201  				(ThermalValue - pHalData->EEPROMThermalMeter) :
8cd574e6af5463 Phillip Potter  2021-07-28  202  				(pHalData->EEPROMThermalMeter - ThermalValue);
8cd574e6af5463 Phillip Potter  2021-07-28  203  			dm_odm->RFCalibrateInfo.bReloadtxpowerindex = false;
8cd574e6af5463 Phillip Potter  2021-07-28  204  			dm_odm->RFCalibrateInfo.bDoneTxpower = false;
8cd574e6af5463 Phillip Potter  2021-07-28  205  		} else if (dm_odm->RFCalibrateInfo.bDoneTxpower) {
8cd574e6af5463 Phillip Potter  2021-07-28  206  			delta = (ThermalValue > dm_odm->RFCalibrateInfo.ThermalValue) ?
8cd574e6af5463 Phillip Potter  2021-07-28  207  				(ThermalValue - dm_odm->RFCalibrateInfo.ThermalValue) :
8cd574e6af5463 Phillip Potter  2021-07-28  208  				(dm_odm->RFCalibrateInfo.ThermalValue - ThermalValue);
8cd574e6af5463 Phillip Potter  2021-07-28  209  		} else {
8cd574e6af5463 Phillip Potter  2021-07-28  210  			delta = ThermalValue > pHalData->EEPROMThermalMeter ?
8cd574e6af5463 Phillip Potter  2021-07-28  211  				(ThermalValue - pHalData->EEPROMThermalMeter) :
8cd574e6af5463 Phillip Potter  2021-07-28  212  				(pHalData->EEPROMThermalMeter - ThermalValue);
8cd574e6af5463 Phillip Potter  2021-07-28  213  		}
8cd574e6af5463 Phillip Potter  2021-07-28  214  		delta_LCK = (ThermalValue > dm_odm->RFCalibrateInfo.ThermalValue_LCK) ?
8cd574e6af5463 Phillip Potter  2021-07-28  215  			    (ThermalValue - dm_odm->RFCalibrateInfo.ThermalValue_LCK) :
8cd574e6af5463 Phillip Potter  2021-07-28  216  			    (dm_odm->RFCalibrateInfo.ThermalValue_LCK - ThermalValue);
8cd574e6af5463 Phillip Potter  2021-07-28  217  		delta_IQK = (ThermalValue > dm_odm->RFCalibrateInfo.ThermalValue_IQK) ?
8cd574e6af5463 Phillip Potter  2021-07-28  218  			    (ThermalValue - dm_odm->RFCalibrateInfo.ThermalValue_IQK) :
8cd574e6af5463 Phillip Potter  2021-07-28  219  			    (dm_odm->RFCalibrateInfo.ThermalValue_IQK - ThermalValue);
8cd574e6af5463 Phillip Potter  2021-07-28  220  
8cd574e6af5463 Phillip Potter  2021-07-28  221  		if ((delta_LCK >= 8)) { /*  Delta temperature is equal to or larger than 20 centigrade. */
8cd574e6af5463 Phillip Potter  2021-07-28  222  			dm_odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue;
8cd574e6af5463 Phillip Potter  2021-07-28  223  			PHY_LCCalibrate_8188E(Adapter);
8cd574e6af5463 Phillip Potter  2021-07-28  224  		}
8cd574e6af5463 Phillip Potter  2021-07-28  225  
8cd574e6af5463 Phillip Potter  2021-07-28  226  		if (delta > 0 && dm_odm->RFCalibrateInfo.TxPowerTrackControl) {
8cd574e6af5463 Phillip Potter  2021-07-28  227  			delta = ThermalValue > pHalData->EEPROMThermalMeter ?
8cd574e6af5463 Phillip Potter  2021-07-28  228  				(ThermalValue - pHalData->EEPROMThermalMeter) :
8cd574e6af5463 Phillip Potter  2021-07-28  229  				(pHalData->EEPROMThermalMeter - ThermalValue);
8cd574e6af5463 Phillip Potter  2021-07-28  230  			/* calculate new OFDM / CCK offset */
8cd574e6af5463 Phillip Potter  2021-07-28  231  			if (ThermalValue > pHalData->EEPROMThermalMeter)
8cd574e6af5463 Phillip Potter  2021-07-28  232  				j = 1;
8cd574e6af5463 Phillip Potter  2021-07-28  233  			else
8cd574e6af5463 Phillip Potter  2021-07-28  234  				j = 0;
8cd574e6af5463 Phillip Potter  2021-07-28  235  			for (offset = 0; offset < index_mapping_NUM_88E; offset++) {
8cd574e6af5463 Phillip Potter  2021-07-28  236  				if (delta < Thermal_mapping[j][offset]) {
8cd574e6af5463 Phillip Potter  2021-07-28  237  					if (offset != 0)
8cd574e6af5463 Phillip Potter  2021-07-28  238  						offset--;
8cd574e6af5463 Phillip Potter  2021-07-28  239  					break;
8cd574e6af5463 Phillip Potter  2021-07-28  240  				}
8cd574e6af5463 Phillip Potter  2021-07-28  241  			}
8cd574e6af5463 Phillip Potter  2021-07-28  242  			if (offset >= index_mapping_NUM_88E)
8cd574e6af5463 Phillip Potter  2021-07-28  243  				offset = index_mapping_NUM_88E - 1;
8cd574e6af5463 Phillip Potter  2021-07-28  244  			for (i = 0; i < rf; i++)
8cd574e6af5463 Phillip Potter  2021-07-28  245  				OFDM_index[i] = dm_odm->RFCalibrateInfo.OFDM_index[i] + OFDM_index_mapping[j][offset];
8cd574e6af5463 Phillip Potter  2021-07-28  246  			CCK_index = dm_odm->RFCalibrateInfo.CCK_index + OFDM_index_mapping[j][offset];
8cd574e6af5463 Phillip Potter  2021-07-28  247  
8cd574e6af5463 Phillip Potter  2021-07-28  248  			for (i = 0; i < rf; i++) {
8cd574e6af5463 Phillip Potter  2021-07-28  249  				if (OFDM_index[i] > OFDM_TABLE_SIZE_92D - 1)
8cd574e6af5463 Phillip Potter  2021-07-28  250  					OFDM_index[i] = OFDM_TABLE_SIZE_92D - 1;
8cd574e6af5463 Phillip Potter  2021-07-28  251  				else if (OFDM_index[i] < OFDM_min_index)
8cd574e6af5463 Phillip Potter  2021-07-28  252  					OFDM_index[i] = OFDM_min_index;
8cd574e6af5463 Phillip Potter  2021-07-28  253  			}
8cd574e6af5463 Phillip Potter  2021-07-28  254  
8cd574e6af5463 Phillip Potter  2021-07-28  255  			if (CCK_index > CCK_TABLE_SIZE - 1)
8cd574e6af5463 Phillip Potter  2021-07-28  256  				CCK_index = CCK_TABLE_SIZE - 1;
8cd574e6af5463 Phillip Potter  2021-07-28  257  			else if (CCK_index < 0)
8cd574e6af5463 Phillip Potter  2021-07-28  258  				CCK_index = 0;
8cd574e6af5463 Phillip Potter  2021-07-28  259  
8cd574e6af5463 Phillip Potter  2021-07-28  260  			/* 2 temporarily remove bNOPG */
8cd574e6af5463 Phillip Potter  2021-07-28  261  			/* Config by SwingTable */
8cd574e6af5463 Phillip Potter  2021-07-28  262  			if (dm_odm->RFCalibrateInfo.TxPowerTrackControl) {
8cd574e6af5463 Phillip Potter  2021-07-28  263  				dm_odm->RFCalibrateInfo.bDoneTxpower = true;
8cd574e6af5463 Phillip Potter  2021-07-28  264  
8cd574e6af5463 Phillip Potter  2021-07-28  265  				/* Adujst OFDM Ant_A according to IQK result */
8cd574e6af5463 Phillip Potter  2021-07-28  266  				ele_D = (OFDMSwingTable[(u8)OFDM_index[0]] & 0xFFC00000) >> 22;
b2ad8ba6300fbb Michael Straube 2021-08-29  267  				X = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][0];
b2ad8ba6300fbb Michael Straube 2021-08-29  268  				Y = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][1];
8cd574e6af5463 Phillip Potter  2021-07-28  269  
8cd574e6af5463 Phillip Potter  2021-07-28  270  				/*  Revse TX power table. */
8cd574e6af5463 Phillip Potter  2021-07-28  271  				dm_odm->BbSwingIdxOfdm		= (u8)OFDM_index[0];
8cd574e6af5463 Phillip Potter  2021-07-28  272  				dm_odm->BbSwingIdxCck		= (u8)CCK_index;
8cd574e6af5463 Phillip Potter  2021-07-28  273  
8cd574e6af5463 Phillip Potter  2021-07-28  274  				if (dm_odm->BbSwingIdxOfdmCurrent != dm_odm->BbSwingIdxOfdm) {
8cd574e6af5463 Phillip Potter  2021-07-28  275  					dm_odm->BbSwingIdxOfdmCurrent = dm_odm->BbSwingIdxOfdm;
8cd574e6af5463 Phillip Potter  2021-07-28  276  					dm_odm->BbSwingFlagOfdm = true;
8cd574e6af5463 Phillip Potter  2021-07-28  277  				}
8cd574e6af5463 Phillip Potter  2021-07-28  278  
8cd574e6af5463 Phillip Potter  2021-07-28  279  				if (dm_odm->BbSwingIdxCckCurrent != dm_odm->BbSwingIdxCck) {
8cd574e6af5463 Phillip Potter  2021-07-28  280  					dm_odm->BbSwingIdxCckCurrent = dm_odm->BbSwingIdxCck;
8cd574e6af5463 Phillip Potter  2021-07-28  281  					dm_odm->BbSwingFlagCck = true;
8cd574e6af5463 Phillip Potter  2021-07-28  282  				}
8cd574e6af5463 Phillip Potter  2021-07-28  283  
8cd574e6af5463 Phillip Potter  2021-07-28  284  				if (X != 0) {
8cd574e6af5463 Phillip Potter  2021-07-28  285  					if ((X & 0x00000200) != 0)
8cd574e6af5463 Phillip Potter  2021-07-28  286  						X = X | 0xFFFFFC00;
8cd574e6af5463 Phillip Potter  2021-07-28  287  					ele_A = ((X * ele_D) >> 8) & 0x000003FF;
8cd574e6af5463 Phillip Potter  2021-07-28  288  
8cd574e6af5463 Phillip Potter  2021-07-28  289  					/* new element C = element D x Y */
8cd574e6af5463 Phillip Potter  2021-07-28  290  					if ((Y & 0x00000200) != 0)
8cd574e6af5463 Phillip Potter  2021-07-28  291  						Y = Y | 0xFFFFFC00;
8cd574e6af5463 Phillip Potter  2021-07-28  292  					ele_C = ((Y * ele_D) >> 8) & 0x000003FF;
8cd574e6af5463 Phillip Potter  2021-07-28  293  
8cd574e6af5463 Phillip Potter  2021-07-28  294  					/*  2012/04/23 MH According to Luke's suggestion, we can not write BB digital */
8cd574e6af5463 Phillip Potter  2021-07-28  295  					/*  to increase TX power. Otherwise, EVM will be bad. */
8cd574e6af5463 Phillip Potter  2021-07-28  296  				}
8cd574e6af5463 Phillip Potter  2021-07-28  297  			}
8cd574e6af5463 Phillip Potter  2021-07-28  298  		}
8cd574e6af5463 Phillip Potter  2021-07-28  299  
8cd574e6af5463 Phillip Potter  2021-07-28  300  		if (delta_IQK >= 8) { /*  Delta temperature is equal to or larger than 20 centigrade. */
8cd574e6af5463 Phillip Potter  2021-07-28  301  			dm_odm->RFCalibrateInfo.ThermalValue_IQK = ThermalValue;
8cd574e6af5463 Phillip Potter  2021-07-28  302  			PHY_IQCalibrate_8188E(Adapter, false);
8cd574e6af5463 Phillip Potter  2021-07-28  303  		}
8cd574e6af5463 Phillip Potter  2021-07-28  304  		/* update thermal meter value */
8cd574e6af5463 Phillip Potter  2021-07-28  305  		if (dm_odm->RFCalibrateInfo.TxPowerTrackControl)
8cd574e6af5463 Phillip Potter  2021-07-28  306  			dm_odm->RFCalibrateInfo.ThermalValue = ThermalValue;
8cd574e6af5463 Phillip Potter  2021-07-28  307  	}
8cd574e6af5463 Phillip Potter  2021-07-28  308  	dm_odm->RFCalibrateInfo.TXPowercount = 0;
8cd574e6af5463 Phillip Potter  2021-07-28  309  }
8cd574e6af5463 Phillip Potter  2021-07-28  310  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 0/4] staging: r8188eu: remove unused code for RF_PATH_B
  2022-02-03 20:32 [PATCH 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
                   ` (3 preceding siblings ...)
  2022-02-03 20:32 ` [PATCH 4/4] staging: r8188eu: remove constant variable eRFPath Martin Kaiser
@ 2022-02-04  9:09 ` Martin Kaiser
  2022-02-04  9:09   ` [PATCH v2 1/4] staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E Martin Kaiser
                     ` (3 more replies)
  4 siblings, 4 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-02-04  9:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

It seems that the r8188eu driver uses only RF_PATH_A. Remove RF_PATH_B
handling in some places where it's certainly not used

Martin Kaiser (4):
  staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E
  staging: r8188eu: remove dead code for tx power tracking
  staging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E
  staging: r8188eu: remove constant variable eRFPath

 drivers/staging/r8188eu/hal/HalPhyRf_8188e.c  | 90 ++-----------------
 .../staging/r8188eu/hal/odm_RegConfig8188E.c  |  7 +-
 drivers/staging/r8188eu/hal/rtl8188e_phycfg.c |  5 +-
 3 files changed, 10 insertions(+), 92 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/4] staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E
  2022-02-04  9:09 ` [PATCH v2 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
@ 2022-02-04  9:09   ` Martin Kaiser
  2022-02-04  9:09   ` [PATCH v2 2/4] staging: r8188eu: remove dead code for tx power tracking Martin Kaiser
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-02-04  9:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

The only caller of phy_LCCalibrate_8188E sets is2t to false.
Remove this parameter and resulting dead code.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2: no changes

 drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
index 5f7a2668cabb..db87eaafb72f 100644
--- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
+++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
@@ -821,10 +821,10 @@ static void phy_IQCalibrate_8188E(struct adapter *adapt, s32 result[][8], u8 t)
 	}
 }
 
-static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t)
+static void phy_LCCalibrate_8188E(struct adapter *adapt)
 {
 	u8 tmpreg;
-	u32 RF_Amode = 0, RF_Bmode = 0, LC_Cal;
+	u32 RF_Amode = 0, LC_Cal;
 
 	/* Check continuous TX and Packet TX */
 	tmpreg = rtw_read8(adapt, 0xd03);
@@ -839,17 +839,9 @@ static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t)
 		/* Path-A */
 		RF_Amode = rtl8188e_PHY_QueryRFReg(adapt, RF_PATH_A, RF_AC, bMask12Bits);
 
-		/* Path-B */
-		if (is2t)
-			RF_Bmode = rtl8188e_PHY_QueryRFReg(adapt, RF_PATH_B, RF_AC, bMask12Bits);
-
 		/* 2. Set RF mode = standby mode */
 		/* Path-A */
 		rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_AC, bMask12Bits, (RF_Amode & 0x8FFFF) | 0x10000);
-
-		/* Path-B */
-		if (is2t)
-			rtl8188e_PHY_SetRFReg(adapt, RF_PATH_B, RF_AC, bMask12Bits, (RF_Bmode & 0x8FFFF) | 0x10000);
 	}
 
 	/* 3. Read RF reg18 */
@@ -866,10 +858,6 @@ static void phy_LCCalibrate_8188E(struct adapter *adapt, bool is2t)
 		/* Path-A */
 		rtw_write8(adapt, 0xd03, tmpreg);
 		rtl8188e_PHY_SetRFReg(adapt, RF_PATH_A, RF_AC, bMask12Bits, RF_Amode);
-
-		/* Path-B */
-		if (is2t)
-			rtl8188e_PHY_SetRFReg(adapt, RF_PATH_B, RF_AC, bMask12Bits, RF_Bmode);
 	} else {
 		/*  Deal with Packet TX case */
 		rtw_write8(adapt, REG_TXPAUSE, 0x00);
@@ -999,5 +987,5 @@ void PHY_LCCalibrate_8188E(struct adapter *adapt)
 		timecount += 50;
 	}
 
-	phy_LCCalibrate_8188E(adapt, false);
+	phy_LCCalibrate_8188E(adapt);
 }
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 2/4] staging: r8188eu: remove dead code for tx power tracking
  2022-02-04  9:09 ` [PATCH v2 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
  2022-02-04  9:09   ` [PATCH v2 1/4] staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E Martin Kaiser
@ 2022-02-04  9:09   ` Martin Kaiser
  2022-02-04  9:09   ` [PATCH v2 3/4] staging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E Martin Kaiser
  2022-02-04  9:09   ` [PATCH v2 4/4] staging: r8188eu: remove constant variable eRFPath Martin Kaiser
  3 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-02-04  9:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser, kernel test robot

The odm_TXPowerTrackingCallback_ThermalMeter_8188E contains code
for OFDM paths A and B. It seems that path B is not used, is2t is
always false. Remove resulting dead code.

Without the path B code, the ele_A and ele_C variables are set but
not used. They can be removed. With ele_A and ele_C gone, X and Y
are now set but no longer used. Remove them as well.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2: remove variables which are set but not used

 drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 72 +-------------------
 1 file changed, 2 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
index db87eaafb72f..795320e13e55 100644
--- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
+++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
@@ -102,12 +102,10 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
 	u8 ThermalValue = 0, delta, delta_LCK, delta_IQK, offset;
 	u8 ThermalValue_AVG_count = 0;
 	u32 ThermalValue_AVG = 0;
-	s32 ele_A = 0, ele_D, TempCCk, X, value32;
-	s32 Y, ele_C = 0;
+	s32 ele_D, TempCCk;
 	s8 OFDM_index[2], CCK_index = 0;
 	s8 OFDM_index_old[2] = {0, 0}, CCK_index_old = 0;
 	u32 i = 0, j = 0;
-	bool is2t = false;
 
 	u8 OFDM_min_index = 6, rf; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */
 	s8 OFDM_index_mapping[2][index_mapping_NUM_88E] = {
@@ -139,10 +137,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
 
 	ThermalValue = (u8)rtl8188e_PHY_QueryRFReg(Adapter, RF_PATH_A, RF_T_METER_88E, 0xfc00); /* 0x42: RF Reg[15:10] 88E */
 
-	if (is2t)
-		rf = 2;
-	else
-		rf = 1;
+	rf = 1;
 
 	if (ThermalValue) {
 		/* Query OFDM path A default setting */
@@ -155,17 +150,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
 			}
 		}
 
-		/* Query OFDM path B default setting */
-		if (is2t) {
-			ele_D = rtl8188e_PHY_QueryBBReg(Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord) & bMaskOFDM_D;
-			for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) {	/* find the index */
-				if (ele_D == (OFDMSwingTable[i] & bMaskOFDM_D)) {
-					OFDM_index_old[1] = (u8)i;
-					break;
-				}
-			}
-		}
-
 		/* Query CCK default setting From 0xa24 */
 		TempCCk = dm_odm->RFCalibrateInfo.RegA24;
 
@@ -277,11 +261,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
 			if (dm_odm->RFCalibrateInfo.TxPowerTrackControl) {
 				dm_odm->RFCalibrateInfo.bDoneTxpower = true;
 
-				/* Adujst OFDM Ant_A according to IQK result */
-				ele_D = (OFDMSwingTable[(u8)OFDM_index[0]] & 0xFFC00000) >> 22;
-				X = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][0];
-				Y = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][1];
-
 				/*  Revse TX power table. */
 				dm_odm->BbSwingIdxOfdm		= (u8)OFDM_index[0];
 				dm_odm->BbSwingIdxCck		= (u8)CCK_index;
@@ -295,53 +274,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
 					dm_odm->BbSwingIdxCckCurrent = dm_odm->BbSwingIdxCck;
 					dm_odm->BbSwingFlagCck = true;
 				}
-
-				if (X != 0) {
-					if ((X & 0x00000200) != 0)
-						X = X | 0xFFFFFC00;
-					ele_A = ((X * ele_D) >> 8) & 0x000003FF;
-
-					/* new element C = element D x Y */
-					if ((Y & 0x00000200) != 0)
-						Y = Y | 0xFFFFFC00;
-					ele_C = ((Y * ele_D) >> 8) & 0x000003FF;
-
-					/*  2012/04/23 MH According to Luke's suggestion, we can not write BB digital */
-					/*  to increase TX power. Otherwise, EVM will be bad. */
-				}
-
-				if (is2t) {
-					ele_D = (OFDMSwingTable[(u8)OFDM_index[1]] & 0xFFC00000) >> 22;
-
-					/* new element A = element D x X */
-					X = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][4];
-					Y = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][5];
-
-					if (X != 0) {
-						if ((X & 0x00000200) != 0)	/* consider minus */
-							X = X | 0xFFFFFC00;
-						ele_A = ((X * ele_D) >> 8) & 0x000003FF;
-
-						/* new element C = element D x Y */
-						if ((Y & 0x00000200) != 0)
-							Y = Y | 0xFFFFFC00;
-						ele_C = ((Y * ele_D) >> 8) & 0x00003FF;
-
-						/* wtite new elements A, C, D to regC88 and regC9C, element B is always 0 */
-						value32 = (ele_D << 22) | ((ele_C & 0x3F) << 16) | ele_A;
-						rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord, value32);
-
-						value32 = (ele_C & 0x000003C0) >> 6;
-						rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_XDTxAFE, bMaskH4Bits, value32);
-
-						value32 = ((X * ele_D) >> 7) & 0x01;
-						rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_ECCAThreshold, BIT(28), value32);
-					} else {
-						rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord, OFDMSwingTable[(u8)OFDM_index[1]]);
-						rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_XDTxAFE, bMaskH4Bits, 0x00);
-						rtl8188e_PHY_SetBBReg(Adapter, rOFDM0_ECCAThreshold, BIT(28), 0x00);
-					}
-				}
 			}
 		}
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 3/4] staging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E
  2022-02-04  9:09 ` [PATCH v2 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
  2022-02-04  9:09   ` [PATCH v2 1/4] staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E Martin Kaiser
  2022-02-04  9:09   ` [PATCH v2 2/4] staging: r8188eu: remove dead code for tx power tracking Martin Kaiser
@ 2022-02-04  9:09   ` Martin Kaiser
  2022-02-04  9:09   ` [PATCH v2 4/4] staging: r8188eu: remove constant variable eRFPath Martin Kaiser
  3 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-02-04  9:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

The only caller of odm_ConfigRFReg_8188E sets RF_PATH to RF_PATH_A.
Remove this parameter and use RF_PATH_A inside the function.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2: no changes

 drivers/staging/r8188eu/hal/odm_RegConfig8188E.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c b/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c
index 5fb5a88314ed..9059f2533b0b 100644
--- a/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c
+++ b/drivers/staging/r8188eu/hal/odm_RegConfig8188E.c
@@ -4,8 +4,7 @@
 #include "../include/drv_types.h"
 
 static void odm_ConfigRFReg_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr,
-				  u32 Data, enum rf_radio_path RF_PATH,
-				  u32 RegAddr)
+				  u32 Data, u32 RegAddr)
 {
 	if (Addr == 0xffe) {
 		msleep(50);
@@ -20,7 +19,7 @@ static void odm_ConfigRFReg_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr,
 	} else if (Addr == 0xf9) {
 		udelay(1);
 	} else {
-		rtl8188e_PHY_SetRFReg(pDM_Odm->Adapter, RF_PATH, RegAddr, bRFRegOffsetMask, Data);
+		rtl8188e_PHY_SetRFReg(pDM_Odm->Adapter, RF_PATH_A, RegAddr, bRFRegOffsetMask, Data);
 		/*  Add 1us delay between BB/RF register setting. */
 		udelay(1);
 	}
@@ -31,7 +30,7 @@ void odm_ConfigRF_RadioA_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u32 Data
 	u32  content = 0x1000; /*  RF_Content: radioa_txt */
 	u32 maskforPhySet = (u32)(content & 0xE000);
 
-	odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, RF_PATH_A, Addr | maskforPhySet);
+	odm_ConfigRFReg_8188E(pDM_Odm, Addr, Data, Addr | maskforPhySet);
 }
 
 void odm_ConfigMAC_8188E(struct odm_dm_struct *pDM_Odm, u32 Addr, u8 Data)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 4/4] staging: r8188eu: remove constant variable eRFPath
  2022-02-04  9:09 ` [PATCH v2 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
                     ` (2 preceding siblings ...)
  2022-02-04  9:09   ` [PATCH v2 3/4] staging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E Martin Kaiser
@ 2022-02-04  9:09   ` Martin Kaiser
  3 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-02-04  9:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, linux-staging,
	linux-kernel, Martin Kaiser

In the _PHY_SwChnl8192C function, eRFPath is always zero. Remove the
variable and use 0 in the code. Replace (enum rf_radio_path)0 with
RF_PATH_A.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
v2: no changes

 drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
index 8279768201b7..6e26359bdda7 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_phycfg.c
@@ -712,7 +712,6 @@ void PHY_SetBWMode8188E(struct adapter *Adapter, enum ht_channel_width Bandwidth
 
 static void _PHY_SwChnl8192C(struct adapter *Adapter, u8 channel)
 {
-	u8 eRFPath = 0;
 	u32 param1, param2;
 	struct hal_data_8188e *pHalData = &Adapter->haldata;
 
@@ -725,8 +724,8 @@ static void _PHY_SwChnl8192C(struct adapter *Adapter, u8 channel)
 	/* s2. RF dependent command - CmdID_RF_WriteReg, param1=RF_CHNLBW, param2=channel */
 	param1 = RF_CHNLBW;
 	param2 = channel;
-	pHalData->RfRegChnlVal[eRFPath] = ((pHalData->RfRegChnlVal[eRFPath] & 0xfffffc00) | param2);
-	rtl8188e_PHY_SetRFReg(Adapter, (enum rf_radio_path)eRFPath, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal[eRFPath]);
+	pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffffc00) | param2);
+	rtl8188e_PHY_SetRFReg(Adapter, RF_PATH_A, param1, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]);
 }
 
 void PHY_SwChnl8188E(struct adapter *Adapter, u8 channel)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-02-04  9:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 20:32 [PATCH 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
2022-02-03 20:32 ` [PATCH 1/4] staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E Martin Kaiser
2022-02-03 20:32 ` [PATCH 2/4] staging: r8188eu: remove dead code for tx power tracking Martin Kaiser
2022-02-04  1:30   ` kernel test robot
2022-02-03 20:32 ` [PATCH 3/4] staging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E Martin Kaiser
2022-02-03 20:32 ` [PATCH 4/4] staging: r8188eu: remove constant variable eRFPath Martin Kaiser
2022-02-04  9:09 ` [PATCH v2 0/4] staging: r8188eu: remove unused code for RF_PATH_B Martin Kaiser
2022-02-04  9:09   ` [PATCH v2 1/4] staging: r8188eu: remove constant parameter of phy_LCCalibrate_8188E Martin Kaiser
2022-02-04  9:09   ` [PATCH v2 2/4] staging: r8188eu: remove dead code for tx power tracking Martin Kaiser
2022-02-04  9:09   ` [PATCH v2 3/4] staging: r8188eu: remove constant parameter of odm_ConfigRFReg_8188E Martin Kaiser
2022-02-04  9:09   ` [PATCH v2 4/4] staging: r8188eu: remove constant variable eRFPath Martin Kaiser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.