aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2016-07-03 06:39:00 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-08-24 08:50:19 -0400
commit802d62c1db166d4ef5a27c81b372437a409b033e (patch)
treee17b90f83d85d48649eae2eb6fcd734c7d1ba57f
parentd1d094618eb24abb03a56fea7bcc6d848acb7880 (diff)
[media] saa7134: convert g/s_crop to g/s_selection
This is part of a final push to convert all drivers to g/s_selection. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/pci/saa7134/saa7134-video.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c
index 8a6ebd087889..20baa22afc42 100644
--- a/drivers/media/pci/saa7134/saa7134-video.c
+++ b/drivers/media/pci/saa7134/saa7134-video.c
@@ -1659,8 +1659,6 @@ static int saa7134_cropcap(struct file *file, void *priv,
1659 if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && 1659 if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
1660 cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) 1660 cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
1661 return -EINVAL; 1661 return -EINVAL;
1662 cap->bounds = dev->crop_bounds;
1663 cap->defrect = dev->crop_defrect;
1664 cap->pixelaspect.numerator = 1; 1662 cap->pixelaspect.numerator = 1;
1665 cap->pixelaspect.denominator = 1; 1663 cap->pixelaspect.denominator = 1;
1666 if (dev->tvnorm->id & V4L2_STD_525_60) { 1664 if (dev->tvnorm->id & V4L2_STD_525_60) {
@@ -1674,25 +1672,41 @@ static int saa7134_cropcap(struct file *file, void *priv,
1674 return 0; 1672 return 0;
1675} 1673}
1676 1674
1677static int saa7134_g_crop(struct file *file, void *f, struct v4l2_crop *crop) 1675static int saa7134_g_selection(struct file *file, void *f, struct v4l2_selection *sel)
1678{ 1676{
1679 struct saa7134_dev *dev = video_drvdata(file); 1677 struct saa7134_dev *dev = video_drvdata(file);
1680 1678
1681 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && 1679 if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
1682 crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) 1680 sel->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
1683 return -EINVAL; 1681 return -EINVAL;
1684 crop->c = dev->crop_current; 1682
1683 switch (sel->target) {
1684 case V4L2_SEL_TGT_CROP:
1685 sel->r = dev->crop_current;
1686 break;
1687 case V4L2_SEL_TGT_CROP_DEFAULT:
1688 sel->r = dev->crop_defrect;
1689 break;
1690 case V4L2_SEL_TGT_CROP_BOUNDS:
1691 sel->r = dev->crop_bounds;
1692 break;
1693 default:
1694 return -EINVAL;
1695 }
1685 return 0; 1696 return 0;
1686} 1697}
1687 1698
1688static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *crop) 1699static int saa7134_s_selection(struct file *file, void *f, struct v4l2_selection *sel)
1689{ 1700{
1690 struct saa7134_dev *dev = video_drvdata(file); 1701 struct saa7134_dev *dev = video_drvdata(file);
1691 struct v4l2_rect *b = &dev->crop_bounds; 1702 struct v4l2_rect *b = &dev->crop_bounds;
1692 struct v4l2_rect *c = &dev->crop_current; 1703 struct v4l2_rect *c = &dev->crop_current;
1693 1704
1694 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && 1705 if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
1695 crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) 1706 sel->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
1707 return -EINVAL;
1708
1709 if (sel->target != V4L2_SEL_TGT_CROP)
1696 return -EINVAL; 1710 return -EINVAL;
1697 1711
1698 if (dev->overlay_owner) 1712 if (dev->overlay_owner)
@@ -1700,7 +1714,7 @@ static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *cr
1700 if (vb2_is_streaming(&dev->video_vbq)) 1714 if (vb2_is_streaming(&dev->video_vbq))
1701 return -EBUSY; 1715 return -EBUSY;
1702 1716
1703 *c = crop->c; 1717 *c = sel->r;
1704 if (c->top < b->top) 1718 if (c->top < b->top)
1705 c->top = b->top; 1719 c->top = b->top;
1706 if (c->top > b->top + b->height) 1720 if (c->top > b->top + b->height)
@@ -1714,6 +1728,7 @@ static int saa7134_s_crop(struct file *file, void *f, const struct v4l2_crop *cr
1714 c->left = b->left + b->width; 1728 c->left = b->left + b->width;
1715 if (c->width > b->left - c->left + b->width) 1729 if (c->width > b->left - c->left + b->width)
1716 c->width = b->left - c->left + b->width; 1730 c->width = b->left - c->left + b->width;
1731 sel->r = *c;
1717 return 0; 1732 return 0;
1718} 1733}
1719 1734
@@ -1989,8 +2004,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
1989 .vidioc_streamoff = vb2_ioctl_streamoff, 2004 .vidioc_streamoff = vb2_ioctl_streamoff,
1990 .vidioc_g_tuner = saa7134_g_tuner, 2005 .vidioc_g_tuner = saa7134_g_tuner,
1991 .vidioc_s_tuner = saa7134_s_tuner, 2006 .vidioc_s_tuner = saa7134_s_tuner,
1992 .vidioc_g_crop = saa7134_g_crop, 2007 .vidioc_g_selection = saa7134_g_selection,
1993 .vidioc_s_crop = saa7134_s_crop, 2008 .vidioc_s_selection = saa7134_s_selection,
1994 .vidioc_g_fbuf = saa7134_g_fbuf, 2009 .vidioc_g_fbuf = saa7134_g_fbuf,
1995 .vidioc_s_fbuf = saa7134_s_fbuf, 2010 .vidioc_s_fbuf = saa7134_s_fbuf,
1996 .vidioc_overlay = saa7134_overlay, 2011 .vidioc_overlay = saa7134_overlay,