blob: e4df42bf2c46ef8c510a9a63b951845ece4e6ba1 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001################################################################################
2# MET Kernel module mode
3################################################################################
4ifneq ($(CONFIG_MTK_MET_BUILT_IN),y)
5$(info ======== Build met.ko ... ========)
6MET_CORE := common
7obj-m := met.o
8
9ifneq ($(wildcard $(MET_PLF_DIR)/Kbuild.platform.h),)
10 include $(MET_PLF_DIR)/Kbuild.platform.h
11else
12 $(info ======= Missing $(MET_PLF_DIR)/Kbuild.platform.h ========)
13endif
14
15ccflags-y += -DCONFIG_MET_MODULE
16ccflags-y += -DMET_PLF_USE
17ccflags-y += -I$(MET_COMMON_DIR)
18ccflags-y += -I$(MET_PLF_DIR)
19ccflags-y += -I$(srctree)/include/
20ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/
21ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/
22ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/
23ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
24
25ccflags-y += $(EXTRA_ARGS) $(EXTRA_CFLAGS)
26ccflags-y += -DMTK_PLATFORM=$(MTK_PLATFORM)
27
28met-y := $(MET_CORE)/met_main.o \
29 $(MET_CORE)/met_backlight.o \
30 $(MET_CORE)/met_tag_ex.o \
31 $(MET_CORE)/interface.o \
32 $(MET_CORE)/sampler.o \
33 $(MET_CORE)/dummy_header.o \
34 $(MET_CORE)/util.o \
35 $(MET_CORE)/stat.o \
36 $(MET_CORE)/cookie.o \
37 $(MET_CORE)/mem_stat.o \
38 $(MET_CORE)/switch.o \
39 $(MET_CORE)/trace_event.o \
40 $(MET_CORE)/core_plf_init.o \
41 $(MET_CORE)/core_plf_trace.o \
42 $(MET_CORE)/ondiemet.o \
43 $(MET_CORE)/ondiemet_log.o \
44 $(MET_CORE)/sspm/ondiemet_sspm.o
45
46CFLAGS_interface.o += -DMET_USER_EVENT_SUPPORT
47CFLAGS_met_tag_ex.o += -DMET_USER_EVENT_SUPPORT
48
49$(info CPUPMU_VERSION = $(CPUPMU_VERSION))
50ifeq ("$(CPUPMU_VERSION)", "V8_2")
51 ccflags-y += -DCPUPMU_V8_2
52endif
53
54$(info ARCH = $(ARCH))
55ifeq ($(ARCH), mips)
56 met-y += $(MET_CORE)/mips_pmu_hw.o
57endif #ifeq ($(ARCH), mips)
58
59ifeq ($(ARCH), arm)
60 ccflags-y += -DCONFIG_MET_ARM_32BIT
61 met-y += $(MET_CORE)/cpu_pmu.o
62 met-y += $(MET_CORE)/v7_pmu_hw.o
63 met-y += $(MET_CORE)/v6_pmu_hw.o
64endif #ifeq ($(ARCH), arm)
65
66ifeq ($(ARCH), arm64)
67 met-y += $(MET_CORE)/cpu_pmu.o
68 met-y += $(MET_CORE)/v8_pmu_hw.o
69endif
70
71$(info CONFIG_CPU_FREQ = $(CONFIG_CPU_FREQ))
72ifeq ($(CONFIG_CPU_FREQ),y)
73 met-y += $(MET_CORE)/power.o
74endif
75
76################################################################################
77# MET_SPM_TWAM
78################################################################################
79FEATURE_SPMTWAM := $(if $(FEATURE_SPMTWAM),$(FEATURE_SPMTWAM),y)
80$(info FEATURE_SPMTWAM = $(FEATURE_SPMTWAM))
81
82ifneq ($(FEATURE_SPMTWAM), n)
83 MET_SPM_TWAM := y
84
85 # for mtk_spm.h
86 ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/include/mtk_spm.h)","")
87 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include/
88 ccflags-y += -I$(MET_COMMON_DIR)/spmtwam/include/
89 else
90 MET_SPM_TWAM = n
91 $(info ========= Missing $(srctree)/drivers/misc/mediatek/base/power/include/mtk_spm.h ========)
92 $(info ======== disable MET_SPM_TWAM ========)
93 endif
94else
95 MET_SPM_TWAM := n
96endif
97
98$(info SPMTWAM_VERSION = $(SPMTWAM_VERSION))
99$(info SPMTWAM_IDLE_SIGNAL_SUPPORT = $(SPMTWAM_IDLE_SIGNAL_SUPPORT))
100
101ifeq ("$(SPMTWAM_IDLE_SIGNAL_SUPPORT)", "single")
102 ccflags-y += -DSPMTWAM_SINGLE_IDLE_SIGNAL
103endif
104
105ifeq ("$(SPMTWAM_IDLE_SIGNAL_SUPPORT)", "multiple")
106 ccflags-y += -DSPMTWAM_MULTIPLE_IDLE_SIGNAL
107endif
108
109ifeq ("$(SPMTWAM_VERSION)", "ap")
110 ccflags-y += -DSPMTWAM_AP
111 met-$(MET_SPM_TWAM) += $(MET_CORE)/spmtwam/ap/met_spmtwam.o
112endif
113
114ifeq ("$(SPMTWAM_VERSION)", "sspm")
115 ccflags-y += -DSPMTWAM_SSPM
116 met-$(MET_SPM_TWAM) += $(MET_CORE)/spmtwam/sspm/met_spmtwam.o
117endif
118
119################################################################################
120# MET_EMI
121################################################################################
122FEATURE_SSPM_EMI := $(if $(FEATURE_SSPM_EMI),$(FEATURE_SSPM_EMI),y)
123$(info FEATURE_SSPM_EMI = $(FEATURE_SSPM_EMI))
124
125ifeq ($(CONFIG_MTK_TINYSYS_SSPM_SUPPORT),y)
126 ifneq ($(FEATURE_ONDIEMET), n)
127 MET_EMI := $(if $(filter n,$(FEATURE_SSPM_EMI)),n,y)
128 ifeq ("$(EMI_SEDA_VERSION)", "SEDA3_5")
129 met-$(MET_EMI) += $(MET_CORE)/emi/SEDA3_5/met_emi.o \
130 $(MET_CORE)/emi/SEDA3_5/mtk_emi_bm.o
131 else ifeq ("$(EMI_SEDA_VERSION)", "SEDA3_6")
132 met-$(MET_EMI) += $(MET_CORE)/emi/SEDA3_6/met_emi.o \
133 $(MET_CORE)/emi/SEDA3_6/mtk_emi_bm.o
134 else
135 met-$(MET_EMI) += $(MET_CORE)/emi/SEDA3/met_emi.o \
136 $(MET_CORE)/emi/SEDA3/mtk_emi_bm.o
137 endif
138 endif
139endif
140
141################################################################################
142# MET_GPU
143################################################################################
144FEATURE_GPU := $(if $(FEATURE_GPU),$(FEATURE_GPU),y)
145$(info FEATURE_GPU = $(FEATURE_GPU))
146
147ifneq ($(FEATURE_GPU), n)
148 MET_GPU := y
149
150 # for mtk_gpufreq.h
151 ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","")
152 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
153 else ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/include/mtk_gpufreq.h)","")
154 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include/
155 else
156 MET_GPU = n
157 $(info ======= Missing $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h ========)
158 $(info ======= Missing $(srctree)/drivers/misc/mediatek/base/power/include/mtk_gpufreq.h ========)
159 $(info ======== disable MET_GPU ========)
160 endif
161
162 # for mtk_gpu_utility.h
163 ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/include/mt-plat/mtk_gpu_utility.h)","")
164 ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/
165 else
166 MET_GPU = n
167 $(info ======== Missing $(srctree)/drivers/misc/mediatek/include/mt-plat/mtk_gpu_utility.h ========)
168 $(info ======== disable MET_GPU ========)
169 endif
170
171 ifneq ($(CONFIG_MTK_GPU_SUPPORT), y)
172 MET_GPU = n
173 $(info ======== CONFIG_MTK_GPU_SUPPORT = n ========)
174 $(info ======== disable MET_GPU ========)
175 endif
176
177 GPU_STALL_CNT_TYPE := $(if $(GPU_STALL_CNT_TYPE),$(GPU_STALL_CNT_TYPE),multiple)
178 $(info GPU_STALL_CNT_TYPE = $(GPU_STALL_CNT_TYPE))
179
180 ifeq ("$(GPU_STALL_CNT_TYPE)", "single")
181 ccflags-y += -DGPU_STALL_CNT_SINGLE
182 endif
183else
184 MET_GPU := n
185endif
186
187met-$(MET_GPU) += $(MET_CORE)/mtk_gpu_metmonitor.o
188
189
190################################################################################
191# MET_VCOREDVFS
192################################################################################
193FEATURE_VCOREDVFS := $(if $(FEATURE_VCOREDVFS),$(FEATURE_VCOREDVFS),y)
194$(info FEATURE_VCOREDVFS = $(FEATURE_VCOREDVFS))
195
196ifneq ($(FEATURE_VCOREDVFS), n)
197
198 MET_VCOREDVFS := y
199
200 # for mtk_vcorefs_manager.h
201 ifneq ("$(wildcard $(MET_VCOREDVFS_INC)/mtk_vcorefs_manager.h)","")
202 ccflags-y += -I$(MET_VCOREDVFS_INC)/
203 else
204 MET_VCOREDVFS = n
205 $(info ======== Missing $(MET_VCOREDVFS_INC)/mtk_vcorefs_manager.h ========)
206 $(info ======== disable MET_VCOREDVFS ========)
207 endif
208
209 # for mtk_vcorefs_governor.h
210 ifneq ("$(wildcard $(MET_VCOREDVFS_INC)/mtk_vcorefs_governor.h)","")
211 ccflags-y += -I$(MET_VCOREDVFS_INC)
212 else
213 MET_VCOREDVFS = n
214 $(info ======== Missing $(MET_VCOREDVFS_INC)/mtk_vcorefs_governor.h ========)
215 $(info ======== disable MET_VCOREDVFS ========)
216 endif
217
218 ifneq ($(VCOREDVFS_OLD_VER),y)
219 # for helio-dvfsrc.h
220 ifneq ("$(wildcard $(srctree)/drivers/devfreq/helio-dvfsrc.h)","")
221 ccflags-y += -I$(srctree)/drivers/devfreq/
222 else
223 MET_VCOREDVFS = n
224 $(info ======== Missing $(srctree)/drivers/devfreq/helio-dvfsrc.h ========)
225 $(info ======== disable MET_VCOREDVFS ========)
226 endif
227 endif
228else
229 MET_VCOREDVFS := n
230endif
231
232ifneq ($(VCOREDVFS_OLD_VER),y)
233 met-$(MET_VCOREDVFS) += $(MET_CORE)/met_vcoredvfs.o
234else
235 ccflags-y += -DVCOREDVFS_OLD_VER
236 met-$(MET_VCOREDVFS) += $(MET_CORE)/met_vcoredvfs_44.o
237endif
238
239################################################################################
240# MET_PTPOD
241################################################################################
242FEATURE_PTPOD := $(if $(FEATURE_PTPOD),$(FEATURE_PTPOD),y)
243$(info FEATURE_PTPOD = $(FEATURE_PTPOD))
244
245ifneq ($(FEATURE_PTPOD), n)
246 MET_PTPOD := y
247
248 # for mtk_gpufreq.h
249 ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","")
250 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
251 else ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/include/mtk_gpufreq.h)","")
252 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include/
253 else
254 MET_PTPOD = n
255 $(info ======== Missing $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h ========)
256 $(info ======== Missing $(srctree)/drivers/misc/mediatek/base/power/include/mtk_gpufreq.h ========)
257 $(info ======== disable MET_PTPOD ========)
258 endif
259
260 # for mtk_cpufreq_api.h
261 ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/mach/mtk_cpufreq_api.h)","")
262 ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/
263 else
264 MET_PTPOD = n
265 $(info ======== Missing $(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/mach/mtk_cpufreq_api.h ========)
266 $(info ======== disable MET_PTPOD ========)
267 endif
268
269 # for mtk_cpufreq_config.h
270 ifneq ("$(wildcard $(MET_PTPOD_INC)/mtk_cpufreq_config.h)","")
271 ccflags-y += -I$(MET_PTPOD_INC)
272 else
273 MET_PTPOD = n
274 $(info ======== Missing $(MET_PTPOD_INC)/mtk_cpufreq_config.h ========)
275 $(info ======== disable MET_PTPOD ========)
276 endif
277else
278 MET_PTPOD := n
279endif
280
281met-$(MET_PTPOD) += $(MET_CORE)/met_ptpod.o
282
283
284################################################################################
285# MET_CPUDSU
286################################################################################
287FEATURE_CPUDSU := $(if $(FEATURE_CPUDSU),$(FEATURE_CPUDSU),y)
288$(info FEATURE_CPUDSU = $(FEATURE_CPUDSU))
289
290MET_CPUDSU := $(if $(filter n,$(FEATURE_CPUDSU)),n,y)
291
292met-$(MET_CPUDSU) += $(MET_CORE)/cpu_dsu.o \
293 $(MET_CORE)/v8_dsu_hw.o
294
295################################################################################
296# MET_WALLTIME
297################################################################################
298FEATURE_WALLTIME := $(if $(FEATURE_WALLTIME),$(FEATURE_WALLTIME),y)
299$(info FEATURE_WALLTIME = $(FEATURE_WALLTIME))
300
301MET_WALLTIME := $(if $(filter n,$(FEATURE_WALLTIME)),n,y)
302
303met-$(MET_WALLTIME) += $(MET_CORE)/met_wall_time.o
304
305################################################################################
306# MET_SMI
307################################################################################
308FEATURE_SMI := $(if $(FEATURE_SMI),$(FEATURE_SMI),y)
309$(info FEATURE_SMI = $(FEATURE_SMI))
310
311#MET_SMI := $(if $(filter n,$(FEATURE_SMI)),n,y)
312
313#met-$(MET_SMI) += $(MET_CORE)/sspm/sspm_met_smi.o
314
315################################################################################
316# EVENT_POWER
317################################################################################
318FEATURE_EVENT_POWER := $(if $(FEATURE_EVENT_POWER),$(FEATURE_EVENT_POWER),y)
319$(info FEATURE_EVENT_POWER = $(FEATURE_EVENT_POWER))
320
321ifeq ($(FEATURE_EVENT_POWER), y)
322 ccflags-y += -DMET_EVENT_POWER_SUPPORT
323endif
324
325################################################################################
326# On-die-met SSPM only module
327################################################################################
328FEATURE_ONDIEMET := $(if $(FEATURE_ONDIEMET),$(FEATURE_ONDIEMET),y)
329ifeq ($(FEATURE_ONDIEMET), y)
330 FEATURE_ONDIEMET_WALLTIME := $(if $(FEATURE_ONDIEMET_WALLTIME),$(FEATURE_ONDIEMET_WALLTIME),y)
331else
332 FEATURE_ONDIEMET_WALLTIME := n
333endif
334
335$(info FEATURE_ONDIEMET = $(FEATURE_ONDIEMET))
336$(info FEATURE_ONDIEMET_WALLTIME = $(FEATURE_ONDIEMET_WALLTIME))
337
338ifneq ($(FEATURE_ONDIEMET), n)
339 subdir-ccflags-y += -DONDIEMET_SUPPORT
340
341 ifeq ($(CONFIG_MTK_TINYSYS_SSPM_SUPPORT),)
342 $(info CONFIG_MTK_TINYSYS_SSPM_SUPPORT = n)
343 else
344 $(info CONFIG_MTK_TINYSYS_SSPM_SUPPORT = $(CONFIG_MTK_TINYSYS_SSPM_SUPPORT))
345 endif
346
347 ifeq ($(CONFIG_MTK_TINYSYS_SSPM_SUPPORT),y)
348 subdir-ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm
349 subdir-ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)
350 met-y += $(MET_CORE)/sspm/sspm_ipi_handle.o
351 met-y += $(MET_CORE)/sspm/sspm_common.o
352 ccflags-y += -DMTK_TINYSYS_SSPM_SUPPORT
353
354 SSPM_VERSION := $(if $(SSPM_VERSION),$(SSPM_VERSION),v1)
355 $(info SSPM_VERSION = $(SSPM_VERSION))
356
357 ifneq ($(SSPM_VERSION), v2)
358 MET_SSPM_COMM_INC := $(srctree)/drivers/misc/mediatek/sspm/$(SSPM_VERSION)
359 MET_SSPM_IF_INC := $(srctree)/drivers/misc/mediatek/sspm/$(SSPM_VERSION)
360 MET_SSPM_IF := sspm_ipi.h
361 MET_SSPM_IPI := sspm_ipi_define.h
362 else
363 MET_SSPM_COMM_INC := $(srctree)/drivers/misc/mediatek/sspm/$(SSPM_VERSION)
364 MET_SSPM_IF_INC := $(srctree)/drivers/misc/mediatek/include/mt-plat/
365 MET_SSPM_IF := mtk_tinysys_ipi.h
366 MET_SSPM_IPI := sspm_ipi_table.h
367 endif
368
369
370 ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)/$(MET_SSPM_IPI))","")
371 subdir-ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm \
372 -I$(srctree)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)
373
374 SYS_SSPM_READY := y
375 else
376 $(info ======== Missing $(srctree)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)/$(MET_SSPM_IPI)========)
377 $(info ======== disable ALL ondiemet feature ========)
378
379 SYS_SSPM_READY := n
380 endif
381
382 # for smi_met_conf format
383 ifeq ($(SSPM_VERSION), v2)
384 ccflags-y += -DSSPM_VERSION_V2
385 ccflags-y += -DSMI_MASTER_8BIT
386 endif
387
388 # for sspm ipi interface
389 ifneq ("$(wildcard $(MET_SSPM_IF_INC)/$(MET_SSPM_IF))","")
390 ccflags-y += -I$(MET_SSPM_IF_INC) \
391 -I$(MET_SSPM_COMM_INC)
392 else
393 $(info ======== Missing $(MET_SSPM_IF_INC)/$(MET_SSPM_IF) ========)
394 $(info ======== disable ALL ondiemet feature ========)
395
396 SYS_SSPM_READY := n
397 endif
398 else
399 $(info ======== CONFIG_MTK_TINYSYS_SSPM_SUPPORT = n ========)
400 $(info ======== disable ALL ondiemet feature ========)
401
402 SYS_SSPM_READY := n
403 endif
404
405 ifeq ($(SYS_SSPM_READY), y)
406 MET_SSPM_WALLTIME := $(if $(filter n,$(FEATURE_ONDIEMET_WALLTIME)),n,y)
407 met-$(MET_SSPM_WALLTIME) += $(MET_CORE)/sspm/sspm_walltime.o
408
409 MET_SMI := $(if $(filter n,$(FEATURE_SMI)),n,y)
410 met-$(MET_SMI) += $(MET_CORE)/sspm/sspm_met_smi.o
411 endif
412endif
413################################################################################
414# MET built in mode
415################################################################################
416else # ifneq ($(CONFIG_MTK_MET_BUILT_IN),y)
417$(info ======== MET Built in ... ========)
418MET_DRV_DIR := ../../../../../vendor/mediatek/kernel_modules/met_drv/$(CONFIG_KERVER_VERSION)
419MET_CORE := $(MET_DRV_DIR)/common
420
421ifneq ($(wildcard $(MET_PLF_DIR)/Kbuild.platform.h),)
422 include $(MET_PLF_DIR)/Kbuild.platform.h
423else
424 $(info ======= Missing $(MET_PLF_DIR)/Kbuild.platform.h ========)
425endif
426
427ccflags-y += -DCONFIG_MET_MODULE
428ccflags-y += -DMET_PLF_USE
429ccflags-y += -I$(MET_COMMON_DIR)
430ccflags-y += -I$(MET_PLF_DIR)
431ccflags-y += -I$(srctree)/include/
432ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/
433ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/
434ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/
435ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
436
437ccflags-y += $(EXTRA_ARGS) $(EXTRA_CFLAGS)
438ccflags-y += -DMTK_PLATFORM=$(MTK_PLATFORM)
439
440obj-y += $(MET_CORE)/met_main.o \
441 $(MET_CORE)/met_backlight.o \
442 $(MET_CORE)/met_tag_ex.o \
443 $(MET_CORE)/interface.o \
444 $(MET_CORE)/sampler.o \
445 $(MET_CORE)/dummy_header.o \
446 $(MET_CORE)/util.o \
447 $(MET_CORE)/stat.o \
448 $(MET_CORE)/cookie.o \
449 $(MET_CORE)/mem_stat.o \
450 $(MET_CORE)/switch.o \
451 $(MET_CORE)/trace_event.o \
452 $(MET_CORE)/core_plf_init.o \
453 $(MET_CORE)/core_plf_trace.o \
454 $(MET_CORE)/ondiemet.o \
455 $(MET_CORE)/ondiemet_log.o \
456 $(MET_CORE)/sspm/ondiemet_sspm.o
457
458CFLAGS_interface.o += -DMET_USER_EVENT_SUPPORT
459CFLAGS_met_tag_ex.o += -DMET_USER_EVENT_SUPPORT
460
461$(info CPUPMU_VERSION = $(CPUPMU_VERSION))
462ifeq ("$(CPUPMU_VERSION)", "V8_2")
463 ccflags-y += -DCPUPMU_V8_2
464endif
465
466$(info ARCH = $(ARCH))
467ifeq ($(ARCH), mips)
468 obj-y += $(MET_CORE)/mips_pmu_hw.o
469endif #ifeq ($(ARCH), mips)
470
471ifeq ($(ARCH), arm)
472 ccflags-y += -DCONFIG_MET_ARM_32BIT
473 obj-y += $(MET_CORE)/cpu_pmu.o
474 obj-y += $(MET_CORE)/v7_pmu_hw.o
475 obj-y += $(MET_CORE)/v6_pmu_hw.o
476endif #ifeq ($(ARCH), arm)
477
478ifeq ($(ARCH), arm64)
479 obj-y += $(MET_CORE)/cpu_pmu.o
480 obj-y += $(MET_CORE)/v8_pmu_hw.o
481endif
482
483$(info CONFIG_CPU_FREQ = $(CONFIG_CPU_FREQ))
484ifeq ($(CONFIG_CPU_FREQ),y)
485 obj-y += $(MET_CORE)/power.o
486endif
487
488
489################################################################################
490# MET_EMI
491################################################################################
492FEATURE_SSPM_EMI := $(if $(FEATURE_SSPM_EMI),$(FEATURE_SSPM_EMI),y)
493$(info FEATURE_SSPM_EMI = $(FEATURE_SSPM_EMI))
494
495ifeq ($(CONFIG_MTK_TINYSYS_SSPM_SUPPORT),y)
496 ifneq ($(FEATURE_ONDIEMET), n)
497 MET_EMI := $(if $(filter n,$(FEATURE_SSPM_EMI)),n,y)
498 ifeq ("$(EMI_SEDA_VERSION)", "SEDA3_5")
499 met-$(MET_EMI) += $(MET_CORE)/emi/SEDA3_5/met_emi.o \
500 $(MET_CORE)/emi/SEDA3_5/mtk_emi_bm.o
501 else ifeq ("$(EMI_SEDA_VERSION)", "SEDA3_6")
502 met-$(MET_EMI) += $(MET_CORE)/emi/SEDA3_6/met_emi.o \
503 $(MET_CORE)/emi/SEDA3_6/mtk_emi_bm.o
504 else
505 met-$(MET_EMI) += $(MET_CORE)/emi/SEDA3/met_emi.o \
506 $(MET_CORE)/emi/SEDA3/mtk_emi_bm.o
507 endif
508 endif
509endif
510################################################################################
511# MET_GPU
512################################################################################
513FEATURE_GPU := $(if $(FEATURE_GPU),$(FEATURE_GPU),y)
514$(info FEATURE_GPU = $(FEATURE_GPU))
515
516ifneq ($(FEATURE_GPU), n)
517 MET_GPU := y
518
519 # for mtk_gpufreq.h
520 ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","")
521 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
522 else ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/include/mtk_gpufreq.h)","")
523 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include/
524 else
525 MET_GPU = n
526 $(info ======= Missing $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h ========)
527 $(info ======= Missing $(srctree)/drivers/misc/mediatek/base/power/include/mtk_gpufreq.h ========)
528 $(info ======== disable MET_GPU ========)
529 endif
530
531 # for mtk_gpu_utility.h
532 ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/include/mt-plat/mtk_gpu_utility.h)","")
533 ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/
534 else
535 MET_GPU = n
536 $(info ======== Missing $(srctree)/drivers/misc/mediatek/include/mt-plat/mtk_gpu_utility.h ========)
537 $(info ======== disable MET_GPU ========)
538 endif
539
540 ifneq ($(CONFIG_MTK_GPU_SUPPORT), y)
541 MET_GPU = n
542 $(info ======== CONFIG_MTK_GPU_SUPPORT = n ========)
543 $(info ======== disable MET_GPU ========)
544 endif
545
546 GPU_STALL_CNT_TYPE := $(if $(GPU_STALL_CNT_TYPE),$(GPU_STALL_CNT_TYPE),multiple)
547 $(info GPU_STALL_CNT_TYPE = $(GPU_STALL_CNT_TYPE))
548
549 ifeq ("$(GPU_STALL_CNT_TYPE)", "single")
550 ccflags-y += -DGPU_STALL_CNT_SINGLE
551 endif
552else
553 MET_GPU := n
554endif
555
556obj-$(MET_GPU) += $(MET_CORE)/mtk_gpu_metmonitor.o
557
558
559################################################################################
560# MET_VCOREDVFS
561################################################################################
562FEATURE_VCOREDVFS := $(if $(FEATURE_VCOREDVFS),$(FEATURE_VCOREDVFS),y)
563$(info FEATURE_VCOREDVFS = $(FEATURE_VCOREDVFS))
564
565ifneq ($(FEATURE_VCOREDVFS), n)
566 MET_VCOREDVFS := y
567
568 # for mtk_vcorefs_manager.h
569 ifneq ("$(wildcard $(MET_VCOREDVFS_INC)/mtk_vcorefs_manager.h)","")
570 ccflags-y += -I$(MET_VCOREDVFS_INC)/
571 else
572 MET_VCOREDVFS = n
573 $(info ======== Missing $(MET_VCOREDVFS_INC)/mtk_vcorefs_manager.h ========)
574 $(info ======== disable MET_VCOREDVFS ========)
575 endif
576
577 # for mtk_vcorefs_governor.h
578 ifneq ("$(wildcard $(MET_VCOREDVFS_INC)/mtk_vcorefs_governor.h)","")
579 ccflags-y += -I$(MET_VCOREDVFS_INC)
580 else
581 MET_VCOREDVFS = n
582 $(info ======== Missing $(MET_VCOREDVFS_INC)/mtk_vcorefs_governor.h ========)
583 $(info ======== disable MET_VCOREDVFS ========)
584 endif
585
586 # for helio-dvfsrc.h
587 ifneq ("$(wildcard $(srctree)/drivers/devfreq/helio-dvfsrc.h)","")
588 ccflags-y += -I$(srctree)/drivers/devfreq/
589 else
590 MET_VCOREDVFS = n
591 $(info ======== Missing $(srctree)/drivers/devfreq/helio-dvfsrc.h ========)
592 $(info ======== disable MET_VCOREDVFS ========)
593 endif
594else
595 MET_VCOREDVFS := n
596endif
597
598obj-$(MET_VCOREDVFS) += $(MET_CORE)/met_vcoredvfs.o
599
600
601################################################################################
602# MET_PTPOD
603################################################################################
604FEATURE_PTPOD := $(if $(FEATURE_PTPOD),$(FEATURE_PTPOD),y)
605$(info FEATURE_PTPOD = $(FEATURE_PTPOD))
606
607ifneq ($(FEATURE_PTPOD), n)
608 MET_PTPOD := y
609
610 # for mtk_gpufreq.h
611 ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","")
612 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
613 else ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/include/mtk_gpufreq.h)","")
614 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include/
615 else
616 MET_PTPOD = n
617 $(info ======== Missing $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h ========)
618 $(info ======== Missing $(srctree)/drivers/misc/mediatek/base/power/include/mtk_gpufreq.h ========)
619 $(info ======== disable MET_PTPOD ========)
620 endif
621
622 # for mtk_cpufreq_api.h
623 ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/mach/mtk_cpufreq_api.h)","")
624 ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/
625 else
626 MET_PTPOD = n
627 $(info ======== Missing $(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/mach/mtk_cpufreq_api.h ========)
628 $(info ======== disable MET_PTPOD ========)
629 endif
630
631 # for mtk_cpufreq_config.h
632 ifneq ("$(wildcard $(MET_PTPOD_INC)/mtk_cpufreq_config.h)","")
633 ccflags-y += -I$(MET_PTPOD_INC)
634 else
635 MET_PTPOD = n
636 $(info ======== Missing $(MET_PTPOD_INC)/mtk_cpufreq_config.h ========)
637 $(info ======== disable MET_PTPOD ========)
638 endif
639else
640 MET_PTPOD := n
641endif
642
643obj-$(MET_PTPOD) += $(MET_CORE)/met_ptpod.o
644
645
646################################################################################
647# MET_CPUDSU
648################################################################################
649FEATURE_CPUDSU := $(if $(FEATURE_CPUDSU),$(FEATURE_CPUDSU),y)
650$(info FEATURE_CPUDSU = $(FEATURE_CPUDSU))
651
652MET_CPUDSU := $(if $(filter n,$(FEATURE_CPUDSU)),n,y)
653
654obj-$(MET_CPUDSU) += $(MET_CORE)/cpu_dsu.o \
655 $(MET_CORE)/v8_dsu_hw.o
656
657################################################################################
658# MET_WALLTIME
659################################################################################
660FEATURE_WALLTIME := $(if $(FEATURE_WALLTIME),$(FEATURE_WALLTIME),y)
661$(info FEATURE_WALLTIME = $(FEATURE_WALLTIME))
662
663MET_WALLTIME := $(if $(filter n,$(FEATURE_WALLTIME)),n,y)
664
665obj-$(MET_WALLTIME) += $(MET_CORE)/met_wall_time.o
666
667################################################################################
668# MET_SMI
669################################################################################
670FEATURE_SMI := $(if $(FEATURE_SMI),$(FEATURE_SMI),y)
671$(info FEATURE_SMI = $(FEATURE_SMI))
672
673#MET_SMI := $(if $(filter n,$(FEATURE_SMI)),n,y)
674
675#obj-$(MET_SMI) += $(MET_CORE)/sspm/sspm_met_smi.o
676
677
678################################################################################
679# EVENT_POWER
680################################################################################
681FEATURE_EVENT_POWER := $(if $(FEATURE_EVENT_POWER),$(FEATURE_EVENT_POWER),y)
682$(info FEATURE_EVENT_POWER = $(FEATURE_EVENT_POWER))
683
684ifeq ($(FEATURE_EVENT_POWER), y)
685 ccflags-y += -DMET_EVENT_POWER_SUPPORT
686endif
687
688################################################################################
689# On-die-met SSPM only module
690################################################################################
691FEATURE_ONDIEMET := $(if $(FEATURE_ONDIEMET),$(FEATURE_ONDIEMET),y)
692ifeq ($(FEATURE_ONDIEMET), y)
693 FEATURE_ONDIEMET_WALLTIME := $(if $(FEATURE_ONDIEMET_WALLTIME),$(FEATURE_ONDIEMET_WALLTIME),y)
694else
695 FEATURE_ONDIEMET_WALLTIME := n
696endif
697
698$(info FEATURE_ONDIEMET = $(FEATURE_ONDIEMET))
699$(info FEATURE_ONDIEMET_WALLTIME = $(FEATURE_ONDIEMET_WALLTIME))
700
701ifneq ($(FEATURE_ONDIEMET), n)
702 subdir-ccflags-y += -DONDIEMET_SUPPORT
703
704 ifeq ($(CONFIG_MTK_TINYSYS_SSPM_SUPPORT),)
705 $(info CONFIG_MTK_TINYSYS_SSPM_SUPPORT = n)
706 else
707 $(info CONFIG_MTK_TINYSYS_SSPM_SUPPORT = $(CONFIG_MTK_TINYSYS_SSPM_SUPPORT))
708 endif
709
710 ifeq ($(CONFIG_MTK_TINYSYS_SSPM_SUPPORT),y)
711 subdir-ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm
712 subdir-ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)
713 obj-y += $(MET_CORE)/sspm/sspm_ipi_handle.o
714 obj-y += $(MET_CORE)/sspm/sspm_common.o
715 ccflags-y += -DMTK_TINYSYS_SSPM_SUPPORT
716
717 SSPM_VERSION := $(if $(SSPM_VERSION),$(SSPM_VERSION),v1)
718 $(info SSPM_VERSION = $(SSPM_VERSION))
719
720 ifneq ($(SSPM_VERSION), v2)
721 MET_SSPM_COMM_INC := $(srctree)/drivers/misc/mediatek/sspm/$(SSPM_VERSION)
722 MET_SSPM_IF_INC := $(srctree)/drivers/misc/mediatek/sspm/$(SSPM_VERSION)
723 MET_SSPM_IF := sspm_ipi.h
724 MET_SSPM_IPI := sspm_ipi_define.h
725 else
726 MET_SSPM_COMM_INC := $(srctree)/drivers/misc/mediatek/sspm/$(SSPM_VERSION)
727 MET_SSPM_IF_INC := $(srctree)/drivers/misc/mediatek/include/mt-plat/
728 MET_SSPM_IF := mtk_tinysys_ipi.h
729 MET_SSPM_IPI := sspm_ipi_table.h
730 endif
731
732
733 ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)/$(MET_SSPM_IPI))","")
734 subdir-ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm \
735 -I$(srctree)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)
736
737 SYS_SSPM_READY := y
738 else
739 $(info ======== Missing $(srctree)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)/$(MET_SSPM_IPI)========)
740 $(info ======== disable ALL ondiemet feature ========)
741
742 SYS_SSPM_READY := n
743 endif
744
745 # for sspm ipi interface
746 ifneq ("$(wildcard $(MET_SSPM_IF_INC)/$(MET_SSPM_IF))","")
747 ccflags-y += -I$(MET_SSPM_IF_INC) \
748 -I$(MET_SSPM_COMM_INC)
749 else
750 $(info ======== Missing $(MET_SSPM_IF_INC)/$(MET_SSPM_IF) ========)
751 $(info ======== disable ALL ondiemet feature ========)
752
753 SYS_SSPM_READY := n
754 endif
755 else
756 $(info ======== CONFIG_MTK_TINYSYS_SSPM_SUPPORT = n ========)
757 $(info ======== disable ALL ondiemet feature ========)
758
759 SYS_SSPM_READY := n
760 endif
761
762 ifeq ($(SYS_SSPM_READY), y)
763 MET_SSPM_WALLTIME := $(if $(filter n,$(FEATURE_ONDIEMET_WALLTIME)),n,y)
764 obj-$(MET_SSPM_WALLTIME) += $(MET_CORE)/sspm/sspm_walltime.o
765
766 MET_SMI := $(if $(filter n,$(FEATURE_SMI)),n,y)
767 met-$(MET_SMI) += $(MET_CORE)/sspm/sspm_met_smi.o
768 endif
769endif
770
771endif # end of ifneq ($(CONFIG_MTK_MET_BUILT_IN),y)
772
773
774##############################################################################################
775# include $(MET_PLF_DIR)/Kbuild
776##############################################################################################
777ifneq ($(wildcard $(MET_PLF_DIR)/Kbuild),)
778 include $(MET_PLF_DIR)/Kbuild
779else
780 $(info ======= Missing $(MET_PLF_DIR)/Kbuild ========)
781endif
782
783#################################################################################
784# add met_device flags
785#################################################################################
786ccflags-y += $(foreach v, $(filter MET_%,$(.VARIABLES)), $(if $(filter $($(v)),y),-D$(v)))