Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f54a507 authored by Karthik Anantha Ram's avatar Karthik Anantha Ram Committed by Pavan Kumar Chilamkurthi
Browse files

msm: camera: isp: Wait for cdm submit incase of custom HW



If IFE is connected to custom HW in the pipeline, make the cdm
submit a blocking call to ensure settings are programmed to IFE
on time.

CRs-Fixed: 2687917
Change-Id: Ib7a3c44f3f99a30805c1cbf49669dabc27d20431
Signed-off-by: default avatarKarthik Anantha Ram <kartanan@codeaurora.org>
parent f458d8e1
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -2910,6 +2910,7 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)
	}

	ife_ctx->custom_enabled = false;
	ife_ctx->custom_config = 0;
	memset(ife_ctx->cdm_handle, 0, sizeof(ife_ctx->cdm_handle));

	ife_ctx->common.cb_priv = acquire_args->context_data;
@@ -2941,8 +2942,11 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)

		if ((in_port->cust_node) && (!ife_ctx->custom_enabled)) {
			ife_ctx->custom_enabled = true;
			/* This can be obtained from uapi */
			ife_ctx->use_frame_header_ts = true;
			/* These can be obtained from uapi */
			ife_ctx->custom_config |=
				CAM_IFE_CUSTOM_CFG_FRAME_HEADER_TS;
			ife_ctx->custom_config |=
				CAM_IFE_CUSTOM_CFG_SW_SYNC_ON;
		}

		if ((in_port->res_type == CAM_ISP_IFE_IN_RES_CPHY_TPG_0) ||
@@ -3034,7 +3038,8 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)

	acquire_args->ctxt_to_hw_map = ife_ctx;
	acquire_args->custom_enabled = ife_ctx->custom_enabled;
	acquire_args->use_frame_header_ts = ife_ctx->use_frame_header_ts;
	acquire_args->use_frame_header_ts =
		(ife_ctx->custom_config & CAM_IFE_CUSTOM_CFG_FRAME_HEADER_TS);
	ife_ctx->ctx_in_use = 1;
	ife_ctx->num_reg_dump_buf = 0;

@@ -3689,7 +3694,8 @@ static int cam_ife_config_hw_internal_cdm(struct cam_ife_hw_mgr_ctx *ctx,

	for (i = 0; i < ctx->num_base; i++) {
		idx = ctx->base[i].idx;
		if (cfg->init_packet) {
		if ((cfg->init_packet) ||
			(ctx->custom_config & CAM_IFE_CUSTOM_CFG_SW_SYNC_ON)) {
			rem_jiffies = wait_for_completion_timeout(
				&ctx->config_done_complete[idx],
				msecs_to_jiffies(30));
@@ -3779,7 +3785,8 @@ static int cam_ife_config_hw_external_cdm(struct cam_ife_hw_mgr_ctx *ctx,
		return rc;
	}

	if (cfg->init_packet) {
	if ((cfg->init_packet) ||
		(ctx->custom_config & CAM_IFE_CUSTOM_CFG_SW_SYNC_ON)) {
		rem_jiffies = wait_for_completion_timeout(
				&ctx->config_done_complete[0],
				msecs_to_jiffies(30));
@@ -4681,7 +4688,7 @@ static int cam_ife_mgr_release_hw(void *hw_mgr_priv,
	ctx->cdm_ops = NULL;
	ctx->num_reg_dump_buf = 0;
	ctx->custom_enabled = false;
	ctx->use_frame_header_ts = false;
	ctx->custom_config = 0;
	ctx->num_reg_dump_buf = 0;
	ctx->is_dual = false;
	ctx->dsp_enabled = false;
@@ -6163,7 +6170,7 @@ static int cam_ife_mgr_prepare_hw_update(void *hw_mgr_priv,
	if (rc)
		return rc;

	if (ctx->use_frame_header_ts) {
	if (ctx->custom_config & CAM_IFE_CUSTOM_CFG_FRAME_HEADER_TS) {
		rc = cam_ife_mgr_util_insert_frame_header(&kmd_buf,
			prepare_hw_data);
		if (rc)
@@ -7350,7 +7357,8 @@ static int cam_ife_hw_mgr_handle_hw_sof(
				&sof_done_event_data.boot_time);

		/* if frame header is enabled reset qtimer ts */
		if (ife_hw_mgr_ctx->use_frame_header_ts)
		if (ife_hw_mgr_ctx->custom_config &
			CAM_IFE_CUSTOM_CFG_FRAME_HEADER_TS)
			sof_done_event_data.timestamp = 0x0;

		if (atomic_read(&ife_hw_mgr_ctx->overflow_pending))
+6 −2
Original line number Diff line number Diff line
@@ -28,6 +28,10 @@ enum cam_ife_res_master_slave {
#define CAM_IFE_HW_OUT_RES_MAX           (CAM_ISP_IFE_OUT_RES_MAX & 0xFF)
#define CAM_IFE_HW_RES_POOL_MAX          64

/* IFE_HW_MGR custom config */
#define CAM_IFE_CUSTOM_CFG_FRAME_HEADER_TS   BIT(0)
#define CAM_IFE_CUSTOM_CFG_SW_SYNC_ON        BIT(1)

/**
 * struct cam_ife_hw_mgr_debug - contain the debug information
 *
@@ -94,7 +98,7 @@ struct cam_ife_hw_mgr_debug {
 * @is_fe_enabled           Indicate whether fetch engine\read path is enabled
 * @is_dual                 indicate whether context is in dual VFE mode
 * @custom_enabled          update the flag if context is connected to custom HW
 * @use_frame_header_ts     obtain qtimer ts using frame header
 * @custom_config           ife ctx config if custom is enabled [bit field]
 * @ts                      captured timestamp when the ctx is acquired
 * @is_tpg                  indicate whether context is using PHY TPG
 * @is_offline              Indicate whether context is for offline IFE
@@ -152,7 +156,7 @@ struct cam_ife_hw_mgr_ctx {
	bool                            is_fe_enabled;
	bool                            is_dual;
	bool                            custom_enabled;
	bool                            use_frame_header_ts;
	uint32_t                        custom_config;
	struct timespec64               ts;
	bool                            is_tpg;
	bool                            is_offline;