diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2009-12-09 14:38:49 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-22 02:32:42 +0300 |
commit | 2096a5dcf9704f5a86ecba37169eb813aaf0431c (patch) | |
tree | 21e7d870302a7c6748667a785b465a7a84805228 /include/media/v4l2-subdev.h | |
parent | 0070d91e5b5ae594116202ab7d62d8264830b1cd (diff) | |
download | linux-2096a5dcf9704f5a86ecba37169eb813aaf0431c.tar.xz |
[media] v4l: subdev: Add device node support
Create a device node named subdevX for every registered subdev.
As the device node is registered before the subdev core::s_config
function is called, return -EGAIN on open until initialization
completes.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Vimarsh Zutshi <vimarsh.zutshi@gmail.com>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media/v4l2-subdev.h')
-rw-r--r-- | include/media/v4l2-subdev.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index da16d2f4a00b..474ef009fd3d 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -22,6 +22,7 @@ #define _V4L2_SUBDEV_H #include <media/v4l2-common.h> +#include <media/v4l2-dev.h> #include <media/v4l2-mediabus.h> /* generic v4l2_device notify callback notification values */ @@ -431,9 +432,11 @@ struct v4l2_subdev_internal_ops { #define V4L2_SUBDEV_NAME_SIZE 32 /* Set this flag if this subdev is a i2c device. */ -#define V4L2_SUBDEV_FL_IS_I2C (1U << 0) +#define V4L2_SUBDEV_FL_IS_I2C (1U << 0) /* Set this flag if this subdev is a spi device. */ -#define V4L2_SUBDEV_FL_IS_SPI (1U << 1) +#define V4L2_SUBDEV_FL_IS_SPI (1U << 1) +/* Set this flag if this subdev needs a device node. */ +#define V4L2_SUBDEV_FL_HAS_DEVNODE (1U << 2) /* Each instance of a subdev driver should create this struct, either stand-alone or embedded in a larger struct. @@ -455,8 +458,15 @@ struct v4l2_subdev { /* pointer to private data */ void *dev_priv; void *host_priv; + /* subdev device node */ + struct video_device devnode; }; +#define vdev_to_v4l2_subdev(vdev) \ + container_of(vdev, struct v4l2_subdev, devnode) + +extern const struct v4l2_file_operations v4l2_subdev_fops; + static inline void v4l2_set_subdevdata(struct v4l2_subdev *sd, void *p) { sd->dev_priv = p; |