media: ov5640: Restrict sizes to mbus code
authorJacopo Mondi <jacopo@jmondi.org>
Fri, 13 May 2022 14:14:13 +0000 (15:14 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 8 Jul 2022 14:39:07 +0000 (15:39 +0100)
commit7dcb3a2f1f1871cc6e18e744d125baaedada3944
treece6037cc285c8c5b691901645c1f8a0fc6d9e801
parent6ac98b41b4fb44656ef0ccccee4fda73751eb7bf
media: ov5640: Restrict sizes to mbus code

The ov5640 driver supports different sizes for different mbus_codes.
In particular:

- 8bpp modes: high resolution sizes (>= 1280x720)
- 16bpp modes: all sizes
- 24bpp modes: low resolutions sizes (< 1280x720)

Restrict the frame sizes enumerations to the above constraints.

While at it, make sure the fse->mbus_code parameter is valid, and return
-EINVAL if it's not.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/i2c/ov5640.c