rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | $(info ======== Build met.ko ... ========) |
| 2 | MET_CORE := common |
| 3 | |
| 4 | obj-m := met.o |
| 5 | |
| 6 | ccflags-y += -I$(srctree)/include/ |
| 7 | ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/ |
| 8 | ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/$(MTK_PLATFORM)/include/ |
| 9 | ccflags-y += -I$(srctree)/../vendor/mediatek/kernel_modules/met_drv/4.4/$(MTK_PLATFORM)/ |
| 10 | |
| 11 | |
| 12 | ccflags-y += $(EXTRA_ARGS) $(EXTRA_CFLAGS) |
| 13 | |
| 14 | met-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 | |
| 33 | CFLAGS_interface.o += -DMET_USER_EVENT_SUPPORT |
| 34 | CFLAGS_met_tag_ex.o += -DMET_USER_EVENT_SUPPORT |
| 35 | |
| 36 | ifeq ($(ARCH), mips) |
| 37 | met-y += $(MET_CORE)/mips_pmu_hw.o |
| 38 | endif #ifeq ($(ARCH), mips) |
| 39 | |
| 40 | ifeq ($(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 |
| 44 | endif #ifeq ($(ARCH), arm) |
| 45 | |
| 46 | ifeq ($(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 |
| 51 | endif |
| 52 | |
| 53 | met-$(CONFIG_CPU_FREQ) += $(MET_CORE)/power.o |
| 54 | |
| 55 | |
| 56 | ################################################################################ |
| 57 | # MET_EMI |
| 58 | ################################################################################ |
| 59 | MET_EMI := y |
| 60 | |
| 61 | met-$(MET_EMI) += $(MET_CORE)/met_emi.o \ |
| 62 | $(MET_CORE)/mtk_emi_bm.o |
| 63 | |
| 64 | |
| 65 | ################################################################################ |
| 66 | # MET_GPU |
| 67 | ################################################################################ |
| 68 | MET_GPU := y |
| 69 | # for mtk_gpufreq.h |
| 70 | ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","") |
| 71 | ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/ |
| 72 | else |
| 73 | MET_GPU = n |
| 74 | endif |
| 75 | |
| 76 | # for mtk_gpu_utility.h |
| 77 | ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/include/mt-plat/mtk_gpu_utility.h)","") |
| 78 | ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat/ |
| 79 | else |
| 80 | MET_GPU = n |
| 81 | endif |
| 82 | |
| 83 | met-$(MET_GPU) += $(MET_CORE)/mtk_gpu_metmonitor.o |
| 84 | |
| 85 | |
| 86 | ################################################################################ |
| 87 | # MET_VCOREDVFS |
| 88 | ################################################################################ |
| 89 | MET_VCOREDVFS := y |
| 90 | |
| 91 | # for mtk_vcorefs_manager.h |
| 92 | ifneq ("$(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/ |
| 97 | else |
| 98 | MET_VCOREDVFS = n |
| 99 | endif |
| 100 | |
| 101 | met-$(MET_VCOREDVFS) += $(MET_CORE)/met_vcoredvfs.o |
| 102 | |
| 103 | |
| 104 | ################################################################################ |
| 105 | # MET_PTPOD |
| 106 | ################################################################################ |
| 107 | MET_PTPOD := y |
| 108 | # for mtk_gpufreq.h |
| 109 | ifneq ("$(wildcard $(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/mtk_gpufreq.h)","") |
| 110 | ccflags-y += -I$(srctree)/drivers/misc/mediatek/base/power/$(MTK_PLATFORM)/ |
| 111 | else |
| 112 | MET_PTPOD = n |
| 113 | endif |
| 114 | |
| 115 | # for mtk_cpufreq_api.h |
| 116 | ifneq ("$(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/ |
| 118 | else |
| 119 | MET_PTPOD = n |
| 120 | endif |
| 121 | |
| 122 | # for mtk_cpufreq_config.h |
| 123 | ifneq ("$(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)/ |
| 125 | else 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)/ |
| 127 | else |
| 128 | MET_PTPOD = n |
| 129 | endif |
| 130 | |
| 131 | met-$(MET_PTPOD) += $(MET_CORE)/met_ptpod.o |
| 132 | |
| 133 | |
| 134 | ################################################################################ |
| 135 | # On-die-met SSPM only module |
| 136 | ################################################################################ |
| 137 | ifeq ($(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 |
| 142 | endif |
| 143 | |
| 144 | |
| 145 | ccflags-y += $(foreach v, $(filter MET_%,$(.VARIABLES)), $(if $(filter $($(v)),y),-D$(v))) |
| 146 | |