From patchwork Fri Apr 13 14:44:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Gruszka X-Patchwork-Id: 10340247 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2183E604D4 for ; Fri, 13 Apr 2018 14:44:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F3D6288C9 for ; Fri, 13 Apr 2018 14:44:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 037F8288CF; Fri, 13 Apr 2018 14:44:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A13F4288C9 for ; Fri, 13 Apr 2018 14:44:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751617AbeDMOow (ORCPT ); Fri, 13 Apr 2018 10:44:52 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:47984 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751299AbeDMOou (ORCPT ); Fri, 13 Apr 2018 10:44:50 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 701B481A88BC; Fri, 13 Apr 2018 14:44:50 +0000 (UTC) Received: from localhost (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C279D7DEE; Fri, 13 Apr 2018 14:44:50 +0000 (UTC) From: Stanislaw Gruszka To: linux-wireless@vger.kernel.org Cc: Jakub Kicinski , Stanislaw Gruszka Subject: [PATCH 2/2] mt7601u: run calibration works after finishing scanning Date: Fri, 13 Apr 2018 16:44:38 +0200 Message-Id: <1523630678-8100-2-git-send-email-sgruszka@redhat.com> In-Reply-To: <1523630678-8100-1-git-send-email-sgruszka@redhat.com> References: <1523630678-8100-1-git-send-email-sgruszka@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 13 Apr 2018 14:44:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 13 Apr 2018 14:44:50 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'sgruszka@redhat.com' RCPT:'' Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When finishing scanning we switch to operational channel sill with SCANNING flag. This mean that we never perform calibration works after scanning. To fix the problem cancel and queue calibration works on .sw_scan_start() and .sw_scan_complete() routines. Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/mediatek/mt7601u/main.c | 9 +++++++++ drivers/net/wireless/mediatek/mt7601u/phy.c | 15 +-------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt7601u/main.c b/drivers/net/wireless/mediatek/mt7601u/main.c index 43ebd460ba86..a09b92a9137d 100644 --- a/drivers/net/wireless/mediatek/mt7601u/main.c +++ b/drivers/net/wireless/mediatek/mt7601u/main.c @@ -273,6 +273,9 @@ static int mt7601u_config(struct ieee80211_hw *hw, u32 changed) { struct mt7601u_dev *dev = hw->priv; + cancel_delayed_work_sync(&dev->cal_work); + cancel_delayed_work_sync(&dev->freq_cal.work); + mt7601u_agc_save(dev); set_bit(MT7601U_STATE_SCANNING, &dev->state); } @@ -285,6 +288,12 @@ static int mt7601u_config(struct ieee80211_hw *hw, u32 changed) mt7601u_agc_restore(dev); clear_bit(MT7601U_STATE_SCANNING, &dev->state); + + ieee80211_queue_delayed_work(dev->hw, &dev->cal_work, + MT_CALIBRATE_INTERVAL); + if (dev->freq_cal.enabled) + ieee80211_queue_delayed_work(dev->hw, &dev->freq_cal.work, + MT_FREQ_CAL_INIT_DELAY); } static int diff --git a/drivers/net/wireless/mediatek/mt7601u/phy.c b/drivers/net/wireless/mediatek/mt7601u/phy.c index d440c550bdb1..e5fe3bef596e 100644 --- a/drivers/net/wireless/mediatek/mt7601u/phy.c +++ b/drivers/net/wireless/mediatek/mt7601u/phy.c @@ -452,24 +452,11 @@ int mt7601u_phy_set_channel(struct mt7601u_dev *dev, { int ret; - cancel_delayed_work_sync(&dev->cal_work); - cancel_delayed_work_sync(&dev->freq_cal.work); - mutex_lock(&dev->hw_atomic_mutex); ret = __mt7601u_phy_set_channel(dev, chandef); mutex_unlock(&dev->hw_atomic_mutex); - if (ret) - return ret; - - if (test_bit(MT7601U_STATE_SCANNING, &dev->state)) - return 0; - ieee80211_queue_delayed_work(dev->hw, &dev->cal_work, - MT_CALIBRATE_INTERVAL); - if (dev->freq_cal.enabled) - ieee80211_queue_delayed_work(dev->hw, &dev->freq_cal.work, - MT_FREQ_CAL_INIT_DELAY); - return 0; + return ret; } #define BBP_R47_FLAG GENMASK(2, 0)