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

Commit 3d2f2e74 authored by Petar Sivenov's avatar Petar Sivenov
Browse files

msm: camera: isp: fix stop axi stream for offline



Stop axi stream routine does not handle properly streams which do not
use CAMIF and continuous RDI streams. In case of stream which does not
use CAMIF, it bypassed axi halt and isp reset sequence. In case of
continuous RDI stream it does not wait for completion. Also
conditional logic is simplified.

Change-Id: Ie3f65f69e731b64833f5a182ab639408b3be1473
Signed-off-by: default avatarPetar Sivenov <psiven@codeaurora.org>
parent e4b5be8f
Loading
Loading
Loading
Loading
+21 −11
Original line number Diff line number Diff line
@@ -1416,9 +1416,12 @@ static int msm_isp_stop_axi_stream(struct vfe_device *vfe_dev,
			enum msm_isp_camif_update_state camif_update)
{
	int i, rc = 0;
	uint8_t wait_for_complete_for_this_stream = 0;
	uint8_t wait_for_complete = 0;
	struct msm_vfe_axi_stream *stream_info = NULL;
	struct msm_vfe_axi_shared_data *axi_data = &vfe_dev->axi_data;
	int    ext_read =
		axi_data->src_info[VFE_PIX_0].input_mux == EXTERNAL_READ;

	if (stream_cfg_cmd->num_streams > MAX_NUM_STREAM ||
		stream_cfg_cmd->num_streams == 0)
@@ -1431,15 +1434,16 @@ static int msm_isp_stop_axi_stream(struct vfe_device *vfe_dev,
		}
		stream_info = &axi_data->stream_info[
			HANDLE_TO_IDX(stream_cfg_cmd->stream_handle[i])];

		wait_for_complete_for_this_stream = 0;
		stream_info->state = STOP_PENDING;
		if (stream_info->stream_src == CAMIF_RAW ||
			stream_info->stream_src == IDEAL_RAW) {
			/* We dont get reg update IRQ for raw snapshot
			 * so frame skip cant be ocnfigured
			*/
			if (camif_update != DISABLE_CAMIF_IMMEDIATELY)
				wait_for_complete = 1;
			if ((camif_update != DISABLE_CAMIF_IMMEDIATELY) &&
					(!ext_read))
				wait_for_complete_for_this_stream = 1;
		} else if (stream_info->stream_type == BURST_STREAM &&
				stream_info->runtime_num_burst_capture == 0) {
			/* Configure AXI writemasters to stop immediately
@@ -1449,14 +1453,17 @@ static int msm_isp_stop_axi_stream(struct vfe_device *vfe_dev,
			if (stream_info->stream_src == RDI_INTF_0 ||
				stream_info->stream_src == RDI_INTF_1 ||
				stream_info->stream_src == RDI_INTF_2)
				wait_for_complete = 1;
		} else if (camif_update != DISABLE_CAMIF_IMMEDIATELY)
				wait_for_complete = 1;
		if (wait_for_complete == 0) {
				wait_for_complete_for_this_stream = 1;
		} else {
			if  ((camif_update != DISABLE_CAMIF_IMMEDIATELY) &&
					(!ext_read))
				wait_for_complete_for_this_stream = 1;
		}
		if (!wait_for_complete_for_this_stream) {
			msm_isp_axi_stream_enable_cfg(vfe_dev, stream_info);
			stream_info->state = INACTIVE;
		}
		rc = 0;
		wait_for_complete |= wait_for_complete_for_this_stream;
	}
	if (wait_for_complete) {
		rc = msm_isp_axi_wait_for_cfg_done(vfe_dev, camif_update);
@@ -1477,12 +1484,15 @@ static int msm_isp_stop_axi_stream(struct vfe_device *vfe_dev,
	if (camif_update == DISABLE_CAMIF) {
		vfe_dev->hw_info->vfe_ops.core_ops.
			update_camif_state(vfe_dev, DISABLE_CAMIF);
	} else if (camif_update == DISABLE_CAMIF_IMMEDIATELY) {
	} else if ((camif_update == DISABLE_CAMIF_IMMEDIATELY) ||
					(ext_read)) {
		/*during stop immediately, stop output then stop input*/
		vfe_dev->ignore_error = 1;
		vfe_dev->hw_info->vfe_ops.axi_ops.halt(vfe_dev, 1);
		if (!ext_read)
			vfe_dev->hw_info->vfe_ops.core_ops.
			update_camif_state(vfe_dev, DISABLE_CAMIF_IMMEDIATELY);
				update_camif_state(vfe_dev,
						DISABLE_CAMIF_IMMEDIATELY);
		vfe_dev->hw_info->vfe_ops.core_ops.reset_hw(vfe_dev, 0, 1);
		vfe_dev->hw_info->vfe_ops.core_ops.init_hw_reg(vfe_dev);
		vfe_dev->ignore_error = 0;