Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3781345ybe; Mon, 16 Sep 2019 00:47:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJM0A5Gkx323xqIaMCG9EfwZkgiwbVC/blr79KRmumHpFkPEbvuIlyiF/R26y1RORNF2dI X-Received: by 2002:a17:906:c799:: with SMTP id cw25mr33889707ejb.107.1568620049036; Mon, 16 Sep 2019 00:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568620049; cv=none; d=google.com; s=arc-20160816; b=j2yVLplGfiEp2ZSexKQZklgH+0rFQucKXhEkAEXvEFkV6z/HiuLeZXjd5t6W+CTMkg ISESpvQb7L+Uq8a3TVJvKacLxWpLwIX616kDjVksNp2qUK0gXc3e5s12Q+dnU/jY6P+7 vcPxOqkoloyd8VxW3MxyMG4K3kf/CdBuJbwHFktwT5CS2TMvWhQbjgD7bKoBP9gCR7EC iVce2UCXp8arbNMSdxm9eiwYuYlxs0jM+/6yddRrWboijlrPigAm1e2/KJt9lAFU6C65 a48tUziNp07LCtOZ1XNNDLwLXopOZuwWIEKx3LJvo6+UZyq+yLH4N24xO/3bQBEUhueT aENg== 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=hqyLLUR/qZ+WKtgTWOJ2JwPdLApI+4HKEDVf2zEa1AQ=; b=B8b3c/BopZ8Vy1bTNMIb4oxIg9qrhcLF0MdzIwb7+/toXD71TyNQTDjX/LexP9fFE8 UMU7qEGj2hjeBnbxU/UeCOWkbWEO1qayyJ0C4cG90lNgRlWTPxvJZN7WBxkHKAfY6oLr uhUbmnTVwpTAWep8LJoHPRfGojI0k7wi1OaRmXjeWMyBtQer917ojuIyqhK/bE8L82J5 zHWHVaLM3sjtJZa+8vOxxj/p0pa3i5W3Sz9gWVeaLjRPzwunqAfZYharfGDfFgdp/mdC 6EBiR4bVnQ+6FWUQpCwwQVy1reZaRN0wxPqNpnq/+rIIcEtZWdHKn/uDE7xokvX3EL5k e18g== 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 c6si21054173edc.291.2019.09.16.00.47.05; Mon, 16 Sep 2019 00:47:28 -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 S1730288AbfIPHEE (ORCPT + 99 others); Mon, 16 Sep 2019 03:04:04 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:60353 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730263AbfIPHED (ORCPT ); Mon, 16 Sep 2019 03:04:03 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x8G73v6i030003, 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 x8G73v6i030003 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 16 Sep 2019 15:03:57 +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; Mon, 16 Sep 2019 15:03:57 +0800 From: To: CC: , Subject: [PATCH 10/15] rtw88: leave PS state for dynamic mechanism Date: Mon, 16 Sep 2019 15:03:40 +0800 Message-ID: <1568617425-28062-11-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568617425-28062-1-git-send-email-yhchuang@realtek.com> References: <1568617425-28062-1-git-send-email-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 --- 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 f55eda9..00ebf8c 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.7.4