From 0f9ba5f0cc8869e10cac54fce68c617344c32125 Mon Sep 17 00:00:00 2001 From: Depeng Shao Date: Wed, 16 Sep 2020 21:11:23 +0800 Subject: [PATCH] msm: camera: isp: Fix some stability issues This change updates the order of error notification, in case the UMD already receive the error notification and power down the isp, then the following register dump may meet problem. This change also add lock protection for csid cmd processing, in case the csid has released before processing the cmd. CRs-Fixed: 2783264 Change-Id: I7399d819d1cdadb96b6824cdb4b53aa0167e527b Signed-off-by: Depeng Shao --- .../isp_hw/ife_csid_hw/cam_ife_csid_core.c | 4 ++++ .../isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c index a99d3f902e24..d4821d9f7420 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c @@ -4208,6 +4208,8 @@ static int cam_ife_csid_process_cmd(void *hw_priv, csid_hw_info = (struct cam_hw_info *)hw_priv; csid_hw = (struct cam_ife_csid_hw *)csid_hw_info->core_info; + mutex_lock(&csid_hw->hw_info->hw_mutex); + switch (cmd_type) { case CAM_IFE_CSID_CMD_GET_TIME_STAMP: rc = cam_ife_csid_get_time_stamp(csid_hw, cmd_args); @@ -4251,6 +4253,8 @@ static int cam_ife_csid_process_cmd(void *hw_priv, break; } + mutex_unlock(&csid_hw->hw_info->hw_mutex); + return rc; } diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c index 2cc592014e46..73b0114ba57f 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_camif_ver3.c @@ -1482,10 +1482,6 @@ static int cam_vfe_camif_ver3_handle_irq_bottom_half(void *handler_priv, "current monotonic time stamp seconds %lld:%lld", ts.tv_sec, ts.tv_nsec/1000); - if (camif_priv->event_cb) - camif_priv->event_cb(camif_priv->priv, - CAM_ISP_HW_EVENT_ERROR, (void *)&evt_info); - ret = CAM_VFE_IRQ_STATUS_OVERFLOW; CAM_INFO(CAM_ISP, "ife_clk_src:%lld", @@ -1495,6 +1491,10 @@ static int cam_vfe_camif_ver3_handle_irq_bottom_half(void *handler_priv, if (camif_priv->camif_debug & CAMIF_DEBUG_ENABLE_REG_DUMP) cam_vfe_camif_ver3_reg_dump(camif_node); + + if (camif_priv->event_cb) + camif_priv->event_cb(camif_priv->priv, + CAM_ISP_HW_EVENT_ERROR, (void *)&evt_info); } if (irq_status[CAM_IFE_IRQ_CAMIF_REG_STATUS0] @@ -1514,10 +1514,6 @@ static int cam_vfe_camif_ver3_handle_irq_bottom_half(void *handler_priv, "current monotonic time stamp seconds %lld:%lld", ts.tv_sec, ts.tv_nsec/1000); - if (camif_priv->event_cb) - camif_priv->event_cb(camif_priv->priv, - CAM_ISP_HW_EVENT_ERROR, (void *)&evt_info); - ret = CAM_VFE_IRQ_STATUS_VIOLATION; CAM_INFO(CAM_ISP, "ife_clk_src:%lld", @@ -1527,6 +1523,10 @@ static int cam_vfe_camif_ver3_handle_irq_bottom_half(void *handler_priv, if (camif_priv->camif_debug & CAMIF_DEBUG_ENABLE_REG_DUMP) cam_vfe_camif_ver3_reg_dump(camif_node); + + if (camif_priv->event_cb) + camif_priv->event_cb(camif_priv->priv, + CAM_ISP_HW_EVENT_ERROR, (void *)&evt_info); } if (camif_priv->camif_debug & CAMIF_DEBUG_ENABLE_SENSOR_DIAG_STATUS) {