2023-03-04 19:13:03

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 0/2] 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(-)

--
2.39.2



2023-03-04 19:13:31

by Philipp Hortmann

[permalink] [raw]
Subject: [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.

Signed-off-by: Philipp Hortmann <[email protected]>
---
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(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index 6388f1220575..385ceb3a9636 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -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;
}
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h
index 75629f5df954..561a4c874fe3 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h
@@ -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[];
diff --git a/drivers/staging/rtl8192e/rtl8192e/table.c b/drivers/staging/rtl8192e/rtl8192e/table.c
index 1f80dbeb17b5..d04608d99cbf 100644
--- a/drivers/staging/rtl8192e/rtl8192e/table.c
+++ b/drivers/staging/rtl8192e/rtl8192e/table.c
@@ -6,8 +6,6 @@
*/
#include "table.h"

-u32 Rtl8192PciEPHY_REGArray[PHY_REGArrayLengthPciE] = {0x0,};
-
u32 Rtl8192PciEPHY_REG_1T2RArray[PHY_REG_1T2RArrayLengthPciE] = {
0x800, 0x00000000,
0x804, 0x00000001,
diff --git a/drivers/staging/rtl8192e/rtl8192e/table.h b/drivers/staging/rtl8192e/rtl8192e/table.h
index 7d63f5a5c1b7..177fe2173430 100644
--- a/drivers/staging/rtl8192e/rtl8192e/table.h
+++ b/drivers/staging/rtl8192e/rtl8192e/table.h
@@ -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
--
2.39.2


2023-03-04 19:13:56

by Philipp Hortmann

[permalink] [raw]
Subject: [PATCH 2/2] staging: rtl8192e: Remove conditions for RF_2T4R

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

Signed-off-by: Philipp Hortmann <[email protected]>
---
.../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(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 1e307789ee93..8edfaaeda910 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -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;
}
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index 385ceb3a9636..35ca01ab65ff 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -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;
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index d8408acfc763..eb54f8cbee76 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -274,14 +274,7 @@ void rtl92e_init_adaptive_rate(struct net_device *dev)
pra->ping_rssi_thresh_for_ra = 15;


- if (priv->rf_type == RF_2T4R) {
- 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;
- } else if (priv->rf_type == RF_1T2R) {
+ if (priv->rf_type == RF_1T2R) {
pra->upper_rssi_threshold_ratr = 0x000fc000;
pra->middle_rssi_threshold_ratr = 0x000ff000;
pra->low_rssi_threshold_ratr = 0x000ff001;
@@ -495,47 +488,18 @@ static void _rtl92e_dm_tx_update_tssi_weak_signal(struct net_device *dev,
{
struct r8192_priv *p = rtllib_priv(dev);

- if (RF_Type == RF_2T4R) {
- if ((p->rfa_txpowertrackingindex > 0) &&
- (p->rfc_txpowertrackingindex > 0)) {
- p->rfa_txpowertrackingindex--;
- if (p->rfa_txpowertrackingindex_real > 4) {
- p->rfa_txpowertrackingindex_real--;
- rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance,
- bMaskDWord,
- dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]);
- }
-
- p->rfc_txpowertrackingindex--;
- if (p->rfc_txpowertrackingindex_real > 4) {
- p->rfc_txpowertrackingindex_real--;
- rtl92e_set_bb_reg(dev,
- rOFDM0_XCTxIQImbalance,
- bMaskDWord,
- dm_tx_bb_gain[p->rfc_txpowertrackingindex_real]);
- }
- } else {
- rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance,
- bMaskDWord,
- dm_tx_bb_gain[4]);
+ if (p->rfa_txpowertrackingindex > 0) {
+ p->rfa_txpowertrackingindex--;
+ if (p->rfa_txpowertrackingindex_real > 4) {
+ p->rfa_txpowertrackingindex_real--;
rtl92e_set_bb_reg(dev,
- rOFDM0_XCTxIQImbalance,
- bMaskDWord, dm_tx_bb_gain[4]);
+ rOFDM0_XATxIQImbalance,
+ bMaskDWord,
+ dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]);
}
} else {
- if (p->rfa_txpowertrackingindex > 0) {
- p->rfa_txpowertrackingindex--;
- if (p->rfa_txpowertrackingindex_real > 4) {
- p->rfa_txpowertrackingindex_real--;
- rtl92e_set_bb_reg(dev,
- rOFDM0_XATxIQImbalance,
- bMaskDWord,
- dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]);
- }
- } else {
- rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance,
- bMaskDWord, dm_tx_bb_gain[4]);
- }
+ rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance,
+ bMaskDWord, dm_tx_bb_gain[4]);
}
}

@@ -544,39 +508,16 @@ static void _rtl92e_dm_tx_update_tssi_strong_signal(struct net_device *dev,
{
struct r8192_priv *p = rtllib_priv(dev);

- if (RF_Type == RF_2T4R) {
- if ((p->rfa_txpowertrackingindex < TX_BB_GAIN_TABLE_LEN - 1) &&
- (p->rfc_txpowertrackingindex < TX_BB_GAIN_TABLE_LEN - 1)) {
- p->rfa_txpowertrackingindex++;
- p->rfa_txpowertrackingindex_real++;
- rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance,
- bMaskDWord,
- dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]);
- p->rfc_txpowertrackingindex++;
- p->rfc_txpowertrackingindex_real++;
- rtl92e_set_bb_reg(dev, rOFDM0_XCTxIQImbalance,
- bMaskDWord,
- dm_tx_bb_gain[p->rfc_txpowertrackingindex_real]);
- } else {
- rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance,
- bMaskDWord,
- dm_tx_bb_gain[TX_BB_GAIN_TABLE_LEN - 1]);
- rtl92e_set_bb_reg(dev, rOFDM0_XCTxIQImbalance,
- bMaskDWord,
- dm_tx_bb_gain[TX_BB_GAIN_TABLE_LEN - 1]);
- }
+ if (p->rfa_txpowertrackingindex < (TX_BB_GAIN_TABLE_LEN - 1)) {
+ p->rfa_txpowertrackingindex++;
+ p->rfa_txpowertrackingindex_real++;
+ rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance,
+ bMaskDWord,
+ dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]);
} else {
- if (p->rfa_txpowertrackingindex < (TX_BB_GAIN_TABLE_LEN - 1)) {
- p->rfa_txpowertrackingindex++;
- p->rfa_txpowertrackingindex_real++;
- rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance,
- bMaskDWord,
- dm_tx_bb_gain[p->rfa_txpowertrackingindex_real]);
- } else {
- rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance,
- bMaskDWord,
- dm_tx_bb_gain[TX_BB_GAIN_TABLE_LEN - 1]);
- }
+ rtl92e_set_bb_reg(dev, rOFDM0_XATxIQImbalance,
+ bMaskDWord,
+ dm_tx_bb_gain[TX_BB_GAIN_TABLE_LEN - 1]);
}
}

@@ -682,13 +623,8 @@ static void _rtl92e_dm_tx_power_tracking_callback_tssi(struct net_device *dev)
else
_rtl92e_dm_tx_update_tssi_strong_signal(dev, RF_Type);

- if (RF_Type == RF_2T4R) {
- priv->cck_present_attn_diff
- = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default;
- } else {
- priv->cck_present_attn_diff
- = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default;
- }
+ priv->cck_present_attn_diff
+ = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default;

if (priv->current_chnl_bw == HT_CHANNEL_WIDTH_20)
priv->cck_present_attn =
@@ -1730,9 +1666,6 @@ static void _rtl92e_dm_rx_path_sel_byrssi(struct net_device *dev)
static u8 disabled_rf_cnt, cck_Rx_Path_initialized;
u8 update_cck_rx_path;

- if (priv->rf_type != RF_2T4R)
- return;
-
if (!cck_Rx_Path_initialized) {
dm_rx_path_sel_table.cck_rx_path = (rtl92e_readb(dev, 0xa07)&0xf);
cck_Rx_Path_initialized = 1;
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 1152fbf43383..8e5e29ce8f0d 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -451,7 +451,6 @@ enum led_ctl_mode {

enum rt_rf_type_def {
RF_1T2R = 0,
- RF_2T4R,
};

enum wireless_mode {
--
2.39.2


2023-03-06 09:25:55

by Dan Carpenter

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

On Sat, Mar 04, 2023 at 08:13:22PM +0100, Philipp Hortmann wrote:
> Remove empty array Rtl8192PciEPHY_REGArray and the code where it is used
> because it is dead code.
>
> Signed-off-by: Philipp Hortmann <[email protected]>
> ---
> 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


2023-03-06 20:49:48

by Philipp Hortmann

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

On 3/6/23 10:25, Dan Carpenter wrote:
> On Sat, Mar 04, 2023 at 08:13:22PM +0100, Philipp Hortmann wrote:
>> Remove empty array Rtl8192PciEPHY_REGArray and the code where it is used
>> because it is dead code.
>>
>> Signed-off-by: Philipp Hortmann <[email protected]>
>> ---
>> 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
>


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