From f49b4dd0b9179677aa177b248fc383593cc625f4 Mon Sep 17 00:00:00 2001 From: Wyes Karny Date: Mon, 15 Nov 2021 13:08:06 +0530 Subject: [PATCH 1/4] msm: camera: cdm: Fix deadlock issue in CDM handle error Fix deadlock issue in CDM handle error. CRs-Fixed: 3073203 Change-Id: Ia63e1841fc00e74e4c03a1d6b28e94814748aa8f Signed-off-by: Wyes Karny --- drivers/cam_cdm/cam_cdm_hw_core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/cam_cdm/cam_cdm_hw_core.c b/drivers/cam_cdm/cam_cdm_hw_core.c index 583963a0d6e2..bd1e938a0d0f 100644 --- a/drivers/cam_cdm/cam_cdm_hw_core.c +++ b/drivers/cam_cdm/cam_cdm_hw_core.c @@ -1809,11 +1809,9 @@ int cam_hw_cdm_handle_error_info( if (node != NULL) { if (node->request_type == CAM_HW_CDM_BL_CB_CLIENT) { - mutex_lock(&cdm_hw->hw_mutex); cam_cdm_notify_clients(cdm_hw, CAM_CDM_CB_STATUS_HW_ERROR, (void *)node); - mutex_unlock(&cdm_hw->hw_mutex); } else if (node->request_type == CAM_HW_CDM_BL_CB_INTERNAL) { CAM_ERR(CAM_CDM, "Invalid node=%pK %d", node, node->request_type); From 572462dbf6f2ca50fad3c9207b906fcdf56700f9 Mon Sep 17 00:00:00 2001 From: Tejas Prajapati Date: Thu, 11 Nov 2021 12:43:59 +0530 Subject: [PATCH 2/4] msm: camera: isp: handle buf_done at apply failure from deferred list For RDI only context where the buf_done is handled from wait list, if the buf_done is moved to deferred list then the bubble recovery might fail. To make sure the bubble is processed the request needs to be moved pending list. This change helps moving the request from active list to pending list. CRs-Fixed: 3079621 Change-Id: Ibb271e68ca2312cbd3d71bd64e2ed7963bf60b55 Signed-off-by: Tejas Prajapati --- drivers/cam_isp/cam_isp_context.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/cam_isp/cam_isp_context.c b/drivers/cam_isp/cam_isp_context.c index 87779aea1a16..9992e6261956 100644 --- a/drivers/cam_isp/cam_isp_context.c +++ b/drivers/cam_isp/cam_isp_context.c @@ -4119,6 +4119,16 @@ static int __cam_isp_ctx_rdi_only_sof_in_bubble_state( CAM_DBG(CAM_ISP, "CDM callback detected for req: %lld, possible buf_done delay, waiting for buf_done", req->request_id); + if (req_isp->num_fence_map_out == + req_isp->num_deferred_acks) { + __cam_isp_handle_deferred_buf_done(ctx_isp, req, + true, + CAM_SYNC_STATE_SIGNALED_ERROR, + CAM_SYNC_ISP_EVENT_BUBBLE); + + __cam_isp_ctx_handle_buf_done_for_req_list( + ctx_isp, req); + } goto end; } else { CAM_WARN(CAM_ISP, From 1f76cca6da19481a659a84a33f19917111017c25 Mon Sep 17 00:00:00 2001 From: sokchetra eung Date: Fri, 27 Aug 2021 15:54:21 -0700 Subject: [PATCH 3/4] msm: camera: reqmgr: Prevent session deadlock Releasing session lock before unlink and acquiring it immediately after to allow workq to be done. Check link state after acquiring session lock in process_ req to return if link is IDLE. CRs-Fixed: 3003287 Change-Id: Ie7a8ffc4edcb123db290d6da047d748b3e99d68b Signed-off-by: sokchetra eung --- drivers/cam_req_mgr/cam_req_mgr_core.c | 34 ++++++++++++++++---------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/cam_req_mgr/cam_req_mgr_core.c b/drivers/cam_req_mgr/cam_req_mgr_core.c index 18dcb1bc2b96..05e6fdb90381 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_core.c +++ b/drivers/cam_req_mgr/cam_req_mgr_core.c @@ -1714,20 +1714,20 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link, return -EINVAL; } + mutex_lock(&session->lock); /* - * In case if the wq is scheduled while destroying session - * the session mutex is already taken and will cause a - * dead lock. To avoid further processing check link state - * and exit. + * During session destroy/unlink the link state is updated and session + * mutex is released when flushing the workq. In case the wq is scheduled + * thereafter this API will then check the updated link state and exit */ spin_lock_bh(&link->link_state_spin_lock); if (link->state == CAM_CRM_LINK_STATE_IDLE) { spin_unlock_bh(&link->link_state_spin_lock); + mutex_unlock(&session->lock); return -EPERM; } spin_unlock_bh(&link->link_state_spin_lock); - mutex_lock(&session->lock); in_q = link->req.in_q; /* * Check if new read index, @@ -3786,13 +3786,17 @@ end: /** * __cam_req_mgr_unlink() * - * @brief : Unlink devices on a link structure from the session - * @link : Pointer to the link structure + * @brief : Unlink devices on a link structure from the session + * This API is to be invoked with session mutex held + * @session: session of the link + * @link : Pointer to the link structure * * @return: 0 for success, negative for failure * */ -static int __cam_req_mgr_unlink(struct cam_req_mgr_core_link *link) +static int __cam_req_mgr_unlink( + struct cam_req_mgr_core_session *session, + struct cam_req_mgr_core_link *link) { int rc; @@ -3808,14 +3812,16 @@ static int __cam_req_mgr_unlink(struct cam_req_mgr_core_link *link) } mutex_lock(&link->lock); - spin_lock_bh(&link->link_state_spin_lock); /* Destroy timer of link */ crm_timer_exit(&link->watchdog); spin_unlock_bh(&link->link_state_spin_lock); + /* Release session mutex for workq processing */ + mutex_unlock(&session->lock); /* Destroy workq of link */ cam_req_mgr_workq_destroy(&link->workq); - + /* Acquire session mutex after workq flush */ + mutex_lock(&session->lock); /* Cleanup request tables and unlink devices */ __cam_req_mgr_destroy_link_info(link); /* Free memory holding data of linked devs */ @@ -3857,6 +3863,7 @@ int cam_req_mgr_destroy_session( goto end; } + mutex_lock(&cam_session->lock); if (cam_session->num_links) { CAM_DBG(CAM_CRM, "destroy session %x num_active_links %d", @@ -3872,7 +3879,7 @@ int cam_req_mgr_destroy_session( link->link_hdl); /* Ignore return value since session is going away */ link->is_shutdown = is_shutdown; - __cam_req_mgr_unlink(link); + __cam_req_mgr_unlink(cam_session, link); __cam_req_mgr_free_link(link); } } @@ -4153,8 +4160,9 @@ int cam_req_mgr_unlink(struct cam_req_mgr_unlink_info *unlink_info) rc = -EINVAL; goto done; } - - rc = __cam_req_mgr_unlink(link); + mutex_lock(&cam_session->lock); + rc = __cam_req_mgr_unlink(cam_session, link); + mutex_unlock(&cam_session->lock); /* Free curent link and put back into session's free pool of links */ __cam_req_mgr_unreserve_link(cam_session, link); From ce9b4b3f1227d3667fa11f6c49af8e0907f8d26d Mon Sep 17 00:00:00 2001 From: Zhenlin Lian Date: Tue, 16 Nov 2021 13:53:58 +0800 Subject: [PATCH 4/4] msm: camera: config: Enable camera drivers for qcs610 Add camera config files for target qcs610. Change-Id: I4fefaa0254aa8267b4375bb4270f286f46ec7997 Signed-off-by: Zhenlin Lian --- Makefile | 9 +++++++++ config/sm6150camera.conf | 18 ++++++++++++++++++ config/sm6150cameraconf.h | 12 ++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 config/sm6150camera.conf create mode 100644 config/sm6150cameraconf.h diff --git a/Makefile b/Makefile index cb00746debf3..2568ff61c873 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,10 @@ ifeq ($(CONFIG_ARCH_YUPIK), y) include $(srctree)/techpack/camera/config/yupikcamera.conf endif +ifeq ($(CONFIG_ARCH_SM6150), y) +include $(srctree)/techpack/camera/config/sm6150camera.conf +endif + ifeq ($(CONFIG_ARCH_KONA), y) LINUXINCLUDE += \ -include $(srctree)/techpack/camera/config/konacameraconf.h @@ -83,6 +87,11 @@ LINUXINCLUDE += \ -include $(srctree)/techpack/camera/config/yupikcameraconf.h endif +ifeq ($(CONFIG_ARCH_SM6150), y) +LINUXINCLUDE += \ + -include $(srctree)/techpack/camera/config/sm6150cameraconf.h +endif + endif ifneq (,$(filter $(CONFIG_SPECTRA_CAMERA), y m)) diff --git a/config/sm6150camera.conf b/config/sm6150camera.conf new file mode 100644 index 000000000000..66b3a4cd548f --- /dev/null +++ b/config/sm6150camera.conf @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (c) 2021, The Linux Foundation. All rights reserved. + +ifeq ($(CONFIG_QGKI),y) +export CONFIG_SPECTRA_CAMERA=m +$(info "QGKI Spectra Camera Building as DLKM") +else +export CONFIG_SPECTRA_CAMERA=m +$(info "GKI Spectra Camera Building as DLKM") +endif + +ifneq (,$(filter $(CONFIG_SPECTRA_CAMERA), y m)) +export CONFIG_SPECTRA_ISP=y +export CONFIG_SPECTRA_SENSOR=y +export CONFIG_SPECTRA_ICP=y +export CONFIG_SPECTRA_JPEG=y +export CONFIG_SPECTRA_CUSTOM=y +endif diff --git a/config/sm6150cameraconf.h b/config/sm6150cameraconf.h new file mode 100644 index 000000000000..d736f140093e --- /dev/null +++ b/config/sm6150cameraconf.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2021, The Linux Foundation. All rights reserved. + */ + + +#define CONFIG_SPECTRA_CAMERA 1 +#define CONFIG_SPECTRA_ISP 1 +#define CONFIG_SPECTRA_SENSOR 1 +#define CONFIG_SPECTRA_ICP 1 +#define CONFIG_SPECTRA_JPEG 1 +#define CONFIG_SPECTRA_CUSTOM 1