MALI: utgard: RK: reconstruct platform specific code for devfreq DVFS
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / mali400 / mali / Kbuild
1 #
2 # Copyright (C) 2010-2011 ARM Limited. All rights reserved.
3
4 # This program is free software and is provided to you under the terms of the GNU General Public License version 2
5 # as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
6
7 # A copy of the licence is included with the program, and can also be obtained from Free Software
8 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
9 #
10
11 # This file is called by the Linux build system.
12
13 # set up defaults if not defined by the user
14 TIMESTAMP ?= default
15 OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB ?= 16
16 USING_GPU_UTILIZATION ?= 1
17 PROFILING_SKIP_PP_JOBS ?= 0
18 PROFILING_SKIP_PP_AND_GP_JOBS ?= 0
19 MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP ?= 0
20 MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED ?= 0
21 MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS ?= 0
22 MALI_UPPER_HALF_SCHEDULING ?= 1
23 MALI_ENABLE_CPU_CYCLES ?= 0
24 MALI_PLATFORM ?= rk
25
26 # For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases:
27 # The ARM proprietary product will only include the license/proprietary directory
28 # The GPL product will only include the license/gpl directory
29 ccflags-y += -I$(src)/linux/license/gpl
30
31
32 ifeq ($(USING_GPU_UTILIZATION), 1)
33     ifeq ($(USING_DVFS), 1)
34         $(error USING_GPU_UTILIZATION conflict with USING_DVFS you can read the Integration Guide to choose which one do you need)
35     endif
36 endif
37
38 ifneq ($(MALI_PLATFORM),)
39         EXTRA_DEFINES += -DMALI_FAKE_PLATFORM_DEVICE=1
40         #MALI_PLATFORM_FILES = $(wildcard platform/$(MALI_PLATFORM)/*.c)
41         mali-y += \
42                 platform/$(MALI_PLATFORM)/rk.o
43 endif
44
45 ifeq ($(MALI_PLATFORM_FILES),)
46 ifeq ($(CONFIG_ARCH_EXYNOS4),y)
47 EXTRA_DEFINES += -DMALI_FAKE_PLATFORM_DEVICE=1
48 export MALI_PLATFORM=exynos4
49 export MALI_PLATFORM_FILES_BUILDIN = $(notdir $(wildcard $(src)/platform/$(MALI_PLATFORM)/*.c))
50 export MALI_PLATFORM_FILES_ADD_PREFIX = $(addprefix platform/$(MALI_PLATFORM)/,$(MALI_PLATFORM_FILES_BUILDIN)) 
51 endif
52 endif
53
54 mali-y += \
55         linux/mali_osk_atomics.o \
56         linux/mali_osk_irq.o \
57         linux/mali_osk_wq.o \
58         linux/mali_osk_locks.o \
59         linux/mali_osk_wait_queue.o \
60         linux/mali_osk_low_level_mem.o \
61         linux/mali_osk_math.o \
62         linux/mali_osk_memory.o \
63         linux/mali_osk_misc.o \
64         linux/mali_osk_mali.o \
65         linux/mali_osk_notification.o \
66         linux/mali_osk_time.o \
67         linux/mali_osk_timers.o \
68         linux/mali_osk_bitmap.o
69
70 mali-y += linux/mali_memory.o linux/mali_memory_os_alloc.o
71 mali-y += linux/mali_memory_external.o
72 mali-y += linux/mali_memory_block_alloc.o
73 mali-y += linux/mali_memory_swap_alloc.o
74
75 mali-y += \
76         linux/mali_memory_manager.o \
77         linux/mali_memory_virtual.o \
78         linux/mali_memory_util.o \
79         linux/mali_memory_cow.o \
80         linux/mali_memory_defer_bind.o
81
82 mali-y += \
83         linux/mali_ukk_mem.o \
84         linux/mali_ukk_gp.o \
85         linux/mali_ukk_pp.o \
86         linux/mali_ukk_core.o \
87         linux/mali_ukk_soft_job.o \
88         linux/mali_ukk_timeline.o
89
90 mali-$(CONFIG_MALI_DEVFREQ) += \
91         linux/mali_devfreq.o \
92         common/mali_pm_metrics.o
93
94 # Source files which always are included in a build
95 mali-y += \
96         common/mali_kernel_core.o \
97         linux/mali_kernel_linux.o \
98         common/mali_session.o \
99         linux/mali_device_pause_resume.o \
100         common/mali_kernel_vsync.o \
101         linux/mali_ukk_vsync.o \
102         linux/mali_kernel_sysfs.o \
103         common/mali_mmu.o \
104         common/mali_mmu_page_directory.o \
105         common/mali_mem_validation.o \
106         common/mali_hw_core.o \
107         common/mali_gp.o \
108         common/mali_pp.o \
109         common/mali_pp_job.o \
110         common/mali_gp_job.o \
111         common/mali_soft_job.o \
112         common/mali_scheduler.o \
113         common/mali_executor.o \
114         common/mali_group.o \
115         common/mali_dlbu.o \
116         common/mali_broadcast.o \
117         common/mali_pm.o \
118         common/mali_pmu.o \
119         common/mali_user_settings_db.o \
120         common/mali_kernel_utilization.o \
121         common/mali_control_timer.o \
122         common/mali_l2_cache.o \
123         common/mali_timeline.o \
124         common/mali_timeline_fence_wait.o \
125         common/mali_timeline_sync_fence.o \
126         common/mali_spinlock_reentrant.o \
127         common/mali_pm_domain.o \
128         linux/mali_osk_pm.o \
129         linux/mali_pmu_power_up_down.o \
130         __malidrv_build_info.o
131
132 ifneq ($(wildcard $(src)/linux/mali_slp_global_lock.c),)
133         mali-y += linux/mali_slp_global_lock.o
134 endif
135
136 ifneq ($(MALI_PLATFORM_FILES),)
137         mali-y += $(MALI_PLATFORM_FILES:.c=.o)
138 endif
139
140 ifneq ($(MALI_PLATFORM_FILES_ADD_PREFIX),)
141         mali-y += $(MALI_PLATFORM_FILES_ADD_PREFIX:.c=.o)
142 endif
143
144 mali-$(CONFIG_MALI400_PROFILING) += linux/mali_ukk_profiling.o
145 mali-$(CONFIG_MALI400_PROFILING) += linux/mali_osk_profiling.o
146
147 mali-$(CONFIG_MALI400_INTERNAL_PROFILING) += linux/mali_profiling_internal.o timestamp-$(TIMESTAMP)/mali_timestamp.o
148 ccflags-$(CONFIG_MALI400_INTERNAL_PROFILING) += -I$(src)/timestamp-$(TIMESTAMP)
149
150 mali-$(CONFIG_DMA_SHARED_BUFFER) += linux/mali_memory_dma_buf.o
151 mali-$(CONFIG_DMA_SHARED_BUFFER) += linux/mali_memory_secure.o
152 mali-$(CONFIG_SYNC) += linux/mali_sync.o
153 mali-$(CONFIG_MALI_DMA_BUF_FENCE) += linux/mali_dma_fence.o
154 ccflags-$(CONFIG_SYNC) += -Idrivers/staging/android
155
156 mali-$(CONFIG_MALI400_UMP) += linux/mali_memory_ump.o
157
158 mali-$(CONFIG_MALI_DVFS) += common/mali_dvfs_policy.o
159
160 # Tell the Linux build system from which .o file to create the kernel module
161 obj-$(CONFIG_MALI400) := mali.o
162
163 ccflags-y += $(EXTRA_DEFINES)
164
165 # Set up our defines, which will be passed to gcc
166 ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP)
167 ccflags-y += -DMALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED=$(MALI_PP_SCHEDULER_KEEP_SUB_JOB_STARTS_ALIGNED)
168 ccflags-y += -DMALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS=$(MALI_PP_SCHEDULER_FORCE_NO_JOB_OVERLAP_BETWEEN_APPS)
169 ccflags-y += -DMALI_STATE_TRACKING=1
170 ccflags-y += -DMALI_OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
171 ccflags-y += -DUSING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
172 ccflags-y += -DMALI_ENABLE_CPU_CYCLES=$(MALI_ENABLE_CPU_CYCLES)
173
174 ifeq ($(MALI_UPPER_HALF_SCHEDULING),1)
175         ccflags-y += -DMALI_UPPER_HALF_SCHEDULING
176 endif
177
178 #build-in include path is different
179 ifeq ($(MALI_PLATFORM_FILES),)
180 ccflags-$(CONFIG_MALI400_UMP) += -I$(src)/../ump/include/
181 else
182 ccflags-$(CONFIG_MALI400_UMP) += -I$(src)/../../ump/include/ump
183 endif
184 ccflags-$(CONFIG_MALI400_DEBUG) += -DDEBUG
185
186 # Use our defines when compiling
187 ccflags-y += -I$(src) -I$(src)/include -I$(src)/common -I$(src)/linux -I$(src)/platform -Wno-date-time
188
189 # Get subversion revision number, fall back to only ${MALI_RELEASE_NAME} if no svn info is available
190 MALI_RELEASE_NAME=$(shell cat $(src)/.version 2> /dev/null)
191
192 SVN_INFO = (cd $(src); svn info 2>/dev/null)
193
194 ifneq ($(shell $(SVN_INFO) 2>/dev/null),)
195 # SVN detected
196 SVN_REV := $(shell $(SVN_INFO) | grep '^Revision: '| sed -e 's/^Revision: //' 2>/dev/null)
197 DRIVER_REV := $(MALI_RELEASE_NAME)-r$(SVN_REV)
198 CHANGE_DATE := $(shell $(SVN_INFO) | grep '^Last Changed Date: ' | cut -d: -f2- | cut -b2-)
199 CHANGED_REVISION := $(shell $(SVN_INFO) | grep '^Last Changed Rev: ' | cut -d: -f2- | cut -b2-)
200 REPO_URL := $(shell $(SVN_INFO) | grep '^URL: ' | cut -d: -f2- | cut -b2-)
201
202 else # SVN
203 GIT_REV := $(shell cd $(src); git describe --always 2>/dev/null)
204 ifneq ($(GIT_REV),)
205 # Git detected
206 DRIVER_REV := $(MALI_RELEASE_NAME)-$(GIT_REV)
207 CHANGE_DATE := $(shell cd $(src); git log -1 --format="%ci")
208 CHANGED_REVISION := $(GIT_REV)
209 REPO_URL := $(shell cd $(src); git describe --all --always 2>/dev/null)
210
211 else # Git
212 # No Git or SVN detected
213 DRIVER_REV := $(MALI_RELEASE_NAME)
214 CHANGE_DATE := $(MALI_RELEASE_NAME)
215 CHANGED_REVISION := $(MALI_RELEASE_NAME)
216 endif
217 endif
218
219 ccflags-y += -DSVN_REV_STRING=\"$(DRIVER_REV)\"
220
221 VERSION_STRINGS :=
222 VERSION_STRINGS += API_VERSION=$(shell cd $(src); grep "\#define _MALI_API_VERSION" $(FILES_PREFIX)include/linux/mali/mali_utgard_uk_types.h | cut -d' ' -f 3 )
223 VERSION_STRINGS += REPO_URL=$(REPO_URL)
224 VERSION_STRINGS += REVISION=$(DRIVER_REV)
225 VERSION_STRINGS += CHANGED_REVISION=$(CHANGED_REVISION)
226 VERSION_STRINGS += CHANGE_DATE=$(CHANGE_DATE)
227 VERSION_STRINGS += BUILD_DATE=$(shell date)
228 ifdef CONFIG_MALI400_DEBUG
229 VERSION_STRINGS += BUILD=debug
230 else
231 VERSION_STRINGS += BUILD=release
232 endif
233 VERSION_STRINGS += TARGET_PLATFORM=$(TARGET_PLATFORM)
234 VERSION_STRINGS += MALI_PLATFORM=$(MALI_PLATFORM)
235 VERSION_STRINGS += KDIR=$(KDIR)
236 VERSION_STRINGS += OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=$(OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB)
237 VERSION_STRINGS += USING_UMP=$(CONFIG_MALI400_UMP)
238 VERSION_STRINGS += USING_PROFILING=$(CONFIG_MALI400_PROFILING)
239 VERSION_STRINGS += USING_INTERNAL_PROFILING=$(CONFIG_MALI400_INTERNAL_PROFILING)
240 VERSION_STRINGS += USING_GPU_UTILIZATION=$(USING_GPU_UTILIZATION)
241 VERSION_STRINGS += USING_DVFS=$(CONFIG_MALI_DVFS)
242 VERSION_STRINGS += USING_DMA_BUF_FENCE = $(CONFIG_MALI_DMA_BUF_FENCE)
243 VERSION_STRINGS += MALI_UPPER_HALF_SCHEDULING=$(MALI_UPPER_HALF_SCHEDULING)
244
245 # Create file with Mali driver configuration
246 $(src)/__malidrv_build_info.c:
247         @echo 'const char *__malidrv_build_info(void) { return "malidrv: $(VERSION_STRINGS)";}' > $(src)/__malidrv_build_info.c