summaryrefslogtreecommitdiff
path: root/drivers/media/platform/vsp1/vsp1_lif.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2016-02-24 20:25:42 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-04-13 19:06:36 -0300
commit6ad9ba9c14fad546b91d654c5b4e870d009ace28 (patch)
tree24c60d2218d312d06ba50f80b14c5ed25369a919 /drivers/media/platform/vsp1/vsp1_lif.c
parent3f557220cc29d1961ef9efa2a8db04c7c5f6e6d4 (diff)
[media] v4l: vsp1: Factorize media bus codes enumeration code
Most of the entities can't perform format conversion and implement the same media bus 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_lif.c')
-rw-r--r--drivers/media/platform/vsp1/vsp1_lif.c29
1 files changed, 2 insertions, 27 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_lif.c b/drivers/media/platform/vsp1/vsp1_lif.c
index 730db64bd4d3..59a8017f39af 100644
--- a/drivers/media/platform/vsp1/vsp1_lif.c
+++ b/drivers/media/platform/vsp1/vsp1_lif.c
@@ -45,34 +45,9 @@ static int lif_enum_mbus_code(struct v4l2_subdev *subdev,
MEDIA_BUS_FMT_ARGB8888_1X32,
MEDIA_BUS_FMT_AYUV8_1X32,
};
- struct vsp1_lif *lif = to_lif(subdev);
-
- if (code->pad == LIF_PAD_SINK) {
- if (code->index >= ARRAY_SIZE(codes))
- return -EINVAL;
-
- code->code = codes[code->index];
- } else {
- struct v4l2_subdev_pad_config *config;
- struct v4l2_mbus_framefmt *format;
-
- /* The LIF can't perform format conversion, the sink format is
- * always identical to the source format.
- */
- if (code->index)
- return -EINVAL;
-
- config = vsp1_entity_get_pad_config(&lif->entity, cfg,
- code->which);
- if (!config)
- return -EINVAL;
- format = vsp1_entity_get_pad_format(&lif->entity, config,
- LIF_PAD_SINK);
- code->code = format->code;
- }
-
- return 0;
+ return vsp1_subdev_enum_mbus_code(subdev, cfg, code, codes,
+ ARRAY_SIZE(codes));
}
static int lif_enum_frame_size(struct v4l2_subdev *subdev,