diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-08-06 20:53:59 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-08-13 19:39:08 -0400 |
commit | d96ecda63f41350dc93c17ccb72ea24511f207a9 (patch) | |
tree | b154253bb1bd1c021ce32964f5850b2c5b0e0686 /drivers/media | |
parent | 83053f7fe3eb0b6b1634d24ede87f1daa01ae60c (diff) |
V4L/DVB (12400): em28xx: Allow changing fps on webcams
em28xx doesn't have temporal scaling. However, on webcams, sensors are
capable of changing the output rate. So, VIDIOC_[G|S]_PARM ioctls should
be passed to the sensor for it to properly set frame rate.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index ff37b4c15f44..92ee9c644328 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -846,6 +846,41 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm) | |||
846 | return 0; | 846 | return 0; |
847 | } | 847 | } |
848 | 848 | ||
849 | static int vidioc_g_parm(struct file *file, void *priv, | ||
850 | struct v4l2_streamparm *p) | ||
851 | { | ||
852 | struct em28xx_fh *fh = priv; | ||
853 | struct em28xx *dev = fh->dev; | ||
854 | int rc = 0; | ||
855 | |||
856 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
857 | return -EINVAL; | ||
858 | |||
859 | if (dev->board.is_webcam) | ||
860 | rc = v4l2_device_call_until_err(&dev->v4l2_dev, 0, | ||
861 | video, g_parm, p); | ||
862 | else | ||
863 | v4l2_video_std_frame_period(dev->norm, | ||
864 | &p->parm.capture.timeperframe); | ||
865 | |||
866 | return rc; | ||
867 | } | ||
868 | |||
869 | static int vidioc_s_parm(struct file *file, void *priv, | ||
870 | struct v4l2_streamparm *p) | ||
871 | { | ||
872 | struct em28xx_fh *fh = priv; | ||
873 | struct em28xx *dev = fh->dev; | ||
874 | |||
875 | if (!dev->board.is_webcam) | ||
876 | return -EINVAL; | ||
877 | |||
878 | if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
879 | return -EINVAL; | ||
880 | |||
881 | return v4l2_device_call_until_err(&dev->v4l2_dev, 0, video, s_parm, p); | ||
882 | } | ||
883 | |||
849 | static const char *iname[] = { | 884 | static const char *iname[] = { |
850 | [EM28XX_VMUX_COMPOSITE1] = "Composite1", | 885 | [EM28XX_VMUX_COMPOSITE1] = "Composite1", |
851 | [EM28XX_VMUX_COMPOSITE2] = "Composite2", | 886 | [EM28XX_VMUX_COMPOSITE2] = "Composite2", |
@@ -1885,6 +1920,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
1885 | .vidioc_qbuf = vidioc_qbuf, | 1920 | .vidioc_qbuf = vidioc_qbuf, |
1886 | .vidioc_dqbuf = vidioc_dqbuf, | 1921 | .vidioc_dqbuf = vidioc_dqbuf, |
1887 | .vidioc_s_std = vidioc_s_std, | 1922 | .vidioc_s_std = vidioc_s_std, |
1923 | .vidioc_g_parm = vidioc_g_parm, | ||
1924 | .vidioc_s_parm = vidioc_s_parm, | ||
1888 | .vidioc_enum_input = vidioc_enum_input, | 1925 | .vidioc_enum_input = vidioc_enum_input, |
1889 | .vidioc_g_input = vidioc_g_input, | 1926 | .vidioc_g_input = vidioc_g_input, |
1890 | .vidioc_s_input = vidioc_s_input, | 1927 | .vidioc_s_input = vidioc_s_input, |