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

Commit 5c813ac7 authored by Konstantin Motov's avatar Konstantin Motov
Browse files

msm: camera: Fix unregistration of buffer queue



Fix waiting for stream update.

Change-Id: Ie3870a5ea844e457736d2d9332c2cb647d452472
Signed-off-by: default avatarKonstantin Motov <kmotov@codeaurora.org>
parent 3045c54b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -266,6 +266,7 @@ enum msm_vfe_axi_state {
	STOPPING,
	PAUSING,
	RESUMING,
	UPDATING,
};

enum msm_vfe_axi_cfg_update_state {
+30 −13
Original line number Diff line number Diff line
@@ -773,10 +773,15 @@ static void msm_isp_axi_stream_enable_cfg(
void msm_isp_axi_stream_update(struct vfe_device *vfe_dev, uint8_t input_src)
{
	int i;
	unsigned long flags;
	struct msm_vfe_axi_shared_data *axi_data = &vfe_dev->axi_data;

	spin_lock_irqsave(&vfe_dev->shared_data_lock, flags);
	for (i = 0; i < MAX_NUM_STREAM; i++) {
		if (axi_data->stream_info[i].state == START_PENDING ||
		if (axi_data->stream_info[i].state == UPDATING) {
			axi_data->stream_info[i].state = ACTIVE;
			vfe_dev->axi_data.stream_update--;
		} else if (axi_data->stream_info[i].state == START_PENDING ||
				axi_data->stream_info[i].state ==
					STOP_PENDING) {
			if ((1 <<
@@ -813,6 +818,8 @@ void msm_isp_axi_stream_update(struct vfe_device *vfe_dev, uint8_t input_src)

	if (vfe_dev->axi_data.stream_update == 0)
		complete(&vfe_dev->stream_config_complete);

	spin_unlock_irqrestore(&vfe_dev->shared_data_lock, flags);
}

static void msm_isp_reload_ping_pong_offset(struct vfe_device *vfe_dev,
@@ -1163,11 +1170,17 @@ static int msm_isp_update_stream_bandwidth(struct vfe_device *vfe_dev)
}

static int msm_isp_axi_wait_for_cfg_done(struct vfe_device *vfe_dev,
	enum msm_isp_camif_update_state camif_update)
	enum msm_isp_camif_update_state camif_update, uint8_t num_streams)
{
	int rc;
	unsigned long flags;
	spin_lock_irqsave(&vfe_dev->shared_data_lock, flags);
	if (vfe_dev->axi_data.stream_update) {
		spin_unlock_irqrestore(&vfe_dev->shared_data_lock, flags);
		pr_err("%s: fail to register for wait\n", __func__);
		return -EINVAL;
	}
	vfe_dev->axi_data.stream_update = num_streams;
	init_completion(&vfe_dev->stream_config_complete);
	vfe_dev->axi_data.pipeline_update = camif_update;
	spin_unlock_irqrestore(&vfe_dev->shared_data_lock, flags);
@@ -1175,8 +1188,9 @@ static int msm_isp_axi_wait_for_cfg_done(struct vfe_device *vfe_dev,
		&vfe_dev->stream_config_complete,
		msecs_to_jiffies(VFE_MAX_CFG_TIMEOUT));
	if (rc == 0) {
		vfe_dev->axi_data.stream_update = 0;
		pr_err("%s: wait timeout\n", __func__);
		rc = -1;
		rc = -EINVAL;
	} else {
		rc = 0;
	}
@@ -1462,10 +1476,9 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev,
		vfe_dev->hw_info->vfe_ops.core_ops.
			update_camif_state(vfe_dev, camif_update);
	}
	if (wait_for_complete) {
		vfe_dev->axi_data.stream_update = stream_cfg_cmd->num_streams;
		rc = msm_isp_axi_wait_for_cfg_done(vfe_dev, camif_update);
	}
	if (wait_for_complete)
		rc = msm_isp_axi_wait_for_cfg_done(vfe_dev, camif_update,
			stream_cfg_cmd->num_streams);

	return rc;
}
@@ -1525,8 +1538,8 @@ static int msm_isp_stop_axi_stream(struct vfe_device *vfe_dev,
		wait_for_complete |= wait_for_complete_for_this_stream;
	}
	if (wait_for_complete) {
		vfe_dev->axi_data.stream_update = stream_cfg_cmd->num_streams;
		rc = msm_isp_axi_wait_for_cfg_done(vfe_dev, camif_update);
		rc = msm_isp_axi_wait_for_cfg_done(vfe_dev, camif_update,
			stream_cfg_cmd->num_streams);
		if (rc < 0) {
			pr_err("%s: wait for config done failed\n", __func__);
			for (i = 0; i < stream_cfg_cmd->num_streams; i++) {
@@ -1833,10 +1846,14 @@ int msm_isp_update_axi_stream(struct vfe_device *vfe_dev, void *arg)
			msm_isp_remove_buf_queue(vfe_dev, stream_info,
				update_info->user_stream_id);

			rc = msm_isp_axi_wait_for_cfg_done(vfe_dev, NO_UPDATE);
			if (stream_info->state == ACTIVE) {
				stream_info->state = UPDATING;
				rc = msm_isp_axi_wait_for_cfg_done(vfe_dev,
					NO_UPDATE, 1);
				if (rc < 0)
				pr_err("%s: wait for config done failed\n",
					pr_err("%s: wait for update failed\n",
						__func__);
			}
			break;
		}
		default: