c4a55b6af5f41c667dd6aa845efdbe1bb99262a1
[openwrt/staging/wigyori.git] / package / kernel / ath10k-ct / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=ath10k-ct
4 PKG_RELEASE=1
5
6 PKG_LICENSE:=GPLv2
7 PKG_LICENSE_FILES:=
8
9 PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
10 PKG_SOURCE_PROTO:=git
11 PKG_SOURCE_DATE:=2020-03-25
12 PKG_SOURCE_VERSION:=3d173a471d3e583f2885ce68190c4387424cecc5
13 PKG_MIRROR_HASH:=496279322f3cd26b262d4999cb5a8c1ea022e92a7bb0d43d008bce235abb9a65
14
15 # Build the 5.4 ath10k-ct driver version. Other option is "-4.19".
16 # Probably this should match as closely as
17 # possible to whatever mac80211 backports version is being used.
18 CT_KVER="-5.4"
19
20 PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com>
21 PKG_BUILD_PARALLEL:=1
22 PKG_EXTMOD_SUBDIRS:=ath10k$(CT_KVER)
23
24 STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
25
26 include $(INCLUDE_DIR)/kernel.mk
27 include $(INCLUDE_DIR)/package.mk
28
29 define KernelPackage/ath10k-ct
30 SUBMENU:=Wireless Drivers
31 TITLE:=ath10k-ct driver optimized for CT ath10k firmware
32 DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT +@DRIVER_11W_SUPPORT @PCI_SUPPORT +kmod-hwmon-core
33 FILES:=\
34 $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_pci.ko \
35 $(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_core.ko
36 AUTOLOAD:=$(call AutoProbe,ath10k_pci)
37 PROVIDES:=kmod-ath10k
38 VARIANT:=regular
39 endef
40
41 define KernelPackage/ath10k-ct/config
42
43 config ATH10K-CT_LEDS
44 bool "Enable LED support"
45 default y
46 depends on PACKAGE_kmod-ath10k-ct || PACKAGE_kmod-ath10k-ct-smallbuffers
47 endef
48
49 define KernelPackage/ath10k-ct-smallbuffers
50 $(call KernelPackage/ath10k-ct)
51 TITLE+= (small buffers for low-RAM devices)
52 VARIANT:=smallbuffers
53 endef
54
55 NOSTDINC_FLAGS = \
56 -I$(PKG_BUILD_DIR) \
57 -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
58 -I$(STAGING_DIR)/usr/include/mac80211-backport \
59 -I$(STAGING_DIR)/usr/include/mac80211/uapi \
60 -I$(STAGING_DIR)/usr/include/mac80211 \
61 -include backport/autoconf.h \
62 -include backport/backport.h
63
64 ifdef CONFIG_PACKAGE_MAC80211_MESH
65 NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
66 endif
67
68 CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m CONFIG_ATH10K_CE=y
69
70 # This AHB logic is needed for IPQ4019 radios
71 CT_MAKEDEFS += CONFIG_ATH10K_AHB=m
72 NOSTDINC_FLAGS += -DCONFIG_ATH10K_AHB
73
74 NOSTDINC_FLAGS += -DSTANDALONE_CT
75
76 ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
77 CT_MAKEDEFS += CONFIG_ATH10K_DEBUGFS=y CONFIG_MAC80211_DEBUGFS=y
78 NOSTDINC_FLAGS += -DCONFIG_MAC80211_DEBUGFS
79 NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUGFS
80 endif
81
82 ifdef CONFIG_PACKAGE_ATH_DEBUG
83 NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUG
84 endif
85
86 ifdef CONFIG_PACKAGE_ATH_DFS
87 NOSTDINC_FLAGS += -DCONFIG_ATH10K_DFS_CERTIFIED
88 endif
89
90 ifdef CONFIG_PACKAGE_ATH_SPECTRAL
91 CT_MAKEDEFS += CONFIG_ATH10K_SPECTRAL=y
92 NOSTDINC_FLAGS += -DCONFIG_ATH10K_SPECTRAL
93 endif
94
95 ifeq ($(CONFIG_ATH10K-CT_LEDS),y)
96 CT_MAKEDEFS += CONFIG_ATH10K_LEDS=y
97 NOSTDINC_FLAGS += -DCONFIG_ATH10K_LEDS
98 endif
99
100 ifeq ($(BUILD_VARIANT),smallbuffers)
101 NOSTDINC_FLAGS += -DCONFIG_ATH10K_SMALLBUFFERS
102 endif
103
104 define Build/Configure
105 cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR)
106 endef
107
108 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
109 CT_MAKEDEFS += V=1
110 endif
111
112 define Build/Compile
113 +$(MAKE) $(CT_MAKEDEFS) $(PKG_JOBS) -C "$(LINUX_DIR)" \
114 $(KERNEL_MAKE_FLAGS) \
115 M="$(PKG_BUILD_DIR)/ath10k$(CT_KVER)" \
116 NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
117 modules
118 endef
119
120 $(eval $(call KernelPackage,ath10k-ct))
121 $(eval $(call KernelPackage,ath10k-ct-smallbuffers))