[media] v4l: Create v4l2 subdev file handle structure

Used for storing subdev information per file handle and hold V4L2 file
handle.

Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Signed-off-by: Antti Koskipaa <akoskipa@gmail.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Stanimir Varbanov
2010-05-21 06:04:24 -03:00
committed by Mauro Carvalho Chehab
parent dacdde78b3
commit 7cd5a16b22
3 changed files with 102 additions and 33 deletions

View File

@@ -24,6 +24,7 @@
#include <media/media-entity.h>
#include <media/v4l2-common.h>
#include <media/v4l2-dev.h>
#include <media/v4l2-fh.h>
#include <media/v4l2-mediabus.h>
/* generic v4l2_device notify callback notification values */
@@ -481,6 +482,34 @@ struct v4l2_subdev {
#define vdev_to_v4l2_subdev(vdev) \
container_of(vdev, struct v4l2_subdev, devnode)
/*
* Used for storing subdev information per file handle
*/
struct v4l2_subdev_fh {
struct v4l2_fh vfh;
#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
struct v4l2_mbus_framefmt *try_fmt;
struct v4l2_rect *try_crop;
#endif
};
#define to_v4l2_subdev_fh(fh) \
container_of(fh, struct v4l2_subdev_fh, vfh)
#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
static inline struct v4l2_mbus_framefmt *
v4l2_subdev_get_try_format(struct v4l2_subdev_fh *fh, unsigned int pad)
{
return &fh->try_fmt[pad];
}
static inline struct v4l2_rect *
v4l2_subdev_get_try_crop(struct v4l2_subdev_fh *fh, unsigned int pad)
{
return &fh->try_crop[pad];
}
#endif
extern const struct v4l2_file_operations v4l2_subdev_fops;
static inline void v4l2_set_subdevdata(struct v4l2_subdev *sd, void *p)