mt76x2: dfs: add set_domain handler
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Tue, 9 Jan 2018 13:13:11 +0000 (14:13 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 24 Jan 2018 15:15:33 +0000 (17:15 +0200)
Add mt76x2_dfs_set_domain routine in order to properly reconfigure
pattern detector when DFS domain has been changed

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c
drivers/net/wireless/mediatek/mt76/mt76x2_dfs.h
drivers/net/wireless/mediatek/mt76/mt76x2_init.c

index 1a6282a8b64b647d8c26fc1040e66a773fc81f06..df23ba5ef900c8aeb8be80c7df188bed75d2b53e 100644 (file)
@@ -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);
+       }
+}
+
index 9ac69b6a116d551352d5335764e1221c2cd22e14..8dbc783cc6bcc049d0503e6f9924a2f6d204e504 100644 (file)
@@ -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 */
index 4373a2ba5143a19fd28b63d941bedd6533665086..9f20a308ff769fc7f54fc128622f4747a1cead84 100644 (file)
@@ -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) {                                        \