blob: 09a8dbaaf597b1fc5823d8be605c1f37fde401b4 [file] [log] [blame]
$(info ======== Build met.ko ... ========)
MET_CORE := common
obj-m := met.o
ccflags-y += -DCONFIG_MET_MODULE
ccflags-y += -DMET_PLF_USE
ccflags-y += -I$(MET_COMMON_DIR)
ccflags-y += -I$(MET_PLF_DIR)
ccflags-y += -I$(KERNEL_SRC)/include/
ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/include/
ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/
ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/
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
$(info ARCH = $(ARCH))
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
$(info CONFIG_CPU_FREQ = $(CONFIG_CPU_FREQ))
ifeq ($(CONFIG_CPU_FREQ),y)
met-y += $(MET_CORE)/power.o
endif
################################################################################
# MET_EMI
################################################################################
FEATURE_SSPM_EMI := $(if $(FEATURE_SSPM_EMI),$(FEATURE_SSPM_EMI),y)
$(info FEATURE_SSPM_EMI = $(FEATURE_SSPM_EMI))
MET_EMI := $(if $(filter n,$(FEATURE_SSPM_EMI)),n,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 $(KERNEL_SRC)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","")
ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
else
MET_GPU = n
endif
# for mtk_gpu_utility.h
ifneq ("$(wildcard $(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/mtk_gpu_utility.h)","")
ccflags-y += -I$(KERNEL_SRC)/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 $(MET_VCOREDVFS_INC)/mtk_vcorefs_manager.h)","")
ccflags-y += -I$(MET_VCOREDVFS_INC)/
# for mtk_vcorefs_governor.h
ifneq ("$(wildcard $(MET_VCOREDVFS_INC)/mtk_vcorefs_governor.h)","")
ccflags-y += -I$(MET_VCOREDVFS_INC)
else
MET_VCOREDVFS = n
$(info ======== Missing $(MET_VCOREDVFS_INC)/mtk_vcorefs_governor.h ========)
$(info ======== disable MET_VCOREDVFS ========)
endif
# for helio-dvfsrc.h
ifneq ("$(wildcard $(KERNEL_SRC)/drivers/devfreq/helio-dvfsrc.h)","")
ccflags-y += -I$(KERNEL_SRC)/drivers/devfreq/
else
MET_VCOREDVFS = n
$(info ======== Missing $(KERNEL_SRC)/drivers/devfreq/helio-dvfsrc.h ========)
$(info ======== disable MET_VCOREDVFS ========)
endif
else
MET_VCOREDVFS := n
endif
met-$(MET_VCOREDVFS) += $(MET_CORE)/met_vcoredvfs.o
################################################################################
# MET_PTPOD
################################################################################
MET_PTPOD := y
# for mtk_gpufreq.h
ifneq ("$(wildcard $(KERNEL_SRC)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","")
ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/
else
MET_PTPOD = n
endif
# for mtk_cpufreq_api.h
ifneq ("$(wildcard $(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/mach/mtk_cpufreq_api.h)","")
ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/
else
MET_PTPOD = n
endif
# for mtk_cpufreq_config.h
ifneq ("$(wildcard $(MET_PTPOD_INC)/mtk_cpufreq_config.h)","")
ccflags-y += -I$(MET_PTPOD_INC)
else
MET_PTPOD = n
endif
#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$(KERNEL_SRC)/drivers/misc/mediatek/sspm
subdir-ccflags-y += -I$(KERNEL_SRC)/drivers/misc/mediatek/sspm/$(MTK_PLATFORM)
met-y += $(MET_CORE)/sspm/sspm_ipi_handle.o
endif
#################################################################################
# add met_device flags
#################################################################################
ccflags-y += $(foreach v, $(filter MET_%,$(.VARIABLES)), $(if $(filter $($(v)),y),-D$(v)))