diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2011-08-24 19:28:18 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-09-06 17:40:04 -0300 |
commit | d09a7dc887275564ea226b3b089b51c2c8b07bee (patch) | |
tree | 18ea530be8f69dab23840067d8643723ed89c720 /drivers/media/video/s5p-fimc/fimc-capture.c | |
parent | 131b6c619758ed8fd16d26b06a423801a497b867 (diff) | |
download | blackbird-op-linux-d09a7dc887275564ea226b3b089b51c2c8b07bee.tar.gz blackbird-op-linux-d09a7dc887275564ea226b3b089b51c2c8b07bee.zip |
[media] s5p-fimc: Add media operations in the capture entity driver
Add the link_setup handler for the camera capture video node.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/s5p-fimc/fimc-capture.c')
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-capture.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 0c237a776f8d..95996fb91a12 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c @@ -669,6 +669,37 @@ static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops = { .vidioc_g_input = fimc_cap_g_input, }; +/* Media operations */ +static int fimc_link_setup(struct media_entity *entity, + const struct media_pad *local, + const struct media_pad *remote, u32 flags) +{ + struct video_device *vd = media_entity_to_video_device(entity); + struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(remote->entity); + struct fimc_dev *fimc = video_get_drvdata(vd); + + if (WARN_ON(fimc == NULL)) + return 0; + + dbg("%s --> %s, flags: 0x%x. input: 0x%x", + local->entity->name, remote->entity->name, flags, + fimc->vid_cap.input); + + if (flags & MEDIA_LNK_FL_ENABLED) { + if (fimc->vid_cap.input != 0) + return -EBUSY; + fimc->vid_cap.input = sd->grp_id; + return 0; + } + + fimc->vid_cap.input = 0; + return 0; +} + +static const struct media_entity_operations fimc_media_ops = { + .link_setup = fimc_link_setup, +}; + /* fimc->lock must be already initialized */ int fimc_register_capture_device(struct fimc_dev *fimc, struct v4l2_device *v4l2_dev) @@ -743,6 +774,7 @@ int fimc_register_capture_device(struct fimc_dev *fimc, if (ret) goto err_ent; + vfd->entity.ops = &fimc_media_ops; vfd->ctrl_handler = &ctx->ctrl_handler; return 0; |