wifi: rtl8xxxu: Report the signal strength only if it's known
PATCH 1/3 wifi: rtl8xxxu: Report the signal strength only if it's known
These chips don't report the signal strength for many (any?) data frames. When the signal strength is not known, set RX_FLAG_NO_SIGNAL_VAL in order to avoid reporting a signal strength of 0.
Tested with RTL8192FU and RTL8192CU.
--- drivers/net/wireless/realtek/rtl8xxxu/core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/realtek/rtl8xxxu/core.c +4 -0
@@ -6454,6 +6454,8 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb)rtl8xxxu_rx_update_rssi (priv, rx_status, hdr); + }else { + rx_status->flag |=RX_FLAG_NO_SIGNAL_VAL ; } rx_status->mactime = rx_desc->tsfl;
@@ -6560,6 +6562,8 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb)rtl8xxxu_rx_update_rssi (priv, rx_status, hdr); + }else { + rx_status->flag |=RX_FLAG_NO_SIGNAL_VAL ; } rx_status->mactime = rx_desc->tsfl;
Signature · 1 line
2.51.0
PATCH 2/3 wifi: rtl8xxxu: Dump the efuse right after reading it
Someone reported a problem with their TP-Link WN722N (RTL8188EUS):
usb 1-1: This Realtek USB WiFi dongle (0x2357:0x010c) is untested! usb 1-1: Please report results to [email protected] usb 1-1: Fatal - failed to parse EFuse
rtl8xxxu: probe of 1-1:1.0 failed with error -22
This error can happen when the first two bytes of the efuse don't have the expected magic value of 0x8129. In a situation like this it could be useful to see the contents of the efuse.
Dump the efuse right after reading it, before trying to parse it.
--- drivers/net/wireless/realtek/rtl8xxxu/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/core.c +3 -3
@@ -7910,15 +7910,15 @@ static int rtl8xxxu_probe(struct usb_interface *interface, goto err_set_intfdata; } +if (rtl8xxxu_debug &RTL8XXXU_DEBUG_EFUSE ) +rtl8xxxu_dump_efuse (priv); + ret = priv->fops->parse_efuse (priv);if (ret) {dev_err (&udev->dev,"Fatal - failed to parse EFuse\n" ); goto err_set_intfdata; } -if (rtl8xxxu_debug &RTL8XXXU_DEBUG_EFUSE ) -rtl8xxxu_dump_efuse (priv); -rtl8xxxu_print_chipinfo (priv); ret = priv->fops->load_firmware (priv);
Signature · 1 line
2.51.0
RE: [PATCH rtw-next 2/3] wifi: rtl8xxxu: Dump the efuse right after reading it
Quoted 7 lines · Bitterblue Smith
Someone reported a problem with their TP-Link WN722N (RTL8188EUS):
usb 1-1: This Realtek USB WiFi dongle (0x2357:0x010c) is untested! usb 1-1: Please report results to [email protected] usb 1-1: Fatal - failed to parse EFuse
rtl8xxxu: probe of 1-1:1.0 failed with error -22
Quoted 7 lines
This error can happen when the first two bytes of the efuse don't have the expected magic value of
0x8129. In a situation like this it could be useful to see the contents of the efuse.Dump the efuse right after reading it, before trying to parse it.
Signed-off-by Bitterblue Smith <[email protected]>
PATCH 3/3 wifi: rtl8xxxu: Use correct power off sequence for RTL8192CU
In reply to Bitterblue SmithRTL8192CU disappears and reappears when rtl8xxxu is unloaded:
usbcore: deregistering interface driver rtl8xxxu
wlp3s0f3u2: deauthenticating from ... by local choice (Reason: 3=DEAUTH_LEAVING) usb 1-2: rtl8xxxu_active_to_emu: Disabling MAC timed out
usb 1-2: USB disconnect, device number 7
usb 1-2: disconnecting
usb 1-2: new high-speed USB device number 8 using xhci_hcd
usb 1-2: New USB device found, idVendor=0bda, idProduct=8178, bcdDevice= 2.00 usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 1-2: Product: 802.11n WLAN Adapter
usb 1-2: Manufacturer: Realtek
usb 1-2: SerialNumber: 00e04c000001
This is because rtl8xxxu is using the power off sequence for RTL8723AU. Add the correct power off sequence for RTL8192CU.
rtl8xxxu_power_off(), rtl8xxxu_active_to_emu(), and rtl8xxxu_emu_to_disabled() are now only used for RTL8723AU, so move them to 8723a.c and rename them to have the "rtl8723au" prefix.
Tested only with RTL8192CU.
--- drivers/net/wireless/realtek/rtl8xxxu/8192c.c | 80 +++++++++++- drivers/net/wireless/realtek/rtl8xxxu/8723a.c | 115 +++++++++++++++- drivers/net/wireless/realtek/rtl8xxxu/core.c | 123 ------------------ drivers/net/wireless/realtek/rtl8xxxu/regs.h | 1 + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 - 5 files changed, 194 insertions(+), 126 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/8192c.c +79 -1
@@ -593,6 +593,84 @@ static int rtl8192cu_power_on(struct rtl8xxxu_priv *priv)return 0 ; } +static void rtl8192cu_power_off (struct rtl8xxxu_priv *priv) +{ +u32 val32; +u16 val16; +u8 val8; +int i; + +/* +* Workaround for 8188RU LNA power leakage problem. +*/ +if (priv->rtl_chip ==RTL8188R ) { + val32 =rtl8xxxu_read32 (priv,REG_FPGA0_XCD_RF_PARM ); + val32 |=BIT (1 ); +rtl8xxxu_write32 (priv,REG_FPGA0_XCD_RF_PARM , val32); + } + +/* _DisableRFAFEAndResetBB */ +rtl8xxxu_write8 (priv,REG_TXPAUSE ,0xff ); +rtl8xxxu_write_rfreg_mask (priv,RF_A ,RF6052_REG_AC ,0xff ,0 ); + +rtl8xxxu_write8_set (priv,REG_APSD_CTRL ,APSD_CTRL_OFF ); +rtl8xxxu_write32_set (priv,REG_FPGA0_XCD_RF_PARM ,FPGA0_RF_PARM_CLK_GATE ); + +rtl8xxxu_write8 (priv,REG_SYS_FUNC , +SYS_FUNC_USBA |SYS_FUNC_USBD |SYS_FUNC_BB_GLB_RSTN ); +rtl8xxxu_write8 (priv,REG_SYS_FUNC ,SYS_FUNC_USBA |SYS_FUNC_USBD ); + +/* _ResetDigitalProcedure1 */ +if (rtl8xxxu_read8 (priv,REG_MCU_FW_DL ) &MCU_FW_DL_READY ) { +rtl8xxxu_write8 (priv,REG_MCU_FW_DL ,0x00 ); + +rtl8xxxu_write8 (priv,REG_FWIMR ,0x20 ); + +rtl8xxxu_write8 (priv,REG_HMTFR +3 ,0x20 ); + +for (i =0 ; i <100 ; i++) { + val16 =rtl8xxxu_read16 (priv,REG_SYS_FUNC ); +if (!(val16 &SYS_FUNC_CPU_ENABLE )) +break ; + +fsleep (50 ); + } + +if (i ==100 ) { +rtl8xxxu_write8 (priv,REG_SYS_FUNC +1 , + (SYS_FUNC_HWPDN |SYS_FUNC_ELDR ) >>8 ); +msleep (10 ); + } + } + + val8 = (SYS_FUNC_HWPDN |SYS_FUNC_ELDR |SYS_FUNC_CPU_ENABLE ) >>8 ; +rtl8xxxu_write8 (priv,REG_SYS_FUNC +1 , val8); + +/* _DisableGPIO */ +rtl8xxxu_write16 (priv,REG_GPIO_PIN_CTRL +2 ,0 ); + val32 =rtl8xxxu_read32 (priv,REG_GPIO_PIN_CTRL ) &0xffff00ff ; + val32 |= (val32 &0xff ) <<8 ; + val32 |=0x00ff0000 ; +rtl8xxxu_write32 (priv,REG_GPIO_PIN_CTRL , val32); + +rtl8xxxu_write8 (priv,REG_GPIO_MUXCFG +3 ,0 ); + val16 =rtl8xxxu_read16 (priv,REG_GPIO_MUXCFG +2 ) &0xff0f ; + val16 |= (val16 &0xf ) <<4 ; + val16 |=0x0780 ; +rtl8xxxu_write16 (priv,REG_GPIO_MUXCFG +2 , val16); + +/* _DisableAnalog */ + val8 =0x23 ; +if (priv->vendor_umc && priv->chip_cut ==1 ) + val8 |=BIT (3 ); +rtl8xxxu_write8 (priv,REG_SPS0_CTRL , val8); + + val16 =APS_FSMCO_HOST |APS_FSMCO_HW_SUSPEND |APS_FSMCO_PFM_ALDN ; +rtl8xxxu_write16 (priv,REG_APS_FSMCO , val16); + +rtl8xxxu_write8 (priv,REG_RSV_CTRL ,0x0e ); +} +static int rtl8192cu_led_brightness_set (struct led_classdev *led_cdev,enum led_brightness brightness) {
@@ -618,7 +696,7 @@ struct rtl8xxxu_fileops rtl8192cu_fops = { .parse_efuse = rtl8192cu_parse_efuse, .load_firmware = rtl8192cu_load_firmware, .power_on = rtl8192cu_power_on, - .power_off = rtl8xxxu_power_off, + .power_off = rtl8192cu_power_off, .read_efuse = rtl8xxxu_read_efuse, .reset_8051 = rtl8xxxu_reset_8051, .llt_init = rtl8xxxu_init_llt_table,
drivers/net/wireless/realtek/rtl8xxxu/8723a.c +114 -1
127 lines not on this page · raw message
drivers/net/wireless/realtek/rtl8xxxu/core.c +0 -123
141 lines not on this page · raw message
drivers/net/wireless/realtek/rtl8xxxu/regs.h +1 -0
@@ -40,6 +40,7 @@#define APS_FSMCO_SW_LPS BIT(10)#define APS_FSMCO_HW_SUSPEND BIT(11)#define APS_FSMCO_PCIE BIT(12) +#define APS_FSMCO_HOST BIT(14)#define APS_FSMCO_HW_POWERDOWN BIT(15)#define APS_FSMCO_WLON_RESET BIT(16)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +0 -1
@@ -2078,7 +2078,6 @@ int rtl8xxxu_init_phy_regs(struct rtl8xxxu_priv *priv, const struct rtl8xxxu_reg32val *array);int rtl8xxxu_load_firmware (struct rtl8xxxu_priv *priv,const char *fw_name);void rtl8xxxu_firmware_self_reset (struct rtl8xxxu_priv *priv); -void rtl8xxxu_power_off (struct rtl8xxxu_priv *priv);void rtl8xxxu_identify_vendor_1bit (struct rtl8xxxu_priv *priv,u32 vendor);void rtl8xxxu_identify_vendor_2bits (struct rtl8xxxu_priv *priv,u32 vendor);void rtl8xxxu_config_endpoints_sie (struct rtl8xxxu_priv *priv);
Signature · 1 line
2.51.0
RE: [PATCH rtw-next 3/3] wifi: rtl8xxxu: Use correct power off sequence for RTL8192CU
Quoted 17 lines · Bitterblue Smith
RTL8192CU disappears and reappears when rtl8xxxu is unloaded:
usbcore: deregistering interface driver rtl8xxxu
wlp3s0f3u2: deauthenticating from ... by local choice (Reason: 3=DEAUTH_LEAVING) usb 1-2:rtl8xxxu_active_to_emu: Disabling MAC timed out
usb 1-2: USB disconnect, device number 7
usb 1-2: disconnecting
usb 1-2: new high-speed USB device number 8 usingxhci_hcd
usb 1-2: New USB device found, idVendor=0bda, idProduct=8178, bcdDevice= 2.00 usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 1-2: Product: 802.11n WLAN Adapter
usb 1-2: Manufacturer: Realtek
usb 1-2: SerialNumber:00e04c000001This is because rtl8xxxu is using the power off sequence for RTL8723AU. Add the correct power off sequence for RTL8192CU.
Quoted 7 lines
rtl8xxxu_power_off(),rtl8xxxu_active_to_emu(), andrtl8xxxu_emu_to_disabled()are now only used for RTL8723AU, so move them to8723a.cand rename them to have the "rtl8723au" prefix.Tested only with RTL8192CU.
Signed-off-by Bitterblue Smith <[email protected]>
Quoted 8 lines · Bitterblue Smith
Sent: Thursday, October 9, 2025 7:53 PM
These chips don't report the signal strength for many (any?) data frames. When the signal strength is not known, setRX_FLAG_NO_SIGNAL_VALin order to avoid reporting a signal strength of 0.Tested with RTL8192FU and RTL8192CU.
Signed-off-by Bitterblue Smith <[email protected]>
Quoted 8 lines · Bitterblue Smith
These chips don't report the signal strength for many (any?) data frames. When the signal strength is not known, set
RX_FLAG_NO_SIGNAL_VALin order to avoid reporting a signal strength of 0.Tested with RTL8192FU and RTL8192CU.
Signed-off-by Bitterblue Smith <[email protected]>Reviewed-by Ping-Ke Shih <[email protected]>
3 patch(es) applied to rtw-next branch of rtw.git, thanks.
7aeb8c118ef9 wifi: rtl8xxxu: Report the signal strength only if it's known fb5183aa65f6 wifi: rtl8xxxu: Dump the efuse right after reading it 9b567039e540 wifi: rtl8xxxu: Use correct power off sequence for RTL8192CU