From patchwork Sun Jan 26 22:53:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 860172 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C46FC5672 for ; Sun, 26 Jan 2025 22:53:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932034; cv=none; b=ZV/MOD87STlM+2uvVjbvjXwcYmzGIuJjwbFvQjFRIjaQqGY4sKAE+Gl0DZEDX7v/rFfi0zstPSrcqZ/qa0KJcBqYuTXqEgKk1m3Z207a/llWISLkIEglKcfWMxXd23McjVPGY2WXmRbHT0t4olbjS8we9h/7zKRyRhf1fJPppFQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932034; c=relaxed/simple; bh=w7IO+dyvb58ZJfz4Cpas3+qJgjZbamZZiIpdmVHIlC4=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=darIbkwht3eCAuYl3w1SaUXftCbAV+Tw9oQHjLyWuq3onYvDXkBHOaRh/L4g7oWqfDjfDtSU2smCUR+EeQbk8gguDVEgQAPfE1RUJ9Jsxfaay36iTvi7P3zzdAN7+zBL610oGlyWiZs7tPQ2I+2rsq7RpfqekuThb7UpVGnrYCs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TwPay0LR; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TwPay0LR" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-38a88ba968aso3791379f8f.3 for ; Sun, 26 Jan 2025 14:53:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737932031; x=1738536831; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=z+Fr7qGeN+LeEeP+tt4dHzvjJ7Lgpc40XLCNl8pt5Ak=; b=TwPay0LRPlH9IorMJi6w9CbWOF6rVdXaejOnaRaOD+sz3W6PbMMmM7hngTYP0HYxIX 4/ZLy1xux9o6FzghKnjtCme4nvpr1MTw6mv8C0pj8Y2snfl753joj8XN+8GkkHU+5txs ooa3LEtVK5H0cNOIsa8PLMTE87bRuA7d8YbRZgnrm86pVWyvCbS8ZoK+sgsJaMdsAvZ0 vsGN37W7fjTfNLjNjZ2gW/IlAmVFM9HoKtUYcuVbM0n1KkkPu8pgYCsUpJNWQEvbumdN lc48bdiDC0SxQjfsS7P3POQA+FKDTvHXfvM8PIBDtXN7DkKwQfALgMnI9ft6Onl3KfgG WHSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737932031; x=1738536831; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=z+Fr7qGeN+LeEeP+tt4dHzvjJ7Lgpc40XLCNl8pt5Ak=; b=fknXFHoXPSTcDz8nvQgiMtZPdMrcusUUVfaIr3jIdRIhK3jpO1MymclQjK+CYWlslo BKdRQR/GD7ao0Yyz0VMYinB9pYZCOZXGYQRvvxjpMfyTCsTluTM9RowN2Mq2wMa2mzaZ nbfqS3biBDv3nKDgZmhJbmdgb0JiutLTgp0Oua5m7ANG33xSvmdATbUVbjrQl+zNdERN 9iVIZOAWmLb7ZVFl71WBEq1vUMHEjcjNsd5jL63784zbPNx/QtW6iEQTJhuWbv5W8aC4 /XD+gMkDuKh0DN4SsygnXmHeK/5a/e6ysvloIP+EtNM+T5PUZaxRCt3AYJCSkbzis7ap 2FXQ== X-Gm-Message-State: AOJu0YwqD/y5p5sgfsik9RXh9Ckhlc+2NloeRQWDYuDWJJaT64cxPPWh C+gv54DR/IE9IipuCinkGvbQkl12E6Pq2llkK0jSKNE5hyu5pt0mJDwZ9w== X-Gm-Gg: ASbGnctLZgLf5PRDlWFSrh2En+9x8HJUWXF+ldxGRjubO0au1UDzmHsuxIf6I7EyQOz DSswbaQFtYzLecrNor+7f/p8Iwkt8MTEdrvVUMYn3BB2grIKjnirp+2lw4tyvMD+koLvngTZiPA pkz3DFGBtd+5f6whaqUmLW1xsCs97S7LgsYiyU9FngeyZ8fDN/Q8HKU3mU9oPZa/llDuEvlm+Yj BjNAAK1XmSiMZFGvbZ2UIvX2iLP87qdxF/IpPmArKIpZCXC2SjQF0kvwmaXhd68xmwxil9d/vBp t+aZb2eoPzHKrMTi+v0sFc0= X-Google-Smtp-Source: AGHT+IGbtvEBSX932LBcdMI2sf7xe78Wos7ifcmA7HaIIUgIQS9bq2e1txUCBb+KtnLS2Zrr6S5LWg== X-Received: by 2002:a5d:64c3:0:b0:38c:3fab:3def with SMTP id ffacd0b85a97d-38c3fab419cmr2293415f8f.10.1737932029237; Sun, 26 Jan 2025 14:53:49 -0800 (PST) Received: from [192.168.0.50] ([79.119.240.80]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1bad92sm9245590f8f.61.2025.01.26.14.53.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jan 2025 14:53:48 -0800 (PST) Message-ID: <0e9b08ef-4719-4d37-8b5c-2d1a780499d7@gmail.com> Date: Mon, 27 Jan 2025 00:53:47 +0200 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/7] wifi: rtw88: Fix __rtw_download_firmware() for RTL8814AU From: Bitterblue Smith To: "linux-wireless@vger.kernel.org" Cc: Ping-Ke Shih References: Content-Language: en-US In-Reply-To: Don't call ltecoex_read_reg() and ltecoex_reg_write() when the ltecoex_addr member of struct rtw_chip_info is NULL. The RTL8814AU doesn't have this feature. Signed-off-by: Bitterblue Smith Acked-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw88/mac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c index cae9cca6dca3..63edf6461de8 100644 --- a/drivers/net/wireless/realtek/rtw88/mac.c +++ b/drivers/net/wireless/realtek/rtw88/mac.c @@ -784,7 +784,8 @@ static int __rtw_download_firmware(struct rtw_dev *rtwdev, if (!check_firmware_size(data, size)) return -EINVAL; - if (!ltecoex_read_reg(rtwdev, 0x38, <ecoex_bckp)) + if (rtwdev->chip->ltecoex_addr && + !ltecoex_read_reg(rtwdev, 0x38, <ecoex_bckp)) return -EBUSY; wlan_cpu_enable(rtwdev, false); @@ -802,7 +803,8 @@ static int __rtw_download_firmware(struct rtw_dev *rtwdev, wlan_cpu_enable(rtwdev, true); - if (!ltecoex_reg_write(rtwdev, 0x38, ltecoex_bckp)) { + if (rtwdev->chip->ltecoex_addr && + !ltecoex_reg_write(rtwdev, 0x38, ltecoex_bckp)) { ret = -EBUSY; goto dlfw_fail; } From patchwork Sun Jan 26 22:54:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 860369 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DF725672 for ; Sun, 26 Jan 2025 22:55:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932102; cv=none; b=PzCt5Un3Oo2WKwbNc4U565MestPc5NvBWxAg5/MHAcf/EXmQU+9dWBux/5vNjg2VIsZqUhBbE41cu9fEQQNgPzSk6olm+YV3a5rN3nlsqmKFoO61anIlRdHebqzTSX/DT/T3sEG9kxMrlaF330OZRhKWE4+JImIC+IP9x5XGTSk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932102; c=relaxed/simple; bh=gikjv/JFgpU6gwksXYuonDfyGKlhm0Iv6qHiKQP0/2I=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=Ya3wHvhLQLZwJjs87FElxxXV+oZ1uYaZDwmc6O6mt17pxxGCkqWy8lQPw9q8xNheRsCJifgCEDnneajE6vutzn5plB80nQdW0PK26GKOIQwiihYRsX4MwCX40NqfdRLHNy/+Twh50hoqECPwFHSN44RCnfQbAiiXTPdZlFkGmJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZP1AsyRM; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZP1AsyRM" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-385d7b4da2bso3631910f8f.1 for ; Sun, 26 Jan 2025 14:55:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737932099; x=1738536899; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=OdJPl/pIxq7UPAWlijuOkLRWdPX67GLTSPT2bSG0RNk=; b=ZP1AsyRMP6hkkNpWPwup6f4d2nc1lknKqCf4CGyWzpG7qFmry4qLwpiSP/LjxzZ8nQ QtApdVwhHRqGeg26gKlDIGXtq7ZXa6h5E3R4fJLkImxD6LOmZ7BxHqfmyWF8s1s+T3V5 +mX42N2MU4dLfpxVxcu4fOf3RqvfEM6W4cXrwDd1Q3sOrtajuAKHrBKze2aDnw6OQs/8 obhEHInBUTTqdWMsRkHRcuPGiUfX/m7WEO7EM6W66CdOfg8T+b/Szw+DnBU91Z38mNSh I/0ofv7O2rnP8E1aCkQYwpeoyQA4cryuWx51NjXMOFoVI4NJDmb2+XcE4+htmX1GA3Co XKGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737932099; x=1738536899; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OdJPl/pIxq7UPAWlijuOkLRWdPX67GLTSPT2bSG0RNk=; b=Aiw+mmCk6VusgHCvTmZu4TYGntrC9oEyjrz7w+8aeiGDBshYL3gg6934DmWiLATOMa O2b5CoEKiiShmsCK8Lxr/8p6ZR3A3MDL9eCXwKYZqKlX0E6SvsOhSuMeu0u5qR85OV10 +NvFVVYSuZXoEALPpGuMTC1/3dD+Xz4M7hpSiba9CY6eQW+IayCcr990tt7rELLzUEsT AXfyshh2B9HMc15rJ+s41Q5Mop3PnRuT3qlqHVsBifqUpMV67TpaImbCiaqkgvHQ0WwT bnh2xDx/w+YpLdnWPVK80WX9oN0irvsyguGOZ2pYMRrL1dCOD4i4QIV7QqaEXGusMxcd uQ9g== X-Gm-Message-State: AOJu0YzYxMnB2nY+OyUyvuHkEYETy7wmOaItlZnohpqOh75lNOSTPHdT p1QI3Cpa9bSy/7/TFPV6AP7SrDfoxLl9rx/yTPnrwBT1c14evcJCMlZ2Dg== X-Gm-Gg: ASbGncvdG6llGukaXIaOJRpuT0dRDy+wz/dflBlVfyGFPR3S0HWcWfPtzTkAt062Z3+ vE6ODCi/9M4l5bmLpyCoAc3ANeLdwLlH+kGA9rF7GPG6bEnUHP1MwiUMKXXr+2q1VALHa8bUrBE mbnY8yLEuG5owUq9/Z9+0/WA3oXSowe3NUu1Fm3GsTzZcUk91+CizelsAvqlpf1erkoxFN4/Hdf hsDViYuZ/poDQ/5OkFH/eq57lbZx0rx56v9L76am9Ro1Cw2dhHxykjLYXv7/N8EoB8XKQb/8T7M thOk+VK/3mJF X-Google-Smtp-Source: AGHT+IFuGUSijt/GKbDJ2m1j8YvlNf3uwrSv0Xe2uJ2SK9O1pNnNvpKLZi9LS1z74pi6ZrRVyAuvAg== X-Received: by 2002:a05:6000:144a:b0:38a:9c1b:df5b with SMTP id ffacd0b85a97d-38bf566a279mr35384857f8f.30.1737932099248; Sun, 26 Jan 2025 14:54:59 -0800 (PST) Received: from [192.168.0.50] ([79.119.240.80]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1bbb39sm9300255f8f.65.2025.01.26.14.54.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jan 2025 14:54:58 -0800 (PST) Message-ID: Date: Mon, 27 Jan 2025 00:54:57 +0200 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/7] wifi: rtw88: Fix download_firmware_validate() for RTL8814AU From: Bitterblue Smith To: "linux-wireless@vger.kernel.org" Cc: Ping-Ke Shih References: Content-Language: en-US In-Reply-To: After the firmware is uploaded, download_firmware_validate() checks some bits in REG_MCUFW_CTRL to see if everything went okay. The RTL8814AU power on sequence sets bits 13 and 12 to 2, which this function does not expect, so it thinks the firmware upload failed. Make download_firmware_validate() ignore bits 13 and 12. Signed-off-by: Bitterblue Smith --- drivers/net/wireless/realtek/rtw88/reg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw88/reg.h b/drivers/net/wireless/realtek/rtw88/reg.h index e438405fba56..209b6fc08a73 100644 --- a/drivers/net/wireless/realtek/rtw88/reg.h +++ b/drivers/net/wireless/realtek/rtw88/reg.h @@ -130,6 +130,7 @@ #define BIT_SHIFT_ROM_PGE 16 #define BIT_FW_INIT_RDY BIT(15) #define BIT_FW_DW_RDY BIT(14) +#define BIT_CPU_CLK_SEL (BIT(12) | BIT(13)) #define BIT_RPWM_TOGGLE BIT(7) #define BIT_RAM_DL_SEL BIT(7) /* legacy only */ #define BIT_DMEM_CHKSUM_OK BIT(6) @@ -147,7 +148,7 @@ BIT_CHECK_SUM_OK) #define FW_READY_LEGACY (BIT_MCUFWDL_RDY | BIT_FWDL_CHK_RPT | \ BIT_WINTINI_RDY | BIT_RAM_DL_SEL) -#define FW_READY_MASK 0xffff +#define FW_READY_MASK (0xffff & ~BIT_CPU_CLK_SEL) #define REG_MCU_TST_CFG 0x84 #define VAL_FW_TRIGGER 0x1 From patchwork Sun Jan 26 22:55:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 860171 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23CFF5672 for ; Sun, 26 Jan 2025 22:55:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932127; cv=none; b=BsjRpyjO6+1nlqmYzJIovcc81asbM/0yAtDs4X+/IOsFYZeyNqJ1SVPnEdNqR7aGRmxB2uzfmRogLXkFnSKPjTuse5ajploE1RamerbuvPNAcfgaS0n9BbSc62pRsxrc4xnYFdD4rE0xu0pxe/PiLbOo2HdTmKeosbL2KjnZxUo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932127; c=relaxed/simple; bh=0NjwfEV7c1Cnl8JJC7l6mj3K4B1jSXL+l92ARzj655g=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=sglDQLLQpyyhmrKadb2/bLHSJzZKmZg+dufhWTT1XwenKWMPSn0ItvpCvpuKcx7UxS9zSBjh+KWJO2Qu/rxxAOOjLOBUJCmpfMyq6nzH0IPX+sVz42ybyk8yJWxGprtONF+6Appi7RXh05wGTIyLAMdaZybpNdeFUeqG6RGrUq8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JJmx/uLk; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JJmx/uLk" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4361f796586so41421145e9.3 for ; Sun, 26 Jan 2025 14:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737932124; x=1738536924; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=5EtVVmXK9RUn9c7FB4vD/ZeyH2PJH8S2j7sOqMdv61c=; b=JJmx/uLkHkmm+0EwgZFAY+5k5GIpFXMERsLjmGiNx7q8o8NIIxLVsD4VB3ZXmcwyLF kl7b8Ac0Dqc0caEr3A+nhmPBAGGZIM2pfF64ZvRy3+Zlb+UdZ9z1gTBBovw8ZLsYPmfx OkhfhB0TVOUysC2lVmAcdqF/Al4CUSxdHN5qPaV8lyMUe/QZtFh+NwS323vuthkawIf5 syK+BdXDFF1RL7ss3j/YsU0NY6JIwAqsjP3TssxOX0ZeQIQ0TESfK8dH7ZPgG1WBKNbf dlKGT9oevGYSQhpziUo0cp+M//Gd76KTf+p2P9750NG786aSoRStWW4QqRKkGfV9gB2s vgAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737932124; x=1738536924; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5EtVVmXK9RUn9c7FB4vD/ZeyH2PJH8S2j7sOqMdv61c=; b=Tiv25CmXKwtS+c6DhxtOHZ5I8ebh9OaKN0mVgV6WG7LH+UQ8fxqJwcVvHfQvfs8J+0 QP8sf5FymZ318Bl/ZVYt7+hEI25qI2rn9vBhIjShuSFdwgYe9p6W9amYKGKSVgh3jCgR vl2Kn7oyniuJ7lXmhVqYSSkOJ9iA8FudBMgnvT4R7YPX2y47VFMm9KwhBP52TCH7gfNL G9wbAceLND6DsxP1G60wx+GYpZI5vHQa+9OV6bcp9GmOI233Fz3LXSyrUqMfv5vlOq+7 h8xMBB7S8xrS2ob/HagRvgRedUO6I5Y44kThZyIyJKiXs09724pw3WegWqBm/iMj4kac jbyQ== X-Gm-Message-State: AOJu0YzGxxoZTULpmyJM5Kehz9mE6w5NuosEg4Y5RUPmTfLdm8VXSFE6 JqoaRL6zOKNMIuxEaQkKPTaM5vP2BvQhqyKsIpiTvD8YDDKAXDvZiEFXUQ== X-Gm-Gg: ASbGnctTgLnH/xxuukzLxp161Cqrr4t+uq4R4jY40ootY/MgS44cmUPPhZf1vphOPHs qvLNuAWq80Udzj1TL+vFYcdTNtPiVhCPo15eJElAdRsfDVJD92EuCTN3AbWLWUDKZfyHfO9BfZA XBXnI6HIIyYNcuGJJfiMy0NeLTikDwFiYn3oaax5CC7lJLLWCKI907p9y6Y8EQEUYpqoRfespy4 PWa3Z2ME+TPsPM89RDd7PRjMMWwMegiKyFVoduOUUYrm3wuruMDxiNp+snVKu8MoXyDVkgrg6i/ JalRfNx3P/px X-Google-Smtp-Source: AGHT+IF7tq1ByzF6+fk4airyca8eaR1tiwkfRo4WOuaIRtk6we6C/bngkBwwA15SAdSGHo0F7QZmOg== X-Received: by 2002:a05:600c:46cb:b0:434:f0df:9fd with SMTP id 5b1f17b1804b1-438913c5b82mr354946865e9.2.1737932124307; Sun, 26 Jan 2025 14:55:24 -0800 (PST) Received: from [192.168.0.50] ([79.119.240.80]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd508257sm107223215e9.23.2025.01.26.14.55.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jan 2025 14:55:23 -0800 (PST) Message-ID: <02424d4b-96a8-4c30-933c-7abbefc520c5@gmail.com> Date: Mon, 27 Jan 2025 00:55:21 +0200 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 3/7] wifi: rtw88: Extend struct rtw_pwr_track_tbl for RTL8814AU From: Bitterblue Smith To: "linux-wireless@vger.kernel.org" Cc: Ping-Ke Shih References: Content-Language: en-US In-Reply-To: Currently this struct has the members required for chips with 2 RF paths. Add more members to support chips with 4 RF paths, like the RTL8814AU. Signed-off-by: Bitterblue Smith Acked-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw88/main.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h index 62cd4c526301..e40e62302984 100644 --- a/drivers/net/wireless/realtek/rtw88/main.h +++ b/drivers/net/wireless/realtek/rtw88/main.h @@ -1130,14 +1130,26 @@ struct rtw_rfe_def { * For 2G there are cck rate and ofdm rate with different settings. */ struct rtw_pwr_track_tbl { + const u8 *pwrtrk_5gd_n[RTW_PWR_TRK_5G_NUM]; + const u8 *pwrtrk_5gd_p[RTW_PWR_TRK_5G_NUM]; + const u8 *pwrtrk_5gc_n[RTW_PWR_TRK_5G_NUM]; + const u8 *pwrtrk_5gc_p[RTW_PWR_TRK_5G_NUM]; const u8 *pwrtrk_5gb_n[RTW_PWR_TRK_5G_NUM]; const u8 *pwrtrk_5gb_p[RTW_PWR_TRK_5G_NUM]; const u8 *pwrtrk_5ga_n[RTW_PWR_TRK_5G_NUM]; const u8 *pwrtrk_5ga_p[RTW_PWR_TRK_5G_NUM]; + const u8 *pwrtrk_2gd_n; + const u8 *pwrtrk_2gd_p; + const u8 *pwrtrk_2gc_n; + const u8 *pwrtrk_2gc_p; const u8 *pwrtrk_2gb_n; const u8 *pwrtrk_2gb_p; const u8 *pwrtrk_2ga_n; const u8 *pwrtrk_2ga_p; + const u8 *pwrtrk_2g_cckd_n; + const u8 *pwrtrk_2g_cckd_p; + const u8 *pwrtrk_2g_cckc_n; + const u8 *pwrtrk_2g_cckc_p; const u8 *pwrtrk_2g_cckb_n; const u8 *pwrtrk_2g_cckb_p; const u8 *pwrtrk_2g_ccka_n; From patchwork Sun Jan 26 22:55:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 860368 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B29D15672 for ; Sun, 26 Jan 2025 22:56:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932165; cv=none; b=OLqISEiHWQPpZ4hTGCgZpk7ziljY2WyOdCx4UojVkJqDCdae9cqUbn3fS25cdPWEn8Jh+R7O/KzNCUy/S2fi8tcDsFjDVzXxN2zS7qrvZbOhEg+bo8q0o5nusZD/QnxpkgaDk4MR9TU2it346m+7spAqZtOptmDfVLzEiIFkqss= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932165; c=relaxed/simple; bh=/W8JoqKt2VzVOsheaDiKXp47kL/MT+Ix5zC4Xl6IAMs=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=gLrFHekwjCzEGYleKVJ3b2nAv6H77tP+0dT36f8+kpZl/I/zr/16XznF70VRNdeOQUIUPOwCrq5kWfkIZPaBqtK2ZM+eRKrDZlcUXbFrd/0Z1UBrgTq/h7x810/h3WgY87uMBZkWiEVtiUjOZZt+12ov+4PtDmypD2OGIIOTWBI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KVwyh/1K; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KVwyh/1K" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4362f61757fso40635725e9.2 for ; Sun, 26 Jan 2025 14:56:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737932162; x=1738536962; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=uqYPQ74fEu1XMQIFRIu9bz+u5J2Uf7E8HdDyJjb8mU0=; b=KVwyh/1Krx4AufJC3hILG8yYWZ+oZJP64e5BYXctuigrMH57RUYpauYG0/At3sfGtW F7rkoaDlhx+V0ANaNOVjEhhOMMPQTHQJHlBTQ6roeiMu2NfnUorqg0qr0Egd0xGt8+QO BwMs+lBqLllGTdoN0TgYA5/5C96B3VWqViHv+Zy8fxdBdrThAu8PLN+sULQqd5DW1Bni 50SuRDhYfWckJBwDFeBNIxkqg7s/cfWzt6gMXE6pFz35UG1jI0Au2sgWiu3KcK4TyzYo PSC7G+7Tp/EE/2Wo+zNGLXB1P0Ksbg1ZMFWRDPP66UKlVVLR+zSxW2VX3V1N14A8DQwr INJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737932162; x=1738536962; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uqYPQ74fEu1XMQIFRIu9bz+u5J2Uf7E8HdDyJjb8mU0=; b=kLW1SNzjvYeMfxDrsWve44GnUR45onENKDEvECtCeVIH1aevg2gsmuaoOqi6M+tB6z WVTqUp0J4A+H1KJhbQIKKnAv5D2FetuJzX1UjyBB7abR8Im8/M4/Ws0pH2fpdoGutsrY VzWqGJJlBPuHFqRzBrF511Z36YPk/R73E7SWCR5odRHOsEGcQVvfZ1XI/xv5nPRLr62Q UfTPS50p0u5NqBbTBvkV5pQld8tHlZQ14w77GSMS0WxXMw0+MaPTqUJU2HoaVEQcxfbU R/jS7wDKOlrsqrmUxVAZkVQ8pU2QFks1VjP5wPx60JTk3EdJdfMhYoBJ37PrKfM3DqZw X+ow== X-Gm-Message-State: AOJu0YzFR8dXdLxU4/aQM6G6lN1VUH+gJVkQjx1glzoCyYOrgd4sa9Mw VE/BORGZ9uoEJgt+E46GWJlVUm+sSHTQjMtHQwsN0HbNdTWVC3JqOlTCKA== X-Gm-Gg: ASbGncus8mF+esBGFO0Pa5km/TOBTBklVhCqHd/O+YF1F5bxuh/2gFcw5Qknd1SSCf5 w4P2PX6cXG3T8dV2p+72ZHOuECu7jmmEyFQBI7HPNfPtR3732HWDeUi4zfIs4qGSq7mYjV9Y4iY CqhWScRa+1kTnNNKgju4XVh4NoTqx3AY6eRxlpizZIVivRgT42S3rmTgQ2MDkANaeJalZbatPkK 6U6GpZUesZ6J/7Zk8yk2hIKp5FC70alwBD/UICREB3jj1Tkt3T87MLxho3xKXTKHEo7ycNEd0U+ 7zU3ttDRQkup X-Google-Smtp-Source: AGHT+IFCY5Es+Y1T/E92V8KmWHy7dueHXSfnAXc9grSv8UbEdSDaBLoluJJdfN/GKiPa3xszGNcX3Q== X-Received: by 2002:a05:600c:a01:b0:436:ed38:5c7f with SMTP id 5b1f17b1804b1-438913db8b0mr341772165e9.12.1737932161716; Sun, 26 Jan 2025 14:56:01 -0800 (PST) Received: from [192.168.0.50] ([79.119.240.80]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd575468sm107463045e9.39.2025.01.26.14.55.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jan 2025 14:56:00 -0800 (PST) Message-ID: <241f642c-b31f-4b52-be65-515269769a2b@gmail.com> Date: Mon, 27 Jan 2025 00:55:58 +0200 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 4/7] wifi: rtw88: Extend rf_base_addr and rf_sipi_addr for RTL8814AU From: Bitterblue Smith To: "linux-wireless@vger.kernel.org" Cc: Ping-Ke Shih References: Content-Language: en-US In-Reply-To: These members of struct rtw_chip_info each have a size of 2. Increase their size to 4, which is the number of RF paths the RTL8814AU has. This is required to read and write the RF registers of the RTL8814AU. Signed-off-by: Bitterblue Smith --- drivers/net/wireless/realtek/rtw88/main.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h index e40e62302984..ba64d269521a 100644 --- a/drivers/net/wireless/realtek/rtw88/main.h +++ b/drivers/net/wireless/realtek/rtw88/main.h @@ -1239,8 +1239,8 @@ struct rtw_chip_info { const struct rtw_hw_reg *dig; const struct rtw_hw_reg *dig_cck; - u32 rf_base_addr[2]; - u32 rf_sipi_addr[2]; + u32 rf_base_addr[RTW_RF_PATH_MAX]; + u32 rf_sipi_addr[RTW_RF_PATH_MAX]; const struct rtw_rf_sipi_addr *rf_sipi_read_addr; u8 fix_rf_phy_num; const struct rtw_ltecoex_addr *ltecoex_addr; From patchwork Sun Jan 26 22:56:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 860170 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60C215672 for ; Sun, 26 Jan 2025 22:56:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932194; cv=none; b=FU+lT+6+ntwrU7ConH74GuSF4cMYCkc8u/MgpUI3jSM08QUjv3jcopkBr7TxznsS1kEGlneYLn5NRZdioDeUVLl4F1sYuU4rkkaHKBd0jPW22r9zTfYf5BYlETf763Z19EDBEB3pMdzALyrPYyAMyuyG+4i2ivcrgyzlnBPnPjc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932194; c=relaxed/simple; bh=5bAcsapafvFcUgKVbCZ2tvSLLTtdVgRrqA52pTk16TU=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=kPx/BIluv2KbSJbO0vJf7h8kX3fetcs9fiZs3zZvwQ1zUoLGpVRRqw7I2L6pIpuW/WBwXhGjHabgHzfIVG26ySTV0xwjnyjeOskb7sEBhye1A7EZhIMkMgRlVaj9gIvHP1jOqwp11LZ35hUlhzSOjatZlQddMFm9RLedElQprAk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=djyTs+vr; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="djyTs+vr" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-436341f575fso41557495e9.1 for ; Sun, 26 Jan 2025 14:56:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737932190; x=1738536990; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=M1wcQtmMnk6kFrc7dpl5z4c/qXyaxGiNpFhqFS3oGmg=; b=djyTs+vrDn2c+aZ896l5I7Ui6Epgep20VAWgLL9cZcpHyujtoqzQ2yNBmi3u1t8Sz5 mUnbvfVoz6s0/RL6KOJc9+lECHU7VD4o7g6UmBR/XznP7kRJ3v2iTGnhHfG/TtP0vOG6 vI0Rvd5SWluZZG2ABF4v33kQOqx6PuLmMHvS/O7kUsM3DARLg01CSzYVtiBX6Q7t74Gu WR2snFF1mQRIR18AioGy7k3YNFrdmHupb+IfkmxhS1Gh3wYhXXinl7v5mgxpTfDgJ2rZ oiap71SKoxC7QAWPEzzHHH7Qc1OmOG3DVgO976Rc2fhCnYYTSyqyqy8dVB9gyXQoALbW j9cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737932190; x=1738536990; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=M1wcQtmMnk6kFrc7dpl5z4c/qXyaxGiNpFhqFS3oGmg=; b=kpW+uoeNe8sxUC1xxc0uZoT5ZLrIbhDJRD/a22woLXnO/NakhSU/TLQxqH94Rnywj+ Qq7d6aQVLosifnYVKeCB9cmRHtlEN5kPT5xWOxmCdqeE1Uym8qbDTSNXzqSNSrY6UN/T 8r+DYPTurgXx8ts6SwIr1xwzkoWBoAkfv8BojcwqXptMZq+tnVrYTq3ixq1AwuK7BiiP u9HVriuLsc7rF0pYJ0FmGch2q3UxM7DMM9KRWQQCn2ic4tPmD9sDVY5zoynIm3/b+63q AMDuBcgIjlFG/kJfuHBRO3dU94BSLC+JYv2h5c19B1qNtbdmhL55DVa8X3JN9zkgyB5W zhww== X-Gm-Message-State: AOJu0Yxf/uoA4+oCt4akzvhrhOZ0njKPRwBxuXjrlEloNh6FBhnDb8eW S9K4G6LR7jZWDMo4PJ8cI23aj8anzMjK2WbX7/YE8jimRpG3+QIIQORtmw== X-Gm-Gg: ASbGncsLV5DSFN4vepXrVA4fb6WNAyhDvDdeqZ29DbdIM6cXilTcabMI3FW4M7dyKDL ECzqVDxEJQK9w5vE/mevKUZ/nc2yKOmgjagvQNKyFWAl98OaNsfhHGEV4gcu8VZE/R+BjJuwWQW 9igGF0Hoyr8Px1T43voiT8tGvz7EXlm80yHowj03eIkNtg/4lYu14FI3A5vkZVUoDdS/YpwGWFp yLJjOHkXozwdDMSfWlLRtAjqQmlRsLPbwVpRYvW2YtWm66jjvriuIlAlagbfFe5jwkmDOwFpgrp zCmkCLrnUpy4 X-Google-Smtp-Source: AGHT+IFVlFOy6yLVEixFV8+U3mITKfucb2wP/gkgnzIsjQR8MTz1n4mUbaJkAhjCJv/uvHmsW5QLdA== X-Received: by 2002:a05:600c:1386:b0:434:f739:7cd9 with SMTP id 5b1f17b1804b1-438913cf349mr324363365e9.9.1737932190514; Sun, 26 Jan 2025 14:56:30 -0800 (PST) Received: from [192.168.0.50] ([79.119.240.80]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd4857b8sm107664835e9.15.2025.01.26.14.56.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jan 2025 14:56:29 -0800 (PST) Message-ID: Date: Mon, 27 Jan 2025 00:56:27 +0200 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 5/7] wifi: rtw88: Extend rtw_fw_send_ra_info() for RTL8814AU From: Bitterblue Smith To: "linux-wireless@vger.kernel.org" Cc: Ping-Ke Shih References: Content-Language: en-US In-Reply-To: The existing code is suitable for chips with up to 2 spatial streams. Inform the firmware about the rates it's allowed to use when transmitting 3 spatial streams. Signed-off-by: Bitterblue Smith --- drivers/net/wireless/realtek/rtw88/fw.c | 14 ++++++++++++++ drivers/net/wireless/realtek/rtw88/fw.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c index 02389b7c6876..0ca1b139110d 100644 --- a/drivers/net/wireless/realtek/rtw88/fw.c +++ b/drivers/net/wireless/realtek/rtw88/fw.c @@ -735,6 +735,7 @@ void rtw_fw_send_ra_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si, { u8 h2c_pkt[H2C_PKT_SIZE] = {0}; bool disable_pt = true; + u32 mask_hi; SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_RA_INFO); @@ -755,6 +756,19 @@ void rtw_fw_send_ra_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si, si->init_ra_lv = 0; rtw_fw_send_h2c_command(rtwdev, h2c_pkt); + + if (rtwdev->chip->rf_tbl[RF_PATH_C]) { + SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_RA_INFO_HI); + + mask_hi = si->ra_mask >> 32; + + SET_RA_INFO_RA_MASK0(h2c_pkt, (mask_hi & 0xff)); + SET_RA_INFO_RA_MASK1(h2c_pkt, (mask_hi & 0xff00) >> 8); + SET_RA_INFO_RA_MASK2(h2c_pkt, (mask_hi & 0xff0000) >> 16); + SET_RA_INFO_RA_MASK3(h2c_pkt, (mask_hi & 0xff000000) >> 24); + + rtw_fw_send_h2c_command(rtwdev, h2c_pkt); + } } void rtw_fw_media_status_report(struct rtw_dev *rtwdev, u8 mac_id, bool connect) diff --git a/drivers/net/wireless/realtek/rtw88/fw.h b/drivers/net/wireless/realtek/rtw88/fw.h index 404de1b0c407..48ad9ceab6ea 100644 --- a/drivers/net/wireless/realtek/rtw88/fw.h +++ b/drivers/net/wireless/realtek/rtw88/fw.h @@ -557,6 +557,7 @@ static inline void rtw_h2c_pkt_set_header(u8 *h2c_pkt, u8 sub_id) #define H2C_CMD_DEFAULT_PORT 0x2c #define H2C_CMD_RA_INFO 0x40 #define H2C_CMD_RSSI_MONITOR 0x42 +#define H2C_CMD_RA_INFO_HI 0x46 #define H2C_CMD_BCN_FILTER_OFFLOAD_P0 0x56 #define H2C_CMD_BCN_FILTER_OFFLOAD_P1 0x57 #define H2C_CMD_WL_PHY_INFO 0x58 From patchwork Sun Jan 26 23:01:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 860367 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57DFA25A641 for ; Sun, 26 Jan 2025 23:01:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932467; cv=none; b=Iq1n+3IMIZKK1OpF8A8eqUNWPlaC4cdVcus42oVfx+9TRILDGwK/a4g7TfjoHzE0coH4T9Nyd9BAO/itnGr/XzVpGT8/zhOmxo3nqIxXDU1vt3Ubx2pDybeBsc+svQidIt4TjZTYASyMEERkNi5poy1qojS3/MFfjmYqHnzwi7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932467; c=relaxed/simple; bh=LZYpsk3HKopAbKmcYBK0cFyW1OmjljKfv8zYpvhEjJg=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=cehaCU4RAEHf0bYiA3KxjGYK/+IkOTuFsNCQjcRV5cr0oplKRRxS54dhMoLdwb/Y9gpYqVXjnCl/LjqsXu/B/hgZVmsDuryYZIArETiAxny8b6EZUie8s+31MZfFIuBCv7dHZFKTifdt6p7WXGMSLTyrnH1YNgxkrBJYYAlCUmo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NeZO6rkg; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NeZO6rkg" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-43621d27adeso25079275e9.2 for ; Sun, 26 Jan 2025 15:01:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737932463; x=1738537263; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=Chdyhy4X+Nhz8WiLvFQTte8qdLKysMf9IM8MhkwfZyY=; b=NeZO6rkg9Dy+vmP2QZJ2PAZJ0m+pvjtqbHMrYV1PIcw2URLGYha5v8nftYWpcg0E5g fdZLZ7oVaQcfiIed0X9sOATIJFcwX4Nzx/2o7TJ7s9z/A0T19n1RR8OX3fKQQU8ufY/k 0qwLH8fLq2bZhKBd07ILN79EF6/+XHyykOipYbqtZpqFYsrHOcudlRC2RA7aIL3yNoVQ KnuPYF+Q77To7QibCtMp7FaOn1ztGLwgrizA+iAQzclGbzooX8xRJfJHdgYKqiEqPq4O wHtaQiqPgRlLuE7Twum9HmH8WnzC2rL5JQPK9K1w4GMPugrnf8K07X/O/X3KPBEC/UGN hRVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737932463; x=1738537263; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Chdyhy4X+Nhz8WiLvFQTte8qdLKysMf9IM8MhkwfZyY=; b=eLiFHKgbiRm2JsJeJX0pf1jxh/nxKzXQqp4W52dAffZAcuHIhp3VT84qPxlNELn7pd Ap72R99Hpp11kpEfI4KodfgJGva/nBK/OAKNzU3F8FITn/lgZb1ul1s34wgGecvRxXrP eVKV1l82iV1M1tXdfXy3VJn+KxtMYwpvYmMxFVDTSnkefHp8C3dE7eiWJBCmwj8nq5qR IS/2ExrP4ujbUPRJGRwzq1BJCsf8eWNcmfw9L77BFF1irgNBVDAFL+5qaPN9o++nbBlH AdyG7V9aiX1NTvQtJREoJfModJCQhjYI9t9RR9ntRgc3x5Yf0V4oTGEBiWhj+3az2Cv2 /jxw== X-Gm-Message-State: AOJu0YxuZ3xv2z7S9XrigOkGNnDF9TTDEv8cJMc75vXXZffy7ScPxjWB AScWP64yuAM1ewLuwSio6zBgetw5PO+dmxA5NgtQJU98cDBiO2HNvoiI0w== X-Gm-Gg: ASbGncsHixqEc87ptvCB2HMGJ3v3XwxWVhZ+CnEZiX0x/q50k6YAx1J6wBlxw4EAagt qlr9D+eP4NF+YxrTKXIjNL+CNfAKgHYy78ZlNGQpedUmTr3fXs1CZO/Nr+OOpHfZCY+C0yejb/H 8TSoGEm0zKLfzlMQIW5eXae4pVfs8m8Z30drBO3cxEJFMYduNgTlTOc7StkiIG9dL1wtth5ZOuv Og8KscNKiJIRXl+QPk5O0aTQ2ONRJvk/vvm9wB3HRALha6VQP8ljPt00UNrzazf0wH4Yyq1Tj0W 0JcNcZFztiy7 X-Google-Smtp-Source: AGHT+IFSPp9yLFHZZWpC4xPIOSBESJujT2TEYemPTR2exp4cjNOEBxrNVH9hIjzG5rgxO7FiHR6H6g== X-Received: by 2002:a5d:6d8d:0:b0:38a:88bc:ace1 with SMTP id ffacd0b85a97d-38bf57a9608mr31829871f8f.34.1737932463379; Sun, 26 Jan 2025 15:01:03 -0800 (PST) Received: from [192.168.0.50] ([79.119.240.80]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1ca723sm9166051f8f.101.2025.01.26.15.01.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jan 2025 15:01:02 -0800 (PST) Message-ID: Date: Mon, 27 Jan 2025 01:01:00 +0200 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 6/7] wifi: rtw88: Extend TX power stuff for 3-4 spatial streams From: Bitterblue Smith To: "linux-wireless@vger.kernel.org" Cc: Ping-Ke Shih References: Content-Language: en-US In-Reply-To: Although the RTL8814AU only has 3 spatial streams, maybe some other chip has 4. Correct the TX power index and TX power limit calculations for 3SS and 4SS HT/VHT rates. With this the RTL8814AU can set the TX power correctly. Signed-off-by: Bitterblue Smith --- I just realised this patch depends on another pending patch: https://lore.kernel.org/linux-wireless/8a60f581-0ab5-4d98-a97d-dd83b605008f@gmail.com/ Originally this patch was going to be in part 2, but then I rearranged them. Too late to turn back now... --- drivers/net/wireless/realtek/rtw88/main.h | 4 + drivers/net/wireless/realtek/rtw88/phy.c | 149 ++++++++++++------ drivers/net/wireless/realtek/rtw88/phy.h | 4 + drivers/net/wireless/realtek/rtw88/rtw8821c.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw8822c.c | 2 +- drivers/net/wireless/realtek/rtw88/rtw88xxa.c | 2 +- 7 files changed, 114 insertions(+), 51 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h index ba64d269521a..bbae6d7c1aa9 100644 --- a/drivers/net/wireless/realtek/rtw88/main.h +++ b/drivers/net/wireless/realtek/rtw88/main.h @@ -166,6 +166,10 @@ enum rtw_rate_section { RTW_RATE_SECTION_HT_2S, RTW_RATE_SECTION_VHT_1S, RTW_RATE_SECTION_VHT_2S, + RTW_RATE_SECTION_HT_3S, + RTW_RATE_SECTION_HT_4S, + RTW_RATE_SECTION_VHT_3S, + RTW_RATE_SECTION_VHT_4S, /* keep last */ RTW_RATE_SECTION_MAX, diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c index 8ed20c89d216..5ddc9d4988b8 100644 --- a/drivers/net/wireless/realtek/rtw88/phy.c +++ b/drivers/net/wireless/realtek/rtw88/phy.c @@ -53,21 +53,25 @@ static const u32 db_invert_table[12][8] = { }; u8 rtw_cck_rates[] = { DESC_RATE1M, DESC_RATE2M, DESC_RATE5_5M, DESC_RATE11M }; + u8 rtw_ofdm_rates[] = { DESC_RATE6M, DESC_RATE9M, DESC_RATE12M, DESC_RATE18M, DESC_RATE24M, DESC_RATE36M, DESC_RATE48M, DESC_RATE54M }; + u8 rtw_ht_1s_rates[] = { DESC_RATEMCS0, DESC_RATEMCS1, DESC_RATEMCS2, DESC_RATEMCS3, DESC_RATEMCS4, DESC_RATEMCS5, DESC_RATEMCS6, DESC_RATEMCS7 }; + u8 rtw_ht_2s_rates[] = { DESC_RATEMCS8, DESC_RATEMCS9, DESC_RATEMCS10, DESC_RATEMCS11, DESC_RATEMCS12, DESC_RATEMCS13, DESC_RATEMCS14, DESC_RATEMCS15 }; + u8 rtw_vht_1s_rates[] = { DESC_RATEVHT1SS_MCS0, DESC_RATEVHT1SS_MCS1, DESC_RATEVHT1SS_MCS2, DESC_RATEVHT1SS_MCS3, @@ -75,6 +79,7 @@ u8 rtw_vht_1s_rates[] = { DESC_RATEVHT1SS_MCS6, DESC_RATEVHT1SS_MCS7, DESC_RATEVHT1SS_MCS8, DESC_RATEVHT1SS_MCS9 }; + u8 rtw_vht_2s_rates[] = { DESC_RATEVHT2SS_MCS0, DESC_RATEVHT2SS_MCS1, DESC_RATEVHT2SS_MCS2, DESC_RATEVHT2SS_MCS3, @@ -82,10 +87,41 @@ u8 rtw_vht_2s_rates[] = { DESC_RATEVHT2SS_MCS6, DESC_RATEVHT2SS_MCS7, DESC_RATEVHT2SS_MCS8, DESC_RATEVHT2SS_MCS9 }; + +u8 rtw_ht_3s_rates[] = { + DESC_RATEMCS16, DESC_RATEMCS17, DESC_RATEMCS18, + DESC_RATEMCS19, DESC_RATEMCS20, DESC_RATEMCS21, + DESC_RATEMCS22, DESC_RATEMCS23 +}; + +u8 rtw_ht_4s_rates[] = { + DESC_RATEMCS24, DESC_RATEMCS25, DESC_RATEMCS26, + DESC_RATEMCS27, DESC_RATEMCS28, DESC_RATEMCS29, + DESC_RATEMCS30, DESC_RATEMCS31 +}; + +u8 rtw_vht_3s_rates[] = { + DESC_RATEVHT3SS_MCS0, DESC_RATEVHT3SS_MCS1, + DESC_RATEVHT3SS_MCS2, DESC_RATEVHT3SS_MCS3, + DESC_RATEVHT3SS_MCS4, DESC_RATEVHT3SS_MCS5, + DESC_RATEVHT3SS_MCS6, DESC_RATEVHT3SS_MCS7, + DESC_RATEVHT3SS_MCS8, DESC_RATEVHT3SS_MCS9 +}; + +u8 rtw_vht_4s_rates[] = { + DESC_RATEVHT4SS_MCS0, DESC_RATEVHT4SS_MCS1, + DESC_RATEVHT4SS_MCS2, DESC_RATEVHT4SS_MCS3, + DESC_RATEVHT4SS_MCS4, DESC_RATEVHT4SS_MCS5, + DESC_RATEVHT4SS_MCS6, DESC_RATEVHT4SS_MCS7, + DESC_RATEVHT4SS_MCS8, DESC_RATEVHT4SS_MCS9 +}; + u8 *rtw_rate_section[RTW_RATE_SECTION_MAX] = { rtw_cck_rates, rtw_ofdm_rates, rtw_ht_1s_rates, rtw_ht_2s_rates, - rtw_vht_1s_rates, rtw_vht_2s_rates + rtw_vht_1s_rates, rtw_vht_2s_rates, + rtw_ht_3s_rates, rtw_ht_4s_rates, + rtw_vht_3s_rates, rtw_vht_4s_rates }; EXPORT_SYMBOL(rtw_rate_section); @@ -95,17 +131,14 @@ u8 rtw_rate_size[RTW_RATE_SECTION_MAX] = { ARRAY_SIZE(rtw_ht_1s_rates), ARRAY_SIZE(rtw_ht_2s_rates), ARRAY_SIZE(rtw_vht_1s_rates), - ARRAY_SIZE(rtw_vht_2s_rates) + ARRAY_SIZE(rtw_vht_2s_rates), + ARRAY_SIZE(rtw_ht_3s_rates), + ARRAY_SIZE(rtw_ht_4s_rates), + ARRAY_SIZE(rtw_vht_3s_rates), + ARRAY_SIZE(rtw_vht_4s_rates) }; EXPORT_SYMBOL(rtw_rate_size); -static const u8 rtw_cck_size = ARRAY_SIZE(rtw_cck_rates); -static const u8 rtw_ofdm_size = ARRAY_SIZE(rtw_ofdm_rates); -static const u8 rtw_ht_1s_size = ARRAY_SIZE(rtw_ht_1s_rates); -static const u8 rtw_ht_2s_size = ARRAY_SIZE(rtw_ht_2s_rates); -static const u8 rtw_vht_1s_size = ARRAY_SIZE(rtw_vht_1s_rates); -static const u8 rtw_vht_2s_size = ARRAY_SIZE(rtw_vht_2s_rates); - enum rtw_phy_band_type { PHY_BAND_2G = 0, PHY_BAND_5G = 1, @@ -1635,10 +1668,12 @@ static void rtw_xref_txpwr_lmt_by_rs(struct rtw_dev *rtwdev, u8 regd, u8 bw, u8 ch_idx) { u8 rs_idx, rs_ht, rs_vht; - u8 rs_cmp[2][2] = {{RTW_RATE_SECTION_HT_1S, RTW_RATE_SECTION_VHT_1S}, - {RTW_RATE_SECTION_HT_2S, RTW_RATE_SECTION_VHT_2S} }; + u8 rs_cmp[4][2] = {{RTW_RATE_SECTION_HT_1S, RTW_RATE_SECTION_VHT_1S}, + {RTW_RATE_SECTION_HT_2S, RTW_RATE_SECTION_VHT_2S}, + {RTW_RATE_SECTION_HT_3S, RTW_RATE_SECTION_VHT_3S}, + {RTW_RATE_SECTION_HT_4S, RTW_RATE_SECTION_VHT_4S} }; - for (rs_idx = 0; rs_idx < 2; rs_idx++) { + for (rs_idx = 0; rs_idx < 4; rs_idx++) { rs_ht = rs_cmp[rs_idx][0]; rs_vht = rs_cmp[rs_idx][1]; @@ -1959,10 +1994,10 @@ static u8 rtw_phy_get_2g_tx_power_index(struct rtw_dev *rtwdev, u8 rate, u8 group) { const struct rtw_chip_info *chip = rtwdev->chip; - u8 tx_power; - bool mcs_rate; - bool above_2ss; + bool above_2ss, above_3ss, above_4ss; u8 factor = chip->txgi_factor; + bool mcs_rate; + u8 tx_power; if (rate <= DESC_RATE11M) tx_power = pwr_idx_2g->cck_base[group]; @@ -1972,11 +2007,15 @@ static u8 rtw_phy_get_2g_tx_power_index(struct rtw_dev *rtwdev, if (rate >= DESC_RATE6M && rate <= DESC_RATE54M) tx_power += pwr_idx_2g->ht_1s_diff.ofdm * factor; - mcs_rate = (rate >= DESC_RATEMCS0 && rate <= DESC_RATEMCS15) || + mcs_rate = (rate >= DESC_RATEMCS0 && rate <= DESC_RATEMCS31) || (rate >= DESC_RATEVHT1SS_MCS0 && - rate <= DESC_RATEVHT2SS_MCS9); - above_2ss = (rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS15) || + rate <= DESC_RATEVHT4SS_MCS9); + above_2ss = (rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS31) || (rate >= DESC_RATEVHT2SS_MCS0); + above_3ss = (rate >= DESC_RATEMCS16 && rate <= DESC_RATEMCS31) || + (rate >= DESC_RATEVHT3SS_MCS0); + above_4ss = (rate >= DESC_RATEMCS24 && rate <= DESC_RATEMCS31) || + (rate >= DESC_RATEVHT4SS_MCS0); if (!mcs_rate) return tx_power; @@ -1989,11 +2028,19 @@ static u8 rtw_phy_get_2g_tx_power_index(struct rtw_dev *rtwdev, tx_power += pwr_idx_2g->ht_1s_diff.bw20 * factor; if (above_2ss) tx_power += pwr_idx_2g->ht_2s_diff.bw20 * factor; + if (above_3ss) + tx_power += pwr_idx_2g->ht_3s_diff.bw20 * factor; + if (above_4ss) + tx_power += pwr_idx_2g->ht_4s_diff.bw20 * factor; break; case RTW_CHANNEL_WIDTH_40: /* bw40 is the base power */ if (above_2ss) tx_power += pwr_idx_2g->ht_2s_diff.bw40 * factor; + if (above_3ss) + tx_power += pwr_idx_2g->ht_3s_diff.bw40 * factor; + if (above_4ss) + tx_power += pwr_idx_2g->ht_4s_diff.bw40 * factor; break; } @@ -2006,19 +2053,23 @@ static u8 rtw_phy_get_5g_tx_power_index(struct rtw_dev *rtwdev, u8 rate, u8 group) { const struct rtw_chip_info *chip = rtwdev->chip; - u8 tx_power; + bool above_2ss, above_3ss, above_4ss; + u8 factor = chip->txgi_factor; u8 upper, lower; bool mcs_rate; - bool above_2ss; - u8 factor = chip->txgi_factor; + u8 tx_power; tx_power = pwr_idx_5g->bw40_base[group]; - mcs_rate = (rate >= DESC_RATEMCS0 && rate <= DESC_RATEMCS15) || + mcs_rate = (rate >= DESC_RATEMCS0 && rate <= DESC_RATEMCS31) || (rate >= DESC_RATEVHT1SS_MCS0 && - rate <= DESC_RATEVHT2SS_MCS9); - above_2ss = (rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS15) || + rate <= DESC_RATEVHT4SS_MCS9); + above_2ss = (rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS31) || (rate >= DESC_RATEVHT2SS_MCS0); + above_3ss = (rate >= DESC_RATEMCS16 && rate <= DESC_RATEMCS31) || + (rate >= DESC_RATEVHT3SS_MCS0); + above_4ss = (rate >= DESC_RATEMCS24 && rate <= DESC_RATEMCS31) || + (rate >= DESC_RATEVHT4SS_MCS0); if (!mcs_rate) { tx_power += pwr_idx_5g->ht_1s_diff.ofdm * factor; @@ -2033,11 +2084,19 @@ static u8 rtw_phy_get_5g_tx_power_index(struct rtw_dev *rtwdev, tx_power += pwr_idx_5g->ht_1s_diff.bw20 * factor; if (above_2ss) tx_power += pwr_idx_5g->ht_2s_diff.bw20 * factor; + if (above_3ss) + tx_power += pwr_idx_5g->ht_3s_diff.bw20 * factor; + if (above_4ss) + tx_power += pwr_idx_5g->ht_4s_diff.bw20 * factor; break; case RTW_CHANNEL_WIDTH_40: /* bw40 is the base power */ if (above_2ss) tx_power += pwr_idx_5g->ht_2s_diff.bw40 * factor; + if (above_3ss) + tx_power += pwr_idx_5g->ht_3s_diff.bw40 * factor; + if (above_4ss) + tx_power += pwr_idx_5g->ht_4s_diff.bw40 * factor; break; case RTW_CHANNEL_WIDTH_80: /* the base idx of bw80 is the average of bw40+/bw40- */ @@ -2048,6 +2107,10 @@ static u8 rtw_phy_get_5g_tx_power_index(struct rtw_dev *rtwdev, tx_power += pwr_idx_5g->vht_1s_diff.bw80 * factor; if (above_2ss) tx_power += pwr_idx_5g->vht_2s_diff.bw80 * factor; + if (above_3ss) + tx_power += pwr_idx_5g->vht_3s_diff.bw80 * factor; + if (above_4ss) + tx_power += pwr_idx_5g->vht_4s_diff.bw80 * factor; break; } @@ -2065,10 +2128,18 @@ static u8 rtw_phy_rate_to_rate_section(u8 rate) return RTW_RATE_SECTION_HT_1S; else if (rate >= DESC_RATEMCS8 && rate <= DESC_RATEMCS15) return RTW_RATE_SECTION_HT_2S; + else if (rate >= DESC_RATEMCS16 && rate <= DESC_RATEMCS23) + return RTW_RATE_SECTION_HT_3S; + else if (rate >= DESC_RATEMCS24 && rate <= DESC_RATEMCS31) + return RTW_RATE_SECTION_HT_4S; else if (rate >= DESC_RATEVHT1SS_MCS0 && rate <= DESC_RATEVHT1SS_MCS9) return RTW_RATE_SECTION_VHT_1S; else if (rate >= DESC_RATEVHT2SS_MCS0 && rate <= DESC_RATEVHT2SS_MCS9) return RTW_RATE_SECTION_VHT_2S; + else if (rate >= DESC_RATEVHT3SS_MCS0 && rate <= DESC_RATEVHT3SS_MCS9) + return RTW_RATE_SECTION_VHT_3S; + else if (rate >= DESC_RATEVHT4SS_MCS0 && rate <= DESC_RATEVHT4SS_MCS9) + return RTW_RATE_SECTION_VHT_4S; else return RTW_RATE_SECTION_MAX; } @@ -2096,7 +2167,7 @@ static s8 rtw_phy_get_tx_power_limit(struct rtw_dev *rtwdev, u8 band, bw = RTW_CHANNEL_WIDTH_20; /* only 20/40M BW with ht */ - if (rs == RTW_RATE_SECTION_HT_1S || rs == RTW_RATE_SECTION_HT_2S) + if (rate >= DESC_RATEMCS0 && rate <= DESC_RATEMCS31) bw = min_t(u8, bw, RTW_CHANNEL_WIDTH_40); /* select min power limit among [20M BW ~ current BW] */ @@ -2280,7 +2351,7 @@ rtw_phy_tx_power_by_rate_config_by_path(struct rtw_hal *hal, u8 path, u8 base_idx, rate_idx; s8 base_2g, base_5g; - if (rs >= RTW_RATE_SECTION_VHT_1S) + if (size == 10) /* VHT rates */ base_idx = rates[size - 3]; else base_idx = rates[size - 1]; @@ -2297,28 +2368,12 @@ rtw_phy_tx_power_by_rate_config_by_path(struct rtw_hal *hal, u8 path, void rtw_phy_tx_power_by_rate_config(struct rtw_hal *hal) { - u8 path; + u8 path, rs; - for (path = 0; path < RTW_RF_PATH_MAX; path++) { - rtw_phy_tx_power_by_rate_config_by_path(hal, path, - RTW_RATE_SECTION_CCK, - rtw_cck_size, rtw_cck_rates); - rtw_phy_tx_power_by_rate_config_by_path(hal, path, - RTW_RATE_SECTION_OFDM, - rtw_ofdm_size, rtw_ofdm_rates); - rtw_phy_tx_power_by_rate_config_by_path(hal, path, - RTW_RATE_SECTION_HT_1S, - rtw_ht_1s_size, rtw_ht_1s_rates); - rtw_phy_tx_power_by_rate_config_by_path(hal, path, - RTW_RATE_SECTION_HT_2S, - rtw_ht_2s_size, rtw_ht_2s_rates); - rtw_phy_tx_power_by_rate_config_by_path(hal, path, - RTW_RATE_SECTION_VHT_1S, - rtw_vht_1s_size, rtw_vht_1s_rates); - rtw_phy_tx_power_by_rate_config_by_path(hal, path, - RTW_RATE_SECTION_VHT_2S, - rtw_vht_2s_size, rtw_vht_2s_rates); - } + for (path = 0; path < RTW_RF_PATH_MAX; path++) + for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++) + rtw_phy_tx_power_by_rate_config_by_path(hal, path, rs, + rtw_rate_size[rs], rtw_rate_section[rs]); } static void diff --git a/drivers/net/wireless/realtek/rtw88/phy.h b/drivers/net/wireless/realtek/rtw88/phy.h index ccfcbd3ced03..707576d04262 100644 --- a/drivers/net/wireless/realtek/rtw88/phy.h +++ b/drivers/net/wireless/realtek/rtw88/phy.h @@ -13,6 +13,10 @@ extern u8 rtw_ht_1s_rates[]; extern u8 rtw_ht_2s_rates[]; extern u8 rtw_vht_1s_rates[]; extern u8 rtw_vht_2s_rates[]; +extern u8 rtw_ht_3s_rates[]; +extern u8 rtw_ht_4s_rates[]; +extern u8 rtw_vht_3s_rates[]; +extern u8 rtw_vht_4s_rates[]; extern u8 *rtw_rate_section[]; extern u8 rtw_rate_size[]; diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c index cc152248407c..106a9e38e428 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c @@ -709,7 +709,7 @@ static void rtw8821c_set_tx_power_index(struct rtw_dev *rtwdev) int rs, path; for (path = 0; path < hal->rf_path_num; path++) { - for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++) { + for (rs = 0; rs < RTW_RATE_SECTION_HT_3S; rs++) { if (rs == RTW_RATE_SECTION_HT_2S || rs == RTW_RATE_SECTION_VHT_2S) continue; diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wireless/realtek/rtw88/rtw8822b.c index 23a29019752d..5472fbf2b498 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c @@ -964,7 +964,7 @@ static void rtw8822b_set_tx_power_index(struct rtw_dev *rtwdev) int rs, path; for (path = 0; path < hal->rf_path_num; path++) { - for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++) + for (rs = 0; rs < RTW_RATE_SECTION_HT_3S; rs++) rtw8822b_set_tx_power_index_by_rate(rtwdev, path, rs, &phy_pwr_idx); } diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c index ec362a817f5f..aea9a20eab59 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c @@ -2746,7 +2746,7 @@ static void rtw8822c_set_tx_power_index(struct rtw_dev *rtwdev) s8 diff_idx[4]; rtw8822c_set_write_tx_power_ref(rtwdev, pwr_ref_cck, pwr_ref_ofdm); - for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++) { + for (rs = 0; rs < RTW_RATE_SECTION_HT_3S; rs++) { for (j = 0; j < rtw_rate_size[rs]; j++) { rate = rtw_rate_section[rs][j]; pwr_a = hal->tx_pwr_tbl[RF_PATH_A][rate]; diff --git a/drivers/net/wireless/realtek/rtw88/rtw88xxa.c b/drivers/net/wireless/realtek/rtw88/rtw88xxa.c index 71e61b9c0bec..08bbd84733d1 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw88xxa.c +++ b/drivers/net/wireless/realtek/rtw88/rtw88xxa.c @@ -1637,7 +1637,7 @@ void rtw88xxa_set_tx_power_index(struct rtw_dev *rtwdev) int rs, path; for (path = 0; path < hal->rf_path_num; path++) { - for (rs = 0; rs < RTW_RATE_SECTION_MAX; rs++) { + for (rs = 0; rs < RTW_RATE_SECTION_HT_3S; rs++) { if (hal->rf_path_num == 1 && (rs == RTW_RATE_SECTION_HT_2S || rs == RTW_RATE_SECTION_VHT_2S)) From patchwork Sun Jan 26 23:02:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bitterblue Smith X-Patchwork-Id: 860169 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDCAE1CD3F for ; Sun, 26 Jan 2025 23:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932539; cv=none; b=XWIbOlHC+cZuSKW7ewfnHZQAfjDG66DiM4l6QH5U6ht1s9T4n3RH078SjT/l+c/oR+tF8miL7orf6P8qDk8jH020WQzsDL1gUqK8K+fz2FIYBAUUXd9SVHWkYJiiuYSzU8/HRPgBgRs14OICoCaOF6TIL9hZvtRv9FZNcEFtaB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737932539; c=relaxed/simple; bh=2OmmiSVFpvCnMOonxhO2wDmm6N2Pmu7EoVGn4DC9TVY=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=OrKe43gtwVlj02C5VbvWDU0CAVUsKV/GU7k4j3ty6ih5ONiU/9OilCzbmDiTZC2l3JPBNayASjCdLScj3R5ZW0SytvfLe4KmSBXDpobsv6q4Tcbi+glRU3BfVdsQBVfo47/n/fU8qqqE6ixDFNDG5CLk+DZg4rwPwwyzC6Z9ckk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H6P63eB3; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H6P63eB3" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-38a25d4b9d4so2002855f8f.0 for ; Sun, 26 Jan 2025 15:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737932536; x=1738537336; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=8OcRTt9Y4PUP8FtGtevnvsP69gFiGEAlUvDZ9pzpupw=; b=H6P63eB3DCyHqwEUeqWWsY0EZWzJ48w3DDX6JingF5oLv638jOTaOPsPzik76nUbBJ hvK2MN08wlwwsiGkvz5H7BQ0scw1RJBDrmi5YTrZR7MnapJdvudfu2ORl/xFoiePn2qU 6lzzYZfEzsE6CRsxHrmifA5Rze5HbjV1YUu9vCplfh/VWujIZCOYMmNxss0ZGbKGEcl1 4Zwj9WjNJv0UPZwLenMsP5jIty7ambstK7X1L21I3sWTCkjVNYVnIrirpthAxsvi1gjX BSxCphGcKXvORpyAeZeqOMId00snAPojNvx0NCYWEDP8/L9nHlqb+oM5Clt8W9bkV/oJ eRig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737932536; x=1738537336; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8OcRTt9Y4PUP8FtGtevnvsP69gFiGEAlUvDZ9pzpupw=; b=JVAzSEgg657EaEq2Q3qoHCHFtt8Y8kngcmTU0MGwx3RZxDEtXWBIf9Vxrm+hGEYRYX VYDsVoB8nz2+ouk7j7TagpWfg6VUVOxBrLQ2qeQyqmkpgdPN3fNrSRoVsZAlN3wqmFks uOa30cyPoPwiXH0+XRhE02qG/yRbpOd0+y0WW/lRL5+fyugY5kcdfEfMQjp0HJycl0PD h8WhYRV+aSz2RfI7c0g5DmliFm1C3anC7JxpiADoIPIp0gjcge5dXXGtTeTOAeqJKs/S sj1V1x0OOEGdodlFNP6tpG2WeEzK/n4v0Dwgm3HZp5eFM1+6CglhyihON6XXCkwWJeC+ ObKQ== X-Gm-Message-State: AOJu0Yythf2rMTAPWk5a69s1J74DPP9O3bkclRe0gJYKv5RLBROZI6gq +9DDI7UkV4qfLZkEGrretv3150FNLAaJ/bbPqR2tMA8sY4qNWfRbAxxrtg== X-Gm-Gg: ASbGncv4K+P343NAVgDA7yzOxP0DqvlmjAbDaBylJO3U1OgqqS4uKX5dB62SdNZVMbd Tx1JiNZahN5Af5Nn487EIfVRfHDw/y6E4EK30z1tnGd/zQh2Ux5v8ueM5wanvlDgwqnMnNNR7OX 0dfxCLeeX+FFbocJA2i38zmE2mk14VkyWqc1jrzXar/kYr9TJm/XmGgmu1EfIybTYX1kSKdTe2G j+Lbc3n2QEvjmZKuSiA9WDSvriPzSxmX+KvYpJAqhXRFTH91SNgsHm6Zb3q9eDL0Db5OdQ+Bj5q gbP/w3+nYOpX X-Google-Smtp-Source: AGHT+IGAFCqi+GRvNRtBHRc2NClWQrQL0do8SEAqmXpTL4kLIKqEsEN0FHWi3AbUtp/CyLEiglPU4g== X-Received: by 2002:a5d:6d8d:0:b0:38a:88bc:ace1 with SMTP id ffacd0b85a97d-38bf57a9608mr31831600f8f.34.1737932535965; Sun, 26 Jan 2025 15:02:15 -0800 (PST) Received: from [192.168.0.50] ([79.119.240.80]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a1c3c8csm9426882f8f.90.2025.01.26.15.02.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jan 2025 15:02:14 -0800 (PST) Message-ID: <2a7c21bd-e78c-4792-99c7-fc73ce209930@gmail.com> Date: Mon, 27 Jan 2025 01:02:13 +0200 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 7/7] wifi: rtw88: Fix rtw_update_sta_info() for RTL8814AU From: Bitterblue Smith To: "linux-wireless@vger.kernel.org" Cc: Ping-Ke Shih References: Content-Language: en-US In-Reply-To: This function tells the firmware what rates it can use. Put the 3SS and 4SS HT rates supported by the other station into the rate mask. Remove the 3SS and 4SS rates from the rate mask if the hardware only has 2 spatial streams. And finally, select the right rate ID (a parameter for the firmware) when the hardware has 3 spatial streams. Signed-off-by: Bitterblue Smith Acked-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw88/main.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index 0cee0fd8c0ef..fab7e79fce47 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1234,7 +1234,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si, if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC) ldpc_en = VHT_LDPC_EN; } else if (sta->deflink.ht_cap.ht_supported) { - ra_mask |= (sta->deflink.ht_cap.mcs.rx_mask[1] << 20) | + ra_mask |= ((u64)sta->deflink.ht_cap.mcs.rx_mask[3] << 36) | + ((u64)sta->deflink.ht_cap.mcs.rx_mask[2] << 28) | + (sta->deflink.ht_cap.mcs.rx_mask[1] << 20) | (sta->deflink.ht_cap.mcs.rx_mask[0] << 12); if (sta->deflink.ht_cap.cap & IEEE80211_HT_CAP_RX_STBC) stbc_en = HT_STBC_EN; @@ -1244,6 +1246,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si, if (efuse->hw_cap.nss == 1 || rtwdev->hal.txrx_1ss) ra_mask &= RA_MASK_VHT_RATES_1SS | RA_MASK_HT_RATES_1SS; + else if (efuse->hw_cap.nss == 2) + ra_mask &= RA_MASK_VHT_RATES_2SS | RA_MASK_HT_RATES_2SS | + RA_MASK_VHT_RATES_1SS | RA_MASK_HT_RATES_1SS; if (hal->current_band_type == RTW_BAND_5G) { ra_mask |= (u64)sta->deflink.supp_rates[NL80211_BAND_5GHZ] << 4; @@ -1302,10 +1307,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si, break; } - if (sta->deflink.vht_cap.vht_supported && ra_mask & 0xffc00000) - tx_num = 2; - else if (sta->deflink.ht_cap.ht_supported && ra_mask & 0xfff00000) - tx_num = 2; + if (sta->deflink.vht_cap.vht_supported || + sta->deflink.ht_cap.ht_supported) + tx_num = efuse->hw_cap.nss; rate_id = get_rate_id(wireless_set, bw_mode, tx_num);