From 1f40c7a4673f5dcd47fb7dedde1a84c9aa39b057 Mon Sep 17 00:00:00 2001 From: Mangalaram ARCHANA Date: Thu, 5 Dec 2019 15:32:46 +0530 Subject: [PATCH] msm: camera: reqmgr: skip re_apply of ISP for buf_done request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit crm applied both sensor and isp packets,sensor packet failed to apply due to CCI timeout error. In the meantime ISP packet applied and that request of ISP moved to free_list.In the next epoch crm trying to reapply both the packets of sensor and isp again.In this case ISP always reporting an apply failure because its pending queue doesn’t have that request.To handle this we are skipping to re-apply the ISP successful buf_done request and trying to apply only sensor packet in this scenario. CRs-Fixed: 2599186 Change-Id: Id7e72fc016a75782b57f05558c615b069b416ffe Signed-off-by: Mangalaram ARCHANA --- drivers/cam_isp/cam_isp_context.c | 8 ++++++++ drivers/cam_req_mgr/cam_req_mgr_core.c | 5 +++++ drivers/cam_req_mgr/cam_req_mgr_core.h | 2 ++ drivers/cam_req_mgr/cam_req_mgr_debug.c | 9 ++++++++- drivers/cam_req_mgr/cam_req_mgr_interface.h | 2 ++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/cam_isp/cam_isp_context.c b/drivers/cam_isp/cam_isp_context.c index 5843b6be1042..6a02b4acd10f 100644 --- a/drivers/cam_isp/cam_isp_context.c +++ b/drivers/cam_isp/cam_isp_context.c @@ -2485,6 +2485,14 @@ static int __cam_isp_ctx_apply_req_in_activated_state( goto end; } + if (apply->re_apply) + if (apply->request_id <= ctx_isp->last_applied_req_id) { + CAM_INFO(CAM_ISP, + "Trying to reapply the same request %llu again", + apply->request_id); + return 0; + } + spin_lock_bh(&ctx->lock); req = list_first_entry(&ctx->pending_req_list, struct cam_ctx_request, list); diff --git a/drivers/cam_req_mgr/cam_req_mgr_core.c b/drivers/cam_req_mgr/cam_req_mgr_core.c index b5f10a232b89..af27858834b9 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_core.c +++ b/drivers/cam_req_mgr/cam_req_mgr_core.c @@ -659,6 +659,11 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link, apply_req.link_hdl = link->link_hdl; apply_req.report_if_bubble = 0; + apply_req.re_apply = false; + if (link->retry_cnt > 0) { + if (g_crm_core_dev->recovery_on_apply_fail) + apply_req.re_apply = true; + } for (i = 0; i < link->num_devs; i++) { dev = &link->l_dev[i]; diff --git a/drivers/cam_req_mgr/cam_req_mgr_core.h b/drivers/cam_req_mgr/cam_req_mgr_core.h index 8324e706cbe5..991eaf9f3344 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_core.h +++ b/drivers/cam_req_mgr/cam_req_mgr_core.h @@ -406,10 +406,12 @@ struct cam_req_mgr_core_session { * - Core camera request manager data struct * @session_head : list head holding sessions * @crm_lock : mutex lock to protect session creation & destruction + * @recovery_on_apply_fail : Recovery on apply failure using debugfs. */ struct cam_req_mgr_core_device { struct list_head session_head; struct mutex crm_lock; + bool recovery_on_apply_fail; }; /** diff --git a/drivers/cam_req_mgr/cam_req_mgr_debug.c b/drivers/cam_req_mgr/cam_req_mgr_debug.c index 6b428c41c1b0..db6bec704370 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_debug.c +++ b/drivers/cam_req_mgr/cam_req_mgr_debug.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. */ #include "cam_req_mgr_debug.h" @@ -128,5 +128,12 @@ int cam_req_mgr_debug_register(struct cam_req_mgr_core_device *core_dev) debugfs_root, core_dev, &bubble_recovery)) return -ENOMEM; + if (!debugfs_create_bool("recovery_on_apply_fail", + 0644, + debugfs_root, + &core_dev->recovery_on_apply_fail)) { + return -ENOMEM; + } + return 0; } diff --git a/drivers/cam_req_mgr/cam_req_mgr_interface.h b/drivers/cam_req_mgr/cam_req_mgr_interface.h index e2e69c3cd2f7..12b3e63c3764 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_interface.h +++ b/drivers/cam_req_mgr/cam_req_mgr_interface.h @@ -320,6 +320,7 @@ struct cam_req_mgr_core_dev_link_setup { * @request_id : request id settings to apply * @report_if_bubble : report to crm if failure in applying * @trigger_point : the trigger point of this apply + * @re_apply : to skip re_apply for buf_done request * */ struct cam_req_mgr_apply_request { @@ -328,6 +329,7 @@ struct cam_req_mgr_apply_request { uint64_t request_id; int32_t report_if_bubble; uint32_t trigger_point; + bool re_apply; }; /**