From 3e5443aaee43965eeb2cde797b6e1af483cdd9cf Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Fri, 24 Sep 2010 14:17:29 -0300 Subject: [PATCH] --- yaml --- r: 219237 b: refs/heads/master c: e99dfcf7f68d8dffccfa795d1548790cee2d7395 h: refs/heads/master i: 219235: 5383305a30638d2915f8b14fbbfc854781280924 v: v3 --- [refs] | 2 +- trunk/drivers/media/video/ov7670.c | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 9d209da0e15f..d380b8024b06 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: df2b9b0f9c02689ce3b3f0b5dbc6c9b272bbe1ab +refs/heads/master: e99dfcf7f68d8dffccfa795d1548790cee2d7395 diff --git a/trunk/drivers/media/video/ov7670.c b/trunk/drivers/media/video/ov7670.c index 089013ec987a..ffccac5c2d75 100644 --- a/trunk/drivers/media/video/ov7670.c +++ b/trunk/drivers/media/video/ov7670.c @@ -887,14 +887,28 @@ static int ov7670_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) } - /* - * Code for dealing with controls. + * Frame intervals. Since frame rates are controlled with the clock + * divider, we can only do 30/n for integer n values. So no continuous + * or stepwise options. Here we just pick a handful of logical values. */ +static int ov7670_frame_rates[] = { 30, 15, 10, 5, 1 }; +static int ov7670_enum_frameintervals(struct v4l2_subdev *sd, + struct v4l2_frmivalenum *interval) +{ + if (interval->index >= ARRAY_SIZE(ov7670_frame_rates)) + return -EINVAL; + interval->type = V4L2_FRMIVAL_TYPE_DISCRETE; + interval->discrete.numerator = 1; + interval->discrete.denominator = ov7670_frame_rates[interval->index]; + return 0; +} - +/* + * Code for dealing with controls. + */ static int ov7670_store_cmatrix(struct v4l2_subdev *sd, int matrix[CMATRIX_LEN]) @@ -1438,6 +1452,7 @@ static const struct v4l2_subdev_video_ops ov7670_video_ops = { .s_mbus_fmt = ov7670_s_mbus_fmt, .s_parm = ov7670_s_parm, .g_parm = ov7670_g_parm, + .enum_frameintervals = ov7670_enum_frameintervals, }; static const struct v4l2_subdev_ops ov7670_ops = {