Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp76768lqf; Thu, 25 Apr 2024 23:12:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWd3OGVo88h92hPO/SM0UyvAcKp5DDTsSgyNQ2XzvtRMesm8JBby8jKz55Is1wjucxZ8heiQ4+az0F47yCOI0k/BhNJBnnXP8CqrCqh8A== X-Google-Smtp-Source: AGHT+IE7fB2NXWupChaW9HACb7Hk8XkPBWU9DPp9fyJmtTJyhRL268OOq2pWljz6+rZPEgKKx+N+ X-Received: by 2002:a50:aa89:0:b0:56d:b7d6:d64b with SMTP id q9-20020a50aa89000000b0056db7d6d64bmr1694001edc.29.1714111953357; Thu, 25 Apr 2024 23:12:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714111953; cv=pass; d=google.com; s=arc-20160816; b=ca2IqC1lf24zkKxKEDmW33/0YM7SjS/MQ+X0Po5Gypi8sZGQRXwf5CAlvqMAcWbKGv mku3R9pYk3jLJdVhAzbfOTU7mbKeUVUPTEouGfHpOMP9d7xOXg0P7M1liWRPd7MbujeX GEKqksX6Bfr8tXjD9KWLyNKcnJBdHga+8zQq1XWrouHH/V85Wp8S0/TCu47f1rsHY+6h ZbkfZVRcflXgop/RJhCD3LGjNct1UiAgqOeT77WAZBqVLKEUz/O3u1KeMz9NE2gN4thS Q7UC7OwW/GGKckFyTxWkBr3EQnyOKDZTR69yk6rUGnUuRm5U3zioYqPgUxFjJUe7+uPT /zUw== 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=ROpzmVJ9BfmWnTr3rnphusrWv/5o0zYcKMj31h7nto8=; fh=8wm86B6hZzTVT7uyofBnNJUYeYr15uonQ5C5s5lmjf8=; b=WKcucVMyGFr69yuOuGx4BDRigAPUd6EnVt9Zr2NmZwkl4vSOs2X1pOUqnGWUHJFLt2 r8YPBeunY3fK6h/51S5IVtlwrjFC/gMgNoP+92blHw7dRa0Onc4vny8yq9XHD26W2ykx /5i1j5SySoqvUH2sCg+Y6FB3l707o1i8geNZui/H7GQUfWkJNKpve1wZtlnDuSdSjg1H wTmaWQvbF2mT+3fV57C7SZ3/4RqorGI6tnlxMOv6j6DnDTiWx5eRp18yh4bzfOEifG5I 3SDERgF/dQLNRxrrAUKkDz0ynyrOTUeJMXW/m797hksuoHFkZHiDVh/KK15Gt7JaRPbm 5dzA==; 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-6917-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6917-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bo21-20020a0564020b3500b0056c3e3a1293si10592371edb.66.2024.04.25.23.12.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 23:12:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6917-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-6917-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6917-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1D1CC1F22DAA for ; Fri, 26 Apr 2024 06:12:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 474132F2F; Fri, 26 Apr 2024 06:12:26 +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 AA2C413A3EF for ; Fri, 26 Apr 2024 06:12:23 +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=1714111946; cv=none; b=eLdK6g+X1fP9LC46l/wK0NV9955jsKO1ZaT0nezENhLjnANhyjiSe9txgBr4TbDuZKBua/teSc+9QfqqIBhfDDhYZUfZMozE+EonwNjNQDpKrVfOA0fpH94v4UrIDE3sr5LQIY+8QSFdbkMICVqC9y3tlK9ZZxmdOPiq2APRYBY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714111946; c=relaxed/simple; bh=ZvmgOAgf8gGn89mkhf+6H/UZ9rz2cCID22Qqhup9omU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UgO1a+UJP6HfW8sQZJMAVES5ls74DXq4xnN9MsodfnvAclmwY42om7uwKDsWRk5ef6aQ/jqA8pTVcyVdPlwoTCRLB9B4d1OqgeGmjeTFrF8TDDEBHQyuD5oPrsHMEOvEfAV6joMaLxm/x8MwGzEwMKGPrmqDxDlQ5K0L9IO088k= 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 43Q6CLxH4161678, 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 43Q6CLxH4161678 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 26 Apr 2024 14:12:21 +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.2507.35; Fri, 26 Apr 2024 14:12:21 +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, 26 Apr 2024 14:12:20 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH 2/2] wifi: rtw89: 8852c: refine power sequence to imporve power consumption Date: Fri, 26 Apr 2024 14:12:00 +0800 Message-ID: <20240426061200.44262-2-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240426061200.44262-1-pkshih@realtek.com> References: <20240426061200.44262-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 From: Chia-Yuan Li Power sequence is a flow to enable/disable WiFi card with hardware parameters. Adjust power and clock parameters according to results of internal simulation and verification, so apply them to have better power consumption. Signed-off-by: Chia-Yuan Li Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/rtw8852c.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c.c b/drivers/net/wireless/realtek/rtw89/rtw8852c.c index efc772eb79a4..3571b41786d7 100644 --- a/drivers/net/wireless/realtek/rtw89/rtw8852c.c +++ b/drivers/net/wireless/realtek/rtw89/rtw8852c.c @@ -203,6 +203,9 @@ static int rtw8852c_pwr_on_func(struct rtw89_dev *rtwdev) rtw89_write32_clr(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APDM_HPDN); rtw89_write32_clr(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFM_SWLPS); + rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, + B_AX_OCP_L1_MASK, 0x7); + ret = read_poll_timeout(rtw89_read32, val32, val32 & B_AX_RDY_SYSPWR, 1000, 20000, false, rtwdev, R_AX_SYS_PW_CTRL); if (ret) @@ -266,7 +269,7 @@ static int rtw8852c_pwr_on_func(struct rtw89_dev *rtwdev) ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_SRAM2RFC); if (ret) return ret; - ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_XTAL_XMD_2, 0, XTAL_SI_LDO_LPS); + ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_XTAL_XMD_2, 0x10, XTAL_SI_LDO_LPS); if (ret) return ret; ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_XTAL_XMD_4, 0, XTAL_SI_LPS_CAP); @@ -361,8 +364,11 @@ static int rtw8852c_pwr_off_func(struct rtw89_dev *rtwdev) if (ret) return ret; - rtw89_write32(rtwdev, R_AX_WLLPS_CTRL, 0x0001A0B0); + rtw89_write32(rtwdev, R_AX_WLLPS_CTRL, SW_LPS_OPTION); rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_XTAL_OFF_A_DIE); + rtw89_write32_set(rtwdev, R_AX_SYS_SWR_CTRL1, B_AX_SYM_CTRL_SPS_PWMFREQ); + rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, + B_AX_REG_ZCDC_H_MASK, 0x3); rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFM_SWLPS); return 0; -- 2.25.1