Commit df95e82f authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: gspca: fix g/s_parm handling

Fix v4l2-compliance error: s_parm never set V4L2_CAP_TIMEPERFRAME.
Also various g/s_parm-related cleanups.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 0d5615d3
......@@ -1256,14 +1256,15 @@ static int vidioc_g_parm(struct file *filp, void *priv,
{
struct gspca_dev *gspca_dev = video_drvdata(filp);
parm->parm.capture.readbuffers = 2;
parm->parm.capture.readbuffers = gspca_dev->queue.min_buffers_needed;
if (gspca_dev->sd_desc->get_streamparm) {
if (!gspca_dev->sd_desc->get_streamparm)
return 0;
parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
gspca_dev->usb_err = 0;
gspca_dev->sd_desc->get_streamparm(gspca_dev, parm);
return gspca_dev->usb_err;
}
return 0;
}
static int vidioc_s_parm(struct file *filp, void *priv,
......@@ -1271,15 +1272,17 @@ static int vidioc_s_parm(struct file *filp, void *priv,
{
struct gspca_dev *gspca_dev = video_drvdata(filp);
parm->parm.capture.readbuffers = 2;
parm->parm.capture.readbuffers = gspca_dev->queue.min_buffers_needed;
if (gspca_dev->sd_desc->set_streamparm) {
if (!gspca_dev->sd_desc->set_streamparm) {
parm->parm.capture.capability = 0;
return 0;
}
parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
gspca_dev->usb_err = 0;
gspca_dev->sd_desc->set_streamparm(gspca_dev, parm);
return gspca_dev->usb_err;
}
return 0;
}
static int gspca_queue_setup(struct vb2_queue *vq,
......
......@@ -1476,7 +1476,6 @@ static void sd_get_streamparm(struct gspca_dev *gspca_dev,
struct v4l2_fract *tpf = &cp->timeperframe;
struct sd *sd = (struct sd *) gspca_dev;
cp->capability |= V4L2_CAP_TIMEPERFRAME;
tpf->numerator = 1;
tpf->denominator = sd->frame_rate;
}
......
......@@ -4780,7 +4780,6 @@ static void sd_get_streamparm(struct gspca_dev *gspca_dev,
struct v4l2_fract *tpf = &cp->timeperframe;
int fr, i;
cp->capability |= V4L2_CAP_TIMEPERFRAME;
tpf->numerator = 1;
i = get_fr_idx(gspca_dev);
if (i & 0x80) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment