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

Commit 5def64ce authored by Chandan Kumar Jha's avatar Chandan Kumar Jha
Browse files

msm: camera: isp: Add fps Blob support



Add fps blob to get the fps value from user space. Epoch interrupt
configuration will be depend on the fps value. Configure epoch
interrupt to half of the frame if fps value is 60, in rest all cases
configure epoch interrupt to 2/3 of the frame.

Change-Id: I2544a5e18895a983155c2f01e49920c9e1ec59b9
Signed-off-by: default avatarChandan Kumar Jha <cjha@codeaurora.org>
parent cb1a16e3
Loading
Loading
Loading
Loading
+66 −1
Original line number Diff line number Diff line
@@ -3198,6 +3198,54 @@ static int cam_isp_blob_fe_update(
	return rc;
}

static int cam_isp_blob_fps_config(
	uint32_t                               blob_type,
	struct cam_isp_generic_blob_info      *blob_info,
	struct cam_fps_config                 *fps_config,
	struct cam_hw_prepare_update_args     *prepare)
{
	struct cam_ife_hw_mgr_ctx             *ctx = NULL;
	struct cam_ife_hw_mgr_res             *hw_mgr_res;
	struct cam_hw_intf                    *hw_intf;
	struct cam_vfe_fps_config_args         fps_config_args;
	int                                    rc = -EINVAL;
	uint32_t                               i;

	ctx = prepare->ctxt_to_hw_map;

	list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_src, list) {
		for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
			if (!hw_mgr_res->hw_res[i])
				continue;

			if (hw_mgr_res->res_id == CAM_ISP_HW_VFE_IN_CAMIF) {
				hw_intf = hw_mgr_res->hw_res[i]->hw_intf;
				if (hw_intf && hw_intf->hw_ops.process_cmd) {
					fps_config_args.fps =
						fps_config->fps;
					fps_config_args.node_res =
						hw_mgr_res->hw_res[i];

					rc = hw_intf->hw_ops.process_cmd(
						hw_intf->hw_priv,
						CAM_ISP_HW_CMD_FPS_CONFIG,
						&fps_config_args,
						sizeof(
						struct cam_vfe_fps_config_args)
						);
					if (rc)
						CAM_ERR(CAM_ISP,
							"Failed fps config:%d",
							fps_config->fps);
				} else
					CAM_WARN(CAM_ISP, "NULL hw_intf!");
			}
		}
	}

	return rc;
}

static int cam_isp_blob_ubwc_update(
	uint32_t                               blob_type,
	struct cam_isp_generic_blob_info      *blob_info,
@@ -3742,7 +3790,6 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
		return -EINVAL;
	}

	CAM_DBG(CAM_ISP, "FS2: BLOB Type: %d", blob_type);
	switch (blob_type) {
	case CAM_ISP_GENERIC_BLOB_TYPE_HFR_CONFIG: {
		struct cam_isp_resource_hfr_config    *hfr_config;
@@ -3995,6 +4042,24 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
		if (rc)
			CAM_ERR(CAM_ISP,
				"Sensor Dimension Update Failed rc: %d", rc);
	}
		break;
	case CAM_ISP_GENERIC_BLOB_TYPE_FPS_CONFIG: {
		struct cam_fps_config *fps_config;

		if (blob_size < sizeof(struct cam_fps_config)) {
			CAM_ERR(CAM_ISP, "Invalid fps blob size %u expected %u",
				blob_size, sizeof(struct cam_fps_config));
			return -EINVAL;
		}

		fps_config = (struct cam_fps_config *)blob_data;

		rc = cam_isp_blob_fps_config(blob_type, blob_info,
			fps_config, prepare);
		if (rc)
			CAM_ERR(CAM_ISP, "FPS Update Failed rc: %d", rc);

	}
		break;
	default:
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@
#include "cam_irq_controller.h"
#include <uapi/media/cam_isp.h>

#define CAM_ISP_FPS_60                           60

/*
 * struct cam_isp_timestamp:
 *
@@ -105,6 +107,7 @@ enum cam_isp_hw_cmd_type {
	CAM_ISP_HW_CMD_FE_UPDATE_IN_RD,
	CAM_ISP_HW_CMD_FE_UPDATE_BUS_RD,
	CAM_ISP_HW_CMD_GET_IRQ_REGISTER_DUMP,
	CAM_ISP_HW_CMD_FPS_CONFIG,
	CAM_ISP_HW_CMD_MAX,
};

+11 −0
Original line number Diff line number Diff line
@@ -177,6 +177,17 @@ struct cam_vfe_clock_update_args {
	uint64_t                           clk_rate;
};

/*
 * struct cam_vfe_fps_config_args:
 *
 * @node_res:                Resource to get the fps value
 * @fps:                     FPS value to configure EPOCH
 */
struct cam_vfe_fps_config_args {
	struct cam_isp_resource_node      *node_res;
	uint32_t                           fps;
};

/*
 * struct cam_vfe_bw_update_args:
 *
+1 −0
Original line number Diff line number Diff line
@@ -761,6 +761,7 @@ int cam_vfe_process_cmd(void *hw_priv, uint32_t cmd_type,
	case CAM_ISP_HW_CMD_BW_UPDATE:
	case CAM_ISP_HW_CMD_BW_CONTROL:
	case CAM_ISP_HW_CMD_GET_IRQ_REGISTER_DUMP:
	case CAM_ISP_HW_CMD_FPS_CONFIG:
		rc = core_info->vfe_top->hw_ops.process_cmd(
			core_info->vfe_top->top_priv, cmd_type, cmd_args,
			arg_size);
+25 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ struct cam_vfe_mux_camif_data {
	bool                               enable_sof_irq_debug;
	uint32_t                           irq_debug_cnt;
	uint32_t                           camif_debug;
	uint32_t                           fps;
};

static int cam_vfe_camif_validate_pix_pattern(uint32_t pattern)
@@ -269,9 +270,15 @@ static int cam_vfe_camif_resource_start(
				rsrc_data->camif_reg->epoch_irq);
		break;
	default:
		if (rsrc_data->fps == CAM_ISP_FPS_60) {
			epoch0_irq_mask = ((rsrc_data->last_line -
				rsrc_data->first_line) / 2) +
				rsrc_data->first_line;
		} else {
			epoch0_irq_mask = (((rsrc_data->last_line -
				rsrc_data->first_line) * 2) / 3) +
				rsrc_data->first_line;
		}
		epoch1_irq_mask = rsrc_data->reg_data->epoch_line_cfg &
				0xFFFF;
		computed_epoch_line_cfg = (epoch0_irq_mask << 16) |
@@ -515,6 +522,20 @@ static int cam_vfe_camif_sof_irq_debug(

	return 0;
}
static int cam_vfe_camif_set_fps_config(
	struct cam_isp_resource_node *rsrc_node, void *cmd_args)
{
	struct cam_vfe_mux_camif_data *camif_priv = NULL;
	struct cam_vfe_fps_config_args *fps_args = cmd_args;

	camif_priv =
		(struct cam_vfe_mux_camif_data *)rsrc_node->res_priv;

	camif_priv->fps = fps_args->fps;

	return 0;

}

static int cam_vfe_camif_process_cmd(struct cam_isp_resource_node *rsrc_node,
	uint32_t cmd_type, void *cmd_args, uint32_t arg_size)
@@ -546,6 +567,9 @@ static int cam_vfe_camif_process_cmd(struct cam_isp_resource_node *rsrc_node,
	case CAM_ISP_HW_CMD_GET_IRQ_REGISTER_DUMP:
		rc = cam_vfe_camif_irq_reg_dump(rsrc_node);
		break;
	case CAM_ISP_HW_CMD_FPS_CONFIG:
		rc = cam_vfe_camif_set_fps_config(rsrc_node, cmd_args);
		break;
	default:
		CAM_ERR(CAM_ISP,
			"unsupported process command:%d", cmd_type);
Loading