static int fimc_lite_close(struct file *file) { struct fimc_lite *fimc = video_drvdata(file); int ret; if (mutex_lock_interruptible(&fimc->lock)) return -ERESTARTSYS; if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) { clear_bit(ST_FLITE_IN_USE, &fimc->state); fimc_lite_stop_capture(fimc, false); fimc_pipeline_shutdown(&fimc->pipeline); clear_bit(ST_FLITE_SUSPENDED, &fimc->state); } pm_runtime_put(&fimc->pdev->dev); platform_sysmmu_off(&fimc->pdev->dev); if (fimc->ref_count == 0) vb2_queue_release(&fimc->vb_queue); ret = v4l2_fh_release(file); mutex_unlock(&fimc->lock); return ret; }
static int fimc_lite_release(struct file *file) { struct fimc_lite *fimc = video_drvdata(file); struct media_entity *entity = &fimc->ve.vdev.entity; mutex_lock(&fimc->lock); if (v4l2_fh_is_singular_file(file) && atomic_read(&fimc->out_path) == FIMC_IO_DMA) { if (fimc->streaming) { media_entity_pipeline_stop(entity); fimc->streaming = false; } fimc_lite_stop_capture(fimc, false); fimc_pipeline_call(&fimc->ve, close); clear_bit(ST_FLITE_IN_USE, &fimc->state); mutex_lock(&entity->parent->graph_mutex); entity->use_count--; mutex_unlock(&entity->parent->graph_mutex); } _vb2_fop_release(file, NULL); pm_runtime_put(&fimc->pdev->dev); clear_bit(ST_FLITE_SUSPENDED, &fimc->state); mutex_unlock(&fimc->lock); return 0; }
static int stop_streaming(struct vb2_queue *q) { struct fimc_lite *fimc = q->drv_priv; if (!fimc_lite_active(fimc)) return -EINVAL; return fimc_lite_stop_capture(fimc, false); }
static void stop_streaming(struct vb2_queue *q) { struct fimc_lite *fimc = q->drv_priv; if (!fimc_lite_active(fimc)) return; fimc_lite_stop_capture(fimc, false); }
static int fimc_lite_suspend(struct device *dev) { struct fimc_lite *fimc = dev_get_drvdata(dev); bool suspend = test_bit(ST_FLITE_IN_USE, &fimc->state); int ret; if (test_and_set_bit(ST_LPM, &fimc->state)) return 0; ret = fimc_lite_stop_capture(fimc, suspend); if (ret < 0 || !fimc_lite_active(fimc)) return ret; return fimc_pipeline_call(fimc, close, &fimc->pipeline); }
static int fimc_lite_close(struct file *file) { struct fimc_lite *fimc = video_drvdata(file); int ret; mutex_lock(&fimc->lock); if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) { clear_bit(ST_FLITE_IN_USE, &fimc->state); fimc_lite_stop_capture(fimc, false); fimc_pipeline_call(fimc, close, &fimc->pipeline); clear_bit(ST_FLITE_SUSPENDED, &fimc->state); } pm_runtime_put(&fimc->pdev->dev); if (fimc->ref_count == 0) vb2_queue_release(&fimc->vb_queue); ret = v4l2_fh_release(file); mutex_unlock(&fimc->lock); return ret; }