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