From a6efb05c3ffe97f2bd234f695870a5525249bb2d Mon Sep 17 00:00:00 2001 From: Venkat Chinta Date: Wed, 17 Jul 2019 17:24:18 -0700 Subject: [PATCH] msm: camera: isp: Move req out of pending list before start This change moves init request out of pending list before starting hardware. Currently if we receive the first SOF and RUP IRQs before start_dev routine has completed, we miss pushing out the init request to free list on the first RUP as wait list will be empty. Change-Id: Icd53e0ebe0d12e264172058d836e6ccfcb7df0c2 Signed-off-by: Venkat Chinta Signed-off-by: Jigarkumar Zala --- drivers/cam_isp/cam_isp_context.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/cam_isp/cam_isp_context.c b/drivers/cam_isp/cam_isp_context.c index 84f5e4937a9e..9c0d4d6c2817 100644 --- a/drivers/cam_isp/cam_isp_context.c +++ b/drivers/cam_isp/cam_isp_context.c @@ -3368,6 +3368,21 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx, goto end; } + /* + * In case of CSID TPG we might receive SOF and RUP IRQs + * before hw_mgr_intf->hw_start has returned. So move + * req out of pending list before hw_start and add it + * back to pending list if hw_start fails. + */ + list_del_init(&req->list); + + if (req_isp->num_fence_map_out) { + list_add_tail(&req->list, &ctx->active_req_list); + ctx_isp->active_req_cnt++; + } else { + list_add_tail(&req->list, &ctx->wait_req_list); + } + start_isp.hw_config.ctxt_to_hw_map = ctx_isp->hw_ctx; start_isp.hw_config.request_id = req->request_id; start_isp.hw_config.hw_update_entries = req_isp->cfg; @@ -3401,18 +3416,12 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx, CAM_ERR(CAM_ISP, "Start HW failed"); ctx->state = CAM_CTX_READY; trace_cam_context_state("ISP", ctx); + list_del_init(&req->list); + list_add(&req->list, &ctx->pending_req_list); goto end; } CAM_DBG(CAM_ISP, "start device success ctx %u", ctx->ctx_id); - list_del_init(&req->list); - - if (req_isp->num_fence_map_out) { - list_add_tail(&req->list, &ctx->active_req_list); - ctx_isp->active_req_cnt++; - } else { - list_add_tail(&req->list, &ctx->wait_req_list); - } end: return rc; }