diff options
author | Shuah Khan <shuahkh@osg.samsung.com> | 2016-02-11 21:41:25 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-27 08:33:29 -0300 |
commit | d0a164f593ec770e5fc0dd9b003ac057559482c7 (patch) | |
tree | 23bd2e78da923959011315f88ff4f813170d1608 /drivers/media/v4l2-core | |
parent | fb49f20438f361a60f9af555e5a69d91bb5e358f (diff) | |
download | linux-rpi-d0a164f593ec770e5fc0dd9b003ac057559482c7.tar.gz linux-rpi-d0a164f593ec770e5fc0dd9b003ac057559482c7.tar.bz2 linux-rpi-d0a164f593ec770e5fc0dd9b003ac057559482c7.zip |
[media] media: v4l-core add enable/disable source common interfaces
Add a new interfaces to be used by v4l-core to invoke enable
source and disable_source handlers in the media_device. The
enable_source helper function invokes the enable_source handler
to find media source entity connected to the entity and check
is it is available or busy. If source is available, link is
activated and pipeline is started. The disable_source helper
function invokes the disable_source handler to deactivate and
stop the pipeline.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-mc.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c index 4a1efa827fe2..643686d40551 100644 --- a/drivers/media/v4l2-core/v4l2-mc.c +++ b/drivers/media/v4l2-core/v4l2-mc.c @@ -2,6 +2,7 @@ * Media Controller ancillary functions * * Copyright (c) 2016 Mauro Carvalho Chehab <mchehab@osg.samsung.com> + * Copyright (C) 2016 Shuah Khan <shuahkh@osg.samsung.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +17,10 @@ #include <linux/module.h> #include <media/media-entity.h> +#include <media/media-device.h> +#include <media/v4l2-fh.h> #include <media/v4l2-mc.h> +#include <media/videobuf2-core.h> int v4l2_mc_create_media_graph(struct media_device *mdev) @@ -182,3 +186,34 @@ int v4l2_mc_create_media_graph(struct media_device *mdev) return 0; } EXPORT_SYMBOL_GPL(v4l2_mc_create_media_graph); + +int v4l_enable_media_source(struct video_device *vdev) +{ + struct media_device *mdev = vdev->entity.graph_obj.mdev; + int ret; + + if (!mdev || !mdev->enable_source) + return 0; + ret = mdev->enable_source(&vdev->entity, &vdev->pipe); + if (ret) + return -EBUSY; + return 0; +} +EXPORT_SYMBOL_GPL(v4l_enable_media_source); + +void v4l_disable_media_source(struct video_device *vdev) +{ + struct media_device *mdev = vdev->entity.graph_obj.mdev; + + if (mdev && mdev->disable_source) + mdev->disable_source(&vdev->entity); +} +EXPORT_SYMBOL_GPL(v4l_disable_media_source); + +int v4l_vb2q_enable_media_source(struct vb2_queue *q) +{ + struct v4l2_fh *fh = q->owner; + + return v4l_enable_media_source(fh->vdev); +} +EXPORT_SYMBOL_GPL(v4l_vb2q_enable_media_source); |