diff --git a/Android.mk b/Android.mk index 2904db167f..78d72d8be0 100644 --- a/Android.mk +++ b/Android.mk @@ -16,6 +16,9 @@ DLKM_DIR := $(TOP)/device/qcom/common/dlkm # List of board platforms for which MMRM driver API should be enabled MMRM_BOARDS := taro parrot kalama pineapple +# List of board platforms for which Synx V2 vendor driver API should be enabled +SYNX_VENDOR_BOARDS := pineapple + CAMERA_SRC_FILES := \ $(addprefix $(LOCAL_PATH)/, $(call all-named-files-under,*.h,drivers dt-bindings include))\ $(addprefix $(LOCAL_PATH)/, $(call all-named-files-under,*.mk,config))\ diff --git a/Kbuild b/Kbuild index 6043d135ff..e88f995a87 100644 --- a/Kbuild +++ b/Kbuild @@ -54,7 +54,7 @@ ifeq ($(CONFIG_ARCH_PARROT), y) include $(CAMERA_KERNEL_ROOT)/config/parrot.mk endif -ifdef ($(KBUILD_EXTRA_CONFIGS)) +ifneq ($(KBUILD_EXTRA_CONFIGS),) include $(KBUILD_EXTRA_CONFIGS) endif @@ -71,8 +71,11 @@ LINUXINCLUDE += \ -I$(CAMERA_KERNEL_ROOT)/include/uapi/camera \ -I$(CAMERA_KERNEL_ROOT)/ # Optional include directories +SYNXVENDORDIR=$(CAMERA_KERNEL_ROOT)/../synx-kernel ccflags-$(CONFIG_MSM_GLOBAL_SYNX) += -I$(KERNEL_ROOT)/drivers/media/platform/msm/synx -ccflags-$(CONFIG_MSM_GLOBAL_SYNX_V2) += -I$(KERNEL_ROOT)/drivers/media/platform/msm/synx +ccflags-$(TARGET_SYNX_ENABLE) += -I$(SYNXVENDORDIR)/include/uapi/synx/media +ccflags-$(TARGET_SYNX_ENABLE) += -I$(SYNXVENDORDIR)/msm/synx +ccflags-$(TARGET_SYNX_ENABLE) += -DCONFIG_TARGET_SYNX_ENABLE=1 # After creating lists, add content of 'ccflags-m' variable to 'ccflags-y' one. ccflags-y += ${ccflags-m} @@ -121,7 +124,7 @@ else ccflags-y += -DCONFIG_CAM_PRESIL=1 endif -camera-$(CONFIG_MSM_GLOBAL_SYNX_V2) += drivers/cam_sync/cam_sync_synx.o +camera-$(TARGET_SYNX_ENABLE) += drivers/cam_sync/cam_sync_synx.o camera-$(CONFIG_QCOM_CX_IPEAK) += drivers/cam_utils/cam_cx_ipeak.o camera-$(CONFIG_QCOM_BUS_SCALING) += drivers/cam_utils/cam_soc_bus.o camera-$(CONFIG_INTERCONNECT_QCOM) += drivers/cam_utils/cam_soc_icc.o diff --git a/dependency.mk b/dependency.mk index 5513f054bb..c602bd2b85 100644 --- a/dependency.mk +++ b/dependency.mk @@ -11,12 +11,28 @@ $(info camera-kernel: Found msm-mmrm driver, adding symbol dependency! $(CAM_MMR ifneq ($(TARGET_BOARD_PLATFORM), pineapple) LOCAL_REQUIRED_MODULES := mmrm-module-symvers endif # End of check lanai -CAM_MMRM_EXTRA_CONFIGS ?= $(TOP)/vendor/qcom/opensource/mmrm-driver/config/waipiommrm.conf +CAM_MMRM_EXTRA_CONFIGS ?= $(realpath $(TOP))/vendor/qcom/opensource/mmrm-driver/config/waipiommrm.conf LOCAL_ADDITIONAL_DEPENDENCIES := $(call intermediates-dir-for,DLKM,mmrm-module-symvers)/Module.symvers endif # End of check for board platform MMRM_BOARDS endif # End of find msm-mmrm driver -KBUILD_OPTIONS += KBUILD_EXTRA_SYMBOLS=$(CAM_MMRM_EXTRA_SYMBOLS) -KBUILD_OPTIONS += KBUILD_EXTRA_CONFIGS=$(CAM_MMRM_EXTRA_CONFIGS) +# Check if this board's product.mk finds synx-driver.ko driver +ifeq ($(findstring synx-driver.ko,$(BOARD_VENDOR_KERNEL_MODULES)), synx-driver.ko) +# Assume if synx-driver.ko driver is found, then symbols will be required! + +ifeq ($(call is-board-platform-in-list, $(SYNX_VENDOR_BOARDS)),true) +# Add SYNX driver symbols, requires absolute path +CAM_SYNX_EXTRA_SYMBOLS ?= $(realpath $(TOP))/$(call intermediates-dir-for,DLKM,synx-driver-symvers)/synx-driver-symvers +$(info camera-kernel: Found synx driver, adding symbol dependency! $(CAM_SYNX_EXTRA_SYMBOLS)) +LOCAL_REQUIRED_MODULES := synx-driver-symvers +CAM_SYNX_EXTRA_CONFIGS ?= $(realpath $(TOP))/vendor/qcom/opensource/synx-kernel/config/pineapplesynx.conf +LOCAL_ADDITIONAL_DEPENDENCIES += $(call intermediates-dir-for,DLKM,synx-driver-symvers)/synx-driver-symvers + +endif # End of check for board platform SYNX_VENDOR_BOARDS + +endif # End of find synx driver + +KBUILD_OPTIONS += KBUILD_EXTRA_SYMBOLS=$(CAM_MMRM_EXTRA_SYMBOLS) KBUILD_EXTRA_SYMBOLS+=$(CAM_SYNX_EXTRA_SYMBOLS) +KBUILD_OPTIONS += KBUILD_EXTRA_CONFIGS=$(CAM_MMRM_EXTRA_CONFIGS) KBUILD_EXTRA_CONFIGS+=$(CAM_SYNX_EXTRA_CONFIGS) diff --git a/drivers/cam_sync/cam_sync.c b/drivers/cam_sync/cam_sync.c index e35c68bf10..cc0945b5d5 100644 --- a/drivers/cam_sync/cam_sync.c +++ b/drivers/cam_sync/cam_sync.c @@ -10,7 +10,7 @@ #include #include #include -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX) || IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX) || IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) #include #endif #include "cam_sync_util.h" @@ -357,7 +357,7 @@ int cam_sync_signal(int32_t sync_obj, uint32_t status, uint32_t event_cause) struct sync_table_row *row = NULL; struct list_head parents_list; int rc = 0; -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) struct cam_synx_obj_signal signal_synx_obj; #endif @@ -397,7 +397,7 @@ int cam_sync_signal(int32_t sync_obj, uint32_t status, uint32_t event_cause) row->dma_fence_info.dma_fence_fd, row->name, sync_obj); } -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) /* * Signal associated synx obj */ @@ -974,7 +974,7 @@ end: return rc; } -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) static int cam_sync_synx_obj_cb(int32_t sync_obj, struct cam_synx_obj_signal_sync_obj *signal_sync_obj) { @@ -1351,7 +1351,7 @@ static int cam_generic_fence_process_dma_fence_cmd( return rc; } -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) static int cam_generic_fence_validate_signal_input_info_util( int32_t fence_type, struct cam_generic_fence_cmd_args *fence_cmd_args, @@ -1829,7 +1829,7 @@ static int cam_generic_fence_handle_sync_create( struct cam_generic_fence_config *fence_cfg = NULL; bool synx_obj_created; struct sync_synx_obj_info synx_obj_create; -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) int32_t fence_flag; int32_t synx_obj_row_idx; struct cam_synx_obj_release_params synx_release_params; @@ -1871,7 +1871,7 @@ static int cam_generic_fence_handle_sync_create( dma_fence_created = true; } -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) /* Create a synx object */ if (test_bit(CAM_GENERIC_FENCE_TYPE_SYNX_OBJ, &fence_sel_mask)) { if (dma_fence_created) { @@ -1932,7 +1932,7 @@ static int cam_generic_fence_handle_sync_create( cam_dma_fence_release(&release_params); } -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) /* Release synx obj */ if (synx_obj_created) { synx_release_params.use_row_idx = true; @@ -1964,7 +1964,7 @@ static int cam_generic_fence_handle_sync_create( cam_dma_fence_release(&release_params); } -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) /* Release synx obj */ if (synx_obj_created) { synx_release_params.use_row_idx = true; @@ -1976,7 +1976,7 @@ static int cam_generic_fence_handle_sync_create( goto out_copy; } } -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) /* Register synx object callback */ if (test_bit(CAM_GENERIC_FENCE_TYPE_SYNX_OBJ, &fence_sel_mask)) { rc = cam_synx_obj_register_cb(&fence_cfg->sync_obj, @@ -2040,7 +2040,7 @@ static int cam_generic_fence_handle_sync_release( struct cam_generic_fence_input_info *fence_input_info = NULL; struct cam_generic_fence_config *fence_cfg = NULL; struct cam_sync_check_for_synx_release check_for_synx_release; -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) struct cam_synx_obj_release_params synx_release_params; #endif @@ -2098,7 +2098,7 @@ static int cam_generic_fence_handle_sync_release( } } -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) /* Release associated synx obj */ if (test_bit(CAM_GENERIC_FENCE_TYPE_SYNX_OBJ, &fence_sel_mask)) { if (!check_for_synx_release.sync_created_with_synx) { @@ -2207,7 +2207,7 @@ static int cam_generic_fence_parser( case CAM_GENERIC_FENCE_TYPE_DMA_FENCE: rc = cam_generic_fence_process_dma_fence_cmd(k_ioctl->id, &fence_cmd_args); break; -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) case CAM_GENERIC_FENCE_TYPE_SYNX_OBJ: rc = cam_generic_fence_process_synx_obj_cmd(k_ioctl->id, &fence_cmd_args); break; @@ -2387,7 +2387,7 @@ static int cam_sync_close(struct file *filep) /* Clean dma fence table */ cam_dma_fence_close(); -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) /* Clean synx obj table */ cam_synx_obj_close(); #endif @@ -2709,7 +2709,7 @@ static int cam_sync_component_bind(struct device *dev, trigger_cb_without_switch = false; cam_sync_create_debugfs(); -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) /* Initialize synx obj driver */ rc = cam_synx_obj_driver_init(); if (rc) { @@ -2727,7 +2727,7 @@ static int cam_sync_component_bind(struct device *dev, CAM_DBG(CAM_SYNC, "Component bound successfully"); return rc; -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX) || IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX) || IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) dma_driver_deinit: cam_dma_fence_driver_deinit(); #endif @@ -2753,7 +2753,7 @@ static void cam_sync_component_unbind(struct device *dev, v4l2_device_unregister(sync_dev->vdev->v4l2_dev); cam_sync_media_controller_cleanup(sync_dev); -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) cam_synx_obj_driver_deinit(); #elif IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX) cam_sync_unregister_synx_bind_ops(&sync_dev->params); diff --git a/drivers/cam_sync/cam_sync_private.h b/drivers/cam_sync/cam_sync_private.h index ae21a9ad4b..43fe3c05fa 100644 --- a/drivers/cam_sync/cam_sync_private.h +++ b/drivers/cam_sync/cam_sync_private.h @@ -20,11 +20,11 @@ #include "cam_sync_api.h" #include "cam_sync_dma_fence.h" -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) #include "cam_sync_synx.h" #endif -#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX) || IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX_V2) +#if IS_REACHABLE(CONFIG_MSM_GLOBAL_SYNX) || IS_ENABLED(CONFIG_TARGET_SYNX_ENABLE) #include #endif