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

Commit 64aa7f79 authored by Rishabh Jain's avatar Rishabh Jain
Browse files

msm: camera: ope: Reorder the reset order in ope acquire



Initialize CDM prior to the OPE. This will help to reset
CDM before OPE.

CRs-Fixed: 2646377
Change-Id: I7136cbb04f687e7d5756431731af618718c5a2a7
Signed-off-by: default avatarRishabh Jain <risjai@codeaurora.org>
parent 09c895e7
Loading
Loading
Loading
Loading
+47 −47
Original line number Diff line number Diff line
@@ -2470,6 +2470,42 @@ static int cam_ope_mgr_acquire_hw(void *hw_priv, void *hw_acquire_args)
		goto end;
	}

	cdm_acquire = kzalloc(sizeof(struct cam_cdm_acquire_data), GFP_KERNEL);
	if (!cdm_acquire) {
		CAM_ERR(CAM_ISP, "Out of memory");
		goto end;
	}
	strlcpy(cdm_acquire->identifier, "ope", sizeof("ope"));
	if (ctx->ope_acquire.dev_type == OPE_DEV_TYPE_OPE_RT)
		cdm_acquire->priority = CAM_CDM_BL_FIFO_3;
	else if (ctx->ope_acquire.dev_type ==
		OPE_DEV_TYPE_OPE_NRT)
		cdm_acquire->priority = CAM_CDM_BL_FIFO_0;
	else
		goto free_cdm_acquire;

	cdm_acquire->cell_index = 0;
	cdm_acquire->handle = 0;
	cdm_acquire->userdata = ctx;
	cdm_acquire->cam_cdm_callback = cam_ope_ctx_cdm_callback;
	cdm_acquire->id = CAM_CDM_VIRTUAL;
	cdm_acquire->base_array_cnt = 1;
	cdm_acquire->base_array[0] = hw_mgr->cdm_reg_map[OPE_DEV_OPE][0];

	rc = cam_cdm_acquire(cdm_acquire);
	if (rc) {
		CAM_ERR(CAM_OPE, "cdm_acquire is failed: %d", rc);
		goto cdm_acquire_failed;
	}

	ctx->ope_cdm.cdm_ops = cdm_acquire->ops;
	ctx->ope_cdm.cdm_handle = cdm_acquire->handle;

	rc = cam_cdm_stream_on(cdm_acquire->handle);
	if (rc) {
		CAM_ERR(CAM_OPE, "cdm stream on failure: %d", rc);
		goto cdm_stream_on_failure;
	}

	if (!hw_mgr->ope_ctx_cnt) {
		for (i = 0; i < ope_hw_mgr->num_ope; i++) {
@@ -2479,7 +2515,7 @@ static int cam_ope_mgr_acquire_hw(void *hw_priv, void *hw_acquire_args)
				sizeof(init));
			if (rc) {
				CAM_ERR(CAM_OPE, "OPE Dev init failed: %d", rc);
				goto end;
				goto ope_dev_init_failure;
			}
		}

@@ -2525,43 +2561,6 @@ static int cam_ope_mgr_acquire_hw(void *hw_priv, void *hw_acquire_args)
		}
	}

	cdm_acquire = kzalloc(sizeof(struct cam_cdm_acquire_data), GFP_KERNEL);
	if (!cdm_acquire) {
		CAM_ERR(CAM_ISP, "Out of memory");
		goto ope_dev_acquire_failed;
	}
	strlcpy(cdm_acquire->identifier, "ope", sizeof("ope"));
	if (ctx->ope_acquire.dev_type == OPE_DEV_TYPE_OPE_RT)
		cdm_acquire->priority = CAM_CDM_BL_FIFO_3;
	else if (ctx->ope_acquire.dev_type ==
		OPE_DEV_TYPE_OPE_NRT)
		cdm_acquire->priority = CAM_CDM_BL_FIFO_0;
	else
		goto free_cdm_acquire;

	cdm_acquire->cell_index = 0;
	cdm_acquire->handle = 0;
	cdm_acquire->userdata = ctx;
	cdm_acquire->cam_cdm_callback = cam_ope_ctx_cdm_callback;
	cdm_acquire->id = CAM_CDM_VIRTUAL;
	cdm_acquire->base_array_cnt = 1;
	cdm_acquire->base_array[0] = hw_mgr->cdm_reg_map[OPE_DEV_OPE][0];

	rc = cam_cdm_acquire(cdm_acquire);
	if (rc) {
		CAM_ERR(CAM_OPE, "cdm_acquire is failed: %d", rc);
		goto cdm_acquire_failed;
	}

	ctx->ope_cdm.cdm_ops = cdm_acquire->ops;
	ctx->ope_cdm.cdm_handle = cdm_acquire->handle;

	rc = cam_cdm_stream_on(cdm_acquire->handle);
	if (rc) {
		CAM_ERR(CAM_OPE, "cdm stream on failure: %d", rc);
		goto cdm_stream_on_failure;
	}

	for (i = 0; i < ope_hw_mgr->num_ope; i++) {
		clk_update.clk_rate = 600000000;
		rc = hw_mgr->ope_dev_intf[i]->hw_ops.process_cmd(
@@ -2619,11 +2618,6 @@ static int cam_ope_mgr_acquire_hw(void *hw_priv, void *hw_acquire_args)
	kzfree(bw_update);
	bw_update = NULL;
ope_clk_update_failed:
cdm_stream_on_failure:
	cam_cdm_release(cdm_acquire->handle);
	ctx->ope_cdm.cdm_ops = NULL;
	ctx->ope_cdm.cdm_handle = 0;
cdm_acquire_failed:
	ope_dev_release.ctx_id = ctx_id;
	for (i = 0; i < ope_hw_mgr->num_ope; i++) {
		if (hw_mgr->ope_dev_intf[i]->hw_ops.process_cmd(
@@ -2631,10 +2625,6 @@ static int cam_ope_mgr_acquire_hw(void *hw_priv, void *hw_acquire_args)
			&ope_dev_release, sizeof(ope_dev_release)))
			CAM_ERR(CAM_OPE, "OPE Dev release failed");
	}

free_cdm_acquire:
	kzfree(cdm_acquire);
	cdm_acquire = NULL;
ope_dev_acquire_failed:
	if (!hw_mgr->ope_ctx_cnt) {
		irq_cb.ope_hw_mgr_cb = NULL;
@@ -2661,6 +2651,16 @@ static int cam_ope_mgr_acquire_hw(void *hw_priv, void *hw_acquire_args)
				CAM_ERR(CAM_OPE, "OPE stop fail");
		}
	}
ope_dev_init_failure:
cdm_stream_on_failure:
	cam_cdm_release(cdm_acquire->handle);
	ctx->ope_cdm.cdm_ops = NULL;
	ctx->ope_cdm.cdm_handle = 0;

cdm_acquire_failed:
free_cdm_acquire:
	kzfree(cdm_acquire);
	cdm_acquire = NULL;
end:
	args->ctxt_to_hw_map = NULL;
	cam_ope_put_free_ctx(hw_mgr, ctx_id);