From patchwork Wed Jun 12 01:33:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1946599 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VzSkB2Tk9z20Z4 for ; Wed, 12 Jun 2024 11:33:53 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1sHCru-0000aD-N8; Wed, 12 Jun 2024 01:33:42 +0000 Received: from mail-pj1-f53.google.com ([209.85.216.53]) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1sHCrs-0000Zh-3g for kernel-team@lists.ubuntu.com; Wed, 12 Jun 2024 01:33:40 +0000 Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2c2c74d9be0so1488664a91.1 for ; Tue, 11 Jun 2024 18:33:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718156018; x=1718760818; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=zopNxwxquwyrhmi5DNbRI0Yt+L6DKLWB5XRrZ7gJAGY=; b=tWacBWtqRD0Ncro4/mtT1DNkMWlh7ZBag8AJJsaEmHduEehMd6RNeLPFAl3LAzDXjf QOyM46Srnl05jeOdLRpv05ZLlkfw6pQ6AW1pEqzNHI1Z2VeJ9fyTFhBSLzh4Be7YwfQT zDtDsOynsUBr0aJPKgnIppzt3bsbdw3Mam8+Zm8NoWAbFuYV8LPUdhKRlfJcXc+D2F0m cz0RF5Jz2aO1g1gW4l0c5rk8vS2Jcyn355zquZkU5cjxDYvdjXKKaCE/9bkFtcCMukjS U+6tonBK0hPk1JVLq1vTNtux60QdLJavuUqqI0QasZ8AThWSE7zHRGtmVsxAhhIodSQN 6t8A== X-Gm-Message-State: AOJu0Yy1DivHPeXjqOxd0dpiWX0ZgMIRTeWtn7tJF8gbd/jSh/jVbmm0 8fJa0plbuCCGChzq7HK3qM7ZdfMHT2ipV6aC8msyXx9wu93APi7EaMs+cw== X-Google-Smtp-Source: AGHT+IF9nw7xy3t09d5JpxncgdBl/3Ce/0vNXv7zMRmv7qLPkAfLULnbdZkNHUl7lq1WdPmU+mjdkg== X-Received: by 2002:a17:90a:dc09:b0:2c2:ce7e:458e with SMTP id 98e67ed59e1d1-2c4a7601f0dmr546652a91.10.1718156017635; Tue, 11 Jun 2024 18:33:37 -0700 (PDT) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c4a75eeef1sm302083a91.22.2024.06.11.18.33.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 18:33:37 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/2][SRU][N] wifi: rtw89: reset AFEDIG register in power off sequence Date: Wed, 12 Jun 2024 09:33:32 +0800 Message-Id: <20240612013333.1608029-2-acelan.kao@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240612013333.1608029-1-acelan.kao@canonical.com> References: <20240612013333.1608029-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.216.53; envelope-from=acelan@gmail.com; helo=mail-pj1-f53.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Chin-Yen Lee BugLink: https://bugs.launchpad.net/bugs/2065128 Some Wi-Fi chips meet card lost issue due to unstable hardware signal of GPIO pins during power off. Reset AFEDIG register before BB reset in power off sequence could avoid unstable signal and fix the issue. Signed-off-by: Chin-Yen Lee Signed-off-by: Ping-Ke Shih Link: https://msgid.link/20240426061200.44262-1-pkshih@realtek.com (cherry picked from commit 535c045da60fec1afb31919a9df3e06574d4dc52) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/net/wireless/realtek/rtw89/rtw8851b.c | 1 + drivers/net/wireless/realtek/rtw89/rtw8852b.c | 2 ++ drivers/net/wireless/realtek/rtw89/rtw8852c.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/rtw8851b.c b/drivers/net/wireless/realtek/rtw89/rtw8851b.c index 5c167a9278ce..6ebbe48ca50b 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8851b.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8851b.c @@ -2274,6 +2274,7 @@ static int rtw8851b_mac_disable_bb_rf(struct rtw89_dev *rtwdev) u8 wl_rfc_s1; int ret; + rtw89_write32_clr(rtwdev, R_AX_WLRF_CTRL, B_AX_AFC_AFEDIG); rtw89_write8_clr(rtwdev, R_AX_SYS_FUNC_EN, B_AX_FEN_BBRSTB | B_AX_FEN_BB_GLB_RSTN); diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b.c b/drivers/net/wireless/realtek/rtw89/rtw8852b.c index de887a35f3fb..491527e3c7a3 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852b.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852b.c @@ -550,6 +550,7 @@ static int rtw8852b_pwr_off_func(struct rtw89_dev *rtwdev) return ret; rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_EN_WLON); + rtw89_write32_clr(rtwdev, R_AX_WLRF_CTRL, B_AX_AFC_AFEDIG); rtw89_write8_clr(rtwdev, R_AX_SYS_FUNC_EN, B_AX_FEN_BB_GLB_RSTN | B_AX_FEN_BBRSTB); rtw89_write32_clr(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_RFC_1P3); @@ -2443,6 +2444,7 @@ static int rtw8852b_mac_disable_bb_rf(struct rtw89_dev *rtwdev) u8 wl_rfc_s1; int ret; + rtw89_write32_clr(rtwdev, R_AX_WLRF_CTRL, B_AX_AFC_AFEDIG); rtw89_write8_clr(rtwdev, R_AX_SYS_FUNC_EN, B_AX_FEN_BBRSTB | B_AX_FEN_BB_GLB_RSTN); diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c index 8618d0204f66..4f2cd9082e9f 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c @@ -338,6 +338,7 @@ static int rtw8852c_pwr_off_func(struct rtw89_dev *rtwdev) return ret; rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_EN_WLON); + rtw89_write32_clr(rtwdev, R_AX_WLRF_CTRL, B_AX_AFC_AFEDIG); rtw89_write8_clr(rtwdev, R_AX_SYS_FUNC_EN, B_AX_FEN_BB_GLB_RSTN | B_AX_FEN_BBRSTB); rtw89_write32_clr(rtwdev, R_AX_SYS_ISO_CTRL_EXTEND, B_AX_R_SYM_FEN_WLBBGLB_1 | B_AX_R_SYM_FEN_WLBBFUN_1); @@ -2790,6 +2791,7 @@ static int rtw8852c_mac_enable_bb_rf(struct rtw89_dev *rtwdev) static int rtw8852c_mac_disable_bb_rf(struct rtw89_dev *rtwdev) { + rtw89_write32_clr(rtwdev, R_AX_WLRF_CTRL, B_AX_AFC_AFEDIG); rtw89_write8_clr(rtwdev, R_AX_SYS_FUNC_EN, B_AX_FEN_BBRSTB | B_AX_FEN_BB_GLB_RSTN);