blob: eb2667247cc91372180d34075304410dfe39f90a [file] [log] [blame]
$(info ======== Build met.ko ... ========)
MET_CORE := common
obj-m := met.o
ccflags-y += -I$(srctree)/include/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/
ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/
ccflags-y += -I$(srctree)/../vendor/mediatek/kernel_modules/met_drv/4.4/$(MTK_PLATFORM)/
ccflags-y += $(EXTRA_ARGS) $(EXTRA_CFLAGS)
met-y := $(MET_CORE)/met_main.o \
$(MET_CORE)/met_backlight.o \
$(MET_CORE)/met_tag_ex.o \
$(MET_CORE)/interface.o \
$(MET_CORE)/sampler.o \
$(MET_CORE)/dummy_header.o \
$(MET_CORE)/util.o \
$(MET_CORE)/stat.o \
$(MET_CORE)/cookie.o \
$(MET_CORE)/cpu_pmu.o \
$(MET_CORE)/mem_stat.o \
$(MET_CORE)/switch.o \
$(MET_CORE)/trace_event.o \
$(MET_CORE)/core_plf_init.o \
$(MET_CORE)/core_plf_trace.o \
$(MET_CORE)/ondiemet.o \
$(MET_CORE)/ondiemet_log.o \
$(MET_CORE)/sspm/ondiemet_sspm.o
CFLAGS_interface.o += -DMET_USER_EVENT_SUPPORT
CFLAGS_met_tag_ex.o += -DMET_USER_EVENT_SUPPORT
ifeq ($(ARCH), mips)
met-y += $(MET_CORE)/mips_pmu_hw.o
endif #ifeq ($(ARCH), mips)
ifeq ($(ARCH), arm)
ccflags-y += -DCONFIG_MET_ARM_32BIT
met-y += $(MET_CORE)/v7_pmu_hw.o
met-y += $(MET_CORE)/v6_pmu_hw.o
endif #ifeq ($(ARCH), arm)
ifeq ($(ARCH), arm64)
ccflags-y += -DMET_SUPPORT_CPUPMU_V2
met-y += $(MET_CORE)/v8_pmu_hw.o
met-y += $(MET_CORE)/cpu_pmu_v2.o
met-y += $(MET_CORE)/v8_pmu_hw_v2.o
endif
met-$(CONFIG_CPU_FREQ) += $(MET_CORE)/power.o
################################################################################
# MET_EMI
################################################################################
MET_EMI := y
met-$(MET_EMI) += $(MET_CORE)/met_emi.o \
$(MET_CORE)/mtk_emi_bm.o
################################################################################
# MET_GPU
################################################################################
MET_GPU := y
# for mtk_gpufreq.h
ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","")
ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
else
MET_GPU = n
endif
# for mtk_gpu_utility.h
ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/include/mt-plat/mtk_gpu_utility.h)","")
ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/
else
MET_GPU = n
endif
met-$(MET_GPU) += $(MET_CORE)/mtk_gpu_metmonitor.o
################################################################################
# MET_VCOREDVFS
################################################################################
MET_VCOREDVFS := y
# for mtk_vcorefs_manager.h
ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/include/mtk_vcorefs_manager.h)","")
ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include/
# for mtk_vcorefs_governor.h
ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/include/vcorefs_v3/
else
MET_VCOREDVFS = n
endif
met-$(MET_VCOREDVFS) += $(MET_CORE)/met_vcoredvfs.o
################################################################################
# MET_PTPOD
################################################################################
MET_PTPOD := y
# for mtk_gpufreq.h
ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","")
ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
else
MET_PTPOD = n
endif
# for mtk_cpufreq_api.h
ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/mach/mtk_cpufreq_api.h)","")
ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/
else
MET_PTPOD = n
endif
# for mtk_cpufreq_config.h
ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/cpufreq_v1/src/mach/$(MTK_PLATFORM)/mtk_cpufreq_config.h)","")
ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/cpufreq_v1/src/mach/$(MTK_PLATFORM)/
else ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/cpufreq_v2/src/mach/$(MTK_PLATFORM)/mtk_cpufreq_config.h)","")
ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/cpufreq_v2/src/mach/$(MTK_PLATFORM)/
else
MET_PTPOD = n
endif
met-$(MET_PTPOD) += $(MET_CORE)/met_ptpod.o
################################################################################
# On-die-met SSPM only module
################################################################################
ifeq ($(CONFIG_MTK_TINYSYS_SSPM_SUPPORT),y)
# for sspm_ipi.h
subdir-ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm
subdir-ccflags-y += -I$(srctree)/drivers/misc/mediatek/sspm/$(CONFIG_MTK_PLATFORM)
met-y += $(MET_CORE)/sspm/sspm_ipi_handle.o
endif
ccflags-y += $(foreach v, $(filter MET_%,$(.VARIABLES)), $(if $(filter $($(v)),y),-D$(v)))