Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp594921ybd; Sat, 29 Jun 2019 03:39:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+jG83jBm6tM5BUTDMA/jtRXAlMOdi3LP9UiF98xk4wCHdlhymIUjNXmZpR4C12mVQSHta X-Received: by 2002:a17:90a:8a0b:: with SMTP id w11mr18598909pjn.125.1561804741202; Sat, 29 Jun 2019 03:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561804741; cv=none; d=google.com; s=arc-20160816; b=iARkjVrswY0QWIZUNn9485OqEYn2QT5hNXOx9vY0TZZ193r3a63M4YkuUYmKosjaDw wUaiucR9mDKp63lflN4rQZTbnwd8bQCIiLd+FD4z9kzu08wmdmgRV1PI48oHzKeWQNXh PBFLqg2Csk65JemqPmlitLHtshhZKOrgoCLyKJwiUcyBqWTTl7FhY+BdIBMcBUy5Kz9X WopP0c9sPp/+b8lkJyzs0/UGmDUN5bdqMmR4COwnDjhvtCorZac2vBlVCxgzlVNx1IIE LvNprDoU7q//vI8rOCbT2EituOIB244vH7qyFbuW1E1Y2pZXpBNavKbjiq+HTzsknxpF IP8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eOQG3lDx59keG8h3oac3pUlwnEZ9AsdtygBOFlv6Q18=; b=1EfGZ1lZX49qgEzdkHNEGVWTgdw4Sm9gw83SNRW82IacZfDYPFDzQms0APDcKSlPbl T35O3SnQWjyZNTpKk59hxM5vUlhet56tFLdWO01sAK1X+JMlX6j3isqHcw+PKtZszqyG Y7VIiNSY87WlYHucySxGVZ+fiqyOqWg+L7K7kKXI5wLp7eXVTRq3CK/NNSG+pt7RlkOZ VDaZd+1U8rC9ZPzHxHq37WVOJA0AolQ3uTpGTxa5eLkPT390mx5Ib6enoA+wqV9KgOEX qOYBmP/naYkWeA25zMI5WRE8WCE9oWpmd32RgNvSJSahLUH6jes9eQqtcEZX5l3zbfNm C0WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OKJwyXAB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t17si5042573pfe.269.2019.06.29.03.38.46; Sat, 29 Jun 2019 03:39:01 -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; dkim=pass header.i=@kernel.org header.s=default header.b=OKJwyXAB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726965AbfF2Kgd (ORCPT + 99 others); Sat, 29 Jun 2019 06:36:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:42886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726839AbfF2Kgd (ORCPT ); Sat, 29 Jun 2019 06:36:33 -0400 Received: from lore-desk-wlan.lan (unknown [151.66.61.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1B2DC214DA; Sat, 29 Jun 2019 10:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561804592; bh=BeIh69WM8av1MpHWKri+uvtMzaWyibgbEYu1f8OHElQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OKJwyXABLc5O9djQtJ/CG4tEftVL9WjCAu4Sr86xUJCASoq8T9T+jsEit3eSNZddk QItICrXD+Dh9IbuFxCuKl6i5LRyTqwqlLl7j49bbS498VnaIfKm/gComzpUhQX8C7i xsc7wIOKyV5hRvYRvc5lTU98ktak273OrZEvzplY= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org, ryder.lee@mediatek.com, royluo@google.com, yf.luo@mediatek.com Subject: [PATCH 3/6] mt76: mt7615: do not perform txcalibration before cac is complited Date: Sat, 29 Jun 2019 12:36:08 +0200 Message-Id: <1689be5790afeb380634394bdc1b030e0b2ef050.1561804422.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Delay channel calibration after Channel Availability Check. Add some code cleanup to mt7615_mcu_set_channel Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index c3fefccf3d5b..397ae4f95db8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -1280,7 +1280,8 @@ int mt7615_mcu_rdd_cmd(struct mt7615_dev *dev, int mt7615_mcu_set_channel(struct mt7615_dev *dev) { - struct cfg80211_chan_def *chdef = &dev->mt76.chandef; + struct cfg80211_chan_def *chandef = &dev->mt76.chandef; + int freq1 = chandef->center_freq1, freq2 = chandef->center_freq2; struct { u8 control_chan; u8 center_chan; @@ -1299,17 +1300,20 @@ int mt7615_mcu_set_channel(struct mt7615_dev *dev) u8 rsv1[3]; u8 txpower_sku[53]; u8 rsv2[3]; - } req = {0}; + } req = { + .control_chan = chandef->chan->hw_value, + .center_chan = ieee80211_frequency_to_channel(freq1), + .tx_streams = (dev->mt76.chainmask >> 8) & 0xf, + .rx_streams_mask = dev->mt76.antenna_mask, + .center_chan2 = ieee80211_frequency_to_channel(freq2), + }; int ret; - req.control_chan = chdef->chan->hw_value; - req.center_chan = ieee80211_frequency_to_channel(chdef->center_freq1); - req.tx_streams = (dev->mt76.chainmask >> 8) & 0xf; - req.rx_streams_mask = dev->mt76.antenna_mask; - req.switch_reason = CH_SWITCH_NORMAL; - req.band_idx = 0; - req.center_chan2 = ieee80211_frequency_to_channel(chdef->center_freq2); - req.txpower_drop = 0; + if ((chandef->chan->flags & IEEE80211_CHAN_RADAR) && + chandef->chan->dfs_state != NL80211_DFS_AVAILABLE) + req.switch_reason = CH_SWITCH_DFS; + else + req.switch_reason = CH_SWITCH_NORMAL; switch (dev->mt76.chandef.width) { case NL80211_CHAN_WIDTH_40: @@ -1334,6 +1338,7 @@ int mt7615_mcu_set_channel(struct mt7615_dev *dev) case NL80211_CHAN_WIDTH_20: default: req.bw = CMD_CBW_20MHZ; + break; } memset(req.txpower_sku, 0x3f, 49); -- 2.21.0