diff mbox series

[18/18] rtw89: add Kconfig and Makefile

Message ID 20201230044223.14085-19-pkshih@realtek.com (mailing list archive)
State Superseded
Delegated to: Kalle Valo
Headers show
Series rtw89: add Realtek 802.11ax driver | expand

Commit Message

Ping-Ke Shih Dec. 30, 2020, 4:42 a.m. UTC
With Kconfig and Makefile, we can build rtw89 and support 8852AE chip.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/Kconfig        |  1 +
 drivers/net/wireless/realtek/Makefile       |  1 +
 drivers/net/wireless/realtek/rtw89/Kconfig  | 50 +++++++++++++++++++++
 drivers/net/wireless/realtek/rtw89/Makefile | 23 ++++++++++
 4 files changed, 75 insertions(+)
 create mode 100644 drivers/net/wireless/realtek/rtw89/Kconfig
 create mode 100644 drivers/net/wireless/realtek/rtw89/Makefile

Comments

kernel test robot Dec. 30, 2020, 7:21 a.m. UTC | #1
Hi Ping-Ke,

I love your patch! Perhaps something to improve:

[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on wireless-drivers/master v5.11-rc1 next-20201223]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ping-Ke-Shih/rtw89-add-Realtek-802-11ax-driver/20201230-124948
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/b4945b490f8d3df1d3e1aa0c9e16654172195a08
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Ping-Ke-Shih/rtw89-add-Realtek-802-11ax-driver/20201230-124948
        git checkout b4945b490f8d3df1d3e1aa0c9e16654172195a08
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/net/wireless/realtek/rtw89/phy.c: In function 'rtw89_phy_average_cfo_calc':
>> drivers/net/wireless/realtek/rtw89/phy.c:1367:24: warning: variable 'cfo_min_macid' set but not used [-Wunused-but-set-variable]
    1367 |  u8 cfo_max_macid = 0, cfo_min_macid = 0, i;
         |                        ^~~~~~~~~~~~~
>> drivers/net/wireless/realtek/rtw89/phy.c:1367:5: warning: variable 'cfo_max_macid' set but not used [-Wunused-but-set-variable]
    1367 |  u8 cfo_max_macid = 0, cfo_min_macid = 0, i;
         |     ^~~~~~~~~~~~~
>> drivers/net/wireless/realtek/rtw89/phy.c:1366:24: warning: variable 'cnt_min_macid' set but not used [-Wunused-but-set-variable]
    1366 |  u8 cnt_max_macid = 0, cnt_min_macid = 0;
         |                        ^~~~~~~~~~~~~
--
   drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c: In function '_lok_finetune_check':
>> drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c:1191:6: warning: variable 'fine_q' set but not used [-Wunused-but-set-variable]
    1191 |  u32 fine_q = 0x0;
         |      ^~~~~~
>> drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c:1190:6: warning: variable 'fine_i' set but not used [-Wunused-but-set-variable]
    1190 |  u32 fine_i = 0x0;
         |      ^~~~~~
   drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c: In function '_iqk_get_ch_info':
>> drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c:1384:6: warning: variable 'reg_rf18' set but not used [-Wunused-but-set-variable]
    1384 |  u32 reg_rf18 = 0x0;
         |      ^~~~~~~~
--
   drivers/net/wireless/realtek/rtw89/pci.c: In function 'rtw89_pci_release_rpp':
>> drivers/net/wireless/realtek/rtw89/pci.c:407:7: warning: variable 'polluted' set but not used [-Wunused-but-set-variable]
     407 |  bool polluted;
         |       ^~~~~~~~
>> drivers/net/wireless/realtek/rtw89/pci.c:406:5: warning: variable 'mac_id' set but not used [-Wunused-but-set-variable]
     406 |  u8 mac_id, qsel, tx_status, txch;
         |     ^~~~~~
   drivers/net/wireless/realtek/rtw89/pci.c: In function 'rtw89_pci_reset_trx_rings':
>> drivers/net/wireless/realtek/rtw89/pci.c:1009:6: warning: variable 'addr_desa_h' set but not used [-Wunused-but-set-variable]
    1009 |  u32 addr_desa_h;
         |      ^~~~~~~~~~~
   drivers/net/wireless/realtek/rtw89/pci.c: In function 'rtw89_pci_remove':
>> drivers/net/wireless/realtek/rtw89/pci.c:2549:20: warning: variable 'rtwpci' set but not used [-Wunused-but-set-variable]
    2549 |  struct rtw89_pci *rtwpci;
         |                    ^~~~~~


vim +/cfo_min_macid +1367 drivers/net/wireless/realtek/rtw89/phy.c

eb46958227be930 Ping-Ke Shih 2020-12-30  1358  
eb46958227be930 Ping-Ke Shih 2020-12-30  1359  static void rtw89_phy_average_cfo_calc(struct rtw89_dev *rtwdev)
eb46958227be930 Ping-Ke Shih 2020-12-30  1360  {
eb46958227be930 Ping-Ke Shih 2020-12-30  1361  	struct rtw89_cfo_tracking_info *cfo = &rtwdev->cfo_tracking;
eb46958227be930 Ping-Ke Shih 2020-12-30  1362  	s32 cfo_khz_avg[CFO_TRACK_MAX_USER] = {0};
eb46958227be930 Ping-Ke Shih 2020-12-30  1363  	s32 cfo_max = 0, cfo_min = U16_MAX, cfo_khz_all = 0;
eb46958227be930 Ping-Ke Shih 2020-12-30  1364  	s32 cnt_max = 0, cnt_min = U16_MAX, cfo_cnt_all = 0;
eb46958227be930 Ping-Ke Shih 2020-12-30  1365  	s16 val;
eb46958227be930 Ping-Ke Shih 2020-12-30 @1366  	u8 cnt_max_macid = 0, cnt_min_macid = 0;
eb46958227be930 Ping-Ke Shih 2020-12-30 @1367  	u8 cfo_max_macid = 0, cfo_min_macid = 0, i;
eb46958227be930 Ping-Ke Shih 2020-12-30  1368  
eb46958227be930 Ping-Ke Shih 2020-12-30  1369  	rtw89_debug(rtwdev, RTW89_DBG_CFO, "one_entry_only=%d\n",
eb46958227be930 Ping-Ke Shih 2020-12-30  1370  		    rtwdev->total_sta_assoc == 1);
eb46958227be930 Ping-Ke Shih 2020-12-30  1371  
eb46958227be930 Ping-Ke Shih 2020-12-30  1372  	if (rtwdev->total_sta_assoc == 1) {
eb46958227be930 Ping-Ke Shih 2020-12-30  1373  		for (i = 0; i < CFO_TRACK_MAX_USER; i++) {
eb46958227be930 Ping-Ke Shih 2020-12-30  1374  			if (cfo->cfo_cnt[i] == 0)
eb46958227be930 Ping-Ke Shih 2020-12-30  1375  				continue;
eb46958227be930 Ping-Ke Shih 2020-12-30  1376  			cfo_khz_all += cfo->cfo_tail[i];
eb46958227be930 Ping-Ke Shih 2020-12-30  1377  			cfo_cnt_all += cfo->cfo_cnt[i];
eb46958227be930 Ping-Ke Shih 2020-12-30  1378  			if (cfo_cnt_all == 0)
eb46958227be930 Ping-Ke Shih 2020-12-30  1379  				cfo->cfo_avg_pre = 0;
eb46958227be930 Ping-Ke Shih 2020-12-30  1380  			else
eb46958227be930 Ping-Ke Shih 2020-12-30  1381  				cfo->cfo_avg_pre = cfo_khz_all / cfo_cnt_all;
eb46958227be930 Ping-Ke Shih 2020-12-30  1382  		}
eb46958227be930 Ping-Ke Shih 2020-12-30  1383  		rtw89_debug(rtwdev, RTW89_DBG_CFO,
eb46958227be930 Ping-Ke Shih 2020-12-30  1384  			    "CFO track for one entry only\n");
eb46958227be930 Ping-Ke Shih 2020-12-30  1385  		rtw89_debug(rtwdev, RTW89_DBG_CFO,
eb46958227be930 Ping-Ke Shih 2020-12-30  1386  			    "Total cfo=(%dK), pkt_cnt=(%d), avg_cfo=(%dK)\n",
eb46958227be930 Ping-Ke Shih 2020-12-30  1387  			    cfo_khz_all >> 2, cfo_cnt_all,
eb46958227be930 Ping-Ke Shih 2020-12-30  1388  			    cfo->cfo_avg_pre >> 2);
eb46958227be930 Ping-Ke Shih 2020-12-30  1389  		return;
eb46958227be930 Ping-Ke Shih 2020-12-30  1390  	}
eb46958227be930 Ping-Ke Shih 2020-12-30  1391  
eb46958227be930 Ping-Ke Shih 2020-12-30  1392  	for (i = 0; i < CFO_TRACK_MAX_USER; i++) {
eb46958227be930 Ping-Ke Shih 2020-12-30  1393  		if (cfo->cfo_cnt[i] == 0)
eb46958227be930 Ping-Ke Shih 2020-12-30  1394  			continue;
eb46958227be930 Ping-Ke Shih 2020-12-30  1395  
eb46958227be930 Ping-Ke Shih 2020-12-30  1396  		cfo_khz_all += cfo->cfo_tail[i];
eb46958227be930 Ping-Ke Shih 2020-12-30  1397  		cfo_cnt_all += cfo->cfo_cnt[i];
eb46958227be930 Ping-Ke Shih 2020-12-30  1398  		if (cfo->cfo_cnt[i] == 0)
eb46958227be930 Ping-Ke Shih 2020-12-30  1399  			cfo_khz_avg[i] = 0;
eb46958227be930 Ping-Ke Shih 2020-12-30  1400  		else
eb46958227be930 Ping-Ke Shih 2020-12-30  1401  			cfo_khz_avg[i] = cfo->cfo_tail[i] / cfo->cfo_cnt[i];
eb46958227be930 Ping-Ke Shih 2020-12-30  1402  
eb46958227be930 Ping-Ke Shih 2020-12-30  1403  		if (cfo->cfo_cnt[i] > cnt_max) {
eb46958227be930 Ping-Ke Shih 2020-12-30  1404  			cnt_max = cfo->cfo_cnt[i];
eb46958227be930 Ping-Ke Shih 2020-12-30  1405  			cnt_max_macid = i;
eb46958227be930 Ping-Ke Shih 2020-12-30  1406  		}
eb46958227be930 Ping-Ke Shih 2020-12-30  1407  		if (cfo->cfo_cnt[i] < cnt_min) {
eb46958227be930 Ping-Ke Shih 2020-12-30  1408  			cnt_min = cfo->cfo_cnt[i];
eb46958227be930 Ping-Ke Shih 2020-12-30  1409  			cnt_min_macid = i;
eb46958227be930 Ping-Ke Shih 2020-12-30  1410  		}
eb46958227be930 Ping-Ke Shih 2020-12-30  1411  		if (cfo_khz_avg[i] > cfo_max) {
eb46958227be930 Ping-Ke Shih 2020-12-30  1412  			cfo_max = cfo_khz_avg[i];
eb46958227be930 Ping-Ke Shih 2020-12-30  1413  			cfo_max_macid = i;
eb46958227be930 Ping-Ke Shih 2020-12-30  1414  		}
eb46958227be930 Ping-Ke Shih 2020-12-30  1415  		if (cfo_khz_avg[i] < cfo_min) {
eb46958227be930 Ping-Ke Shih 2020-12-30  1416  			cfo_min = cfo_khz_avg[i];
eb46958227be930 Ping-Ke Shih 2020-12-30  1417  			cfo_min_macid = i;
eb46958227be930 Ping-Ke Shih 2020-12-30  1418  		}
eb46958227be930 Ping-Ke Shih 2020-12-30  1419  	}
eb46958227be930 Ping-Ke Shih 2020-12-30  1420  
eb46958227be930 Ping-Ke Shih 2020-12-30  1421  	/* Multi-sta CFO tracking strategy */
eb46958227be930 Ping-Ke Shih 2020-12-30  1422  	val = (s16)abs(cfo_max - cfo_min);
eb46958227be930 Ping-Ke Shih 2020-12-30  1423  	if (val < MAX_CFO_TOLERANCE || val > (MAX_CFO_TOLERANCE << 1)) {
eb46958227be930 Ping-Ke Shih 2020-12-30  1424  		rtw89_debug(rtwdev, RTW89_DBG_CFO,
eb46958227be930 Ping-Ke Shih 2020-12-30  1425  			    "CFO track for only pri-user\n");
eb46958227be930 Ping-Ke Shih 2020-12-30  1426  		rtw89_debug(rtwdev, RTW89_DBG_CFO,
eb46958227be930 Ping-Ke Shih 2020-12-30  1427  			    "Total cfo=(%dK), pkt_cnt=(%d), avg_cfo=(%dK)\n",
eb46958227be930 Ping-Ke Shih 2020-12-30  1428  			    cfo->cfo_tail[cnt_max_macid] >> 2,
eb46958227be930 Ping-Ke Shih 2020-12-30  1429  			    cfo->cfo_cnt[cnt_max_macid],
eb46958227be930 Ping-Ke Shih 2020-12-30  1430  			    cfo_khz_avg[cnt_max_macid] >> 2);
eb46958227be930 Ping-Ke Shih 2020-12-30  1431  		cfo->cfo_avg_pre = cfo_khz_avg[cnt_max_macid];
eb46958227be930 Ping-Ke Shih 2020-12-30  1432  	} else {
eb46958227be930 Ping-Ke Shih 2020-12-30  1433  		rtw89_debug(rtwdev, RTW89_DBG_CFO,
eb46958227be930 Ping-Ke Shih 2020-12-30  1434  			    "CFO track for average of all user\n");
eb46958227be930 Ping-Ke Shih 2020-12-30  1435  		rtw89_debug(rtwdev, RTW89_DBG_CFO,
eb46958227be930 Ping-Ke Shih 2020-12-30  1436  			    "Total cfo=(%dK), pkt_cnt=(%d), avg_cfo=(%dK)\n",
eb46958227be930 Ping-Ke Shih 2020-12-30  1437  			    cfo_khz_all >> 2, cfo_cnt_all,
eb46958227be930 Ping-Ke Shih 2020-12-30  1438  			    cfo->cfo_avg_pre >> 2);
eb46958227be930 Ping-Ke Shih 2020-12-30  1439  		if (cfo_cnt_all == 0)
eb46958227be930 Ping-Ke Shih 2020-12-30  1440  			cfo->cfo_avg_pre = 0;
eb46958227be930 Ping-Ke Shih 2020-12-30  1441  		else
eb46958227be930 Ping-Ke Shih 2020-12-30  1442  			cfo->cfo_avg_pre = cfo_khz_all / cfo_cnt_all;
eb46958227be930 Ping-Ke Shih 2020-12-30  1443  	}
eb46958227be930 Ping-Ke Shih 2020-12-30  1444  }
eb46958227be930 Ping-Ke Shih 2020-12-30  1445  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/Kconfig b/drivers/net/wireless/realtek/Kconfig
index 474843277fa1..4a1f0e64df03 100644
--- a/drivers/net/wireless/realtek/Kconfig
+++ b/drivers/net/wireless/realtek/Kconfig
@@ -16,5 +16,6 @@  source "drivers/net/wireless/realtek/rtl818x/Kconfig"
 source "drivers/net/wireless/realtek/rtlwifi/Kconfig"
 source "drivers/net/wireless/realtek/rtl8xxxu/Kconfig"
 source "drivers/net/wireless/realtek/rtw88/Kconfig"
+source "drivers/net/wireless/realtek/rtw89/Kconfig"
 
 endif # WLAN_VENDOR_REALTEK
diff --git a/drivers/net/wireless/realtek/Makefile b/drivers/net/wireless/realtek/Makefile
index 888b5d594e79..ab25419f56c6 100644
--- a/drivers/net/wireless/realtek/Makefile
+++ b/drivers/net/wireless/realtek/Makefile
@@ -8,4 +8,5 @@  obj-$(CONFIG_RTL8187)		+= rtl818x/
 obj-$(CONFIG_RTLWIFI)		+= rtlwifi/
 obj-$(CONFIG_RTL8XXXU)		+= rtl8xxxu/
 obj-$(CONFIG_RTW88)		+= rtw88/
+obj-$(CONFIG_RTW89)		+= rtw89/
 
diff --git a/drivers/net/wireless/realtek/rtw89/Kconfig b/drivers/net/wireless/realtek/rtw89/Kconfig
new file mode 100644
index 000000000000..055d45103a4b
--- /dev/null
+++ b/drivers/net/wireless/realtek/rtw89/Kconfig
@@ -0,0 +1,50 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+menuconfig RTW89
+	tristate "Realtek 802.11ax wireless chips support"
+	depends on MAC80211
+	help
+	  This module adds support for mac80211-based wireless drivers that
+	  enables Realtek IEEE 802.11ax wireless chipsets.
+
+	  If you choose to build a module, it'll be called rtw89.
+
+if RTW89
+
+config RTW89_CORE
+	tristate
+
+config RTW89_PCI
+	tristate
+
+config RTW89_8852AE
+	tristate "Realtek 8852AE PCI wireless network adapter"
+	depends on PCI
+	select RTW89_CORE
+	select RTW89_PCI
+	help
+	  Select this option will enable support for 8852AE chipset
+
+	  802.11ax PCIe wireless network adapter
+
+config RTW89_DEBUG
+	bool
+
+config RTW89_DEBUGMSG
+	bool "Realtek rtw89 debug message support"
+	depends on RTW89_CORE
+	select RTW89_DEBUG
+	help
+	  Enable debug message support
+
+	  If unsure, say Y to simplify debug problems
+
+config RTW89_DEBUGFS
+	bool "Realtek rtw89 debugfs support"
+	depends on RTW89_CORE
+	select RTW89_DEBUG
+	help
+	  Enable debugfs support
+
+	  If unsure, say Y to simplify debug problems
+
+endif
diff --git a/drivers/net/wireless/realtek/rtw89/Makefile b/drivers/net/wireless/realtek/rtw89/Makefile
new file mode 100644
index 000000000000..6752f0c64727
--- /dev/null
+++ b/drivers/net/wireless/realtek/rtw89/Makefile
@@ -0,0 +1,23 @@ 
+# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+
+obj-$(CONFIG_RTW89_CORE) += rtw89_core.o
+rtw89_core-y += core.o \
+		mac80211.o \
+		mac.o \
+		phy.o \
+		fw.o \
+		rtw8852a.o \
+		rtw8852a_table.o \
+		rtw8852a_rfk.o \
+		rtw8852a_rfk_table.o \
+		cam.o \
+		efuse.o \
+		regd.o \
+		coex.o \
+		ser.o
+
+rtw89_core-$(CONFIG_RTW89_DEBUG) += debug.o
+
+obj-$(CONFIG_RTW89_PCI) += rtw89_pci.o
+rtw89_pci-y := pci.o
+