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

Commit 091d998d authored by Harsh Shah's avatar Harsh Shah
Browse files

msm: camera: isp: Use max stream src based on VFE output



Stream info holds information about various axi outputs
but maximum streams VFE can output is limited by write masters.
Use correct macros to differentiate between two.

Change-Id: I264e8ef6b77e0f5a1fff1c7114d53d017375aa78
Signed-off-by: default avatarSagar Gore <sgore@codeaurora.org>
Signed-off-by: default avatarHarsh Shah <harshs@codeaurora.org>
parent 6f4fb9da
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -509,7 +509,7 @@ struct msm_vfe_error_info {
	uint32_t error_mask1;
	uint32_t violation_status;
	uint32_t camif_status;
	uint8_t stream_framedrop_count[MAX_NUM_STREAM];
	uint8_t stream_framedrop_count[VFE_AXI_SRC_MAX];
	uint8_t stats_framedrop_count[MSM_ISP_STATS_MAX];
	uint32_t info_dump_frame_count;
	uint32_t error_count;
+31 −28
Original line number Diff line number Diff line
@@ -86,7 +86,8 @@ int msm_isp_validate_axi_request(struct msm_vfe_axi_shared_data *axi_data,
{
	int rc = -1, i;
	struct msm_vfe_axi_stream *stream_info = NULL;
	if (HANDLE_TO_IDX(stream_cfg_cmd->axi_stream_handle) < MAX_NUM_STREAM) {
	if (HANDLE_TO_IDX(stream_cfg_cmd->axi_stream_handle)
		< VFE_AXI_SRC_MAX) {
		stream_info = &axi_data->stream_info[
			HANDLE_TO_IDX(stream_cfg_cmd->axi_stream_handle)];
	} else {
@@ -391,7 +392,7 @@ int msm_isp_axi_check_stream_state(

	for (i = 0; i < stream_cfg_cmd->num_streams; i++) {
		if (HANDLE_TO_IDX(stream_cfg_cmd->stream_handle[i]) >=
			MAX_NUM_STREAM) {
			VFE_AXI_SRC_MAX) {
			return -EINVAL;
		}
		stream_info = &axi_data->stream_info[
@@ -497,7 +498,7 @@ void msm_isp_update_framedrop_reg(struct vfe_device *vfe_dev,
	int i;
	struct msm_vfe_axi_shared_data *axi_data = &vfe_dev->axi_data;
	struct msm_vfe_axi_stream *stream_info;
	for (i = 0; i < MAX_NUM_STREAM; i++) {
	for (i = 0; i < VFE_AXI_SRC_MAX; i++) {
		if (SRC_TO_INTF(axi_data->stream_info[i].stream_src) !=
			frame_src) {
			continue;
@@ -596,7 +597,7 @@ void msm_isp_check_for_output_error(struct vfe_device *vfe_dev,
	if (!vfe_dev->reg_updated) {
		output_info->regs_not_updated =
			vfe_dev->reg_update_requested;
		for (i = 0; i < MAX_NUM_STREAM; i++) {
		for (i = 0; i < VFE_AXI_SRC_MAX; i++) {
			stream_info = &axi_data->stream_info[i];
			if (stream_info->state != ACTIVE ||
				!stream_info->controllable_output ||
@@ -616,7 +617,7 @@ void msm_isp_check_for_output_error(struct vfe_device *vfe_dev,

	/* report frame drop per stream */
	if (vfe_dev->error_info.framedrop_flag) {
		for (i = 0; i < MAX_NUM_STREAM; i++) {
		for (i = 0; i < VFE_AXI_SRC_MAX; i++) {
			ISP_DBG("%s: get buf failed\n", __func__);
			if (vfe_dev->error_info.stream_framedrop_count[i]) {
				output_info->stream_framedrop_mask |= (1 << i);
@@ -824,7 +825,8 @@ void msm_isp_calculate_framedrop(
{
	uint32_t framedrop_period = 0;
	struct msm_vfe_axi_stream *stream_info = NULL;
	if (HANDLE_TO_IDX(stream_cfg_cmd->axi_stream_handle) < MAX_NUM_STREAM) {
	if (HANDLE_TO_IDX(stream_cfg_cmd->axi_stream_handle)
		< VFE_AXI_SRC_MAX) {
		stream_info = &axi_data->stream_info[
			HANDLE_TO_IDX(stream_cfg_cmd->axi_stream_handle)];
	} else {
@@ -958,7 +960,7 @@ int msm_isp_request_axi_stream(struct vfe_device *vfe_dev, void *arg)
	if (rc) {
		pr_err("%s: Request validation failed\n", __func__);
		if (HANDLE_TO_IDX(stream_cfg_cmd->axi_stream_handle) <
			MAX_NUM_STREAM)
			VFE_AXI_SRC_MAX)
			msm_isp_axi_destroy_stream(&vfe_dev->axi_data,
			      HANDLE_TO_IDX(stream_cfg_cmd->axi_stream_handle));
		return rc;
@@ -1039,7 +1041,7 @@ int msm_isp_release_axi_stream(struct vfe_device *vfe_dev, void *arg)


	if (HANDLE_TO_IDX(stream_release_cmd->stream_handle) >=
		MAX_NUM_STREAM) {
		VFE_AXI_SRC_MAX) {
		pr_err("%s: Invalid stream handle\n", __func__);
		return -EINVAL;
	}
@@ -1127,7 +1129,7 @@ void msm_isp_axi_stream_update(struct vfe_device *vfe_dev,
	unsigned long flags;
	struct msm_vfe_axi_shared_data *axi_data = &vfe_dev->axi_data;

	for (i = 0; i < MAX_NUM_STREAM; i++) {
	for (i = 0; i < VFE_AXI_SRC_MAX; i++) {
		if (SRC_TO_INTF(axi_data->stream_info[i].stream_src) !=
			frame_src) {
			ISP_DBG("%s stream_src %d frame_src %d\n", __func__,
@@ -1220,7 +1222,7 @@ void msm_isp_axi_cfg_update(struct vfe_device *vfe_dev,
	struct msm_vfe_axi_stream *stream_info;
	int num_stream = 0;

	for (i = 0; i < MAX_NUM_STREAM; i++) {
	for (i = 0; i < VFE_AXI_SRC_MAX; i++) {
		if (SRC_TO_INTF(axi_data->stream_info[i].stream_src) !=
			frame_src) {
			continue;
@@ -1314,12 +1316,13 @@ void msm_isp_halt_send_error(struct vfe_device *vfe_dev)
	atomic_set(&vfe_dev->error_info.overflow_state,
		HALT_ENFORCED);

	/*heavy spin lock in in axi halt, avoid spin lock outside.*/
	/* heavy spin lock in axi halt, avoid spin lock outside. */
	msm_isp_axi_halt(vfe_dev, &halt_cmd);

	for (i = 0; i < MAX_NUM_STREAM; i++)
	for (i = 0; i < VFE_AXI_SRC_MAX; i++)
		vfe_dev->axi_data.stream_info[i].state =
			INACTIVE;

	error_event.frame_id =
		vfe_dev->axi_data.src_info[VFE_PIX_0].frame_id;

@@ -1334,7 +1337,7 @@ int msm_isp_print_ping_pong_address(struct vfe_device *vfe_dev,
	uint32_t pingpong_bit;
	struct msm_vfe_axi_stream *stream_info = NULL;

	for (j = 0; j < MAX_NUM_STREAM; j++) {
	for (j = 0; j < VFE_AXI_SRC_MAX; j++) {
		stream_info = &vfe_dev->axi_data.stream_info[j];
		if (stream_info->state == INACTIVE)
			continue;
@@ -1379,7 +1382,7 @@ static int msm_isp_cfg_ping_pong_address(struct vfe_device *vfe_dev,
	dma_addr_t paddr;
	struct dual_vfe_resource *dual_vfe_res;

	if (stream_idx >= MAX_NUM_STREAM) {
	if (stream_idx >= VFE_AXI_SRC_MAX) {
		pr_err("%s: Invalid stream_idx", __func__);
		return rc;
	}
@@ -1513,7 +1516,7 @@ static void msm_isp_process_done_buf(struct vfe_device *vfe_dev,
	frame_id = vfe_dev->axi_data.
		src_info[SRC_TO_INTF(stream_info->stream_src)].frame_id;

	if (stream_idx >= MAX_NUM_STREAM) {
	if (stream_idx >= VFE_AXI_SRC_MAX) {
		pr_err_ratelimited("%s: Invalid stream_idx", __func__);
		return;
	}
@@ -1775,7 +1778,7 @@ static void msm_isp_update_camif_output_count(

	for (i = 0; i < stream_cfg_cmd->num_streams; i++) {
		if (HANDLE_TO_IDX(stream_cfg_cmd->stream_handle[i]) >=
			MAX_NUM_STREAM) {
			VFE_AXI_SRC_MAX) {
			return;
		}
		stream_info =
@@ -1816,7 +1819,7 @@ static int msm_isp_update_stream_bandwidth(struct vfe_device *vfe_dev)
	uint32_t num_pix_streams = 0;
	uint64_t total_bandwidth = 0;

	for (i = 0; i < MAX_NUM_STREAM; i++) {
	for (i = 0; i < VFE_AXI_SRC_MAX; i++) {
		stream_info = &axi_data->stream_info[i];
		if (stream_info->state == ACTIVE ||
			stream_info->state == START_PENDING) {
@@ -1981,7 +1984,7 @@ int msm_isp_axi_reset(struct vfe_device *vfe_dev,
		0, reset_cmd->blocking);

	for (i = 0, j = 0; j < axi_data->num_active_stream &&
		i < MAX_NUM_STREAM; i++, j++) {
		i < VFE_AXI_SRC_MAX; i++, j++) {
		stream_info = &axi_data->stream_info[i];
		if (stream_info->stream_src >= VFE_AXI_SRC_MAX) {
			rc = -1;
@@ -2043,7 +2046,7 @@ int msm_isp_axi_restart(struct vfe_device *vfe_dev,
	}

	for (i = 0, j = 0; j < axi_data->num_active_stream &&
		i < MAX_NUM_STREAM; i++, j++) {
		i < VFE_AXI_SRC_MAX; i++, j++) {
		stream_info = &axi_data->stream_info[i];
		if (stream_info->state != ACTIVE) {
			j--;
@@ -2078,7 +2081,7 @@ static int msm_isp_axi_update_cgc_override(struct vfe_device *vfe_dev,

	for (i = 0; i < stream_cfg_cmd->num_streams; i++) {
		if (HANDLE_TO_IDX(stream_cfg_cmd->stream_handle[i]) >=
				MAX_NUM_STREAM) {
				VFE_AXI_SRC_MAX) {
			return -EINVAL;
		}
		stream_info = &axi_data->stream_info[
@@ -2243,7 +2246,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev,

	for (i = 0; i < stream_cfg_cmd->num_streams; i++) {
		if (HANDLE_TO_IDX(stream_cfg_cmd->stream_handle[i]) >=
			MAX_NUM_STREAM) {
			VFE_AXI_SRC_MAX) {
			return -EINVAL;
		}
		stream_info = &axi_data->stream_info[
@@ -2339,7 +2342,7 @@ static int msm_isp_stop_axi_stream(struct vfe_device *vfe_dev,

	for (i = 0; i < stream_cfg_cmd->num_streams; i++) {
		if (HANDLE_TO_IDX(stream_cfg_cmd->stream_handle[i]) >=
			MAX_NUM_STREAM) {
			VFE_AXI_SRC_MAX) {
			return -EINVAL;
		}
		stream_info = &axi_data->stream_info[
@@ -2566,7 +2569,7 @@ static int msm_isp_return_empty_buffer(struct vfe_device *vfe_dev,
		return -EINVAL;
	}

	if (stream_idx >= MAX_NUM_STREAM) {
	if (stream_idx >= VFE_AXI_SRC_MAX) {
		pr_err("%s: Invalid stream_idx", __func__);
		return rc;
	}
@@ -2821,7 +2824,7 @@ int msm_isp_update_axi_stream(struct vfe_device *vfe_dev, void *arg)
		update_info = &update_cmd->update_info[i];
		/*check array reference bounds*/
		if (HANDLE_TO_IDX(update_info->stream_handle) >=
			MAX_NUM_STREAM) {
			VFE_AXI_SRC_MAX) {
			return -EINVAL;
		}
		stream_info = &axi_data->stream_info[
@@ -3045,6 +3048,7 @@ void msm_isp_process_axi_irq(struct vfe_device *vfe_dev,
	struct msm_vfe_axi_stream *stream_info;
	struct msm_vfe_axi_composite_info *comp_info;
	struct msm_vfe_axi_shared_data *axi_data = &vfe_dev->axi_data;
	int wm;

	comp_mask = vfe_dev->hw_info->vfe_ops.axi_ops.
		get_comp_mask(irq_status0, irq_status1);
@@ -3064,8 +3068,7 @@ void msm_isp_process_axi_irq(struct vfe_device *vfe_dev,
		if (comp_mask & (1 << i)) {
			stream_idx = HANDLE_TO_IDX(comp_info->stream_handle);
			if ((!comp_info->stream_handle) ||
				(stream_idx >= MAX_NUM_STREAM)) {
				int wm;
				(stream_idx >= VFE_AXI_SRC_MAX)) {
				pr_err_ratelimited("%s: Invalid handle for composite irq\n",
					__func__);
				for (wm = 0; wm < axi_data->hw_info->num_wm;
@@ -3089,7 +3092,7 @@ void msm_isp_process_axi_irq(struct vfe_device *vfe_dev,
		if (wm_mask & (1 << i)) {
			stream_idx = HANDLE_TO_IDX(axi_data->free_wm[i]);
			if ((!axi_data->free_wm[i]) ||
				(stream_idx >= MAX_NUM_STREAM)) {
				(stream_idx >= VFE_AXI_SRC_MAX)) {
				pr_err("%s: Invalid handle for wm irq\n",
					__func__);
				msm_isp_cfg_wm_scratch(vfe_dev, i,
@@ -3116,7 +3119,7 @@ void msm_isp_axi_disable_all_wm(struct vfe_device *vfe_dev)
		return;
	}

	for (i = 0; i < MAX_NUM_STREAM; i++) {
	for (i = 0; i < VFE_AXI_SRC_MAX; i++) {
		stream_info = &axi_data->stream_info[i];

		if (stream_info->state != ACTIVE)
+2 −1
Original line number Diff line number Diff line
@@ -1781,6 +1781,7 @@ void ms_isp_process_iommu_page_fault(struct vfe_device *vfe_dev)
		__LINE__,  vfe_dev->pdev->id, vfe_dev);

	msm_isp_halt_send_error(vfe_dev);

	if (vfe_dev->buf_mgr->pagefault_debug_disable == 0) {
		vfe_dev->buf_mgr->pagefault_debug_disable = 1;
		vfe_dev->buf_mgr->ops->buf_mgr_debug(vfe_dev->buf_mgr,
@@ -2247,7 +2248,7 @@ void msm_isp_save_framedrop_values(struct vfe_device *vfe_dev)
	struct msm_vfe_axi_stream *stream_info = NULL;
	uint32_t j = 0;

	for (j = 0; j < MAX_NUM_STREAM; j++) {
	for (j = 0; j < VFE_AXI_SRC_MAX; j++) {
		stream_info =
			&vfe_dev->axi_data.stream_info[j];
		stream_info->prev_framedrop_pattern =
+1 −1
Original line number Diff line number Diff line
@@ -294,7 +294,7 @@ enum msm_vfe_axi_stream_cmd {

struct msm_vfe_axi_stream_cfg_cmd {
	uint8_t num_streams;
	uint32_t stream_handle[MAX_NUM_STREAM];
	uint32_t stream_handle[VFE_AXI_SRC_MAX];
	enum msm_vfe_axi_stream_cmd cmd;
};