aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/video4linux/v4l2-framework.txt
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2009-12-09 06:40:08 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-22 03:53:20 -0400
commit61f5db549dde43fb91a8b337f3a4096e4076c2d9 (patch)
tree0c28bb9dd1aab1b3fc8ce61036677a7790316421 /Documentation/video4linux/v4l2-framework.txt
parent2c0ab67be1b4197a4effac89bb0604832e38be8d (diff)
[media] v4l: Make v4l2_subdev inherit from media_entity
V4L2 subdevices are media entities. As such they need to inherit from (include) the media_entity structure. When registering/unregistering the subdevice, the media entity is automatically registered/unregistered. The entity is acquired on device open and released on device close. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation/video4linux/v4l2-framework.txt')
-rw-r--r--Documentation/video4linux/v4l2-framework.txt23
1 files changed, 23 insertions, 0 deletions
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt
index 062708169def..77d96f4e3f50 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -268,6 +268,26 @@ A sub-device driver initializes the v4l2_subdev struct using:
268Afterwards you need to initialize subdev->name with a unique name and set the 268Afterwards you need to initialize subdev->name with a unique name and set the
269module owner. This is done for you if you use the i2c helper functions. 269module owner. This is done for you if you use the i2c helper functions.
270 270
271If integration with the media framework is needed, you must initialize the
272media_entity struct embedded in the v4l2_subdev struct (entity field) by
273calling media_entity_init():
274
275 struct media_pad *pads = &my_sd->pads;
276 int err;
277
278 err = media_entity_init(&sd->entity, npads, pads, 0);
279
280The pads array must have been previously initialized. There is no need to
281manually set the struct media_entity type and name fields, but the revision
282field must be initialized if needed.
283
284A reference to the entity will be automatically acquired/released when the
285subdev device node (if any) is opened/closed.
286
287Don't forget to cleanup the media entity before the sub-device is destroyed:
288
289 media_entity_cleanup(&sd->entity);
290
271A device (bridge) driver needs to register the v4l2_subdev with the 291A device (bridge) driver needs to register the v4l2_subdev with the
272v4l2_device: 292v4l2_device:
273 293
@@ -277,6 +297,9 @@ This can fail if the subdev module disappeared before it could be registered.
277After this function was called successfully the subdev->dev field points to 297After this function was called successfully the subdev->dev field points to
278the v4l2_device. 298the v4l2_device.
279 299
300If the v4l2_device parent device has a non-NULL mdev field, the sub-device
301entity will be automatically registered with the media device.
302
280You can unregister a sub-device using: 303You can unregister a sub-device using:
281 304
282 v4l2_device_unregister_subdev(sd); 305 v4l2_device_unregister_subdev(sd);