From patchwork Tue Jan 9 13:13:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10152033 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 9C3A0602CA for ; Tue, 9 Jan 2018 13:13:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98A6628997 for ; Tue, 9 Jan 2018 13:13:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DC1D289D0; Tue, 9 Jan 2018 13:13:28 +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=-6.9 required=2.0 tests=BAYES_00,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 3D80C28997 for ; Tue, 9 Jan 2018 13:13:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757150AbeAINNY (ORCPT ); Tue, 9 Jan 2018 08:13:24 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:44900 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751741AbeAINNV (ORCPT ); Tue, 9 Jan 2018 08:13:21 -0500 Received: by mail-wr0-f195.google.com with SMTP id w50so4849068wrc.11 for ; Tue, 09 Jan 2018 05:13:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=O9Xk853z2hEC+Di/7s1oVU9s+ELDwdU1egIPbOXm8KQ=; b=Hmu1WekhzJaXBVstZAI3XxLZeTsTeKB+8rcnxFgxp7dZsaq4A34iVT9usp+0G9BXxg /zQgTTg44y+IAVzKaXQS/KHnk+DspUjzm3W/UktsBGzFOfjLHlKbEvCaSFkZQOIt5zZM IxElMP2GXLvL4NczfcYlTi+eJEKrEbK2VDUKDyXaDGqITBaJ2IuusyH6CCMx7PoEvo7c TgoLj+BlfS3fqIJP5XWgJrgWowgL09CHtdj3gOfAjyE3jkAGkgbS2EvncTy2SzG2qxmO 2G9KWDP6rQ26+DzM2a3DzpRmzJkNaiKbZ6PJ+M/rzm4j9y33sybGMx3gDbPV0iwCaqEj XFGQ== X-Gm-Message-State: AKGB3mIdjBjVbCTlNSDLn4TtuU1HjpMUsgy4CnYk5xtuQQ5RbURHkw1C Pp10SWd2xd0ZqJZcO0rBF3yO5frGQGU= X-Google-Smtp-Source: ACJfBovb2JS6mck6p2ZfZoXGa4ocWCKm6K1CaoxOnEQQMYM+mquENQWCmke6Kq+sm4+ITyysnGt1yg== X-Received: by 10.223.188.131 with SMTP id g3mr13300697wrh.26.1515503600553; Tue, 09 Jan 2018 05:13:20 -0800 (PST) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id 17sm17488732wmq.10.2018.01.09.05.13.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jan 2018 05:13:20 -0800 (PST) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org Subject: [PATCH 2/3] mt76x2: dfs: add set_domain handler Date: Tue, 9 Jan 2018 14:13:11 +0100 Message-Id: X-Mailer: git-send-email 2.13.6 In-Reply-To: References: 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 Add mt76x2_dfs_set_domain routine in order to properly reconfigure pattern detector when DFS domain has been changed Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c | 13 +++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h | 2 ++ drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c b/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c index 1a6282a8b64b..df23ba5ef900 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c @@ -490,3 +490,16 @@ void mt76x2_dfs_init_detector(struct mt76x2_dev *dev) (unsigned long)dev); } +void mt76x2_dfs_set_domain(struct mt76x2_dev *dev, + enum nl80211_dfs_regions region) +{ + struct mt76x2_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; + + if (dfs_pd->region != region) { + tasklet_disable(&dfs_pd->dfs_tasklet); + dfs_pd->region = region; + mt76x2_dfs_init_params(dev); + tasklet_enable(&dfs_pd->dfs_tasklet); + } +} + diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h b/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h index 9ac69b6a116d..8dbc783cc6bc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h @@ -76,5 +76,7 @@ struct mt76x2_dfs_pattern_detector { void mt76x2_dfs_init_params(struct mt76x2_dev *dev); void mt76x2_dfs_init_detector(struct mt76x2_dev *dev); void mt76x2_dfs_adjust_agc(struct mt76x2_dev *dev); +void mt76x2_dfs_set_domain(struct mt76x2_dev *dev, + enum nl80211_dfs_regions region); #endif /* __MT76x2_DFS_H */ diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c index 4373a2ba5143..9f20a308ff76 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c @@ -652,7 +652,7 @@ static void mt76x2_regd_notifier(struct wiphy *wiphy, struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct mt76x2_dev *dev = hw->priv; - dev->dfs_pd.region = request->dfs_region; + mt76x2_dfs_set_domain(dev, request->dfs_region); } #define CCK_RATE(_idx, _rate) { \