aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-03 14:13:32 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-03 14:13:32 -0500
commit4ba0032984fd2626209c6aef0ee025912875bf9f (patch)
treef6ae0ac2e5bd2ca11e7dd169e3370b9572c38a90
parent25a3bc6bd1ca03ab504b8c55c98f8d0135644d53 (diff)
parentd2a0db1ee01aea154ccc460e45a16857e32c4427 (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media fixes from Mauro Carvalho Chehab: "Some driver fixes for s5p/exynos (mostly race fixes)" * 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: [media] s5p-mfc: Handle multi-frame input buffer [media] s5p-mfc: Bug fix of timestamp/timecode copy mechanism [media] exynos-gsc: Add missing video device vfl_dir flag initialization [media] exynos-gsc: Fix settings for input and output image RGB type [media] exynos-gsc: Don't use mutex_lock_interruptible() in device release() [media] fimc-lite: Don't use mutex_lock_interruptible() in device release() [media] s5p-fimc: Don't use mutex_lock_interruptible() in device release() [media] s5p-fimc: Prevent race conditions during subdevs registration
-rw-r--r--drivers/media/platform/exynos-gsc/gsc-m2m.c4
-rw-r--r--drivers/media/platform/exynos-gsc/gsc-regs.h16
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-capture.c10
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-lite.c6
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-m2m.c3
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-mdevice.c4
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc.c7
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c2
8 files changed, 27 insertions, 25 deletions
diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c
index 3c7f00577bd9..c065d040ed94 100644
--- a/drivers/media/platform/exynos-gsc/gsc-m2m.c
+++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c
@@ -657,8 +657,7 @@ static int gsc_m2m_release(struct file *file)
657 pr_debug("pid: %d, state: 0x%lx, refcnt= %d", 657 pr_debug("pid: %d, state: 0x%lx, refcnt= %d",
658 task_pid_nr(current), gsc->state, gsc->m2m.refcnt); 658 task_pid_nr(current), gsc->state, gsc->m2m.refcnt);
659 659
660 if (mutex_lock_interruptible(&gsc->lock)) 660 mutex_lock(&gsc->lock);
661 return -ERESTARTSYS;
662 661
663 v4l2_m2m_ctx_release(ctx->m2m_ctx); 662 v4l2_m2m_ctx_release(ctx->m2m_ctx);
664 gsc_ctrls_delete(ctx); 663 gsc_ctrls_delete(ctx);
@@ -732,6 +731,7 @@ int gsc_register_m2m_device(struct gsc_dev *gsc)
732 gsc->vdev.ioctl_ops = &gsc_m2m_ioctl_ops; 731 gsc->vdev.ioctl_ops = &gsc_m2m_ioctl_ops;
733 gsc->vdev.release = video_device_release_empty; 732 gsc->vdev.release = video_device_release_empty;
734 gsc->vdev.lock = &gsc->lock; 733 gsc->vdev.lock = &gsc->lock;
734 gsc->vdev.vfl_dir = VFL_DIR_M2M;
735 snprintf(gsc->vdev.name, sizeof(gsc->vdev.name), "%s.%d:m2m", 735 snprintf(gsc->vdev.name, sizeof(gsc->vdev.name), "%s.%d:m2m",
736 GSC_MODULE_NAME, gsc->id); 736 GSC_MODULE_NAME, gsc->id);
737 737
diff --git a/drivers/media/platform/exynos-gsc/gsc-regs.h b/drivers/media/platform/exynos-gsc/gsc-regs.h
index 533e9947a925..4678f9a6a4fd 100644
--- a/drivers/media/platform/exynos-gsc/gsc-regs.h
+++ b/drivers/media/platform/exynos-gsc/gsc-regs.h
@@ -40,10 +40,10 @@
40#define GSC_IN_ROT_YFLIP (2 << 16) 40#define GSC_IN_ROT_YFLIP (2 << 16)
41#define GSC_IN_ROT_XFLIP (1 << 16) 41#define GSC_IN_ROT_XFLIP (1 << 16)
42#define GSC_IN_RGB_TYPE_MASK (3 << 14) 42#define GSC_IN_RGB_TYPE_MASK (3 << 14)
43#define GSC_IN_RGB_HD_WIDE (3 << 14) 43#define GSC_IN_RGB_HD_NARROW (3 << 14)
44#define GSC_IN_RGB_HD_NARROW (2 << 14) 44#define GSC_IN_RGB_HD_WIDE (2 << 14)
45#define GSC_IN_RGB_SD_WIDE (1 << 14) 45#define GSC_IN_RGB_SD_NARROW (1 << 14)
46#define GSC_IN_RGB_SD_NARROW (0 << 14) 46#define GSC_IN_RGB_SD_WIDE (0 << 14)
47#define GSC_IN_YUV422_1P_ORDER_MASK (1 << 13) 47#define GSC_IN_YUV422_1P_ORDER_MASK (1 << 13)
48#define GSC_IN_YUV422_1P_ORDER_LSB_Y (0 << 13) 48#define GSC_IN_YUV422_1P_ORDER_LSB_Y (0 << 13)
49#define GSC_IN_YUV422_1P_OEDER_LSB_C (1 << 13) 49#define GSC_IN_YUV422_1P_OEDER_LSB_C (1 << 13)
@@ -85,10 +85,10 @@
85#define GSC_OUT_GLOBAL_ALPHA_MASK (0xff << 24) 85#define GSC_OUT_GLOBAL_ALPHA_MASK (0xff << 24)
86#define GSC_OUT_GLOBAL_ALPHA(x) ((x) << 24) 86#define GSC_OUT_GLOBAL_ALPHA(x) ((x) << 24)
87#define GSC_OUT_RGB_TYPE_MASK (3 << 10) 87#define GSC_OUT_RGB_TYPE_MASK (3 << 10)
88#define GSC_OUT_RGB_HD_NARROW (3 << 10) 88#define GSC_OUT_RGB_HD_WIDE (3 << 10)
89#define GSC_OUT_RGB_HD_WIDE (2 << 10) 89#define GSC_OUT_RGB_HD_NARROW (2 << 10)
90#define GSC_OUT_RGB_SD_NARROW (1 << 10) 90#define GSC_OUT_RGB_SD_WIDE (1 << 10)
91#define GSC_OUT_RGB_SD_WIDE (0 << 10) 91#define GSC_OUT_RGB_SD_NARROW (0 << 10)
92#define GSC_OUT_YUV422_1P_ORDER_MASK (1 << 9) 92#define GSC_OUT_YUV422_1P_ORDER_MASK (1 << 9)
93#define GSC_OUT_YUV422_1P_ORDER_LSB_Y (0 << 9) 93#define GSC_OUT_YUV422_1P_ORDER_LSB_Y (0 << 9)
94#define GSC_OUT_YUV422_1P_OEDER_LSB_C (1 << 9) 94#define GSC_OUT_YUV422_1P_OEDER_LSB_C (1 << 9)
diff --git a/drivers/media/platform/s5p-fimc/fimc-capture.c b/drivers/media/platform/s5p-fimc/fimc-capture.c
index 3d39d97abaa5..891ee873c62b 100644
--- a/drivers/media/platform/s5p-fimc/fimc-capture.c
+++ b/drivers/media/platform/s5p-fimc/fimc-capture.c
@@ -556,8 +556,7 @@ static int fimc_capture_close(struct file *file)
556 556
557 dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); 557 dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state);
558 558
559 if (mutex_lock_interruptible(&fimc->lock)) 559 mutex_lock(&fimc->lock);
560 return -ERESTARTSYS;
561 560
562 if (--fimc->vid_cap.refcnt == 0) { 561 if (--fimc->vid_cap.refcnt == 0) {
563 clear_bit(ST_CAPT_BUSY, &fimc->state); 562 clear_bit(ST_CAPT_BUSY, &fimc->state);
@@ -1774,9 +1773,13 @@ static int fimc_capture_subdev_registered(struct v4l2_subdev *sd)
1774 if (ret) 1773 if (ret)
1775 return ret; 1774 return ret;
1776 1775
1776 fimc->pipeline_ops = v4l2_get_subdev_hostdata(sd);
1777
1777 ret = fimc_register_capture_device(fimc, sd->v4l2_dev); 1778 ret = fimc_register_capture_device(fimc, sd->v4l2_dev);
1778 if (ret) 1779 if (ret) {
1779 fimc_unregister_m2m_device(fimc); 1780 fimc_unregister_m2m_device(fimc);
1781 fimc->pipeline_ops = NULL;
1782 }
1780 1783
1781 return ret; 1784 return ret;
1782} 1785}
@@ -1793,6 +1796,7 @@ static void fimc_capture_subdev_unregistered(struct v4l2_subdev *sd)
1793 if (video_is_registered(&fimc->vid_cap.vfd)) { 1796 if (video_is_registered(&fimc->vid_cap.vfd)) {
1794 video_unregister_device(&fimc->vid_cap.vfd); 1797 video_unregister_device(&fimc->vid_cap.vfd);
1795 media_entity_cleanup(&fimc->vid_cap.vfd.entity); 1798 media_entity_cleanup(&fimc->vid_cap.vfd.entity);
1799 fimc->pipeline_ops = NULL;
1796 } 1800 }
1797 kfree(fimc->vid_cap.ctx); 1801 kfree(fimc->vid_cap.ctx);
1798 fimc->vid_cap.ctx = NULL; 1802 fimc->vid_cap.ctx = NULL;
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c
index 9db246bed841..1b309a72f09f 100644
--- a/drivers/media/platform/s5p-fimc/fimc-lite.c
+++ b/drivers/media/platform/s5p-fimc/fimc-lite.c
@@ -491,8 +491,7 @@ static int fimc_lite_close(struct file *file)
491 struct fimc_lite *fimc = video_drvdata(file); 491 struct fimc_lite *fimc = video_drvdata(file);
492 int ret; 492 int ret;
493 493
494 if (mutex_lock_interruptible(&fimc->lock)) 494 mutex_lock(&fimc->lock);
495 return -ERESTARTSYS;
496 495
497 if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) { 496 if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) {
498 clear_bit(ST_FLITE_IN_USE, &fimc->state); 497 clear_bit(ST_FLITE_IN_USE, &fimc->state);
@@ -1263,10 +1262,12 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd)
1263 return ret; 1262 return ret;
1264 1263
1265 video_set_drvdata(vfd, fimc); 1264 video_set_drvdata(vfd, fimc);
1265 fimc->pipeline_ops = v4l2_get_subdev_hostdata(sd);
1266 1266
1267 ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); 1267 ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1);
1268 if (ret < 0) { 1268 if (ret < 0) {
1269 media_entity_cleanup(&vfd->entity); 1269 media_entity_cleanup(&vfd->entity);
1270 fimc->pipeline_ops = NULL;
1270 return ret; 1271 return ret;
1271 } 1272 }
1272 1273
@@ -1285,6 +1286,7 @@ static void fimc_lite_subdev_unregistered(struct v4l2_subdev *sd)
1285 if (video_is_registered(&fimc->vfd)) { 1286 if (video_is_registered(&fimc->vfd)) {
1286 video_unregister_device(&fimc->vfd); 1287 video_unregister_device(&fimc->vfd);
1287 media_entity_cleanup(&fimc->vfd.entity); 1288 media_entity_cleanup(&fimc->vfd.entity);
1289 fimc->pipeline_ops = NULL;
1288 } 1290 }
1289} 1291}
1290 1292
diff --git a/drivers/media/platform/s5p-fimc/fimc-m2m.c b/drivers/media/platform/s5p-fimc/fimc-m2m.c
index 4500e44f6857..62afed3162ea 100644
--- a/drivers/media/platform/s5p-fimc/fimc-m2m.c
+++ b/drivers/media/platform/s5p-fimc/fimc-m2m.c
@@ -718,8 +718,7 @@ static int fimc_m2m_release(struct file *file)
718 dbg("pid: %d, state: 0x%lx, refcnt= %d", 718 dbg("pid: %d, state: 0x%lx, refcnt= %d",
719 task_pid_nr(current), fimc->state, fimc->m2m.refcnt); 719 task_pid_nr(current), fimc->state, fimc->m2m.refcnt);
720 720
721 if (mutex_lock_interruptible(&fimc->lock)) 721 mutex_lock(&fimc->lock);
722 return -ERESTARTSYS;
723 722
724 v4l2_m2m_ctx_release(ctx->m2m_ctx); 723 v4l2_m2m_ctx_release(ctx->m2m_ctx);
725 fimc_ctrls_delete(ctx); 724 fimc_ctrls_delete(ctx);
diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
index 38ea4d143a49..0531ab70a94c 100644
--- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c
+++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
@@ -352,6 +352,7 @@ static int fimc_register_callback(struct device *dev, void *p)
352 352
353 sd = &fimc->vid_cap.subdev; 353 sd = &fimc->vid_cap.subdev;
354 sd->grp_id = FIMC_GROUP_ID; 354 sd->grp_id = FIMC_GROUP_ID;
355 v4l2_set_subdev_hostdata(sd, (void *)&fimc_pipeline_ops);
355 356
356 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); 357 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd);
357 if (ret) { 358 if (ret) {
@@ -360,7 +361,6 @@ static int fimc_register_callback(struct device *dev, void *p)
360 return ret; 361 return ret;
361 } 362 }
362 363
363 fimc->pipeline_ops = &fimc_pipeline_ops;
364 fmd->fimc[fimc->id] = fimc; 364 fmd->fimc[fimc->id] = fimc;
365 return 0; 365 return 0;
366} 366}
@@ -375,6 +375,7 @@ static int fimc_lite_register_callback(struct device *dev, void *p)
375 return 0; 375 return 0;
376 376
377 fimc->subdev.grp_id = FLITE_GROUP_ID; 377 fimc->subdev.grp_id = FLITE_GROUP_ID;
378 v4l2_set_subdev_hostdata(&fimc->subdev, (void *)&fimc_pipeline_ops);
378 379
379 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, &fimc->subdev); 380 ret = v4l2_device_register_subdev(&fmd->v4l2_dev, &fimc->subdev);
380 if (ret) { 381 if (ret) {
@@ -384,7 +385,6 @@ static int fimc_lite_register_callback(struct device *dev, void *p)
384 return ret; 385 return ret;
385 } 386 }
386 387
387 fimc->pipeline_ops = &fimc_pipeline_ops;
388 fmd->fimc_lite[fimc->index] = fimc; 388 fmd->fimc_lite[fimc->index] = fimc;
389 return 0; 389 return 0;
390} 390}
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 130f4ac8649e..3afe879d54d7 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -381,11 +381,8 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx,
381 ctx->consumed_stream += s5p_mfc_hw_call(dev->mfc_ops, 381 ctx->consumed_stream += s5p_mfc_hw_call(dev->mfc_ops,
382 get_consumed_stream, dev); 382 get_consumed_stream, dev);
383 if (ctx->codec_mode != S5P_MFC_CODEC_H264_DEC && 383 if (ctx->codec_mode != S5P_MFC_CODEC_H264_DEC &&
384 s5p_mfc_hw_call(dev->mfc_ops, 384 ctx->consumed_stream + STUFF_BYTE <
385 get_dec_frame_type, dev) == 385 src_buf->b->v4l2_planes[0].bytesused) {
386 S5P_FIMV_DECODE_FRAME_P_FRAME
387 && ctx->consumed_stream + STUFF_BYTE <
388 src_buf->b->v4l2_planes[0].bytesused) {
389 /* Run MFC again on the same buffer */ 386 /* Run MFC again on the same buffer */
390 mfc_debug(2, "Running again the same buffer\n"); 387 mfc_debug(2, "Running again the same buffer\n");
391 ctx->after_packed_pb = 1; 388 ctx->after_packed_pb = 1;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index 50b5bee3c44e..3a8cfd9fc1bd 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -1762,7 +1762,7 @@ int s5p_mfc_get_dspl_y_adr_v6(struct s5p_mfc_dev *dev)
1762 1762
1763int s5p_mfc_get_dec_y_adr_v6(struct s5p_mfc_dev *dev) 1763int s5p_mfc_get_dec_y_adr_v6(struct s5p_mfc_dev *dev)
1764{ 1764{
1765 return mfc_read(dev, S5P_FIMV_D_DISPLAY_LUMA_ADDR_V6); 1765 return mfc_read(dev, S5P_FIMV_D_DECODED_LUMA_ADDR_V6);
1766} 1766}
1767 1767
1768int s5p_mfc_get_dspl_status_v6(struct s5p_mfc_dev *dev) 1768int s5p_mfc_get_dspl_status_v6(struct s5p_mfc_dev *dev)