Skip to contentSkip to conversation

staging: rtl8192e: Removing rf_type RF_2T4R from driver

PATCH In review Philipp Hortmann 2 participants 5 messages Mar 4, 2023 – Mar 6, 2023 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: rtl8192e: Removing rf_type RF_2T4R from driver

Removing rf_type RF_2T4R from driver as it is dead code.

First reason:
The following table is used to configure the phy base band:
u32 Rtl8192PciEPHY_REGArray[PHY_REGArrayLengthPciE] = {0x0,}; A valid array has at least two columns.

Second reason:
According to a list of devices from wiki the seven shown devices do only support MIMO config: 1x2:2 in phy modes b,g,n. The only rf chip that is used is RTL8256.

Tested with rtl8192e
Transferred this patch over wlan connection of rtl8192e

This patch series requires the patches:
"[PATCH] staging: rtl8192e: Change filename r8192E_hwimg.x to table.x" "[PATCH] staging: rtl8192e: Remove call_usermodehelper starting RadioPower.sh" "[PATCH] staging: rtl8192e: Remove function ..dm_check_ac_dc_power calling a script"

Philipp Hortmann (2):
staging: rtl8192e: Remove empty Array Rtl8192PciEPHY_REGArray
staging: rtl8192e: Remove conditions for RF_2T4R

 .../staging/rtl8192e/rtl8192e/r8192E_dev.c    |   3 +-
 .../staging/rtl8192e/rtl8192e/r8192E_phy.c    |  26 +----
 .../staging/rtl8192e/rtl8192e/r8192E_phy.h    |   2 -
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c    | 109 ++++--------------
 drivers/staging/rtl8192e/rtl8192e/table.c     |   2 -
 drivers/staging/rtl8192e/rtl8192e/table.h     |   2 -
 drivers/staging/rtl8192e/rtllib.h             |   1 -
 7 files changed, 26 insertions(+), 119 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/2 staging: rtl8192e: Remove empty Array Rtl8192PciEPHY_REGArray

Remove empty array Rtl8192PciEPHY_REGArray and the code where it is used because it is dead code.

---
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 5 +----
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 --
 drivers/staging/rtl8192e/rtl8192e/table.c      | 2 --
 drivers/staging/rtl8192e/rtl8192e/table.h      | 2 --
 4 files changed, 1 insertion(+), 10 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +1 -4
index 6388f1220575..385ceb3a9636 100644
@@ -334,10 +334,7 @@ static void _rtl92e_phy_config_bb(struct net_device *dev, u8 ConfigType)
 
 	AGCTAB_ArrayLen = AGCTAB_ArrayLength;
 	Rtl819XAGCTAB_Array_Table = Rtl819XAGCTAB_Array;
-	if (priv->rf_type == RF_2T4R) {
-		PHY_REGArrayLen = PHY_REGArrayLength;
-		Rtl819XPHY_REGArray_Table = Rtl819XPHY_REGArray;
-	} else if (priv->rf_type == RF_1T2R) {
+	if (priv->rf_type == RF_1T2R) {
 		PHY_REGArrayLen = PHY_REG_1T2RArrayLength;
 		Rtl819XPHY_REGArray_Table = Rtl819XPHY_REG_1T2RArray;
 	}
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h +0 -2
index 75629f5df954..561a4c874fe3 100644
@@ -16,7 +16,6 @@
 #define MACPHY_Array_PGLength			MACPHY_Array_PGLengthPciE
 #define RadioC_ArrayLength			RadioC_ArrayLengthPciE
 #define RadioD_ArrayLength			RadioD_ArrayLengthPciE
-#define PHY_REGArrayLength			PHY_REGArrayLengthPciE
 #define PHY_REG_1T2RArrayLength			PHY_REG_1T2RArrayLengthPciE
 
 #define Rtl819XMACPHY_Array_PG			Rtl8192PciEMACPHY_Array_PG
@@ -26,7 +25,6 @@
 #define Rtl819XRadioC_Array			Rtl8192PciERadioC_Array
 #define Rtl819XRadioD_Array			Rtl8192PciERadioD_Array
 #define Rtl819XAGCTAB_Array			Rtl8192PciEAGCTAB_Array
-#define Rtl819XPHY_REGArray			Rtl8192PciEPHY_REGArray
 #define Rtl819XPHY_REG_1T2RArray		Rtl8192PciEPHY_REG_1T2RArray
 
 extern u32 rtl819XAGCTAB_Array[];
drivers/staging/rtl8192e/rtl8192e/table.c +0 -2
index 1f80dbeb17b5..d04608d99cbf 100644
@@ -6,8 +6,6 @@
  */
 #include "table.h"
 
-u32 Rtl8192PciEPHY_REGArray[PHY_REGArrayLengthPciE] = {0x0,};
-
 u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE] = {
 	0x800, 0x00000000,
 	0x804, 0x00000001,
drivers/staging/rtl8192e/rtl8192e/table.h +0 -2
index 7d63f5a5c1b7..177fe2173430 100644
@@ -11,8 +11,6 @@
 
 #include <linux/types.h>
 
-#define PHY_REGArrayLengthPciE 1
-extern u32 Rtl8192PciEPHY_REGArray[PHY_REGArrayLengthPciE];
 #define PHY_REG_1T2RArrayLengthPciE 296
 extern u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE];
 #define RadioA_ArrayLengthPciE 246
Signature · 1 line
2.39.2
#4 lore raw

PATCH 2/2 staging: rtl8192e: Remove conditions for RF_2T4R

In reply to Philipp Hortmann

Remove conditions for RF_2T4R because hardware that uses RF_2T4R does not exist.

---
 .../staging/rtl8192e/rtl8192e/r8192E_dev.c    |   3 +-
 .../staging/rtl8192e/rtl8192e/r8192E_phy.c    |  21 +---
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c    | 109 ++++--------------
 drivers/staging/rtl8192e/rtllib.h             |   1 -
 4 files changed, 25 insertions(+), 109 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +1 -2
index 1e307789ee93..8edfaaeda910 100644
@@ -353,8 +353,7 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)
 
 			if (tempval&0x80)
 				priv->rf_type = RF_1T2R;
-			else
-				priv->rf_type = RF_2T4R;
+
 		} else {
 			priv->eeprom_legacy_ht_tx_pwr_diff = 0x04;
 		}
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +3 -18
index 385ceb3a9636..35ca01ab65ff 100644
@@ -52,9 +52,7 @@ u8 rtl92e_is_legal_rf_path(struct net_device *dev, u32 eRFPath)
 	u8 ret = 1;
 	struct r8192_priv *priv = rtllib_priv(dev);
 
-	if (priv->rf_type == RF_2T4R)
-		ret = 0;
-	else if (priv->rf_type == RF_1T2R) {
+	if (priv->rf_type == RF_1T2R) {
 		if (eRFPath == RF90_PATH_A || eRFPath == RF90_PATH_B)
 			ret = 1;
 		else if (eRFPath == RF90_PATH_C || eRFPath == RF90_PATH_D)
@@ -531,12 +529,7 @@ static bool _rtl92e_bb_config_para_file(struct net_device *dev)
 	_rtl92e_phy_config_bb(dev, BB_CONFIG_AGC_TAB);
 
 	if (priv->ic_cut  > VERSION_8190_BD) {
-		if (priv->rf_type == RF_2T4R)
-			dwRegValue = priv->antenna_tx_pwr_diff[2] << 8 |
-				      priv->antenna_tx_pwr_diff[1] << 4 |
-				      priv->antenna_tx_pwr_diff[0];
-		else
-			dwRegValue = 0x0;
+		dwRegValue = 0x0;
 		rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage,
 				  (bXBTxAGC|bXCTxAGC|bXDTxAGC), dwRegValue);
 
@@ -587,16 +580,8 @@ void rtl92e_set_tx_power(struct net_device *dev, u8 channel)
 	if (priv->epromtype == EEPROM_93C46) {
 		powerlevel = priv->tx_pwr_level_cck[channel - 1];
 		powerlevelOFDM24G = priv->tx_pwr_level_ofdm_24g[channel - 1];
-	} else if (priv->epromtype == EEPROM_93C56) {
-		if (priv->rf_type == RF_2T4R) {
-			priv->antenna_tx_pwr_diff[2] = 0;
-			priv->antenna_tx_pwr_diff[1] = 0;
-			priv->antenna_tx_pwr_diff[0] = 0;
-
-			rtl92e_set_bb_reg(dev, rFPGA0_TxGainStage,
-					  (bXBTxAGC | bXCTxAGC | bXDTxAGC), 0);
-		}
 	}
+
 	switch (priv->rf_chip) {
 	case RF_8225:
 		break;
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +21 -88

143 lines not on this page · raw message

drivers/staging/rtl8192e/rtllib.h +0 -1
index 1152fbf43383..8e5e29ce8f0d 100644
@@ -451,7 +451,6 @@ enum led_ctl_mode {
 
 enum rt_rf_type_def {
 	RF_1T2R = 0,
-	RF_2T4R,
 };
 
 enum wireless_mode {
Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH 1/2] staging: rtl8192e: Remove empty Array Rtl8192PciEPHY_REGArray

In reply to Philipp Hortmann
Quoted 9 lines · Philipp Hortmann

Remove empty array Rtl8192PciEPHY_REGArray and the code where it is used because it is dead code.

---
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 5 +----
 drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 --
 drivers/staging/rtl8192e/rtl8192e/table.c      | 2 --
 drivers/staging/rtl8192e/rtl8192e/table.h      | 2 --

What are these table.[ch] files? I don't seem to have them.

regards,
dan carpenter

#3 lore raw

Re: [PATCH 1/2] staging: rtl8192e: Remove empty Array Rtl8192PciEPHY_REGArray

Quoted 11 lines · Dan Carpenter
Quoted 9 lines · Philipp Hortmann

Remove empty array Rtl8192PciEPHY_REGArray and the code where it is used because it is dead code.

---
  drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 5 +----
  drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h | 2 --
  drivers/staging/rtl8192e/rtl8192e/table.c      | 2 --
  drivers/staging/rtl8192e/rtl8192e/table.h      | 2 --
Quoted 5 lines

What are these table.[ch] files? I don't seem to have them.

regards,
dan carpenter

Hi Dan,

thanks for the review. Here some answers to your questions:

With patch: "[PATCH] staging: rtl8192e: Change filename r8192E_hwimg.x to table.x" I changed the filename of r8192E_hwimg.c to table.c and r8192E_hwimg.h to table.h to adapt filenames from drivers/net/wireless/realtek/rtlwifi rtl8192ee and rtl8192se. Task is from TODO file.

Thanks for your support.

Bye Philipp