diff options
author | Jonathan Corbet <corbet@lwn.net> | 2010-09-24 13:17:29 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-20 23:17:05 -0400 |
commit | e99dfcf7f68d8dffccfa795d1548790cee2d7395 (patch) | |
tree | 8402127de2243502f9d4a2270af7307568832a32 /drivers/media/video/ov7670.c | |
parent | df2b9b0f9c02689ce3b3f0b5dbc6c9b272bbe1ab (diff) |
[media] ov7670: implement VIDIOC_ENUM_FRAMEINTERVALS
Inquiring minds (and gstreamer) want to know.
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ov7670.c')
-rw-r--r-- | drivers/media/video/ov7670.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index 089013ec987a..ffccac5c2d75 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c | |||
@@ -887,14 +887,28 @@ static int ov7670_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) | |||
887 | } | 887 | } |
888 | 888 | ||
889 | 889 | ||
890 | |||
891 | /* | 890 | /* |
892 | * Code for dealing with controls. | 891 | * Frame intervals. Since frame rates are controlled with the clock |
892 | * divider, we can only do 30/n for integer n values. So no continuous | ||
893 | * or stepwise options. Here we just pick a handful of logical values. | ||
893 | */ | 894 | */ |
894 | 895 | ||
896 | static int ov7670_frame_rates[] = { 30, 15, 10, 5, 1 }; | ||
895 | 897 | ||
898 | static int ov7670_enum_frameintervals(struct v4l2_subdev *sd, | ||
899 | struct v4l2_frmivalenum *interval) | ||
900 | { | ||
901 | if (interval->index >= ARRAY_SIZE(ov7670_frame_rates)) | ||
902 | return -EINVAL; | ||
903 | interval->type = V4L2_FRMIVAL_TYPE_DISCRETE; | ||
904 | interval->discrete.numerator = 1; | ||
905 | interval->discrete.denominator = ov7670_frame_rates[interval->index]; | ||
906 | return 0; | ||
907 | } | ||
896 | 908 | ||
897 | 909 | /* | |
910 | * Code for dealing with controls. | ||
911 | */ | ||
898 | 912 | ||
899 | static int ov7670_store_cmatrix(struct v4l2_subdev *sd, | 913 | static int ov7670_store_cmatrix(struct v4l2_subdev *sd, |
900 | int matrix[CMATRIX_LEN]) | 914 | int matrix[CMATRIX_LEN]) |
@@ -1438,6 +1452,7 @@ static const struct v4l2_subdev_video_ops ov7670_video_ops = { | |||
1438 | .s_mbus_fmt = ov7670_s_mbus_fmt, | 1452 | .s_mbus_fmt = ov7670_s_mbus_fmt, |
1439 | .s_parm = ov7670_s_parm, | 1453 | .s_parm = ov7670_s_parm, |
1440 | .g_parm = ov7670_g_parm, | 1454 | .g_parm = ov7670_g_parm, |
1455 | .enum_frameintervals = ov7670_enum_frameintervals, | ||
1441 | }; | 1456 | }; |
1442 | 1457 | ||
1443 | static const struct v4l2_subdev_ops ov7670_ops = { | 1458 | static const struct v4l2_subdev_ops ov7670_ops = { |