public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
To: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Subject: [PATCH rtw-next 02/11] wifi: rtw89: usb: Fix rtw89_usb_get_bulkout_id() for RTL8852CU
Date: Fri, 1 Aug 2025 23:37:35 +0300	[thread overview]
Message-ID: <ce0b772b-5822-41fe-b496-b1c725c222fc@gmail.com> (raw)
In-Reply-To: <2527e1be-3121-4f29-8539-72f4bfb225a6@gmail.com>

RTL8852CU can work in two bands at the same time, thus some USB bulk
out endpoints are dedicated to one band, others to the other band.

Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
---
 drivers/net/wireless/realtek/rtw89/usb.c | 64 +++++++++++++++++-------
 1 file changed, 46 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/usb.c b/drivers/net/wireless/realtek/rtw89/usb.c
index 6cf89aee252e..eb9978a60d04 100644
--- a/drivers/net/wireless/realtek/rtw89/usb.c
+++ b/drivers/net/wireless/realtek/rtw89/usb.c
@@ -167,24 +167,52 @@ rtw89_usb_ops_check_and_reclaim_tx_resource(struct rtw89_dev *rtwdev,
 	return 42; /* TODO some kind of calculation? */
 }
 
-static u8 rtw89_usb_get_bulkout_id(u8 ch_dma)
+static u8 rtw89_usb_get_bulkout_id(struct rtw89_dev *rtwdev, u8 ch_dma)
 {
-	switch (ch_dma) {
-	case RTW89_DMA_ACH0:
-		return 3;
-	case RTW89_DMA_ACH1:
-		return 4;
-	case RTW89_DMA_ACH2:
-		return 5;
-	case RTW89_DMA_ACH3:
-		return 6;
-	default:
-	case RTW89_DMA_B0MG:
-		return 0;
-	case RTW89_DMA_B0HI:
-		return 1;
-	case RTW89_DMA_H2C:
-		return 2;
+	if (rtwdev->chip->chip_id == RTL8852C) {
+		switch (ch_dma) {
+		case RTW89_DMA_ACH0:
+			return 3;
+		case RTW89_DMA_ACH2:
+			return 5;
+		case RTW89_DMA_ACH4:
+			return 4;
+		case RTW89_DMA_ACH6:
+			return 6;
+		default:
+			rtw89_warn(rtwdev, "unexpected TX channel %d\n",
+				   ch_dma);
+			fallthrough;
+		case RTW89_DMA_B0MG:
+		case RTW89_DMA_B0HI:
+			return 0;
+		case RTW89_DMA_B1MG:
+		case RTW89_DMA_B1HI:
+			return 1;
+		case RTW89_DMA_H2C:
+			return 2;
+		}
+	} else {
+		switch (ch_dma) {
+		case RTW89_DMA_ACH0:
+			return 3;
+		case RTW89_DMA_ACH1:
+			return 4;
+		case RTW89_DMA_ACH2:
+			return 5;
+		case RTW89_DMA_ACH3:
+			return 6;
+		default:
+			rtw89_warn(rtwdev, "unexpected TX channel %d\n",
+				   ch_dma);
+			fallthrough;
+		case RTW89_DMA_B0MG:
+			return 0;
+		case RTW89_DMA_B0HI:
+			return 1;
+		case RTW89_DMA_H2C:
+			return 2;
+		}
 	}
 }
 
@@ -251,7 +279,7 @@ static int rtw89_usb_write_port(struct rtw89_dev *rtwdev, u8 ch_dma,
 	struct rtw89_usb *rtwusb = rtw89_usb_priv(rtwdev);
 	struct usb_device *usbd = rtwusb->udev;
 	struct urb *urb;
-	u8 bulkout_id = rtw89_usb_get_bulkout_id(ch_dma);
+	u8 bulkout_id = rtw89_usb_get_bulkout_id(rtwdev, ch_dma);
 	unsigned int pipe;
 	int ret;
 
-- 
2.50.0


  parent reply	other threads:[~2025-08-01 20:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01 20:35 [PATCH rtw-next 00/11] wifi: rtw89: Add support for RTL8852CU Bitterblue Smith
2025-08-01 20:37 ` [PATCH rtw-next 01/11] wifi: rtw89: Fix rtw89_core_get_ch_dma() " Bitterblue Smith
2025-08-01 20:37 ` Bitterblue Smith [this message]
2025-08-01 20:38 ` [PATCH rtw-next 03/11] wifi: rtw89: usb: Fix rtw89_usb_ops_mac_pre_init() " Bitterblue Smith
2025-08-01 20:38 ` [PATCH rtw-next 04/11] wifi: rtw89: usb: Fix rtw89_usb_ops_mac_post_init() " Bitterblue Smith
2025-08-01 20:38 ` [PATCH rtw-next 05/11] wifi: rtw89: Fix rtw89_mac_dmac_func_pre_en_ax() for USB/SDIO Bitterblue Smith
2025-08-01 20:39 ` [PATCH rtw-next 06/11] wifi: rtw89: 8852c: Fix rtw8852c_pwr_{on,off}_func() for USB Bitterblue Smith
2025-08-01 20:40 ` [PATCH rtw-next 00/11] wifi: rtw89: Add support for RTL8852CU Bitterblue Smith
2025-08-01 20:41 ` [PATCH rtw-next 09/11] wifi: rtw89: 8852c: Accept USB devices and load their MAC address Bitterblue Smith
2025-08-01 20:44 ` [PATCH rtw-next 00/11] wifi: rtw89: Add support for RTL8852CU Bitterblue Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce0b772b-5822-41fe-b496-b1c725c222fc@gmail.com \
    --to=rtl8821cerfe2@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox