summaryrefslogtreecommitdiff
path: root/drivers/media/platform/exynos4-is/fimc-lite.c
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2013-05-31 11:37:20 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-06-12 21:55:56 -0300
commit42625fdfbd608f0bdaffaf25e8eb32ef55cddf96 (patch)
treef511d20365c8d7d7fbb7a94185ca28a57b5079ae /drivers/media/platform/exynos4-is/fimc-lite.c
parent4403106d5cfeb438b19e492e29537a00f9b5495a (diff)
[media] exynos4-is: Media graph/video device locking rework
Remove driver private video node reference counters and use entity->use_count instead. This makes the video pipelines power handling more similar to the method used in omap3isp driver. Now the graph mutex is taken always after the video mutex, as it is not possible to ensure apposite order at the all modules. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform/exynos4-is/fimc-lite.c')
-rw-r--r--drivers/media/platform/exynos4-is/fimc-lite.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
index 64198b84f673..0f372bfffaf0 100644
--- a/drivers/media/platform/exynos4-is/fimc-lite.c
+++ b/drivers/media/platform/exynos4-is/fimc-lite.c
@@ -461,8 +461,6 @@ static int fimc_lite_open(struct file *file)
struct media_entity *me = &fimc->ve.vdev.entity;
int ret;
- mutex_lock(&me->parent->graph_mutex);
-
mutex_lock(&fimc->lock);
if (atomic_read(&fimc->out_path) != FIMC_IO_DMA) {
ret = -EBUSY;
@@ -482,11 +480,19 @@ static int fimc_lite_open(struct file *file)
atomic_read(&fimc->out_path) != FIMC_IO_DMA)
goto unlock;
+ mutex_lock(&me->parent->graph_mutex);
+
ret = fimc_pipeline_call(fimc, open, &fimc->pipeline,
me, true);
+
+ /* Mark video pipeline ending at this video node as in use. */
+ if (ret == 0)
+ me->use_count++;
+
+ mutex_unlock(&me->parent->graph_mutex);
+
if (!ret) {
fimc_lite_clear_event_counters(fimc);
- fimc->ref_count++;
goto unlock;
}
@@ -496,26 +502,28 @@ err_pm:
clear_bit(ST_FLITE_IN_USE, &fimc->state);
unlock:
mutex_unlock(&fimc->lock);
- mutex_unlock(&me->parent->graph_mutex);
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(&fimc->ve.vdev.entity);
+ media_entity_pipeline_stop(entity);
fimc->streaming = false;
}
clear_bit(ST_FLITE_IN_USE, &fimc->state);
fimc_lite_stop_capture(fimc, false);
fimc_pipeline_call(fimc, close, &fimc->pipeline);
- fimc->ref_count--;
+ mutex_lock(&entity->parent->graph_mutex);
+ entity->use_count--;
+ mutex_unlock(&entity->parent->graph_mutex);
}
vb2_fop_release(file);
@@ -954,8 +962,6 @@ static int fimc_lite_link_setup(struct media_entity *entity,
__func__, remote->entity->name, local->entity->name,
flags, fimc->source_subdev_grp_id);
- mutex_lock(&fimc->lock);
-
switch (local->index) {
case FLITE_SD_PAD_SINK:
if (remote_ent_type != MEDIA_ENT_T_V4L2_SUBDEV) {
@@ -997,7 +1003,6 @@ static int fimc_lite_link_setup(struct media_entity *entity,
}
mb();
- mutex_unlock(&fimc->lock);
return ret;
}