Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1645925pxb; Sat, 23 Jan 2021 00:40:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRKa02YQywGAEfb4Z/urTt3BiYfWvpzviwM7HrPM9sEfA4trPmjJqXbRcgnES9U8+ruPIX X-Received: by 2002:a17:906:708f:: with SMTP id b15mr93348ejk.267.1611391257731; Sat, 23 Jan 2021 00:40:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611391257; cv=none; d=google.com; s=arc-20160816; b=ybfotpXFCmRfIZpw/tAVszjRnT53IR6LbDhbju2HS+IzeIobCWXlIAuepkmZvUoDeo zNnyLpZGXkAT/uZoOo8/xg/uoX1iuj0+bb2+fGSSgjq7pjo5CZRYC3ZMuudcsIV1ZDPm Lfhc1TERRqTt5DnZsyUSOPhLXZ7xHJntRDlroJ/IsR8IxPF/g275njYgjwZRtavLJaWs 2VkTvqmDmZcnheKSilJ70SnoJ1o0wJy4S/KxUFA+EXHnZC+/mYrVXSWYld3CDWtBFutn JHKr4QdahpceBiyM3tma1TRATXGg0wFVREsgJ83h0U4ci1/9fEW+xb5JjnDk5Vlcg2M4 1CHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=QP7ljG5Vb865P8T1Z5YiCRfZR5y12GP5xzYPr5qo3Fw=; b=IDGhDmfu8G1arLZ0WfoMwDitDjcx71fZxsQJY/qUQ1HPI52bHBPmt0JtB8Hfe+D3r+ xLU2oQGBrD6AXmyf4mfJpUPk8TjQ9LCpaBXXDa1obXpnn5k8naxxVCb91R09oODbzXJW H01CevIamqNIciBnj8CQYcH3NrZ0YHFVYQGzv+ETkLuEO5vqXOzTj2P+u0C6207/mC6a 0ciU/gKkXihTBTgyJvzHkQ5ZS+g82N/lgotXQbVArVnbeRN1glLIJ0k7YN6PttX2rGVI HMm1lAeUmYIupDzenvMyEIoytnMfbfkxQxTm9gfbmWYjC4+ve54H/FhD8QpFvKxPZCH2 J65g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 17si3768762ejn.465.2021.01.23.00.40.35; Sat, 23 Jan 2021 00:40:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726944AbhAWIhf (ORCPT + 99 others); Sat, 23 Jan 2021 03:37:35 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:50200 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726934AbhAWIhX (ORCPT ); Sat, 23 Jan 2021 03:37:23 -0500 X-UUID: f3cd9087624c473488dbcc1ca73cfdee-20210123 X-UUID: f3cd9087624c473488dbcc1ca73cfdee-20210123 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1441380308; Sat, 23 Jan 2021 16:35:19 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 23 Jan 2021 16:35:17 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 23 Jan 2021 16:35:17 +0800 From: To: , CC: , , , , , , , , , , Lorenzo Bianconi Subject: [PATCH -next v7 18/22] mt76: mt7921: introduce regdomain notifier support Date: Sat, 23 Jan 2021 16:35:09 +0800 Message-ID: <6104d5fa9558ab2687c790690afdde55b35a8235.1611389300.git.objelf@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Lorenzo Bianconi Register regdomain notifier to determine the channel domain the hw scan should rely on. Co-developed-by: Sean Wang Signed-off-by: Sean Wang Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index efc3e94f89d5..2a80b68a588a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -52,6 +52,21 @@ static const struct ieee80211_iface_combination if_comb[] = { } }; +static void +mt7921_regd_notifier(struct wiphy *wiphy, + struct regulatory_request *request) +{ + struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); + struct mt7921_dev *dev = mt7921_hw_dev(hw); + + memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2)); + dev->mt76.region = request->dfs_region; + + mt7921_mutex_acquire(dev); + mt76_connac_mcu_set_channel_domain(hw->priv); + mt7921_mutex_release(dev); +} + static void mt7921_init_wiphy(struct ieee80211_hw *hw) { @@ -78,6 +93,7 @@ mt7921_init_wiphy(struct ieee80211_hw *hw) wiphy->max_match_sets = MT76_CONNAC_MAX_SCAN_MATCH; wiphy->max_sched_scan_reqs = 1; wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; + wiphy->reg_notifier = mt7921_regd_notifier; wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_SET_SCAN_DWELL); -- 2.25.1