[media] sur40: properly report a single frame rate of 60 FPS
authorFlorian Echtler <floe@butterbrot.org>
Tue, 31 May 2016 20:15:31 +0000 (17:15 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 24 Aug 2016 13:07:06 +0000 (10:07 -0300)
The device hardware is always running at 60 FPS, so report this both via
PARM_IOCTL and ENUM_FRAMEINTERVALS.

[hans.verkuil@cisco.com: fix suspect indent checkpatch warning]
[mchehab@s-opensource.com: fix a trivial merge conflict]

Signed-off-by: Martin Kaltenbrunner <modin@yuri.at>
Signed-off-by: Florian Echtler <floe@butterbrot.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/input/touchscreen/sur40.c

index 3967d8c651cc59e97177e8639d88aca555a67ee2..aefb6e11f88a0838917b0a3b7a59dc9eae6b37f2 100644 (file)
@@ -839,6 +839,19 @@ static int sur40_vidioc_g_fmt(struct file *file, void *priv,
        return 0;
 }
 
+static int sur40_ioctl_parm(struct file *file, void *priv,
+                           struct v4l2_streamparm *p)
+{
+       if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+               return -EINVAL;
+
+       p->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
+       p->parm.capture.timeperframe.numerator = 1;
+       p->parm.capture.timeperframe.denominator = 60;
+       p->parm.capture.readbuffers = 3;
+       return 0;
+}
+
 static int sur40_vidioc_enum_fmt(struct file *file, void *priv,
                                 struct v4l2_fmtdesc *f)
 {
@@ -870,14 +883,14 @@ static int sur40_vidioc_enum_frameintervals(struct file *file, void *priv,
 {
        struct sur40_state *sur40 = video_drvdata(file);
 
-       if ((f->index > 1) || ((f->pixel_format != V4L2_TCH_FMT_TU08)
+       if ((f->index > 0) || ((f->pixel_format != V4L2_TCH_FMT_TU08)
                && (f->pixel_format != V4L2_PIX_FMT_GREY))
                || (f->width  != sur40->pix_fmt.width)
                || (f->height != sur40->pix_fmt.height))
                return -EINVAL;
 
        f->type = V4L2_FRMIVAL_TYPE_DISCRETE;
-       f->discrete.denominator  = 60/(f->index+1);
+       f->discrete.denominator  = 60;
        f->discrete.numerator = 1;
        return 0;
 }
@@ -937,6 +950,9 @@ static const struct v4l2_ioctl_ops sur40_video_ioctl_ops = {
        .vidioc_enum_framesizes = sur40_vidioc_enum_framesizes,
        .vidioc_enum_frameintervals = sur40_vidioc_enum_frameintervals,
 
+       .vidioc_g_parm = sur40_ioctl_parm,
+       .vidioc_s_parm = sur40_ioctl_parm,
+
        .vidioc_enum_input      = sur40_vidioc_enum_input,
        .vidioc_g_input         = sur40_vidioc_g_input,
        .vidioc_s_input         = sur40_vidioc_s_input,