diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-24 00:12:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-24 00:12:49 -0400 |
commit | df462b3dbeeaae7141f1b63cbfcc1e1bae6a85fc (patch) | |
tree | bca52fce066159f136d75c69e79016422212cb1d /drivers/media/video/fsl-viu.c | |
parent | 343800e7d20944aead238c2c6e3f7789f8b6587c (diff) | |
parent | cf25220677b3f10468a74278130fe224f73632a6 (diff) |
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (247 commits)
[media] gspca - sunplus: Fix some warnings and simplify code
[media] gspca: Fix some warnings tied to 'no debug'
[media] gspca: Unset debug by default
[media] gspca - cpia1: Remove a bad conditional compilation instruction
[media] gspca - main: Remove USB traces
[media] gspca - main: Version change to 2.13
[media] gspca - stk014 / t613: Accept the index 0 in querymenu
[media] gspca - kinect: Remove __devinitdata
[media] gspca - cpia1: Fix some warnings
[media] video/Kconfig: Fix mis-classified devices
[media] support for medion dvb stick 1660:1921
[media] tm6000: fix uninitialized field, change prink to dprintk
[media] cx231xx: Add support for Iconbit U100
[media] saa7134 add new TV cards
[media] Use a more consistent value for RC repeat period
[media] cx18: Move spinlock and vb_type initialisation into stream_init
[media] tm6000: remove tm6010 sif audio start and stop
[media] tm6000: remove unused exports
[media] tm6000: add pts logging
[media] tm6000: change from ioctl to unlocked_ioctl
...
Diffstat (limited to 'drivers/media/video/fsl-viu.c')
-rw-r--r-- | drivers/media/video/fsl-viu.c | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c index 031af1610154..908d7012c3f2 100644 --- a/drivers/media/video/fsl-viu.c +++ b/drivers/media/video/fsl-viu.c | |||
@@ -766,7 +766,7 @@ inline void viu_activate_overlay(struct viu_reg *viu_reg) | |||
766 | out_be32(&vr->picture_count, reg_val.picture_count); | 766 | out_be32(&vr->picture_count, reg_val.picture_count); |
767 | } | 767 | } |
768 | 768 | ||
769 | static int viu_start_preview(struct viu_dev *dev, struct viu_fh *fh) | 769 | static int viu_setup_preview(struct viu_dev *dev, struct viu_fh *fh) |
770 | { | 770 | { |
771 | int bpp; | 771 | int bpp; |
772 | 772 | ||
@@ -805,11 +805,6 @@ static int viu_start_preview(struct viu_dev *dev, struct viu_fh *fh) | |||
805 | /* setup the base address of the overlay buffer */ | 805 | /* setup the base address of the overlay buffer */ |
806 | reg_val.field_base_addr = (u32)dev->ovbuf.base; | 806 | reg_val.field_base_addr = (u32)dev->ovbuf.base; |
807 | 807 | ||
808 | dev->ovenable = 1; | ||
809 | viu_activate_overlay(dev->vr); | ||
810 | |||
811 | /* start dma */ | ||
812 | viu_start_dma(dev); | ||
813 | return 0; | 808 | return 0; |
814 | } | 809 | } |
815 | 810 | ||
@@ -825,13 +820,11 @@ static int vidioc_s_fmt_overlay(struct file *file, void *priv, | |||
825 | if (err) | 820 | if (err) |
826 | return err; | 821 | return err; |
827 | 822 | ||
828 | mutex_lock(&dev->lock); | ||
829 | fh->win = f->fmt.win; | 823 | fh->win = f->fmt.win; |
830 | 824 | ||
831 | spin_lock_irqsave(&dev->slock, flags); | 825 | spin_lock_irqsave(&dev->slock, flags); |
832 | viu_start_preview(dev, fh); | 826 | viu_setup_preview(dev, fh); |
833 | spin_unlock_irqrestore(&dev->slock, flags); | 827 | spin_unlock_irqrestore(&dev->slock, flags); |
834 | mutex_unlock(&dev->lock); | ||
835 | return 0; | 828 | return 0; |
836 | } | 829 | } |
837 | 830 | ||
@@ -841,6 +834,28 @@ static int vidioc_try_fmt_overlay(struct file *file, void *priv, | |||
841 | return 0; | 834 | return 0; |
842 | } | 835 | } |
843 | 836 | ||
837 | static int vidioc_overlay(struct file *file, void *priv, unsigned int on) | ||
838 | { | ||
839 | struct viu_fh *fh = priv; | ||
840 | struct viu_dev *dev = (struct viu_dev *)fh->dev; | ||
841 | unsigned long flags; | ||
842 | |||
843 | if (on) { | ||
844 | spin_lock_irqsave(&dev->slock, flags); | ||
845 | viu_activate_overlay(dev->vr); | ||
846 | dev->ovenable = 1; | ||
847 | |||
848 | /* start dma */ | ||
849 | viu_start_dma(dev); | ||
850 | spin_unlock_irqrestore(&dev->slock, flags); | ||
851 | } else { | ||
852 | viu_stop_dma(dev); | ||
853 | dev->ovenable = 0; | ||
854 | } | ||
855 | |||
856 | return 0; | ||
857 | } | ||
858 | |||
844 | int vidioc_g_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg) | 859 | int vidioc_g_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg) |
845 | { | 860 | { |
846 | struct viu_fh *fh = priv; | 861 | struct viu_fh *fh = priv; |
@@ -911,12 +926,16 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) | |||
911 | static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) | 926 | static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) |
912 | { | 927 | { |
913 | struct viu_fh *fh = priv; | 928 | struct viu_fh *fh = priv; |
929 | struct viu_dev *dev = fh->dev; | ||
914 | 930 | ||
915 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 931 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
916 | return -EINVAL; | 932 | return -EINVAL; |
917 | if (fh->type != i) | 933 | if (fh->type != i) |
918 | return -EINVAL; | 934 | return -EINVAL; |
919 | 935 | ||
936 | if (dev->ovenable) | ||
937 | dev->ovenable = 0; | ||
938 | |||
920 | viu_start_dma(fh->dev); | 939 | viu_start_dma(fh->dev); |
921 | 940 | ||
922 | return videobuf_streamon(&fh->vb_vidq); | 941 | return videobuf_streamon(&fh->vb_vidq); |
@@ -1311,7 +1330,8 @@ static int viu_open(struct file *file) | |||
1311 | videobuf_queue_dma_contig_init(&fh->vb_vidq, &viu_video_qops, | 1330 | videobuf_queue_dma_contig_init(&fh->vb_vidq, &viu_video_qops, |
1312 | dev->dev, &fh->vbq_lock, | 1331 | dev->dev, &fh->vbq_lock, |
1313 | fh->type, V4L2_FIELD_INTERLACED, | 1332 | fh->type, V4L2_FIELD_INTERLACED, |
1314 | sizeof(struct viu_buf), fh, NULL); | 1333 | sizeof(struct viu_buf), fh, |
1334 | &fh->dev->lock); | ||
1315 | return 0; | 1335 | return 0; |
1316 | } | 1336 | } |
1317 | 1337 | ||
@@ -1401,7 +1421,7 @@ static struct v4l2_file_operations viu_fops = { | |||
1401 | .release = viu_release, | 1421 | .release = viu_release, |
1402 | .read = viu_read, | 1422 | .read = viu_read, |
1403 | .poll = viu_poll, | 1423 | .poll = viu_poll, |
1404 | .ioctl = video_ioctl2, /* V4L2 ioctl handler */ | 1424 | .unlocked_ioctl = video_ioctl2, /* V4L2 ioctl handler */ |
1405 | .mmap = viu_mmap, | 1425 | .mmap = viu_mmap, |
1406 | }; | 1426 | }; |
1407 | 1427 | ||
@@ -1415,6 +1435,7 @@ static const struct v4l2_ioctl_ops viu_ioctl_ops = { | |||
1415 | .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_overlay, | 1435 | .vidioc_g_fmt_vid_overlay = vidioc_g_fmt_overlay, |
1416 | .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_overlay, | 1436 | .vidioc_try_fmt_vid_overlay = vidioc_try_fmt_overlay, |
1417 | .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_overlay, | 1437 | .vidioc_s_fmt_vid_overlay = vidioc_s_fmt_overlay, |
1438 | .vidioc_overlay = vidioc_overlay, | ||
1418 | .vidioc_g_fbuf = vidioc_g_fbuf, | 1439 | .vidioc_g_fbuf = vidioc_g_fbuf, |
1419 | .vidioc_s_fbuf = vidioc_s_fbuf, | 1440 | .vidioc_s_fbuf = vidioc_s_fbuf, |
1420 | .vidioc_reqbufs = vidioc_reqbufs, | 1441 | .vidioc_reqbufs = vidioc_reqbufs, |
@@ -1498,9 +1519,6 @@ static int __devinit viu_of_probe(struct platform_device *op) | |||
1498 | INIT_LIST_HEAD(&viu_dev->vidq.active); | 1519 | INIT_LIST_HEAD(&viu_dev->vidq.active); |
1499 | INIT_LIST_HEAD(&viu_dev->vidq.queued); | 1520 | INIT_LIST_HEAD(&viu_dev->vidq.queued); |
1500 | 1521 | ||
1501 | /* initialize locks */ | ||
1502 | mutex_init(&viu_dev->lock); | ||
1503 | |||
1504 | snprintf(viu_dev->v4l2_dev.name, | 1522 | snprintf(viu_dev->v4l2_dev.name, |
1505 | sizeof(viu_dev->v4l2_dev.name), "%s", "VIU"); | 1523 | sizeof(viu_dev->v4l2_dev.name), "%s", "VIU"); |
1506 | ret = v4l2_device_register(viu_dev->dev, &viu_dev->v4l2_dev); | 1524 | ret = v4l2_device_register(viu_dev->dev, &viu_dev->v4l2_dev); |
@@ -1531,8 +1549,15 @@ static int __devinit viu_of_probe(struct platform_device *op) | |||
1531 | 1549 | ||
1532 | viu_dev->vdev = vdev; | 1550 | viu_dev->vdev = vdev; |
1533 | 1551 | ||
1552 | /* initialize locks */ | ||
1553 | mutex_init(&viu_dev->lock); | ||
1554 | viu_dev->vdev->lock = &viu_dev->lock; | ||
1555 | spin_lock_init(&viu_dev->slock); | ||
1556 | |||
1534 | video_set_drvdata(viu_dev->vdev, viu_dev); | 1557 | video_set_drvdata(viu_dev->vdev, viu_dev); |
1535 | 1558 | ||
1559 | mutex_lock(&viu_dev->lock); | ||
1560 | |||
1536 | ret = video_register_device(viu_dev->vdev, VFL_TYPE_GRABBER, -1); | 1561 | ret = video_register_device(viu_dev->vdev, VFL_TYPE_GRABBER, -1); |
1537 | if (ret < 0) { | 1562 | if (ret < 0) { |
1538 | video_device_release(viu_dev->vdev); | 1563 | video_device_release(viu_dev->vdev); |
@@ -1559,6 +1584,8 @@ static int __devinit viu_of_probe(struct platform_device *op) | |||
1559 | goto err_irq; | 1584 | goto err_irq; |
1560 | } | 1585 | } |
1561 | 1586 | ||
1587 | mutex_unlock(&viu_dev->lock); | ||
1588 | |||
1562 | dev_info(&op->dev, "Freescale VIU Video Capture Board\n"); | 1589 | dev_info(&op->dev, "Freescale VIU Video Capture Board\n"); |
1563 | return ret; | 1590 | return ret; |
1564 | 1591 | ||
@@ -1568,6 +1595,7 @@ err_irq: | |||
1568 | err_clk: | 1595 | err_clk: |
1569 | video_unregister_device(viu_dev->vdev); | 1596 | video_unregister_device(viu_dev->vdev); |
1570 | err_vdev: | 1597 | err_vdev: |
1598 | mutex_unlock(&viu_dev->lock); | ||
1571 | i2c_put_adapter(ad); | 1599 | i2c_put_adapter(ad); |
1572 | v4l2_device_unregister(&viu_dev->v4l2_dev); | 1600 | v4l2_device_unregister(&viu_dev->v4l2_dev); |
1573 | err: | 1601 | err: |