diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2016-02-25 02:25:42 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-04-14 01:11:05 +0300 |
commit | 076e834fee91db7e9df4fe2d3ecf3ed67eadbe88 (patch) | |
tree | c3aaa96646a710e32c2e069171bc8f6d1998ac62 /drivers/media/platform/vsp1/vsp1_rwpf.c | |
parent | c431cbbb446851ecb17095812e049119b2be17ed (diff) | |
download | linux-076e834fee91db7e9df4fe2d3ecf3ed67eadbe88.tar.xz |
[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_rwpf.c')
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_rwpf.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.c b/drivers/media/platform/vsp1/vsp1_rwpf.c index 64d649a1bcf5..3b6e032e7806 100644 --- a/drivers/media/platform/vsp1/vsp1_rwpf.c +++ b/drivers/media/platform/vsp1/vsp1_rwpf.c @@ -53,34 +53,10 @@ static int vsp1_rwpf_enum_frame_size(struct v4l2_subdev *subdev, struct v4l2_subdev_frame_size_enum *fse) { struct vsp1_rwpf *rwpf = to_rwpf(subdev); - struct v4l2_subdev_pad_config *config; - struct v4l2_mbus_framefmt *format; - - config = vsp1_entity_get_pad_config(&rwpf->entity, cfg, fse->which); - if (!config) - return -EINVAL; - - format = vsp1_entity_get_pad_format(&rwpf->entity, config, fse->pad); - if (fse->index || fse->code != format->code) - return -EINVAL; - - if (fse->pad == RWPF_PAD_SINK) { - fse->min_width = RWPF_MIN_WIDTH; - fse->max_width = rwpf->max_width; - fse->min_height = RWPF_MIN_HEIGHT; - fse->max_height = rwpf->max_height; - } 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, RWPF_MIN_WIDTH, + RWPF_MIN_HEIGHT, rwpf->max_width, + rwpf->max_height); } static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, |