[v3,2/2] rtw88: support dynamic user regulatory setting
diff mbox series

Message ID 20191022101229.26044-3-yhchuang@realtek.com
State Deferred
Delegated to: Kalle Valo
Headers show
Series
  • rtw88: update regulatory settings
Related show

Commit Message

Tony Chuang Oct. 22, 2019, 10:12 a.m. UTC
From: Tzu-En Huang <tehuang@realtek.com>

Add support for regulatory set by NL80211_REGDOM_SET_BY_USER.
This should only be enabled for distributions that need set
Realtek's card regulatory from userspace.

Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
---
 drivers/net/wireless/realtek/rtw88/Kconfig | 10 ++++++++++
 drivers/net/wireless/realtek/rtw88/regd.c  |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/drivers/net/wireless/realtek/rtw88/Kconfig b/drivers/net/wireless/realtek/rtw88/Kconfig
index 33bd7ed797ff..04b84ec1dfc1 100644
--- a/drivers/net/wireless/realtek/rtw88/Kconfig
+++ b/drivers/net/wireless/realtek/rtw88/Kconfig
@@ -52,4 +52,14 @@  config RTW88_DEBUGFS
 
 	  If unsure, say Y to simplify debug problems
 
+config RTW88_REGD_USER_REG_HINTS
+	bool "Realtek rtw88 user regulatory hints"
+	depends on RTW88_CORE
+	default n
+	help
+	  Enable regulatoy user hints
+
+	  If unsure, say N. This should only be allowed on distributions
+	  that need this to correct the regulatory.
+
 endif
diff --git a/drivers/net/wireless/realtek/rtw88/regd.c b/drivers/net/wireless/realtek/rtw88/regd.c
index 718a147697cc..500a02b97a9c 100644
--- a/drivers/net/wireless/realtek/rtw88/regd.c
+++ b/drivers/net/wireless/realtek/rtw88/regd.c
@@ -364,7 +364,8 @@  static int rtw_regd_notifier_apply(struct rtw_dev *rtwdev,
 {
 	if (request->initiator == NL80211_REGDOM_SET_BY_DRIVER)
 		return -EINVAL;
-	if (request->initiator == NL80211_REGDOM_SET_BY_USER)
+	if (request->initiator == NL80211_REGDOM_SET_BY_USER &&
+	    !IS_ENABLED(CONFIG_RTW88_REGD_USER_REG_HINTS))
 		return -EINVAL;
 	if (request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE &&
 	    !rtw_regd_is_ww(&rtwdev->regd))