summaryrefslogtreecommitdiff
path: root/drivers/staging/media/imx/imx-media.h
diff options
context:
space:
mode:
authorSteve Longerbeam <slongerbeam@gmail.com>2017-12-14 20:04:45 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-15 14:08:03 -0500
commitbd9d208a04e0db4f66255c24ff37e49069d274ee (patch)
tree183d393d1fb3215e215f6a3128cee7b714f70b15 /drivers/staging/media/imx/imx-media.h
parent9f6a0c59eba91c116f6cd7a487f4929faa07a7f8 (diff)
media: staging/imx: convert static vdev lists to list_head
Although not technically necessary because imx-media has only a maximum of 8 video devices, and once setup the video device lists are static, in anticipation of moving control ineritance to v4l2-core, make the vdev lists more generic by converting to dynamic list_head's. After doing that, 'struct imx_media_pad' is now just a list_head of video devices reachable from a pad. Allocate an array of list_head's, one list_head for each pad, and attach that array to sd->host_priv. An entry in the pad lists is of type 'struct imx_media_pad_vdev', and points to a video device from the master list. Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/staging/media/imx/imx-media.h')
-rw-r--r--drivers/staging/media/imx/imx-media.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
index 5089a0d88114..ebb24b165fff 100644
--- a/drivers/staging/media/imx/imx-media.h
+++ b/drivers/staging/media/imx/imx-media.h
@@ -19,9 +19,6 @@
#include <media/videobuf2-dma-contig.h>
#include <video/imx-ipu-v3.h>
-/* max video devices */
-#define IMX_MEDIA_MAX_VDEVS 8
-
/*
* Pad definitions for the subdevs with multiple source or
* sink pads
@@ -82,6 +79,9 @@ struct imx_media_video_dev {
/* the user format */
struct v4l2_format fmt;
const struct imx_media_pixfmt *cc;
+
+ /* links this vdev to master list */
+ struct list_head list;
};
static inline struct imx_media_buffer *to_imx_media_vb(struct vb2_buffer *vb)
@@ -91,24 +91,26 @@ static inline struct imx_media_buffer *to_imx_media_vb(struct vb2_buffer *vb)
return container_of(vbuf, struct imx_media_buffer, vbuf);
}
-/* to support control inheritance to video devices */
-struct imx_media_pad {
- /*
- * list of video devices that can be reached from this pad,
- * list is only valid for source pads.
- */
- struct imx_media_video_dev *vdev[IMX_MEDIA_MAX_VDEVS];
- int num_vdevs;
-};
-
-static inline struct imx_media_pad *
-to_imx_media_pad(struct v4l2_subdev *sd, int pad_index)
+/*
+ * to support control inheritance to video devices, this
+ * retrieves a pad's list_head of video devices that can
+ * be reached from the pad. Note that only the lists in
+ * source pads get populated, sink pads have empty lists.
+ */
+static inline struct list_head *
+to_pad_vdev_list(struct v4l2_subdev *sd, int pad_index)
{
- struct imx_media_pad *imxpads = sd->host_priv;
+ struct list_head *vdev_list = sd->host_priv;
- return imxpads ? &imxpads[pad_index] : NULL;
+ return vdev_list ? &vdev_list[pad_index] : NULL;
}
+/* an entry in a pad's video device list */
+struct imx_media_pad_vdev {
+ struct imx_media_video_dev *vdev;
+ struct list_head list;
+};
+
struct imx_media_internal_sd_platformdata {
char sd_name[V4L2_SUBDEV_NAME_SIZE];
u32 grp_id;
@@ -139,8 +141,7 @@ struct imx_media_dev {
struct mutex mutex; /* protect elements below */
/* master video device list */
- struct imx_media_video_dev *vdev[IMX_MEDIA_MAX_VDEVS];
- int num_vdevs;
+ struct list_head vdev_list;
/* IPUs this media driver control, valid after subdevs bound */
struct ipu_soc *ipu[2];