Skip to content

Commit 80524ab

Browse files
author
Kalle Valo
committed
Merge tag 'rtw-next-2025-01-12' of https://github.com/pkshih/rtw
rtw-next patches for v6.14 rtl8xxxu, rtlwifi and rtw88 fix field issues reported by users. rtw89 is ongoing to implement MLO and fix issues during the development. Major changes: rtw88: - support LED blinking rtw89: - support RTL8922AE-VS chip
2 parents 1a0d247 + 4b6652b commit 80524ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+762
-122
lines changed

drivers/net/wireless/realtek/rtl8xxxu/8188e.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = {
18601860
.set_crystal_cap = rtl8188f_set_crystal_cap,
18611861
.cck_rssi = rtl8188e_cck_rssi,
18621862
.led_classdev_brightness_set = rtl8188eu_led_brightness_set,
1863-
.writeN_block_size = 128,
1863+
.writeN_block_size = 196,
18641864
.rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16),
18651865
.tx_desc_size = sizeof(struct rtl8xxxu_txdesc32),
18661866
.has_tx_report = 1,

drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ enum rtl8821a_h2c_cmd {
197197

198198
/* _MEDIA_STATUS_RPT_PARM_CMD1 */
199199
#define SET_H2CCMD_MSRRPT_PARM_OPMODE(__cmd, __value) \
200-
u8p_replace_bits(__cmd + 1, __value, BIT(0))
200+
u8p_replace_bits(__cmd, __value, BIT(0))
201201
#define SET_H2CCMD_MSRRPT_PARM_MACID_IND(__cmd, __value) \
202-
u8p_replace_bits(__cmd + 1, __value, BIT(1))
202+
u8p_replace_bits(__cmd, __value, BIT(1))
203203

204204
/* AP_OFFLOAD */
205205
#define SET_H2CCMD_AP_OFFLOAD_ON(__cmd, __value) \

drivers/net/wireless/realtek/rtw88/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ rtw88_core-y += main.o \
2020

2121
rtw88_core-$(CONFIG_PM) += wow.o
2222

23+
rtw88_core-$(CONFIG_LEDS_CLASS) += led.o
24+
2325
obj-$(CONFIG_RTW88_8822B) += rtw88_8822b.o
2426
rtw88_8822b-objs := rtw8822b.o rtw8822b_table.o
2527

drivers/net/wireless/realtek/rtw88/fw.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ void rtw_fw_c2h_cmd_handle(struct rtw_dev *rtwdev, struct sk_buff *skb)
332332
case C2H_RA_RPT:
333333
rtw_fw_ra_report_handle(rtwdev, c2h->payload, len);
334334
break;
335+
case C2H_ADAPTIVITY:
336+
rtw_fw_adaptivity_result(rtwdev, c2h->payload, len);
337+
break;
335338
default:
336339
rtw_dbg(rtwdev, RTW_DBG_FW, "C2H 0x%x isn't handled\n", c2h->id);
337340
break;
@@ -367,10 +370,6 @@ void rtw_fw_c2h_cmd_rx_irqsafe(struct rtw_dev *rtwdev, u32 pkt_offset,
367370
rtw_fw_scan_result(rtwdev, c2h->payload, len);
368371
dev_kfree_skb_any(skb);
369372
break;
370-
case C2H_ADAPTIVITY:
371-
rtw_fw_adaptivity_result(rtwdev, c2h->payload, len);
372-
dev_kfree_skb_any(skb);
373-
break;
374373
default:
375374
/* pass offset for further operation */
376375
*((u32 *)skb->cb) = pkt_offset;
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2+
/* Copyright(c) 2025 Realtek Corporation
3+
*/
4+
5+
#include "main.h"
6+
#include "debug.h"
7+
#include "led.h"
8+
9+
static int rtw_led_set_blocking(struct led_classdev *led,
10+
enum led_brightness brightness)
11+
{
12+
struct rtw_dev *rtwdev = container_of(led, struct rtw_dev, led_cdev);
13+
14+
rtwdev->chip->ops->led_set(led, brightness);
15+
16+
return 0;
17+
}
18+
19+
void rtw_led_init(struct rtw_dev *rtwdev)
20+
{
21+
static const struct ieee80211_tpt_blink rtw_tpt_blink[] = {
22+
{ .throughput = 0 * 1024, .blink_time = 334 },
23+
{ .throughput = 1 * 1024, .blink_time = 260 },
24+
{ .throughput = 5 * 1024, .blink_time = 220 },
25+
{ .throughput = 10 * 1024, .blink_time = 190 },
26+
{ .throughput = 20 * 1024, .blink_time = 170 },
27+
{ .throughput = 50 * 1024, .blink_time = 150 },
28+
{ .throughput = 70 * 1024, .blink_time = 130 },
29+
{ .throughput = 100 * 1024, .blink_time = 110 },
30+
{ .throughput = 200 * 1024, .blink_time = 80 },
31+
{ .throughput = 300 * 1024, .blink_time = 50 },
32+
};
33+
struct led_classdev *led = &rtwdev->led_cdev;
34+
int err;
35+
36+
if (!rtwdev->chip->ops->led_set)
37+
return;
38+
39+
if (rtw_hci_type(rtwdev) == RTW_HCI_TYPE_PCIE)
40+
led->brightness_set = rtwdev->chip->ops->led_set;
41+
else
42+
led->brightness_set_blocking = rtw_led_set_blocking;
43+
44+
snprintf(rtwdev->led_name, sizeof(rtwdev->led_name),
45+
"rtw88-%s", dev_name(rtwdev->dev));
46+
47+
led->name = rtwdev->led_name;
48+
led->max_brightness = LED_ON;
49+
led->default_trigger =
50+
ieee80211_create_tpt_led_trigger(rtwdev->hw,
51+
IEEE80211_TPT_LEDTRIG_FL_RADIO,
52+
rtw_tpt_blink,
53+
ARRAY_SIZE(rtw_tpt_blink));
54+
55+
err = led_classdev_register(rtwdev->dev, led);
56+
if (err) {
57+
rtw_warn(rtwdev, "Failed to register the LED, error %d\n", err);
58+
return;
59+
}
60+
61+
rtwdev->led_registered = true;
62+
}
63+
64+
void rtw_led_deinit(struct rtw_dev *rtwdev)
65+
{
66+
struct led_classdev *led = &rtwdev->led_cdev;
67+
68+
if (!rtwdev->led_registered)
69+
return;
70+
71+
rtwdev->chip->ops->led_set(led, LED_OFF);
72+
led_classdev_unregister(led);
73+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2+
/* Copyright(c) 2025 Realtek Corporation
3+
*/
4+
5+
#ifndef __RTW_LED_H
6+
#define __RTW_LED_H
7+
8+
#ifdef CONFIG_LEDS_CLASS
9+
10+
void rtw_led_init(struct rtw_dev *rtwdev);
11+
void rtw_led_deinit(struct rtw_dev *rtwdev);
12+
13+
#else
14+
15+
static inline void rtw_led_init(struct rtw_dev *rtwdev)
16+
{
17+
}
18+
19+
static inline void rtw_led_deinit(struct rtw_dev *rtwdev)
20+
{
21+
}
22+
23+
#endif
24+
25+
#endif

drivers/net/wireless/realtek/rtw88/main.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "bf.h"
2020
#include "sar.h"
2121
#include "sdio.h"
22+
#include "led.h"
2223

2324
bool rtw_disable_lps_deep_mode;
2425
EXPORT_SYMBOL(rtw_disable_lps_deep_mode);
@@ -1217,7 +1218,6 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,
12171218
u8 wireless_set;
12181219
u8 bw_mode;
12191220
u8 rate_id;
1220-
u8 rf_type = RF_1T1R;
12211221
u8 stbc_en = 0;
12221222
u8 ldpc_en = 0;
12231223
u8 tx_num = 1;
@@ -1302,13 +1302,10 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,
13021302
break;
13031303
}
13041304

1305-
if (sta->deflink.vht_cap.vht_supported && ra_mask & 0xffc00000) {
1305+
if (sta->deflink.vht_cap.vht_supported && ra_mask & 0xffc00000)
13061306
tx_num = 2;
1307-
rf_type = RF_2T2R;
1308-
} else if (sta->deflink.ht_cap.ht_supported && ra_mask & 0xfff00000) {
1307+
else if (sta->deflink.ht_cap.ht_supported && ra_mask & 0xfff00000)
13091308
tx_num = 2;
1310-
rf_type = RF_2T2R;
1311-
}
13121309

13131310
rate_id = get_rate_id(wireless_set, bw_mode, tx_num);
13141311

@@ -1319,7 +1316,6 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si,
13191316
si->bw_mode = bw_mode;
13201317
si->stbc_en = stbc_en;
13211318
si->ldpc_en = ldpc_en;
1322-
si->rf_type = rf_type;
13231319
si->sgi_enable = is_support_sgi;
13241320
si->vht_enable = is_vht_enable;
13251321
si->ra_mask = ra_mask;
@@ -2297,16 +2293,18 @@ int rtw_register_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw)
22972293
return ret;
22982294
}
22992295

2296+
rtw_led_init(rtwdev);
2297+
23002298
ret = ieee80211_register_hw(hw);
23012299
if (ret) {
23022300
rtw_err(rtwdev, "failed to register hw\n");
2303-
return ret;
2301+
goto led_deinit;
23042302
}
23052303

23062304
ret = rtw_regd_hint(rtwdev);
23072305
if (ret) {
23082306
rtw_err(rtwdev, "failed to hint regd\n");
2309-
return ret;
2307+
goto led_deinit;
23102308
}
23112309

23122310
rtw_debugfs_init(rtwdev);
@@ -2315,6 +2313,10 @@ int rtw_register_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw)
23152313
rtwdev->bf_info.bfer_su_cnt = 0;
23162314

23172315
return 0;
2316+
2317+
led_deinit:
2318+
rtw_led_deinit(rtwdev);
2319+
return ret;
23182320
}
23192321
EXPORT_SYMBOL(rtw_register_hw);
23202322

@@ -2325,6 +2327,7 @@ void rtw_unregister_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw)
23252327
ieee80211_unregister_hw(hw);
23262328
rtw_unset_supported_band(hw, chip);
23272329
rtw_debugfs_deinit(rtwdev);
2330+
rtw_led_deinit(rtwdev);
23282331
}
23292332
EXPORT_SYMBOL(rtw_unregister_hw);
23302333

drivers/net/wireless/realtek/rtw88/main.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,12 +510,12 @@ struct rtw_5g_txpwr_idx {
510510
struct rtw_5g_vht_ns_pwr_idx_diff vht_2s_diff;
511511
struct rtw_5g_vht_ns_pwr_idx_diff vht_3s_diff;
512512
struct rtw_5g_vht_ns_pwr_idx_diff vht_4s_diff;
513-
};
513+
} __packed;
514514

515515
struct rtw_txpwr_idx {
516516
struct rtw_2g_txpwr_idx pwr_idx_2g;
517517
struct rtw_5g_txpwr_idx pwr_idx_5g;
518-
};
518+
} __packed;
519519

520520
struct rtw_channel_params {
521521
u8 center_chan;
@@ -757,7 +757,6 @@ struct rtw_sta_info {
757757
u8 mac_id;
758758
u8 rate_id;
759759
enum rtw_bandwidth bw_mode;
760-
enum rtw_rf_type rf_type;
761760
u8 stbc_en:2;
762761
u8 ldpc_en:2;
763762
bool sgi_enable;
@@ -888,6 +887,7 @@ struct rtw_chip_ops {
888887
bool is_tx2_path);
889888
void (*config_txrx_mode)(struct rtw_dev *rtwdev, u8 tx_path,
890889
u8 rx_path, bool is_tx2_path);
890+
void (*led_set)(struct led_classdev *led, enum led_brightness brightness);
891891
/* for USB/SDIO only */
892892
void (*fill_txdesc_checksum)(struct rtw_dev *rtwdev,
893893
struct rtw_tx_pkt_info *pkt_info,
@@ -2098,6 +2098,10 @@ struct rtw_dev {
20982098
struct completion fw_scan_density;
20992099
bool ap_active;
21002100

2101+
bool led_registered;
2102+
char led_name[32];
2103+
struct led_classdev led_cdev;
2104+
21012105
/* hci related data, must be last */
21022106
u8 priv[] __aligned(sizeof(void *));
21032107
};

drivers/net/wireless/realtek/rtw88/reg.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,19 @@
7878
#define BIT_PAPE_SEL_EN BIT(25)
7979
#define BIT_DPDT_WL_SEL BIT(24)
8080
#define BIT_DPDT_SEL_EN BIT(23)
81+
#define BIT_GPIO13_14_WL_CTRL_EN BIT(22)
82+
#define BIT_LED2_SV BIT(19)
83+
#define BIT_LED2_CM GENMASK(18, 16)
84+
#define BIT_LED1_SV BIT(11)
85+
#define BIT_LED1_CM GENMASK(10, 8)
86+
#define BIT_LED0_SV BIT(3)
87+
#define BIT_LED0_CM GENMASK(2, 0)
88+
#define BIT_LED_MODE_SW_CTRL 0
89+
#define BIT_LED_MODE_RX 6
90+
#define BIT_LED_MODE_TX 4
91+
#define BIT_LED_MODE_TRX 2
8192
#define REG_LEDCFG2 0x004E
93+
#define REG_GPIO_PIN_CTRL_2 0x0060
8294
#define REG_PAD_CTRL1 0x0064
8395
#define BIT_BT_BTG_SEL BIT(31)
8496
#define BIT_PAPE_WLBT_SEL BIT(29)
@@ -871,7 +883,17 @@
871883

872884
#define REG_USB_MOD 0xf008
873885
#define REG_USB3_RXITV 0xf050
886+
#define REG_USB2_PHY_ADR 0xfe40
887+
#define REG_USB2_PHY_DAT 0xfe41
888+
#define REG_USB2_PHY_CMD 0xfe42
889+
#define BIT_USB2_PHY_CMD_TRG 0x81
874890
#define REG_USB_HRPWM 0xfe58
891+
#define REG_USB3_PHY_ADR 0xff0c
892+
#define REG_USB3_PHY_DAT_L 0xff0d
893+
#define REG_USB3_PHY_DAT_H 0xff0e
894+
#define BIT_USB3_PHY_ADR_WR BIT(7)
895+
#define BIT_USB3_PHY_ADR_RD BIT(6)
896+
#define BIT_USB3_PHY_ADR_MASK GENMASK(5, 0)
875897

876898
#define RF_MODE 0x00
877899
#define RF_MODOPT 0x01

drivers/net/wireless/realtek/rtw88/rtw8703b.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ static void rtw8703b_set_channel_bb(struct rtw_dev *rtwdev, u8 channel, u8 bw,
903903
rtw_write32_mask(rtwdev, REG_FPGA0_RFMOD, BIT_MASK_RFMOD, 0x0);
904904
rtw_write32_mask(rtwdev, REG_FPGA1_RFMOD, BIT_MASK_RFMOD, 0x0);
905905
rtw_write32_mask(rtwdev, REG_OFDM0_TX_PSD_NOISE,
906-
GENMASK(31, 20), 0x0);
906+
GENMASK(31, 30), 0x0);
907907
rtw_write32(rtwdev, REG_BBRX_DFIR, 0x4A880000);
908908
rtw_write32(rtwdev, REG_OFDM0_A_TX_AFE, 0x19F60000);
909909
break;
@@ -1198,9 +1198,9 @@ static u8 rtw8703b_iqk_rx_path(struct rtw_dev *rtwdev,
11981198
rtw_write32(rtwdev, REG_RXIQK_TONE_A_11N, 0x38008c1c);
11991199
rtw_write32(rtwdev, REG_TX_IQK_TONE_B, 0x38008c1c);
12001200
rtw_write32(rtwdev, REG_RX_IQK_TONE_B, 0x38008c1c);
1201-
rtw_write32(rtwdev, REG_TXIQK_PI_A_11N, 0x8216000f);
1201+
rtw_write32(rtwdev, REG_TXIQK_PI_A_11N, 0x8214030f);
12021202
rtw_write32(rtwdev, REG_RXIQK_PI_A_11N, 0x28110000);
1203-
rtw_write32(rtwdev, REG_TXIQK_PI_B, 0x28110000);
1203+
rtw_write32(rtwdev, REG_TXIQK_PI_B, 0x82110000);
12041204
rtw_write32(rtwdev, REG_RXIQK_PI_B, 0x28110000);
12051205

12061206
/* LOK setting */
@@ -1372,7 +1372,7 @@ void rtw8703b_iqk_fill_a_matrix(struct rtw_dev *rtwdev, const s32 result[])
13721372
return;
13731373

13741374
tmp_rx_iqi |= FIELD_PREP(BIT_MASK_RXIQ_S1_X, result[IQK_S1_RX_X]);
1375-
tmp_rx_iqi |= FIELD_PREP(BIT_MASK_RXIQ_S1_Y1, result[IQK_S1_RX_X]);
1375+
tmp_rx_iqi |= FIELD_PREP(BIT_MASK_RXIQ_S1_Y1, result[IQK_S1_RX_Y]);
13761376
rtw_write32(rtwdev, REG_A_RXIQI, tmp_rx_iqi);
13771377
rtw_write32_mask(rtwdev, REG_RXIQK_MATRIX_LSB_11N, BIT_MASK_RXIQ_S1_Y2,
13781378
BIT_SET_RXIQ_S1_Y2(result[IQK_S1_RX_Y]));

0 commit comments

Comments
 (0)