Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp587693rdb; Thu, 1 Feb 2024 19:07:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHQMzHTVxdC9lapwrxoJQuYQ1Sw7tV5IPu3rcfK2MkkaTL9LWhH1kdgITySTo/gvRRqCEaw X-Received: by 2002:a05:620a:ccf:b0:783:e070:1f09 with SMTP id b15-20020a05620a0ccf00b00783e0701f09mr4453219qkj.69.1706843269431; Thu, 01 Feb 2024 19:07:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706843269; cv=pass; d=google.com; s=arc-20160816; b=PFbONlLItLcBbrnmlJy0q2C7kahKgYlNnIyN6ut1Jg5zGdpyvrTtNqC58ubaokuV3I Ppti2g4DmpqibFMRb5zUvEzRxD2FgFEnhqSNZC8/x6eMXkTMSP1x1NnDJ+TcIwvmSPd3 Smdp/uA3gVk8g7kd5d/tSXtD9Srh0PuApEDW0qjywI++acv6Lxzk8YhQDqVUDFktYfkD kRJ9sRW35i1dUiinT6uqZRU5WA1MNY7oIE902POcl7xsTh6x0ucZUK5H0G+R6f8KTJki oi5QCBHkx9lEXsjf0KwCQXo+e/CIDVYvFaDItmitZcTuoN6e2KSP6xoEI+XWt2vRw607 6zrw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=H5m90Oq/VwHptwH42QVbZs4kATsPdE+0NBu8mM5JldM=; fh=jJTr41eAmM6sAZU1Sd3C4gFC88ygaxkgRMCAUF2MqoM=; b=DzDdUr1URAEtQ9icmKD3PwOwlpWrSn/WwlOO45GlFEYU5eEKTMme2hAEw5E+a5D1hN DsOwJUgt7i8csJ0zdvuY3iM0mzBsG+oJ0UhmDc4Z/zl+l4MFe25E/x8UDtYDJwHuchqu pVWpx7TXDgwukFcavLOjBT4jT1GptZWSFRD5zPh3E1jZ0R7Avmbcv1mTaSyr4gCiJePi diWMYvVFBjCC3E7S8sqoYYXAR8ycz0tUrW2nddF72lNa3ytOKXxCitBWo3McNL7qROex pY1usnXOlMGYvupSJBW/4LqSDdkAQzBk9GbW5AkWwFFwb9ITIO+KgCZ3yK6G9lq5CLsH 8JwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-2984-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2984-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVJl/Dgjnz/RRQ+0ePAxFJ7fqt1R5bPLsxZnBX621yt87L1LN76s014qExWYSv676Xbvs6PrO3e1N4mDDRXYIgGK9viALJfVgh2ggdNQQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v19-20020a05620a441300b0078558d407dfsi262320qkp.597.2024.02.01.19.07.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 19:07:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2984-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-2984-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2984-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 30D5E1C2620B for ; Fri, 2 Feb 2024 03:07:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C14B0DF4C; Fri, 2 Feb 2024 03:07:36 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (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 131A5CA70 for ; Fri, 2 Feb 2024 03:07:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706843256; cv=none; b=SX4C8wCIMYus5AGjdd9CfViHZ1rS+NeAOAC+gOqNYxDsZDCgh2spcbpO+cvlp6rskPziGU9KwDPxQLB7WGftKDSn76UKf85/0FCxW8VH+fG/udOYIJGsAUtzWBR4VWyxsDPG9Fb93XabBlxer5giE+R5D1S1Vya0gZyYX9xBwV0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706843256; c=relaxed/simple; bh=wXv5uMOX45nFD7Ree14neaks36I8B6klsxPdOEv9Jrw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EyfhmWFNzlvLqJBZMU0ZOZXw5YKXHblQWe0eWkyT2tmAa5BpGqiec5k33qVHFg27WQVxM+ggxXHk+x5OuK2ge+EV+z1EG5bR8496YOD6rm5pBoSw888BlbDvd7xH+dznhfmsYHZGu7YbOAVdhS8MinPYsM5boBUnOP5yT+UIn2E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 41237TfG41863083, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 41237TfG41863083 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 2 Feb 2024 11:07:29 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.17; Fri, 2 Feb 2024 11:07:29 +0800 Received: from [127.0.1.1] (172.21.69.94) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 2 Feb 2024 11:07:29 +0800 From: Ping-Ke Shih To: CC: Subject: [PATCH 03/11] wifi: rtw89: rfk: add H2C command to trigger IQK Date: Fri, 2 Feb 2024 11:06:34 +0800 Message-ID: <20240202030642.108385-4-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240202030642.108385-1-pkshih@realtek.com> References: <20240202030642.108385-1-pkshih@realtek.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) IQ signal calibration is a basic and important calibration to yield good RF performance. Do this calibration on AP channel if we are going to connect. During scanning phase, it transmits with low data rate, so without IQK RF performance is still acceptable. Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/fw.c | 35 +++++++++++++++++++++++++ drivers/net/wireless/realtek/rtw89/fw.h | 7 +++++ 2 files changed, 42 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c index 5bd3d08a5d25..d2c166ee5c89 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.c +++ b/drivers/net/wireless/realtek/rtw89/fw.c @@ -4593,6 +4593,41 @@ int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev, return ret; } +int rtw89_fw_h2c_rf_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx) +{ + struct rtw89_h2c_rf_iqk *h2c; + u32 len = sizeof(*h2c); + struct sk_buff *skb; + int ret; + + skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len); + if (!skb) { + rtw89_err(rtwdev, "failed to alloc skb for h2c RF IQK\n"); + return -ENOMEM; + } + skb_put(skb, len); + h2c = (struct rtw89_h2c_rf_iqk *)skb->data; + + h2c->phy_idx = cpu_to_le32(phy_idx); + h2c->dbcc = cpu_to_le32(rtwdev->dbcc_en); + + rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C, + H2C_CAT_OUTSRC, H2C_CL_OUTSRC_RF_FW_RFK, + H2C_FUNC_RFK_IQK_OFFLOAD, 0, 0, len); + + ret = rtw89_h2c_tx(rtwdev, skb, false); + if (ret) { + rtw89_err(rtwdev, "failed to send h2c\n"); + goto fail; + } + + return 0; +fail: + dev_kfree_skb_any(skb); + + return ret; +} + int rtw89_fw_h2c_raw_with_hdr(struct rtw89_dev *rtwdev, u8 h2c_class, u8 h2c_func, u8 *buf, u16 len, bool rack, bool dack) diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h index d9316b66ab76..e9c7f9532b0b 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.h +++ b/drivers/net/wireless/realtek/rtw89/fw.h @@ -3935,6 +3935,7 @@ enum rtw89_mcc_h2c_func { #define H2C_CL_OUTSRC_RF_FW_RFK 0xb enum rtw89_rfk_offload_h2c_func { + H2C_FUNC_RFK_IQK_OFFLOAD = 0x1, H2C_FUNC_RFK_PRE_NOTIFY = 0x8, }; @@ -3982,6 +3983,11 @@ struct rtw89_fw_h2c_rfk_pre_info { } __packed mlo; } __packed; +struct rtw89_h2c_rf_iqk { + __le32 phy_idx; + __le32 dbcc; +} __packed; + enum rtw89_rf_log_type { RTW89_RF_RUN_LOG = 0, RTW89_RF_RPT_LOG = 1, @@ -4169,6 +4175,7 @@ int rtw89_fw_h2c_rf_reg(struct rtw89_dev *rtwdev, int rtw89_fw_h2c_rf_ntfy_mcc(struct rtw89_dev *rtwdev); int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx); +int rtw89_fw_h2c_rf_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx); int rtw89_fw_h2c_raw_with_hdr(struct rtw89_dev *rtwdev, u8 h2c_class, u8 h2c_func, u8 *buf, u16 len, bool rack, bool dack); -- 2.25.1