ifeq ($(CONFIG_SOCT_KMOD_CFLAGS),)
ccflags-y += $(CONFIG_SOCT_KMOD_CFLAGS)
endif

ccflags-y += -fstack-protector-all
ccflags-y += -Wall -Werror

ifneq ($(findstring $(CONFIG_SOCT_CHIP_TYPE), "wudangstick", "shaolingun"),)
HAL_DIR := hal/hal_v1_0
endif

ifneq ($(findstring $(CONFIG_SOCT_CHIP_TYPE), "shaolinsword", "shaolinknive" "hi3751v811"),)
ifneq ($(findstring $(CONFIG_SOCT_CHIP_REVERSION), "shaolinsword_c","hi3751v811_c", ),)
    HAL_DIR := hal/hal_v2_0
else
    HAL_DIR := hal/hal_v3_0
endif
endif

ifneq ($(findstring $(CONFIG_SOCT_CHIP_TYPE), "shaolinaxe"),)
HAL_DIR := hal/hal_v4_0
endif

ccflags-y += -Idrivers/drv/common/include
ccflags-y += -Idrivers/drv/ioctl_inc/generic
ccflags-y += -Idrivers/drv/ioctl_inc/common
ccflags-y += -Idrivers/drv/ioctl_inc/gpio
ccflags-y += -Idrivers/drv/ext_inc/base
ccflags-y += -Idrivers/drv/ext_inc/osal
ccflags-y += -Idrivers/drv/ext_inc/common
ccflags-y += -Idrivers/drv/ext_inc/gpio
ccflags-y += -Idrivers/drv/ext_inc/mailbox
ccflags-y += -Idrivers/drv/ext_inc/otp
ccflags-y += -Idrivers/drv/ext_inc/dvfs
ccflags-y += -Idrivers/drv/dvfs
ccflags-y += -Idrivers/drv/dvfs/hal

MODNAME := soc_dvfs

ifeq ($(CONFIG_SOCT_DRV_BUILDIN),y)
obj-$(CONFIG_SOCT_DVFS_SUPPORT) += $(MODNAME).o
else
obj-m += $(MODNAME).o
endif

$(MODNAME)-objs-y += drv_dvfs_intf.o
$(MODNAME)-objs-y += drv_dvfs.o
$(MODNAME)-objs-y += drv_dvfs_update.o
$(MODNAME)-objs-y += drv_dvfs_proc.o
$(MODNAME)-objs-$(CONFIG_SOCT_TEMP_CTRL_SUPPORT) += drv_dvfs_temp_ctrl.o
$(MODNAME)-objs-$(CONFIG_SOCT_TEMP_CTRL_SUPPORT) += drv_dvfs_temp_adapt.o
$(MODNAME)-objs-$(CONFIG_SOCT_CPU_HOTPLUG_SUPPORT) += drv_dvfs_hotplug.o

$(MODNAME)-objs-y += $(HAL_DIR)/drv_dvfs_volt_calc.o
$(MODNAME)-objs-y += $(HAL_DIR)/drv_dvfs_core_regulator.o
$(MODNAME)-objs-y += $(HAL_DIR)/drv_dvfs_temp_reaction.o
$(MODNAME)-objs-$(CONFIG_SOCT_CPU_MARKER_SUPPORT) += $(HAL_DIR)/drv_dvfs_marker.o

$(MODNAME)-objs := $($(MODNAME)-objs-y)
