summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/vsp1/vsp1_lut.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2016-02-25 00:25:42 +0100
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-04-14 00:11:05 +0200
commit076e834fee91db7e9df4fe2d3ecf3ed67eadbe88 (patch)
treec3aaa96646a710e32c2e069171bc8f6d1998ac62 /drivers/media/platform/vsp1/vsp1_lut.c
parentRevert "[media] v4l2-ioctl: simplify code" (diff)
downloadlinux-076e834fee91db7e9df4fe2d3ecf3ed67eadbe88.tar.xz
linux-076e834fee91db7e9df4fe2d3ecf3ed67eadbe88.zip
[media] v4l: vsp1: Factorize frame size enumeration code
Most of the entities can't perform scaling and implement the same frame size enumeration function. Factorize the code into a single implementation. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/vsp1/vsp1_lut.c')
-rw-r--r--drivers/media/platform/vsp1/vsp1_lut.c32
1 files changed, 3 insertions, 29 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_lut.c b/drivers/media/platform/vsp1/vsp1_lut.c
index 12a069adf567..c779648882ab 100644
--- a/drivers/media/platform/vsp1/vsp1_lut.c
+++ b/drivers/media/platform/vsp1/vsp1_lut.c
@@ -80,35 +80,9 @@ static int lut_enum_frame_size(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_frame_size_enum *fse)
{
- struct vsp1_lut *lut = to_lut(subdev);
- struct v4l2_subdev_pad_config *config;
- struct v4l2_mbus_framefmt *format;
-
- config = vsp1_entity_get_pad_config(&lut->entity, cfg, fse->which);
- if (!config)
- return -EINVAL;
-
- format = vsp1_entity_get_pad_format(&lut->entity, config, fse->pad);
-
- if (fse->index || fse->code != format->code)
- return -EINVAL;
-
- if (fse->pad == LUT_PAD_SINK) {
- fse->min_width = LUT_MIN_SIZE;
- fse->max_width = LUT_MAX_SIZE;
- fse->min_height = LUT_MIN_SIZE;
- fse->max_height = LUT_MAX_SIZE;
- } else {
- /* The size on the source pad are fixed and always identical to
- * the size on the sink pad.
- */
- fse->min_width = format->width;
- fse->max_width = format->width;
- fse->min_height = format->height;
- fse->max_height = format->height;
- }
-
- return 0;
+ return vsp1_subdev_enum_frame_size(subdev, cfg, fse, LUT_MIN_SIZE,
+ LUT_MIN_SIZE, LUT_MAX_SIZE,
+ LUT_MAX_SIZE);
}
static int lut_set_format(struct v4l2_subdev *subdev,