Эх сурвалжийг харах

msm: camera: isp: Reset the out of sync count

Reset the out of sync count once VFE can get valid
SOF irq.

CRs-Fixed: 3311867
Change-Id: I1671cb03616fba89597e2fe7d2d37c310fa20102
Signed-off-by: Depeng Shao <[email protected]>
Depeng Shao 2 жил өмнө
parent
commit
f68c008e5c

+ 42 - 0
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

@@ -12403,6 +12403,41 @@ end:
 	return rc;
 	return rc;
 }
 }
 
 
+static int cam_hw_mgr_reset_out_of_sync_cnt(
+	struct cam_ife_hw_mgr_ctx *ife_ctx)
+{
+	int                                           rc = -EINVAL;
+	uint32_t                                      i;
+	struct cam_isp_hw_mgr_res                    *hw_mgr_res;
+	struct cam_hw_intf                           *hw_intf;
+	struct cam_csid_reset_out_of_sync_count_args  args;
+
+	list_for_each_entry(hw_mgr_res,
+		&ife_ctx->res_list_ife_csid, list) {
+		for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
+			if (!hw_mgr_res->hw_res[i])
+				continue;
+
+			hw_intf = hw_mgr_res->hw_res[i]->hw_intf;
+			if (hw_intf->hw_ops.process_cmd) {
+				args.node_res =
+					hw_mgr_res->hw_res[i];
+
+				rc = hw_intf->hw_ops.process_cmd(
+					hw_intf->hw_priv,
+					CAM_IFE_CSID_RESET_OUT_OF_SYNC_CNT,
+					&args,
+					sizeof(args));
+				if (rc)
+					CAM_ERR(CAM_ISP,
+						"Failed to reset out of sync cnt");
+			}
+		}
+	}
+
+	return rc;
+}
+
 static void *cam_ife_mgr_user_dump_stream_info(
 static void *cam_ife_mgr_user_dump_stream_info(
 	void *dump_struct, uint8_t *addr_ptr)
 	void *dump_struct, uint8_t *addr_ptr)
 {
 {
@@ -13672,6 +13707,8 @@ static int cam_ife_hw_mgr_handle_hw_sof(
 				&sof_done_event_data.boot_time, NULL);
 				&sof_done_event_data.boot_time, NULL);
 		}
 		}
 
 
+		cam_hw_mgr_reset_out_of_sync_cnt(ife_hw_mgr_ctx);
+
 		if (atomic_read(&ife_hw_mgr_ctx->overflow_pending))
 		if (atomic_read(&ife_hw_mgr_ctx->overflow_pending))
 			break;
 			break;
 
 
@@ -13686,11 +13723,16 @@ static int cam_ife_hw_mgr_handle_hw_sof(
 	case CAM_ISP_HW_VFE_IN_RDI3:
 	case CAM_ISP_HW_VFE_IN_RDI3:
 		if (!cam_isp_is_ctx_primary_rdi(ife_hw_mgr_ctx))
 		if (!cam_isp_is_ctx_primary_rdi(ife_hw_mgr_ctx))
 			break;
 			break;
+
 		cam_ife_mgr_cmd_get_sof_timestamp(ife_hw_mgr_ctx,
 		cam_ife_mgr_cmd_get_sof_timestamp(ife_hw_mgr_ctx,
 			&sof_done_event_data.timestamp,
 			&sof_done_event_data.timestamp,
 			&sof_done_event_data.boot_time, NULL);
 			&sof_done_event_data.boot_time, NULL);
+
+		cam_hw_mgr_reset_out_of_sync_cnt(ife_hw_mgr_ctx);
+
 		if (atomic_read(&ife_hw_mgr_ctx->overflow_pending))
 		if (atomic_read(&ife_hw_mgr_ctx->overflow_pending))
 			break;
 			break;
+
 		ife_hw_irq_sof_cb(ife_hw_mgr_ctx->common.cb_priv,
 		ife_hw_irq_sof_cb(ife_hw_mgr_ctx->common.cb_priv,
 			CAM_ISP_HW_EVENT_SOF, (void *)&sof_done_event_data);
 			CAM_ISP_HW_EVENT_SOF, (void *)&sof_done_event_data);
 		break;
 		break;

+ 4 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver1.c

@@ -3767,6 +3767,10 @@ static int cam_ife_csid_ver1_process_cmd(void *hw_priv,
 		/* Not supported for V1 */
 		/* Not supported for V1 */
 		rc = 0;
 		rc = 0;
 		break;
 		break;
+	case CAM_IFE_CSID_RESET_OUT_OF_SYNC_CNT:
+		/* Not supported for V1 */
+		rc = 0;
+		break;
 	default:
 	default:
 		CAM_ERR(CAM_ISP, "CSID:%d unsupported cmd:%d",
 		CAM_ERR(CAM_ISP, "CSID:%d unsupported cmd:%d",
 			csid_hw->hw_intf->hw_idx, cmd_type);
 			csid_hw->hw_intf->hw_idx, cmd_type);

+ 26 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c

@@ -5734,6 +5734,29 @@ end:
 	return 0;
 	return 0;
 }
 }
 
 
+static int cam_ife_csid_ver2_reset_out_of_sync_cnt(
+	struct cam_ife_csid_ver2_hw  *csid_hw, void *args)
+{
+	struct cam_ife_csid_ver2_path_cfg  *path_cfg = NULL;
+	struct cam_isp_resource_node       *res = NULL;
+
+	res = ((struct cam_csid_reset_out_of_sync_count_args *)args)->node_res;
+	path_cfg = (struct cam_ife_csid_ver2_path_cfg *)res->res_priv;
+
+	if (!path_cfg) {
+		CAM_ERR(CAM_ISP, "Invalid res %s", res->res_name);
+		return -EINVAL;
+	}
+
+	atomic_set(&path_cfg->switch_out_of_sync_cnt, 0);
+
+	CAM_DBG(CAM_ISP,
+		"Reset out of sync cnt for res:%s",
+		res->res_name);
+
+	return 0;
+}
+
 static int cam_ife_csid_ver2_drv_config(
 static int cam_ife_csid_ver2_drv_config(
 	struct cam_ife_csid_ver2_hw  *csid_hw, void *cmd_args)
 	struct cam_ife_csid_ver2_hw  *csid_hw, void *cmd_args)
 {
 {
@@ -5899,6 +5922,9 @@ static int cam_ife_csid_ver2_process_cmd(void *hw_priv,
 	case CAM_ISP_HW_CMD_DRV_CONFIG:
 	case CAM_ISP_HW_CMD_DRV_CONFIG:
 		rc = cam_ife_csid_ver2_drv_config(csid_hw, cmd_args);
 		rc = cam_ife_csid_ver2_drv_config(csid_hw, cmd_args);
 		break;
 		break;
+	case CAM_IFE_CSID_RESET_OUT_OF_SYNC_CNT:
+		rc = cam_ife_csid_ver2_reset_out_of_sync_cnt(csid_hw, cmd_args);
+		break;
 	default:
 	default:
 		CAM_ERR(CAM_ISP, "CSID:%d unsupported cmd:%d",
 		CAM_ERR(CAM_ISP, "CSID:%d unsupported cmd:%d",
 			csid_hw->hw_intf->hw_idx, cmd_type);
 			csid_hw->hw_intf->hw_idx, cmd_type);

+ 9 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_ife_csid_hw_intf.h

@@ -334,6 +334,15 @@ struct cam_csid_reset_cfg_args {
 	struct cam_isp_resource_node  *node_res;
 	struct cam_isp_resource_node  *node_res;
 };
 };
 
 
+/**
+ * struct cam_csid_reset_out_of_sync_count_args
+ * @res_node :   resource need to be reset
+ *
+ */
+struct cam_csid_reset_out_of_sync_count_args {
+	struct cam_isp_resource_node  *node_res;
+};
+
 /**
 /**
  * struct cam_csid_get_time_stamp_args-  time stamp capture arguments
  * struct cam_csid_get_time_stamp_args-  time stamp capture arguments
  * @node_res            : resource to get the time stamp
  * @node_res            : resource to get the time stamp

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_isp_hw.h

@@ -205,6 +205,7 @@ enum cam_isp_hw_cmd_type {
 	CAM_IFE_CSID_TOP_CONFIG,
 	CAM_IFE_CSID_TOP_CONFIG,
 	CAM_IFE_CSID_PROGRAM_OFFLINE_CMD,
 	CAM_IFE_CSID_PROGRAM_OFFLINE_CMD,
 	CAM_IFE_CSID_SET_DUAL_SYNC_CONFIG,
 	CAM_IFE_CSID_SET_DUAL_SYNC_CONFIG,
+	CAM_IFE_CSID_RESET_OUT_OF_SYNC_CNT,
 	CAM_ISP_HW_CMD_CSID_DYNAMIC_SWITCH_UPDATE,
 	CAM_ISP_HW_CMD_CSID_DYNAMIC_SWITCH_UPDATE,
 	CAM_ISP_HW_CMD_CSID_DISCARD_INIT_FRAMES,
 	CAM_ISP_HW_CMD_CSID_DISCARD_INIT_FRAMES,
 	CAM_ISP_HW_CMD_BUF_UPDATE,
 	CAM_ISP_HW_CMD_BUF_UPDATE,