Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1605541

[PATCH 3/3] [media] cobalt: Use v4l2_calc_timeperframe helper

From Jose Abreu <Jose.Abreu@synopsys.com>
Newsgroups linux.kernel
Subject [PATCH 3/3] [media] cobalt: Use v4l2_calc_timeperframe helper
Date 2017-03-21 13:00 +0100
Message-ID <tnqCd-2Qk-3@gated-at.bofh.it> (permalink)
References <tnqsz-2K1-49@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
Cc: Carlos Palminha <palminha@synopsys.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: linux-media@vger.kernel.org
Cc: linux-kernel@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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] Handling of reduced FPS in V4L2 Jose Abreu <Jose.Abreu@synopsys.com> - 2017-03-21 12:50 +0100
  [PATCH 3/3] [media] cobalt: Use v4l2_calc_timeperframe helper Jose Abreu <Jose.Abreu@synopsys.com> - 2017-03-21 13:00 +0100
  [PATCH 1/3] [media] videodev2.h: Add new DV flag CAN_DETECT_REDUCED_FPS Jose Abreu <Jose.Abreu@synopsys.com> - 2017-03-21 13:00 +0100
  [PATCH 2/3] [media] v4l2-dv-timings: Introduce v4l2_calc_timeperframe helper Jose Abreu <Jose.Abreu@synopsys.com> - 2017-03-21 13:00 +0100
  Re: [PATCH 0/3] Handling of reduced FPS in V4L2 Jose Abreu <Jose.Abreu@synopsys.com> - 2017-03-24 12:20 +0100
    Re: [PATCH 0/3] Handling of reduced FPS in V4L2 Hans Verkuil <hansverk@cisco.com> - 2017-03-24 12:30 +0100
      Re: [PATCH 0/3] Handling of reduced FPS in V4L2 Jose Abreu <Jose.Abreu@synopsys.com> - 2017-03-24 13:00 +0100
        Re: [PATCH 0/3] Handling of reduced FPS in V4L2 Hans Verkuil <hansverk@cisco.com> - 2017-03-24 13:20 +0100
          Re: [PATCH 0/3] Handling of reduced FPS in V4L2 Jose Abreu <Jose.Abreu@synopsys.com> - 2017-03-24 13:30 +0100
            Re: [PATCH 0/3] Handling of reduced FPS in V4L2 Hans Verkuil <hansverk@cisco.com> - 2017-03-24 13:30 +0100
              Re: [PATCH 0/3] Handling of reduced FPS in V4L2 Jose Abreu <Jose.Abreu@synopsys.com> - 2017-03-27 14:10 +0200

csiph-web