diff --git a/drv/vsp2_video.c b/drv/vsp2_video.c index 2946088..eacbb83 100755 --- a/drv/vsp2_video.c +++ b/drv/vsp2_video.c @@ -442,6 +442,7 @@ static void __vsp2_pipeline_cleanup(struct vsp2_pipeline *pipe) INIT_LIST_HEAD(&pipe->entities); pipe->state = VSP2_PIPELINE_STOPPED; + pipe->running_count = 0; pipe->buffers_ready = 0; pipe->num_video = 0; pipe->num_inputs = 0; @@ -556,6 +557,7 @@ static void vsp2_pipeline_run(struct vsp2_pipeline *pipe) vsp2_vspm_drv_entry(vsp2); pipe->state = VSP2_PIPELINE_RUNNING; + pipe->running_count++; pipe->buffers_ready = 0; } @@ -675,7 +677,9 @@ void vsp2_pipeline_frame_end(struct vsp2_pipeline *pipe) spin_lock_irqsave(&pipe->irqlock, flags); state = pipe->state; - pipe->state = VSP2_PIPELINE_STOPPED; + + if (--pipe->running_count == 0) + pipe->state = VSP2_PIPELINE_STOPPED; /* If a stop has been requested, mark the pipeline as stopped and * return. @@ -981,7 +985,7 @@ static int vsp2_video_stop_streaming(struct vb2_queue *vq) int ret; mutex_lock(&pipe->lock); - if (--pipe->stream_count == 0) { + if (--pipe->stream_count == pipe->num_inputs) { /* Stop the pipeline. */ ret = vsp2_pipeline_stop(pipe); if (ret == -ETIMEDOUT) diff --git a/drv/vsp2_video.h b/drv/vsp2_video.h index 90c3478..db67e66 100755 --- a/drv/vsp2_video.h +++ b/drv/vsp2_video.h @@ -120,6 +120,7 @@ struct vsp2_pipeline { struct mutex lock; unsigned int use_count; unsigned int stream_count; + unsigned int running_count; unsigned int buffers_ready; unsigned int num_video;