summaryrefslogtreecommitdiff
path: root/drivers/media/pci/cobalt
diff options
context:
space:
mode:
authorJose Abreu <Jose.Abreu@synopsys.com>2017-03-21 14:49:18 +0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-08-31 17:03:21 +0300
commit3ae17c66ed666c5a5c627f28c9e20b2ab8fafe28 (patch)
treebf3a721bb36c5886a93a287d02e25cd8b2be726c /drivers/media/pci/cobalt
parent87f9ed85d0f93fcc810dd7081e5f1a883940fab6 (diff)
downloadlinux-3ae17c66ed666c5a5c627f28c9e20b2ab8fafe28.tar.xz
media: cobalt: Use v4l2_calc_timeperframe helper
Currently, cobalt driver always returns 60fps in g_parm. This patch uses the new v4l2_calc_timeperframe helper to calculate the time per frame value. Signed-off-by: Jose Abreu <joabreu@synopsys.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/pci/cobalt')
-rw-r--r--drivers/media/pci/cobalt/cobalt-v4l2.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/media/pci/cobalt/cobalt-v4l2.c b/drivers/media/pci/cobalt/cobalt-v4l2.c
index e2a4c705d353..c8fd2d075f43 100644
--- a/drivers/media/pci/cobalt/cobalt-v4l2.c
+++ b/drivers/media/pci/cobalt/cobalt-v4l2.c
@@ -1064,10 +1064,15 @@ static int cobalt_subscribe_event(struct v4l2_fh *fh,
static int cobalt_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
{
+ struct cobalt_stream *s = video_drvdata(file);
+ struct v4l2_fract fps;
+
if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
- a->parm.capture.timeperframe.numerator = 1;
- a->parm.capture.timeperframe.denominator = 60;
+
+ fps = v4l2_calc_timeperframe(&s->timings);
+ a->parm.capture.timeperframe.numerator = fps.numerator;
+ a->parm.capture.timeperframe.denominator = fps.denominator;
a->parm.capture.readbuffers = 3;
return 0;
}