kernel_samsung_a34x-permissive/drivers/misc/mediatek/connectivity/fmradio/Kbuild

180 lines
4.9 KiB
Makefile

# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2021 Mediatek Inc.
CFG_FM_CHIP := mt6635
CFG_FM_PLAT := connac2x
###############################################################################
# Necessary Check
ifneq ($(KERNEL_OUT),)
ccflags-y += -imacros $(KERNEL_OUT)/include/generated/autoconf.h
endif
ifndef TOP
TOP := $(srctree)/..
endif
# Force build fail on modpost warning
KBUILD_MODPOST_FAIL_ON_WARNINGS := y
###############################################################################
# only WMT align this design flow
#ccflags-y += -D MTK_WCN_REMOVE_KERNEL_MODULE
ifeq ($(CONFIG_ARM64), y)
ccflags-y += -D CONFIG_MTK_WCN_ARM64
endif
ifeq ($(CONFIG_MTK_CONN_LTE_IDC_SUPPORT),y)
ccflags-y += -D WMT_IDC_SUPPORT=1
else
ccflags-y += -D WMT_IDC_SUPPORT=0
endif
ccflags-y += -D MTK_WCN_WMT_STP_EXP_SYMBOL_ABSTRACT
ccflags-y += -I$(srctree)/drivers/misc/mediatek/include
ccflags-y += -I$(srctree)/drivers/misc/mediatek/include/mt-plat
ifeq ($(CONFIG_FM_USER_LOAD),1)
ccflags-y += -D CONFIG_MTK_USER_BUILD
endif
# Makefile generated by Mediatek
# fm support
###############################################################################
$(info [fm_drv:Kbuild] M = $(M))
$(info [fm_drv:Kbuild] CFG_FM_PLAT = $(CFG_FM_PLAT))
$(info [fm_drv:Kbuild] CFG_BUILD_CONNAC2 = $(CFG_BUILD_CONNAC2))
$(info [fm_drv:Kbuild] CFG_FM_CHIP_ID = $(CFG_FM_CHIP_ID))
$(info [fm_drv:Kbuild] CFG_FM_CHIP = $(CFG_FM_CHIP))
MODULE_NAME := fmradio_drv_$(CFG_FM_PLAT)
ifeq ($(CONFIG_WLAN_DRV_BUILD_IN),y)
$(info [fm_drv:Kbuild] $(MODULE_NAME) build-in boot.img)
obj-y += $(MODULE_NAME).o
else
$(info [fm_drv:Kbuild] $(MODULE_NAME) is kernel module)
obj-m += $(MODULE_NAME).o
endif
###############################################################################
KO_CODE_PATH := $(if $(filter /%,$(src)),,$(srctree)/)$(src)
$(info [fm_drv:Kbuild] src = $(src))
$(info [fm_drv:Kbuild] KO_CODE_PATH = $(KO_CODE_PATH))
ifeq ($(CFG_FM_CHIP),)
FM_CHIP := mt6631_6635
ccflags-y += -I$(KO_CODE_PATH)/chips/mt6631/inc -I$(KO_CODE_PATH)/chips/mt6635/inc
$(FM_CHIP)-objs += chips/mt6631/pub/mt6631_fm_rds.o
$(FM_CHIP)-objs += chips/mt6635/pub/mt6635_fm_rds.o
$(FM_CHIP)-objs += chips/mt6631/pub/mt6631_fm_lib.o
$(FM_CHIP)-objs += chips/mt6635/pub/mt6635_fm_lib.o
else
ifneq ($(CFG_FM_CHIP_ID),)
# LD 1.0
# CFG_FM_CHIP_ID is platform chip id
ifeq ($(CONFIG_MTK_FM_CHIP),)
$(error CONFIG_MTK_FM_CHIP not defined)
endif
ccflags-y += -D CFG_FM_CHIP_ID=0x$(CFG_FM_CHIP_ID)
FM_CHIP := $(subst _FM,,$(subst MT,mt,$(subst ",,$(CONFIG_MTK_FM_CHIP))))
else
# LD 2.0
# Cannot get platform chip id in LD 2.0
FM_CHIP := $(CFG_FM_CHIP)
endif
ifeq ($(FM_CHIP), mt6625)
FM_CHIP := mt6627
ccflags-y += -DMT6625_FM
endif
ifeq ($(FM_CHIP), mt6627)
FM_CHIP := mt6627
ccflags-y += -DMT6627_FM
endif
ifeq ($(FM_CHIP), mt6580)
FM_CHIP := soc
ccflags-y += -Dsoc
endif
ifeq ($(FM_CHIP), mt0633)
FM_CHIP := soc
ccflags-y += -Dsoc
endif
ifeq ($(FM_CHIP), mt6630)
ccflags-y += -DMT6630_FM
endif
ifeq ($(FM_CHIP), mt6632)
ccflags-y += -DMT6632_FM
endif
ifeq ($(FM_CHIP), mt6631)
ccflags-y += -DMT6631_FM
endif
ifeq ($(FM_CHIP), mt6635)
ccflags-y += -DMT6635_FM
endif
FM_CHIP_PATH := $(FM_CHIP)/pub/$(FM_CHIP)
ccflags-y += -I$(KO_CODE_PATH)/chips/$(FM_CHIP)/inc
ifneq ($(CFG_BUILD_CONNAC2), true)
$(FM_CHIP)-objs += chips/$(FM_CHIP_PATH)_fm_rds.o
$(FM_CHIP)-objs += chips/$(FM_CHIP_PATH)_fm_lib.o
else
$(FM_CHIP)-objs += chips/mt6635/pub/mt6635_fm_rds.o
$(FM_CHIP)-objs += chips/connac2x/pub/connac2x_fm_lib.o
ccflags-y += -DFM_DTS_PROBE
endif
endif
ccflags-y += -I$(KO_CODE_PATH)/inc \
-I$(KO_CODE_PATH)/plat/inc
$(FM_CHIP)-objs += core/fm_module.o \
core/fm_main.o \
core/fm_config.o \
core/fm_rds_parser.o \
core/fm_patch.o \
core/fm_utils.o \
core/fm_link.o \
core/fm_eint.o \
core/fm_cmd.o \
core/fm_reg_utils.o
ifeq ($(CFG_BUILD_CONNAC2), true)
CONNINFRA_SRC_FOLDER := $(srctree)/drivers/misc/mediatek/connectivity/conninfra
ccflags-y += -I$(CONNINFRA_SRC_FOLDER)/include
ccflags-y += -DCFG_FM_CONNAC2=1
$(FM_CHIP)-objs += plat/conn_infra.o
else
WMT_SRC_FOLDER := $(srctree)/drivers/misc/mediatek/connectivity/common
WMT_INCLUDE_PATH := common_main
ccflags-y += -I$(WMT_SRC_FOLDER)/$(WMT_INCLUDE_PATH)/include \
-I$(WMT_SRC_FOLDER)/$(WMT_INCLUDE_PATH)/linux/include
ccflags-y += -DCFG_FM_CONNAC2=0
$(FM_CHIP)-objs += plat/legacy_wmt.o
endif
$(MODULE_NAME)-objs += $($(FM_CHIP)-objs)
#obj-$(CONFIG_MTK_FMRADIO) += private/
obj-y += dummy.o