Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp406688ybn; Tue, 1 Oct 2019 23:31:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfVRljavlemOjLqaLc02JkBSqJ7mQSoADF85Q/UnSxETqBJMCP6uY15X03fJLkTk4/Nb4Q X-Received: by 2002:a50:ef12:: with SMTP id m18mr2119229eds.18.1569997878954; Tue, 01 Oct 2019 23:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569997878; cv=none; d=google.com; s=arc-20160816; b=nyqpeDUyr9stiwn4d14Q+t5pFYJkGVGZBIlLCOm+NsINO/HZUrhlxs4LitLdrQE0IM J7uexb2hHXHzCcfQ/L7mH7cHKB+vKCefxj4FmHYlPYm8hDFlE2dcXBTGBYfPrkaUy4N1 Fno1knWJtDOeSEWp/7sqMRe7YcB5AxVbD5RAMGUo9YnTBq8nV8/p1LmcpxsURJTP5glz s1xTvTjdG70nbo0tsqIujLbH+henO8JKhrG303oSqT/SXFTgzUNU1yro643qrvMsPo7z v03X964zSdzE9+BODNxcMDDoxOtiRkPWhiY6h6CxPueHCstvTkYUfw3I9wql1YKxLHtn MXeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=/HV/Arkeu4MvGDl2lmadTUaTJSDQ+qzmDrlo0EqT+Ro=; b=FGpC0rgc+o8wj3Gl2bdJijcBMZqVliUm+4NWXqfl6VcziInxEJuiMdtoMZCrtG9wqD raHsxcC8Fpq2wr7rfvxKsnI+Z3RRwGc5m6f2X4fA0WhsnKD7XVNay4zIPlMW+bb47iZB UA6q+pdi0tEa348vR3arxTt0bsNEn0ficB/HskKdLUI8jmKq8R7Q3Vh1pbMaSrWZsU6S hoWM18s678zW+ZNlAWsVOOlydcejajfyhH7mm/l5RjtW9pJiokWerkXy3tXWoXFMzKLG ZQ4cY2X2wEpKZD7fAwCKsX9mleLExhpQEXQH4/LzJXxVnui7Lhs4FbROamnIUv9SplAC tD0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si10772912edj.0.2019.10.01.23.30.54; Tue, 01 Oct 2019 23:31:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729791AbfJBCbn (ORCPT + 99 others); Tue, 1 Oct 2019 22:31:43 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:46011 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729785AbfJBCbm (ORCPT ); Tue, 1 Oct 2019 22:31:42 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x922Va9i031852, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTITCASV01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x922Va9i031852 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 2 Oct 2019 10:31:36 +0800 Received: from localhost.localdomain (172.21.68.126) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.468.0; Wed, 2 Oct 2019 10:31:36 +0800 From: To: CC: , Subject: [PATCH v2 07/12] rtw88: leave PS state for dynamic mechanism Date: Wed, 2 Oct 2019 10:31:23 +0800 Message-ID: <20191002023128.12090-8-yhchuang@realtek.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191002023128.12090-1-yhchuang@realtek.com> References: <20191002023128.12090-1-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.126] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yan-Hsuan Chuang Dynamic mechanism requires BB/RF working to adjust hardware settings. But PS state periodically turns off BB/RF, could lead to wrong setting. So leave PS state before DM to make sure it works. And then check if we can enter PS state again. Signed-off-by: Yan-Hsuan Chuang --- v1 -> v2 - rebase on top of wireless-drivers-next drivers/net/wireless/realtek/rtw88/main.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index f55eda9da827..00ebf8cc81b1 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -174,6 +174,14 @@ static void rtw_watch_dog_work(struct work_struct *work) rtwdev->stats.tx_cnt = 0; rtwdev->stats.rx_cnt = 0; + if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags)) + goto unlock; + + /* make sure BB/RF is working for dynamic mech */ + rtw_leave_lps(rtwdev); + + rtw_phy_dynamic_mechanism(rtwdev); + /* use atomic version to avoid taking local->iflist_mtx mutex */ rtw_iterate_vifs_atomic(rtwdev, rtw_vif_watch_dog_iter, &data); @@ -184,13 +192,6 @@ static void rtw_watch_dog_work(struct work_struct *work) if (rtw_fw_support_lps && data.rtwvif && !data.active && data.assoc_cnt == 1) rtw_enter_lps(rtwdev, data.rtwvif->port); - else - rtw_leave_lps(rtwdev); - - if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags)) - goto unlock; - - rtw_phy_dynamic_mechanism(rtwdev); rtwdev->watch_dog_cnt++; -- 2.17.1