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

Commit 598ee033 authored by Tejas Prajapati's avatar Tejas Prajapati
Browse files

msm: camera: isp: Mask unused rdi interrupts



Enable rdi interrupts from the required sources only,
other unused interrupts from rdi sources should be masked.
Also in the case where multiple rdi has been acquired in
same context interrupts from only one of them should be
enabled.

Change-Id: I489376208f88afe9be4120ced0f277298f0b68c2
Signed-off-by: default avatarTejas Prajapati <tpraja@codeaurora.org>
parent 2cce3769
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -290,8 +290,6 @@ 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));
@@ -2963,6 +2961,7 @@ static int cam_ife_mgr_start_hw(void *hw_mgr_priv, void *start_hw_args)
	uint32_t                          i, j, camif_debug;
	uint32_t                          enable_dmi_dump;
	struct cam_isp_hw_get_cmd_update  cmd_update;
	bool                              res_rdi_context_set = false;

	if (!hw_mgr_priv || !start_isp) {
		CAM_ERR(CAM_ISP, "Invalid arguments");
@@ -3108,6 +3107,21 @@ 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) {
		switch (hw_mgr_res->res_id) {
		case CAM_ISP_HW_VFE_IN_RDI0:
		case CAM_ISP_HW_VFE_IN_RDI1:
		case CAM_ISP_HW_VFE_IN_RDI2:
		case CAM_ISP_HW_VFE_IN_RDI3:
			if (!res_rdi_context_set) {
				hw_mgr_res->hw_res[0]->rdi_only_ctx =
					ctx->is_rdi_only_context;
				res_rdi_context_set = true;
			}
			break;
		default:
			break;
		}

		rc = cam_ife_hw_mgr_start_hw_res(hw_mgr_res, ctx);
		if (rc) {
			CAM_ERR(CAM_ISP, "Can not start IFE MUX (%d)",
+1 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ enum cam_isp_hw_cmd_type {
	CAM_ISP_HW_CMD_FPS_CONFIG,
	CAM_ISP_HW_CMD_DUMP_HW,
	CAM_ISP_HW_CMD_SET_STATS_DMI_DUMP,
	CAM_ISP_HW_CMD_GET_RDI_IRQ_MASK,
	CAM_ISP_HW_CMD_MAX,
};

+15 −6
Original line number Diff line number Diff line
@@ -46,11 +46,6 @@ static uint32_t camif_irq_err_reg_mask[CAM_IFE_IRQ_REGISTERS_MAX] = {
	0xEFFF7EBC,
};

static uint32_t rdi_irq_reg_mask[CAM_IFE_IRQ_REGISTERS_MAX] = {
	0x780001e0,
	0x00000000,
};

static uint32_t top_reset_irq_reg_mask[CAM_IFE_IRQ_REGISTERS_MAX] = {
	0x80000000,
	0x00000000,
@@ -581,7 +576,9 @@ 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;
	struct cam_isp_hw_get_cmd_update   get_irq_mask;
	int rc = 0;
	uint32_t rdi_irq_mask[CAM_IFE_IRQ_REGISTERS_MAX] = {0};

	if (!hw_priv || !start_args ||
		(arg_size != sizeof(struct cam_isp_resource_node))) {
@@ -622,11 +619,22 @@ int cam_vfe_start(void *hw_priv, void *start_args, uint32_t arg_size)
			if (isp_res->irq_handle < 1)
				rc = -ENOMEM;
		} else if (isp_res->rdi_only_ctx) {

			get_irq_mask.cmd_type = CAM_ISP_HW_CMD_GET_REG_UPDATE;
			get_irq_mask.res =
				(struct cam_isp_resource_node *)isp_res;
			get_irq_mask.data = (void *)rdi_irq_mask;

			cam_vfe_process_cmd(hw_priv,
				CAM_ISP_HW_CMD_GET_RDI_IRQ_MASK,
				&get_irq_mask,
				sizeof(struct cam_isp_hw_get_cmd_update));

			isp_res->irq_handle =
				cam_irq_controller_subscribe_irq(
					core_info->vfe_irq_controller,
					CAM_IRQ_PRIORITY_1,
					rdi_irq_reg_mask,
					rdi_irq_mask,
					&core_info->irq_payload,
					cam_vfe_irq_top_half,
					cam_ife_mgr_do_tasklet,
@@ -765,6 +773,7 @@ int cam_vfe_process_cmd(void *hw_priv, uint32_t cmd_type,
	case CAM_ISP_HW_CMD_GET_IRQ_REGISTER_DUMP:
	case CAM_ISP_HW_CMD_FPS_CONFIG:
	case CAM_ISP_HW_CMD_DUMP_HW:
	case CAM_ISP_HW_CMD_GET_RDI_IRQ_MASK:
		rc = core_info->vfe_top->hw_ops.process_cmd(
			core_info->vfe_top->top_priv, cmd_type, cmd_args,
			arg_size);
+2 −1
Original line number Diff line number Diff line
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -101,6 +101,7 @@ int cam_vfe_camif_lite_ver2_acquire_resource(
	acquire_data = (struct cam_vfe_acquire_args *)acquire_param;

	camif_lite_data->sync_mode   = acquire_data->vfe_in.sync_mode;
	camif_lite_res->rdi_only_ctx = 0;

	CAM_DBG(CAM_ISP, "hw id:%d sync_mode=%d",
		camif_lite_res->hw_intf->hw_idx,
+24 −0
Original line number Diff line number Diff line
@@ -85,6 +85,25 @@ static int cam_vfe_rdi_get_reg_update(
	return 0;
}

static void cam_vfe_rdi_get_irq(struct cam_isp_resource_node  *rdi_res,
		void *cmd_args, uint32_t arg_size)
{
	struct cam_isp_hw_get_cmd_update *irq_reg = NULL;
	struct cam_vfe_mux_rdi_data      *rsrc_data = NULL;

	rsrc_data = rdi_res->res_priv;

	irq_reg = (struct cam_isp_hw_get_cmd_update *)cmd_args;

	*(uint32_t *)irq_reg->data =
		(rsrc_data->reg_data->reg_update_irq_mask |
			rsrc_data->reg_data->sof_irq_mask);

	CAM_DBG(CAM_ISP, "RDI%d irq_mask 0x%x",
		rdi_res->res_id - CAM_ISP_HW_VFE_IN_RDI0,
		*(uint32_t *)irq_reg->data);
}

int cam_vfe_rdi_ver2_acquire_resource(
	struct cam_isp_resource_node  *rdi_res,
	void                          *acquire_param)
@@ -96,6 +115,7 @@ int cam_vfe_rdi_ver2_acquire_resource(
	acquire_data = (struct cam_vfe_acquire_args *)acquire_param;

	rdi_data->sync_mode   = acquire_data->vfe_in.sync_mode;
	rdi_res->rdi_only_ctx = 0;

	return 0;
}
@@ -170,6 +190,10 @@ static int cam_vfe_rdi_process_cmd(struct cam_isp_resource_node *rsrc_node,
		rc = cam_vfe_rdi_get_reg_update(rsrc_node, cmd_args,
			arg_size);
		break;
	case CAM_ISP_HW_CMD_GET_RDI_IRQ_MASK:
		cam_vfe_rdi_get_irq(rsrc_node, cmd_args,
			arg_size);
		break;
	default:
		CAM_ERR(CAM_ISP,
			"unsupported RDI process command:%d", cmd_type);
Loading