blob: a0425d313b2c93d3626366d68b81aecc2b339af3 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001################################################################################
2# MET Kernel module mode
3################################################################################
4$(info ======== Build met.ko ... ========)
5MET_CORE := common
6obj-m := met.o
7
8ifneq ($(wildcard $(MET_PLF_DIR)/Kbuild.platform.h),)
9 include $(MET_PLF_DIR)/Kbuild.platform.h
10else
11 $(info ======= Missing $(MET_PLF_DIR)/Kbuild.platform.h ========)
12endif
13
14ccflags-y += -DCONFIG_MET_MODULE
15ccflags-y += -DMET_PLF_USE
16ccflags-y += -I$(MET_COMMON_DIR)
17ccflags-y += -I$(MET_PLF_DIR)
18ccflags-y += -I$(KERNEL_SRC)/include/
19ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/include/
20ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/
21ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/
22
23ccflags-y += $(EXTRA_ARGS) $(EXTRA_CFLAGS)
24ccflags-y += -DMTK_PLATFORM=$(MTK_PLATFORM)
25
26met-y := $(MET_CORE)/met_main.o \
27 $(MET_CORE)/met_backlight.o \
28 $(MET_CORE)/met_tag_ex.o \
29 $(MET_CORE)/interface.o \
30 $(MET_CORE)/sampler.o \
31 $(MET_CORE)/dummy_header.o \
32 $(MET_CORE)/util.o \
33 $(MET_CORE)/stat.o \
34 $(MET_CORE)/cookie.o \
35 $(MET_CORE)/mem_stat.o \
36 $(MET_CORE)/switch.o \
37 $(MET_CORE)/trace_event.o \
38 $(MET_CORE)/core_plf_init.o \
39 $(MET_CORE)/core_plf_trace.o \
40 $(MET_CORE)/ondiemet.o \
41 $(MET_CORE)/ondiemet_log.o \
42 $(MET_CORE)/sspm/ondiemet_sspm.o
43
44CFLAGS_interface.o += -DMET_USER_EVENT_SUPPORT
45CFLAGS_met_tag_ex.o += -DMET_USER_EVENT_SUPPORT
46
47$(info CPUPMU_VERSION = $(CPUPMU_VERSION))
48ifeq ("$(CPUPMU_VERSION)", "V8_2")
49 ccflags-y += -DCPUPMU_V8_2
50endif
51
52$(info ARCH = $(ARCH))
53ifeq ($(ARCH), mips)
54 met-y += $(MET_CORE)/mips_pmu_hw.o
55endif #ifeq ($(ARCH), mips)
56
57ifeq ($(ARCH), arm)
58 ccflags-y += -DCONFIG_MET_ARM_32BIT
59 met-y += $(MET_CORE)/cpu_pmu.o
60 met-y += $(MET_CORE)/v7_pmu_hw.o
61 met-y += $(MET_CORE)/v6_pmu_hw.o
62endif #ifeq ($(ARCH), arm)
63
64ifeq ($(ARCH), arm64)
65 met-y += $(MET_CORE)/cpu_pmu.o
66 met-y += $(MET_CORE)/v8_pmu_hw.o
67endif
68
69$(info CONFIG_CPU_FREQ = $(CONFIG_CPU_FREQ))
70ifeq ($(CONFIG_CPU_FREQ),y)
71 met-y += $(MET_CORE)/power.o
72endif
73
74################################################################################
75# MET_SPM_TWAM
76################################################################################
77FEATURE_SPMTWAM := $(if $(FEATURE_SPMTWAM),$(FEATURE_SPMTWAM),y)
78$(info FEATURE_SPMTWAM = $(FEATURE_SPMTWAM))
79
80ifneq ($(FEATURE_SPMTWAM), n)
81 MET_SPM_TWAM := y
82
83 # for mtk_spm.h
84 ifneq ("$(wildcard $(KERNEL_SRC)/drivers/misc/mediatek/base/power/include/mtk_spm.h)","")
85 ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/base/power/include/
86 ccflags-y += -I$(MET_COMMON_DIR)/spmtwam/include/
87 else
88 MET_SPM_TWAM = n
89 $(info ========= Missing $(KERNEL_SRC)/drivers/misc/mediatek/base/power/include/mtk_spm.h ========)
90 $(info ======== disable MET_SPM_TWAM ========)
91 endif
92else
93 MET_SPM_TWAM := n
94endif
95
96$(info SPMTWAM_VERSION = $(SPMTWAM_VERSION))
97$(info SPMTWAM_IDLE_SIGNAL_SUPPORT = $(SPMTWAM_IDLE_SIGNAL_SUPPORT))
98
99ifeq ("$(SPMTWAM_IDLE_SIGNAL_SUPPORT)", "single")
100 ccflags-y += -DSPMTWAM_SINGLE_IDLE_SIGNAL
101endif
102
103ifeq ("$(SPMTWAM_IDLE_SIGNAL_SUPPORT)", "multiple")
104 ccflags-y += -DSPMTWAM_MULTIPLE_IDLE_SIGNAL
105endif
106
107ifeq ("$(SPMTWAM_VERSION)", "ap")
108 ccflags-y += -DSPMTWAM_AP
109 met-$(MET_SPM_TWAM) += $(MET_CORE)/spmtwam/ap/met_spmtwam.o
110endif
111
112ifeq ("$(SPMTWAM_VERSION)", "sspm")
113 ccflags-y += -DSPMTWAM_SSPM
114 met-$(MET_SPM_TWAM) += $(MET_CORE)/spmtwam/sspm/met_spmtwam.o
115endif
116
117################################################################################
118# MET_SSPM_EMI
119################################################################################
120FEATURE_SSPM_EMI := $(if $(FEATURE_SSPM_EMI),$(FEATURE_SSPM_EMI),y)
121$(info FEATURE_SSPM_EMI = $(FEATURE_SSPM_EMI))
122
123ifeq ($(CONFIG_MTK_TINYSYS_SSPM_SUPPORT),y)
124 ifneq ($(FEATURE_ONDIEMET), n)
125 MET_SSPM_EMI := $(if $(filter n,$(FEATURE_SSPM_EMI)),n,y)
126 ifeq ("$(EMI_SEDA_VERSION)", "SEDA3_5")
127 met-$(MET_SSPM_EMI) += $(MET_CORE)/emi/SEDA3_5/met_emi.o \
128 $(MET_CORE)/emi/SEDA3_5/mtk_emi_bm.o
129 else ifeq ("$(EMI_SEDA_VERSION)", "SEDA3_6")
130 met-$(MET_SSPM_EMI) += $(MET_CORE)/emi/SEDA3_6/met_emi.o \
131 $(MET_CORE)/emi/SEDA3_6/mtk_emi_bm.o
132 else
133 met-$(MET_SSPM_EMI) += $(MET_CORE)/emi/SEDA3/met_emi.o \
134 $(MET_CORE)/emi/SEDA3/mtk_emi_bm.o
135 endif
136 endif
137endif
138
139################################################################################
140# MET_GPU
141################################################################################
142FEATURE_GPU := $(if $(FEATURE_GPU),$(FEATURE_GPU),y)
143$(info FEATURE_GPU = $(FEATURE_GPU))
144
145ifneq ($(FEATURE_GPU), n)
146 MET_GPU := y
147
148 # for mtk_gpufreq.h
149 ifneq ("$(wildcard $(KERNEL_SRC)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","")
150 ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
151 else
152 MET_GPU = n
153 $(info ======= Missing $(KERNEL_SRC)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h ========)
154 $(info ======== disable MET_GPU ========)
155 endif
156
157 # for mtk_gpu_utility.h
158 ifneq ("$(wildcard $(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/mtk_gpu_utility.h)","")
159 ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/
160 else
161 MET_GPU = n
162 $(info ======== Missing $(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/mtk_gpu_utility.h ========)
163 $(info ======== disable MET_GPU ========)
164 endif
165
166 ifneq ($(CONFIG_MTK_GPU_SUPPORT), y)
167 MET_GPU = n
168 $(info ======== CONFIG_MTK_GPU_SUPPORT = n ========)
169 $(info ======== disable MET_GPU ========)
170 endif
171else
172 MET_GPU := n
173endif
174
175met-$(MET_GPU) += $(MET_CORE)/mtk_gpu_metmonitor.o
176
177
178################################################################################
179# MET_VCOREDVFS
180################################################################################
181FEATURE_VCOREDVFS := $(if $(FEATURE_VCOREDVFS),$(FEATURE_VCOREDVFS),y)
182$(info FEATURE_VCOREDVFS = $(FEATURE_VCOREDVFS))
183
184ifneq ($(FEATURE_VCOREDVFS), n)
185 MET_VCOREDVFS := y
186
187 # for mtk_vcorefs_manager.h
188 ifneq ("$(wildcard $(MET_VCOREDVFS_INC)/mtk_vcorefs_manager.h)","")
189 ccflags-y += -I$(MET_VCOREDVFS_INC)/
190 else
191 MET_VCOREDVFS = n
192 $(info ======== Missing $(MET_VCOREDVFS_INC)/mtk_vcorefs_manager.h ========)
193 $(info ======== disable MET_VCOREDVFS ========)
194 endif
195
196 # for mtk_vcorefs_governor.h
197 ifneq ("$(wildcard $(MET_VCOREDVFS_INC)/mtk_vcorefs_governor.h)","")
198 ccflags-y += -I$(MET_VCOREDVFS_INC)
199 else
200 MET_VCOREDVFS = n
201 $(info ======== Missing $(MET_VCOREDVFS_INC)/mtk_vcorefs_governor.h ========)
202 $(info ======== disable MET_VCOREDVFS ========)
203 endif
204
205 # for helio-dvfsrc.h
206 ifneq ("$(wildcard $(KERNEL_SRC)/drivers/devfreq/helio-dvfsrc.h)","")
207 ccflags-y += -I$(KERNEL_SRC)/drivers/devfreq/
208 else
209 MET_VCOREDVFS = n
210 $(info ======== Missing $(KERNEL_SRC)/drivers/devfreq/helio-dvfsrc.h ========)
211 $(info ======== disable MET_VCOREDVFS ========)
212 endif
213else
214 MET_VCOREDVFS := n
215endif
216
217met-$(MET_VCOREDVFS) += $(MET_CORE)/met_vcoredvfs.o
218
219
220################################################################################
221# MET_PTPOD
222################################################################################
223FEATURE_PTPOD := $(if $(FEATURE_PTPOD),$(FEATURE_PTPOD),y)
224$(info FEATURE_PTPOD = $(FEATURE_PTPOD))
225
226ifneq ($(FEATURE_PTPOD), n)
227 MET_PTPOD := y
228
229 # for mtk_gpufreq.h
230 ifneq ("$(wildcard $(KERNEL_SRC)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","")
231 ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
232 else
233 MET_PTPOD = n
234 $(info ======== Missing $(KERNEL_SRC)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h ========)
235 $(info ======== disable MET_PTPOD ========)
236 endif
237
238 # for mtk_cpufreq_api.h
239 ifneq ("$(wildcard $(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/mach/mtk_cpufreq_api.h)","")
240 ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/
241 else
242 MET_PTPOD = n
243 $(info ======== Missing $(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/mach/mtk_cpufreq_api.h ========)
244 $(info ======== disable MET_PTPOD ========)
245 endif
246
247 # for mtk_cpufreq_config.h
248 ifneq ("$(wildcard $(MET_PTPOD_INC)/mtk_cpufreq_config.h)","")
249 ccflags-y += -I$(MET_PTPOD_INC)
250 else
251 MET_PTPOD = n
252 $(info ======== Missing $(MET_PTPOD_INC)/mtk_cpufreq_config.h ========)
253 $(info ======== disable MET_PTPOD ========)
254 endif
255else
256 MET_PTPOD := n
257endif
258
259met-$(MET_PTPOD) += $(MET_CORE)/met_ptpod.o
260
261
262################################################################################
263# MET_CPUDSU
264################################################################################
265FEATURE_CPUDSU := $(if $(FEATURE_CPUDSU),$(FEATURE_CPUDSU),y)
266$(info FEATURE_CPUDSU = $(FEATURE_CPUDSU))
267
268MET_CPUDSU := $(if $(filter n,$(FEATURE_CPUDSU)),n,y)
269
270met-$(MET_CPUDSU) += $(MET_CORE)/cpu_dsu.o \
271 $(MET_CORE)/v8_dsu_hw.o
272
273################################################################################
274# MET_WALLTIME
275################################################################################
276FEATURE_WALLTIME := $(if $(FEATURE_WALLTIME),$(FEATURE_WALLTIME),y)
277$(info FEATURE_WALLTIME = $(FEATURE_WALLTIME))
278
279MET_WALLTIME := $(if $(filter n,$(FEATURE_WALLTIME)),n,y)
280
281met-$(MET_WALLTIME) += $(MET_CORE)/met_wall_time.o
282
283################################################################################
284# MET_SSPM_SMI
285################################################################################
286FEATURE_SSPM_SMI := $(if $(FEATURE_SSPM_SMI),$(FEATURE_SSPM_SMI),y)
287$(info FEATURE_SSPM_SMI = $(FEATURE_SSPM_SMI))
288
289MET_SSPM_SMI := $(if $(filter n,$(FEATURE_SSPM_SMI)),n,y)
290
291met-$(MET_SSPM_SMI) += $(MET_CORE)/sspm/sspm_met_smi.o
292
293################################################################################
294# EVENT_POWER
295################################################################################
296FEATURE_EVENT_POWER := $(if $(FEATURE_EVENT_POWER),$(FEATURE_EVENT_POWER),y)
297$(info FEATURE_EVENT_POWER = $(FEATURE_EVENT_POWER))
298
299ifeq ($(FEATURE_EVENT_POWER), y)
300 ccflags-y += -DMET_EVENT_POWER_SUPPORT
301endif
302
303################################################################################
304# On-die-met SSPM only module
305################################################################################
306FEATURE_ONDIEMET := $(if $(FEATURE_ONDIEMET),$(FEATURE_ONDIEMET),y)
307ifeq ($(FEATURE_ONDIEMET), y)
308 FEATURE_ONDIEMET_WALLTIME := $(if $(FEATURE_ONDIEMET_WALLTIME),$(FEATURE_ONDIEMET_WALLTIME),y)
309else
310 FEATURE_ONDIEMET_WALLTIME := n
311endif
312
313$(info FEATURE_ONDIEMET = $(FEATURE_ONDIEMET))
314$(info FEATURE_ONDIEMET_WALLTIME = $(FEATURE_ONDIEMET_WALLTIME))
315
316ifneq ($(FEATURE_ONDIEMET), n)
317 subdir-ccflags-y += -DONDIEMET_SUPPORT
318
319 ifeq ($(CONFIG_MTK_TINYSYS_SSPM_SUPPORT),)
320 $(info CONFIG_MTK_TINYSYS_SSPM_SUPPORT = n)
321 else
322 $(info CONFIG_MTK_TINYSYS_SSPM_SUPPORT = $(CONFIG_MTK_TINYSYS_SSPM_SUPPORT))
323 endif
324
325 ifeq ($(CONFIG_MTK_TINYSYS_SSPM_SUPPORT),y)
326 # for sspm_ipi.h
327 subdir-ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/sspm
328 subdir-ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)
329 met-y += $(MET_CORE)/sspm/sspm_ipi_handle.o
330 met-y += $(MET_CORE)/sspm/sspm_common.o
331 ccflags-y += -DMTK_TINYSYS_SSPM_SUPPORT
332
333 ifneq ("$(wildcard $(KERNEL_SRC)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)/sspm_ipi_define.h)","")
334 subdir-ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/sspm \
335 -I$(KERNEL_SRC)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)
336
337 SYS_SSPM_READY := y
338 else
339 $(info ======== Missing $(KERNEL_SRC)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)/sspm_ipi_define.h========)
340 $(info ======== disable ALL ondiemet feature ========)
341
342 SYS_SSPM_READY := n
343 endif
344 else
345 $(info ======== CONFIG_MTK_TINYSYS_SSPM_SUPPORT = n ========)
346 $(info ======== disable ALL ondiemet feature ========)
347
348 SYS_SSPM_READY := n
349 endif
350
351 ifeq ($(SYS_SSPM_READY), y)
352 MET_SSPM_WALLTIME := $(if $(filter n,$(FEATURE_ONDIEMET_WALLTIME)),n,y)
353
354 met-$(MET_SSPM_WALLTIME) += $(MET_CORE)/sspm/sspm_walltime.o
355 endif
356endif
357
358##############################################################################################
359# include $(MET_PLF_DIR)/Kbuild
360##############################################################################################
361ifneq ($(wildcard $(MET_PLF_DIR)/Kbuild.yocto),)
362 include $(MET_PLF_DIR)/Kbuild.yocto
363else
364 $(info ======= Missing $(MET_PLF_DIR)/Kbuild.yocto ========)
365endif
366
367#################################################################################
368# add met_device flags
369#################################################################################
370ccflags-y += $(foreach v, $(filter MET_%,$(.VARIABLES)), $(if $(filter $($(v)),y),-D$(v)))