blob: eb2667247cc91372180d34075304410dfe39f90a [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001$(info ======== Build met.ko ... ========)
2MET_CORE := common
3
4obj-m := met.o
5
6ccflags-y += -I$(srctree)/include/
7ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/
8ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/
9ccflags-y += -I$(srctree)/../vendor/mediatek/kernel_modules/met_drv/4.4/$(MTK_PLATFORM)/
10
11
12ccflags-y += $(EXTRA_ARGS) $(EXTRA_CFLAGS)
13
14met-y := $(MET_CORE)/met_main.o \
15 $(MET_CORE)/met_backlight.o \
16 $(MET_CORE)/met_tag_ex.o \
17 $(MET_CORE)/interface.o \
18 $(MET_CORE)/sampler.o \
19 $(MET_CORE)/dummy_header.o \
20 $(MET_CORE)/util.o \
21 $(MET_CORE)/stat.o \
22 $(MET_CORE)/cookie.o \
23 $(MET_CORE)/cpu_pmu.o \
24 $(MET_CORE)/mem_stat.o \
25 $(MET_CORE)/switch.o \
26 $(MET_CORE)/trace_event.o \
27 $(MET_CORE)/core_plf_init.o \
28 $(MET_CORE)/core_plf_trace.o \
29 $(MET_CORE)/ondiemet.o \
30 $(MET_CORE)/ondiemet_log.o \
31 $(MET_CORE)/sspm/ondiemet_sspm.o
32
33CFLAGS_interface.o += -DMET_USER_EVENT_SUPPORT
34CFLAGS_met_tag_ex.o += -DMET_USER_EVENT_SUPPORT
35
36ifeq ($(ARCH), mips)
37 met-y += $(MET_CORE)/mips_pmu_hw.o
38endif #ifeq ($(ARCH), mips)
39
40ifeq ($(ARCH), arm)
41 ccflags-y += -DCONFIG_MET_ARM_32BIT
42 met-y += $(MET_CORE)/v7_pmu_hw.o
43 met-y += $(MET_CORE)/v6_pmu_hw.o
44endif #ifeq ($(ARCH), arm)
45
46ifeq ($(ARCH), arm64)
47 ccflags-y += -DMET_SUPPORT_CPUPMU_V2
48 met-y += $(MET_CORE)/v8_pmu_hw.o
49 met-y += $(MET_CORE)/cpu_pmu_v2.o
50 met-y += $(MET_CORE)/v8_pmu_hw_v2.o
51endif
52
53met-$(CONFIG_CPU_FREQ) += $(MET_CORE)/power.o
54
55
56################################################################################
57# MET_EMI
58################################################################################
59MET_EMI := y
60
61met-$(MET_EMI) += $(MET_CORE)/met_emi.o \
62 $(MET_CORE)/mtk_emi_bm.o
63
64
65################################################################################
66# MET_GPU
67################################################################################
68MET_GPU := y
69# for mtk_gpufreq.h
70ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","")
71 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
72else
73 MET_GPU = n
74endif
75
76# for mtk_gpu_utility.h
77ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/include/mt-plat/mtk_gpu_utility.h)","")
78 ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/
79else
80 MET_GPU = n
81endif
82
83met-$(MET_GPU) += $(MET_CORE)/mtk_gpu_metmonitor.o
84
85
86################################################################################
87# MET_VCOREDVFS
88################################################################################
89MET_VCOREDVFS := y
90
91# for mtk_vcorefs_manager.h
92ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/include/mtk_vcorefs_manager.h)","")
93 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include/
94
95 # for mtk_vcorefs_governor.h
96 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include/vcorefs_v3/
97else
98 MET_VCOREDVFS = n
99endif
100
101met-$(MET_VCOREDVFS) += $(MET_CORE)/met_vcoredvfs.o
102
103
104################################################################################
105# MET_PTPOD
106################################################################################
107MET_PTPOD := y
108# for mtk_gpufreq.h
109ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","")
110 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
111else
112 MET_PTPOD = n
113endif
114
115# for mtk_cpufreq_api.h
116ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/mach/mtk_cpufreq_api.h)","")
117 ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/
118else
119 MET_PTPOD = n
120endif
121
122# for mtk_cpufreq_config.h
123ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/cpufreq_v1/src/mach/$(MTK_PLATFORM)/mtk_cpufreq_config.h)","")
124 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/cpufreq_v1/src/mach/$(MTK_PLATFORM)/
125else ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/cpufreq_v2/src/mach/$(MTK_PLATFORM)/mtk_cpufreq_config.h)","")
126 ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/cpufreq_v2/src/mach/$(MTK_PLATFORM)/
127else
128 MET_PTPOD = n
129endif
130
131met-$(MET_PTPOD) += $(MET_CORE)/met_ptpod.o
132
133
134################################################################################
135# On-die-met SSPM only module
136################################################################################
137ifeq ($(CONFIG_MTK_TINYSYS_SSPM_SUPPORT),y)
138 # for sspm_ipi.h
139 subdir-ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm
140 subdir-ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm/$(CONFIG_MTK_PLATFORM)
141 met-y += $(MET_CORE)/sspm/sspm_ipi_handle.o
142endif
143
144
145ccflags-y += $(foreach v, $(filter MET_%,$(.VARIABLES)), $(if $(filter $($(v)),y),-D$(v)))
146