Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp588216rdb; Thu, 1 Feb 2024 19:09:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqifVkkTPJi8bUq91oQshB4Je+LCJGNFVIdLXYoH4A/yjuD9UHjHJ2616HY9QhDLPBRwsM X-Received: by 2002:a05:6870:1646:b0:218:4171:f0e1 with SMTP id c6-20020a056870164600b002184171f0e1mr647713oae.59.1706843358353; Thu, 01 Feb 2024 19:09:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706843358; cv=pass; d=google.com; s=arc-20160816; b=ojUkD10aVvfGkoDNpGmJN45+4j0oiu9M5sqh7x40LduXlYgDwq6GuZ8gUHQ6WgBM3e 66NjX+bSyIpRC10Kbwa10w5upV2jCmc4oTiQiFiAlmGUnNgB7f3L7SBq8DtXIdjBfpzM QixHe5j5YE7ksUX8ebUfCUbJWI2k5j0Ev5gXMy9op4P8Kslg14TilfVtZPIpL2Z/xZbe LmUxPuCh0ecF0v6zpNO6dXN6NvxQLQrE1t2W1gvCCIej2Ms58EjrPkvTzhFWiumrfu1P sw7kI3cp0kcys15u4li5yyCNNyK1+3jv8cIsE2SXsNGeyaEtAmBGczA9iPgX5GS1EGAT BpvQ== 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=ulFKKBmh7pNnMUYHzd1XJrvc8Ae+f5i17Ukqwj+o/4g=; fh=rem5zvJ/Af3k6QQVbs9PnKtxN9w/NHfFx0UpXQpATYY=; b=t5AWBeWaN0XBijvrs7tXth8suU6k0WVkhzFxoQiWFLZDKhKHd/9CHXMV/G2vToDar6 snIWjyg5ykfky8DrUtIdDvU8zalkgDRo/+bkXa+0wCohlR4d6uZsDwquAq24fEKLhPLK hmaW2unZDh4k/vyZp9OQA501hJJLI4uwVbU7V+KrJhde23/O7c9wzlwczQNGphQ8G8lm +2Q93zra7u/TgQm6rb7Gx/zlfokp9j/W6gK/1Une1aZrlXZvDjCHl818aV4tx54CjinD fY/BXrJs4M5bIHxG2Fj3Bgy1yoyXgWw1CiwDldLOT24vUEFlwHS3Pqk9WbM33EmX7uek CIrg==; 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-2987-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2987-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWcUKczWm/cL8AtB1aL79VuK5JPsRg38OpTE0HR7u1xPwZFDKINUgMTRpv7caYlmE8oXPE9knDG+cJTSo8JcbUXKl52acixcAunZGJIMg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c196-20020a6335cd000000b005cdba90861asi828232pga.159.2024.02.01.19.09.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 19:09:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-2987-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-2987-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-2987-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 23D5728B90E for ; Fri, 2 Feb 2024 03:08:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E7E38C1C; Fri, 2 Feb 2024 03:07:48 +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 7FF92BE79 for ; Fri, 2 Feb 2024 03:07:46 +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=1706843268; cv=none; b=Wzd2zFrFItWSBKPMrY0BOSENtAsJWidutgnzspzE9vyFykPQPKC6N75Uwdq/91ANpEyfAGW7lwZOmFeE613dFHXwiTTcPysiIllZEqaITP+rq6+sLuOSvce1kD1wyr5TCp8CLp4WZ6QkuEDGNmA13y9OPit2h6egjoCK3/rC5Yo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706843268; c=relaxed/simple; bh=WdObyHg3eaqCjYtI7ET1EtTit+KfXodu4tnDg2bzuxY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=R3iL6nD7VdM9vh7gVEos8idvmJJZnJPWG5fxiMQYm2EQqBxZoSt4I5M0LxJCVvUb3qq1vFNq5GtaMpTRecshOt6CuErlZvi7mHW4jysfJzLhsAEQE6RtwM4p3N5OjR2xWUCSFI067ozSCJ1VPlA41iUmJakqfIo+4XA4ZnQse84= 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 41237ffO61863100, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 41237ffO61863100 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 2 Feb 2024 11:07:41 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.32; Fri, 2 Feb 2024 11:07:41 +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:41 +0800 From: Ping-Ke Shih To: CC: Subject: [PATCH 06/11] wifi: rtw89: rfk: add H2C command to trigger DACK Date: Fri, 2 Feb 2024 11:06:37 +0800 Message-ID: <20240202030642.108385-7-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) X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback DACK (digital-to-analog converters calibration) is used to calibrate DAC to output signals with expected quality. Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/fw.c | 36 +++++++++++++++++++++++++ drivers/net/wireless/realtek/rtw89/fw.h | 8 ++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c index 1218bab049c3..5b6693ffa290 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.c +++ b/drivers/net/wireless/realtek/rtw89/fw.c @@ -4671,6 +4671,42 @@ int rtw89_fw_h2c_rf_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx) return ret; } +int rtw89_fw_h2c_rf_dack(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx) +{ + struct rtw89_h2c_rf_dack *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 DACK\n"); + return -ENOMEM; + } + skb_put(skb, len); + h2c = (struct rtw89_h2c_rf_dack *)skb->data; + + h2c->len = cpu_to_le32(len); + h2c->phy = cpu_to_le32(phy_idx); + h2c->type = cpu_to_le32(0); + + rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C, + H2C_CAT_OUTSRC, H2C_CL_OUTSRC_RF_FW_RFK, + H2C_FUNC_RFK_DACK_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_rf_rxdck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx) { const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h index f48d21a772aa..0fdc62fdd25a 100644 --- a/drivers/net/wireless/realtek/rtw89/fw.h +++ b/drivers/net/wireless/realtek/rtw89/fw.h @@ -3937,6 +3937,7 @@ enum rtw89_mcc_h2c_func { enum rtw89_rfk_offload_h2c_func { H2C_FUNC_RFK_IQK_OFFLOAD = 0x1, H2C_FUNC_RFK_DPK_OFFLOAD = 0x3, + H2C_FUNC_RFK_DACK_OFFLOAD = 0x5, H2C_FUNC_RFK_RXDCK_OFFLOAD = 0x6, H2C_FUNC_RFK_PRE_NOTIFY = 0x8, }; @@ -4001,6 +4002,12 @@ struct rtw89_h2c_rf_dpk { u8 dpk_dbg_en; } __packed; +struct rtw89_h2c_rf_dack { + __le32 len; + __le32 phy; + __le32 type; +} __packed; + struct rtw89_h2c_rf_rxdck { u8 len; u8 phy; @@ -4201,6 +4208,7 @@ 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_rf_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx); +int rtw89_fw_h2c_rf_dack(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx); int rtw89_fw_h2c_rf_rxdck(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, -- 2.25.1