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

Commit 4f1b8381 authored by Jing Zhou's avatar Jing Zhou
Browse files

msm: camera: isp: Disable the rdi sof in none RDI only session



In none RDI only session, IFE only need SOF from the pixel stream.
This change make sure we did not subscribe the RDI sof event in
none RDI only session. The side beneift of this change also fixes
the event payload leak in the none RDI only session.

Change-Id: I318016dfc282a0fc8f58db29a1acbc8422b07ddb
Signed-off-by: default avatarJing Zhou <jzhou70@codeaurora.org>
parent 88a33ae3
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -201,7 +201,8 @@ static int cam_ife_hw_mgr_init_hw_res(
}

static int cam_ife_hw_mgr_start_hw_res(
	struct cam_ife_hw_mgr_res   *isp_hw_res)
	struct cam_ife_hw_mgr_res   *isp_hw_res,
	struct cam_ife_hw_mgr_ctx   *ctx)
{
	int i;
	int rc = -1;
@@ -212,6 +213,8 @@ static int cam_ife_hw_mgr_start_hw_res(
			continue;
		hw_intf = isp_hw_res->hw_res[i]->hw_intf;
		if (hw_intf->hw_ops.start) {
			isp_hw_res->hw_res[i]->rdi_only_ctx =
				ctx->is_rdi_only_context;
			rc = hw_intf->hw_ops.start(hw_intf->hw_priv,
				isp_hw_res->hw_res[i],
				sizeof(struct cam_isp_resource_node));
@@ -1747,7 +1750,8 @@ static int cam_ife_mgr_restart_hw(void *start_hw_args)

	/* start the IFE out devices */
	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++) {
		rc = cam_ife_hw_mgr_start_hw_res(&ctx->res_list_ife_out[i]);
		rc = cam_ife_hw_mgr_start_hw_res(
			&ctx->res_list_ife_out[i], ctx);
		if (rc) {
			CAM_ERR(CAM_ISP, "Can not start IFE OUT (%d)", i);
			goto err;
@@ -1757,7 +1761,7 @@ static int cam_ife_mgr_restart_hw(void *start_hw_args)
	CAM_DBG(CAM_ISP, "START IFE SRC ... in ctx id:%d", ctx->ctx_index);
	/* Start the IFE mux in devices */
	list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_src, list) {
		rc = cam_ife_hw_mgr_start_hw_res(hw_mgr_res);
		rc = cam_ife_hw_mgr_start_hw_res(hw_mgr_res, ctx);
		if (rc) {
			CAM_ERR(CAM_ISP, "Can not start IFE MUX (%d)",
				 hw_mgr_res->res_id);
@@ -1768,7 +1772,7 @@ static int cam_ife_mgr_restart_hw(void *start_hw_args)
	CAM_DBG(CAM_ISP, "START CSID HW ... in ctx id:%d", ctx->ctx_index);
	/* Start the IFE CSID HW devices */
	list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_csid, list) {
		rc = cam_ife_hw_mgr_start_hw_res(hw_mgr_res);
		rc = cam_ife_hw_mgr_start_hw_res(hw_mgr_res, ctx);
		if (rc) {
			CAM_ERR(CAM_ISP, "Can not start IFE CSID (%d)",
				 hw_mgr_res->res_id);
@@ -1907,7 +1911,8 @@ static int cam_ife_mgr_start_hw(void *hw_mgr_priv, void *start_hw_args)
		ctx->ctx_index);
	/* start the IFE out devices */
	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++) {
		rc = cam_ife_hw_mgr_start_hw_res(&ctx->res_list_ife_out[i]);
		rc = cam_ife_hw_mgr_start_hw_res(
			&ctx->res_list_ife_out[i], ctx);
		if (rc) {
			CAM_ERR(CAM_ISP, "Can not start IFE OUT (%d)",
				 i);
@@ -1919,7 +1924,7 @@ static int cam_ife_mgr_start_hw(void *hw_mgr_priv, void *start_hw_args)
		ctx->ctx_index);
	/* Start the IFE mux in devices */
	list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_src, list) {
		rc = cam_ife_hw_mgr_start_hw_res(hw_mgr_res);
		rc = cam_ife_hw_mgr_start_hw_res(hw_mgr_res, ctx);
		if (rc) {
			CAM_ERR(CAM_ISP, "Can not start IFE MUX (%d)",
				 hw_mgr_res->res_id);
@@ -1931,7 +1936,7 @@ static int cam_ife_mgr_start_hw(void *hw_mgr_priv, void *start_hw_args)
		ctx->ctx_index);
	/* Start the IFE CSID HW devices */
	list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_csid, list) {
		rc = cam_ife_hw_mgr_start_hw_res(hw_mgr_res);
		rc = cam_ife_hw_mgr_start_hw_res(hw_mgr_res, ctx);
		if (rc) {
			CAM_ERR(CAM_ISP, "Can not start IFE CSID (%d)",
				 hw_mgr_res->res_id);
@@ -1943,7 +1948,7 @@ static int cam_ife_mgr_start_hw(void *hw_mgr_priv, void *start_hw_args)
		ctx->ctx_index);
	/* Start the IFE CID HW devices */
	list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_cid, list) {
		rc = cam_ife_hw_mgr_start_hw_res(hw_mgr_res);
		rc = cam_ife_hw_mgr_start_hw_res(hw_mgr_res, ctx);
		if (rc) {
			CAM_ERR(CAM_ISP, "Can not start IFE CSID (%d)",
				hw_mgr_res->res_id);
+2 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ enum cam_isp_hw_cmd_type {
 * @tasklet_info:                 Tasklet structure that will be used to
 *                                schedule IRQ events related to this resource
 * @irq_handle:                   handle returned on subscribing for IRQ event
 * @rdi_only_ctx:                 resouce belong to rdi only context or not
 * @init:                         function pointer to init the HW resource
 * @deinit:                       function pointer to deinit the HW resource
 * @start:                        function pointer to start the HW resource
@@ -129,6 +130,7 @@ struct cam_isp_resource_node {
	void                          *cdm_ops;
	void                          *tasklet_info;
	int                            irq_handle;
	int                            rdi_only_ctx;

	int (*init)(struct cam_isp_resource_node *rsrc_node,
		void *init_args, uint32_t arg_size);
+63 −28
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ static uint32_t camif_irq_reg_mask[CAM_IFE_IRQ_REGISTERS_MAX] = {

static uint32_t camif_irq_err_reg_mask[CAM_IFE_IRQ_REGISTERS_MAX] = {
	0x00000000,
	0x0FFF7E80,
	0x0FFF7EBC,
};

static uint32_t rdi_irq_reg_mask[CAM_IFE_IRQ_REGISTERS_MAX] = {
@@ -529,7 +529,7 @@ int cam_vfe_start(void *hw_priv, void *start_args, uint32_t arg_size)
	struct cam_vfe_hw_core_info       *core_info = NULL;
	struct cam_hw_info                *vfe_hw  = hw_priv;
	struct cam_isp_resource_node      *isp_res;
	int rc = -ENODEV;
	int rc = 0;

	if (!hw_priv || !start_args ||
		(arg_size != sizeof(struct cam_isp_resource_node))) {
@@ -543,39 +543,70 @@ int cam_vfe_start(void *hw_priv, void *start_args, uint32_t arg_size)

	mutex_lock(&vfe_hw->hw_mutex);
	if (isp_res->res_type == CAM_ISP_RESOURCE_VFE_IN) {
		if (isp_res->res_id == CAM_ISP_HW_VFE_IN_CAMIF)
			isp_res->irq_handle = cam_irq_controller_subscribe_irq(
		if (isp_res->res_id == CAM_ISP_HW_VFE_IN_CAMIF) {
			isp_res->irq_handle =
				cam_irq_controller_subscribe_irq(
					core_info->vfe_irq_controller,
					CAM_IRQ_PRIORITY_1,
				camif_irq_reg_mask, &core_info->irq_payload,
				cam_vfe_irq_top_half, cam_ife_mgr_do_tasklet,
				isp_res->tasklet_info, cam_tasklet_enqueue_cmd);
		else
			isp_res->irq_handle = cam_irq_controller_subscribe_irq(
					camif_irq_reg_mask,
					&core_info->irq_payload,
					cam_vfe_irq_top_half,
					cam_ife_mgr_do_tasklet,
					isp_res->tasklet_info,
					cam_tasklet_enqueue_cmd);
			if (isp_res->irq_handle < 1)
				rc = -ENOMEM;
		} else if (isp_res->rdi_only_ctx) {
			isp_res->irq_handle =
				cam_irq_controller_subscribe_irq(
					core_info->vfe_irq_controller,
					CAM_IRQ_PRIORITY_1,
				rdi_irq_reg_mask, &core_info->irq_payload,
				cam_vfe_irq_top_half, cam_ife_mgr_do_tasklet,
				isp_res->tasklet_info, cam_tasklet_enqueue_cmd);

		core_info->irq_err_handle = cam_irq_controller_subscribe_irq(
			core_info->vfe_irq_controller, CAM_IRQ_PRIORITY_0,
			camif_irq_err_reg_mask, &core_info->irq_payload,
			cam_vfe_irq_err_top_half, cam_ife_mgr_do_tasklet,
			core_info->tasklet_info, cam_tasklet_enqueue_cmd);
					rdi_irq_reg_mask,
					&core_info->irq_payload,
					cam_vfe_irq_top_half,
					cam_ife_mgr_do_tasklet,
					isp_res->tasklet_info,
					cam_tasklet_enqueue_cmd);
			if (isp_res->irq_handle < 1)
				rc = -ENOMEM;
		}

		if (isp_res->irq_handle > 0)
		if (rc == 0) {
			rc = core_info->vfe_top->hw_ops.start(
				core_info->vfe_top->top_priv, isp_res,
				sizeof(struct cam_isp_resource_node));
		else
			if (rc)
				CAM_ERR(CAM_ISP, "Start failed. type:%d",
					isp_res->res_type);
		} else {
			CAM_ERR(CAM_ISP,
				"Error! subscribe irq controller failed");
		}
	} else if (isp_res->res_type == CAM_ISP_RESOURCE_VFE_OUT) {
		rc = core_info->vfe_bus->hw_ops.start(isp_res, NULL, 0);
	} else {
		CAM_ERR(CAM_ISP, "Invalid res type:%d", isp_res->res_type);
		rc = -EFAULT;
	}

	if (!core_info->irq_err_handle) {
		core_info->irq_err_handle =
			cam_irq_controller_subscribe_irq(
				core_info->vfe_irq_controller,
				CAM_IRQ_PRIORITY_0,
				camif_irq_err_reg_mask,
				&core_info->irq_payload,
				cam_vfe_irq_err_top_half,
				cam_ife_mgr_do_tasklet,
				core_info->tasklet_info,
				cam_tasklet_enqueue_cmd);
		if (core_info->irq_err_handle < 1) {
			CAM_ERR(CAM_ISP, "Error handle subscribe failure");
			rc = -ENOMEM;
			core_info->irq_err_handle = 0;
		}
	}

	mutex_unlock(&vfe_hw->hw_mutex);

	return rc;
@@ -605,15 +636,19 @@ int cam_vfe_stop(void *hw_priv, void *stop_args, uint32_t arg_size)
			core_info->vfe_top->top_priv, isp_res,
			sizeof(struct cam_isp_resource_node));

	cam_irq_controller_unsubscribe_irq(
		core_info->vfe_irq_controller, core_info->irq_err_handle);

	} else if (isp_res->res_type == CAM_ISP_RESOURCE_VFE_OUT) {
		rc = core_info->vfe_bus->hw_ops.stop(isp_res, NULL, 0);
	} else {
		CAM_ERR(CAM_ISP, "Invalid res type:%d", isp_res->res_type);
	}

	if (core_info->irq_err_handle) {
		cam_irq_controller_unsubscribe_irq(
			core_info->vfe_irq_controller,
			core_info->irq_err_handle);
		core_info->irq_err_handle = 0;
	}

	mutex_unlock(&vfe_hw->hw_mutex);

	return rc;