media: gspca: support multiple pixel formats in ENUM_FRAMEINTERVALS
If a driver supports multiple pixel formats with the same frame size, ENUM_FRAMEINTERVALS will currently only work for the first pixel format. Fix this by adding pixelformat support to wxh_to_mode(). Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:

committed by
Mauro Carvalho Chehab

parent
4d4abf064d
commit
fc78e0b247
@@ -912,13 +912,14 @@ static void gspca_set_default_mode(struct gspca_dev *gspca_dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int wxh_to_mode(struct gspca_dev *gspca_dev,
|
static int wxh_to_mode(struct gspca_dev *gspca_dev,
|
||||||
int width, int height)
|
int width, int height, u32 pixelformat)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < gspca_dev->cam.nmodes; i++) {
|
for (i = 0; i < gspca_dev->cam.nmodes; i++) {
|
||||||
if (width == gspca_dev->cam.cam_mode[i].width
|
if (width == gspca_dev->cam.cam_mode[i].width
|
||||||
&& height == gspca_dev->cam.cam_mode[i].height)
|
&& height == gspca_dev->cam.cam_mode[i].height
|
||||||
|
&& pixelformat == gspca_dev->cam.cam_mode[i].pixelformat)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -1152,7 +1153,8 @@ static int vidioc_enum_frameintervals(struct file *filp, void *priv,
|
|||||||
int mode;
|
int mode;
|
||||||
__u32 i;
|
__u32 i;
|
||||||
|
|
||||||
mode = wxh_to_mode(gspca_dev, fival->width, fival->height);
|
mode = wxh_to_mode(gspca_dev, fival->width, fival->height,
|
||||||
|
fival->pixel_format);
|
||||||
if (mode < 0)
|
if (mode < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user