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

Commit c92c0e78 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: isp: avoid spink lock recursion"

parents 86170793 ebaa13d2
Loading
Loading
Loading
Loading
+41 −8
Original line number Diff line number Diff line
@@ -1102,18 +1102,19 @@ void msm_isp_axi_cfg_update(struct vfe_device *vfe_dev,
			&axi_data->axi_cfg_update[frame_src]);
}

static void msm_isp_get_done_buf(struct vfe_device *vfe_dev,
static int msm_isp_get_done_buf(struct vfe_device *vfe_dev,
	struct msm_vfe_axi_stream *stream_info, uint32_t pingpong_status,
	struct msm_isp_buffer **done_buf)
{
	uint32_t pingpong_bit = 0, i;
	int rc = 0;

	pingpong_bit = (~(pingpong_status >> stream_info->wm[0]) & 0x1);
	for (i = 0; i < stream_info->num_planes; i++) {
		if (pingpong_bit !=
			(~(pingpong_status >> stream_info->wm[i]) & 0x1)) {
			pr_debug("%s: Write master ping pong mismatch. Status: 0x%x\n",
				__func__, pingpong_status);
			msm_isp_halt_send_error(vfe_dev);
		}
	}

@@ -1131,12 +1132,13 @@ static void msm_isp_get_done_buf(struct vfe_device *vfe_dev,
					__func__, __LINE__, pingpong_bit,
					stream_info->sw_ping_pong_bit);

				msm_isp_halt_send_error(vfe_dev);

				rc = -EINVAL;
			}
			stream_info->sw_ping_pong_bit ^= 1;
		}
	}

	return rc;
}


@@ -1152,6 +1154,10 @@ void msm_isp_halt_send_error(struct vfe_device *vfe_dev)
	halt_cmd.overflow_detected = 0;
	halt_cmd.blocking_halt = 0;

	pr_err("%s: vfe%d fatal scheduling error!\n",
		__func__, vfe_dev->pdev->id);

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

	for (i = 0; i < MAX_NUM_STREAM; i++)
@@ -1471,7 +1477,16 @@ int msm_isp_drop_frame(struct vfe_device *vfe_dev,
		stream_info->runtime_num_burst_capture--;

	spin_lock_irqsave(&stream_info->lock, flags);
	msm_isp_get_done_buf(vfe_dev, stream_info, pingpong_status, &done_buf);
	rc = msm_isp_get_done_buf(vfe_dev, stream_info,
		pingpong_status, &done_buf);
	if (rc < 0) {
		pr_err("%s: VFE%d get buf error\n",
			__func__, vfe_dev->pdev->id);
		spin_unlock_irqrestore(&stream_info->lock, flags);
		msm_isp_halt_send_error(vfe_dev);
		return rc;
	}

	if (stream_info->stream_type == CONTINUOUS_STREAM ||
		stream_info->runtime_num_burst_capture > 1)
		msm_isp_cfg_ping_pong_address(vfe_dev, stream_info,
@@ -1492,7 +1507,7 @@ int msm_isp_drop_frame(struct vfe_device *vfe_dev,
		if (!bufq) {
			pr_err("%s: Invalid bufq buf_handle %x\n",
				__func__, done_buf->bufq_handle);
			return rc;
			return -EINVAL;
		}
		output_info->output_err_mask |=
			1 << bufq->stream_id;
@@ -2587,8 +2602,17 @@ void msm_isp_process_axi_irq(struct vfe_device *vfe_dev,
				stream_info->runtime_num_burst_capture--;
			}

			msm_isp_get_done_buf(vfe_dev, stream_info,
			rc = msm_isp_get_done_buf(vfe_dev, stream_info,
				pingpong_status, &done_buf);
			if (rc < 0) {
				pr_err_ratelimited("%s:VFE%d get done buf fail\n",
					__func__, vfe_dev->pdev->id);
				spin_unlock_irqrestore(&stream_info->lock,
					flags);
				msm_isp_halt_send_error(vfe_dev);
				return;
			}

			if (stream_info->stream_type == CONTINUOUS_STREAM ||
				stream_info->runtime_num_burst_capture > 1) {
				valid_address = 1;
@@ -2636,8 +2660,17 @@ void msm_isp_process_axi_irq(struct vfe_device *vfe_dev,
				stream_info->runtime_num_burst_capture--;
			}

			msm_isp_get_done_buf(vfe_dev, stream_info,
			rc = msm_isp_get_done_buf(vfe_dev, stream_info,
						pingpong_status, &done_buf);
			if (rc < 0) {
				pr_err_ratelimited("%s:VFE%d get done buf fail\n",
					__func__, vfe_dev->pdev->id);
				spin_unlock_irqrestore(&stream_info->lock,
					flags);
				msm_isp_halt_send_error(vfe_dev);
				return;
			}

			if (stream_info->stream_type == CONTINUOUS_STREAM ||
				stream_info->runtime_num_burst_capture > 1) {
				valid_address = 1;