summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/vsp1/vsp1_entity.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2016-02-25 01:10:13 +0100
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-04-14 00:04:26 +0200
commit3f557220cc29d1961ef9efa2a8db04c7c5f6e6d4 (patch)
tree0f8a1256ffcd2442b9875da8ae6c7f9af9427059 /drivers/media/platform/vsp1/vsp1_entity.c
parent[media] v4l: vsp1: RPF entities can't be target nodes (diff)
downloadlinux-3f557220cc29d1961ef9efa2a8db04c7c5f6e6d4.tar.xz
linux-3f557220cc29d1961ef9efa2a8db04c7c5f6e6d4.zip
[media] v4l: vsp1: Factorize get pad format code
All entities implement the same get pad format handler, factorize it into a common function. 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_entity.c')
-rw-r--r--drivers/media/platform/vsp1/vsp1_entity.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c
index dfecddffbc81..e4d6c7a1ed77 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -116,6 +116,31 @@ int vsp1_entity_init_cfg(struct v4l2_subdev *subdev,
return 0;
}
+/*
+ * vsp1_subdev_get_pad_format - Subdev pad get_fmt handler
+ * @subdev: V4L2 subdevice
+ * @cfg: V4L2 subdev pad configuration
+ * @fmt: V4L2 subdev format
+ *
+ * This function implements the subdev get_fmt pad operation. It can be used as
+ * a direct drop-in for the operation handler.
+ */
+int vsp1_subdev_get_pad_format(struct v4l2_subdev *subdev,
+ struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_format *fmt)
+{
+ struct vsp1_entity *entity = to_vsp1_entity(subdev);
+ struct v4l2_subdev_pad_config *config;
+
+ config = vsp1_entity_get_pad_config(entity, cfg, fmt->which);
+ if (!config)
+ return -EINVAL;
+
+ fmt->format = *vsp1_entity_get_pad_format(entity, config, fmt->pad);
+
+ return 0;
+}
+
/* -----------------------------------------------------------------------------
* Media Operations
*/