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 <joab...@synopsys.com>
Cc: Carlos Palminha <palmi...@synopsys.com>
Cc: Mauro Carvalho Chehab <mche...@kernel.org>
Cc: Hans Verkuil <hans.verk...@cisco.com>
Cc: linux-media@vger.kernel.org
Cc: linux-ker...@vger.kernel.org
---
 drivers/media/pci/cobalt/cobalt-v4l2.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/cobalt/cobalt-v4l2.c 
b/drivers/media/pci/cobalt/cobalt-v4l2.c
index def4a3b..25532ae 100644
--- a/drivers/media/pci/cobalt/cobalt-v4l2.c
+++ b/drivers/media/pci/cobalt/cobalt-v4l2.c
@@ -1076,10 +1076,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;
 }
-- 
1.9.1


Reply via email to