[PATCH 16/16] media: vimc: cap: Dynamically define device caps
From: Andrà Almeida
Date: Fri Mar 15 2019 - 12:45:58 EST
The device capabilities are defined according to the
multiplanar kernel parameter. A device can't support
both CAP_VIDEO_CAPTURE and CAP_VIDEO_CAPTURE_MPLANAR
at the same time.
Signed-off-by: Andrà Almeida <andrealmeid@xxxxxxxxxxxxx>
---
drivers/media/platform/vimc/vimc-capture.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c
index 50f7e71f23cd..c30a2887db33 100644
--- a/drivers/media/platform/vimc/vimc-capture.c
+++ b/drivers/media/platform/vimc/vimc-capture.c
@@ -652,7 +652,9 @@ static int vimc_cap_comp_bind(struct device *comp, struct device *master,
/* Initialize the vb2 queue */
q = &vcap->queue;
- q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ q->type = multiplanar ?
+ V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE :
+ V4L2_BUF_TYPE_VIDEO_CAPTURE;
q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_USERPTR;
q->drv_priv = vcap;
q->buf_struct_size = sizeof(struct vimc_cap_buffer);
@@ -697,7 +699,9 @@ static int vimc_cap_comp_bind(struct device *comp, struct device *master,
/* Initialize the video_device struct */
vdev = &vcap->vdev;
- vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
+ vdev->device_caps = (multiplanar ?
+ V4L2_CAP_VIDEO_CAPTURE_MPLANE :
+ V4L2_BUF_TYPE_VIDEO_CAPTURE) | V4L2_CAP_STREAMING;
vdev->entity.ops = &vimc_cap_mops;
vdev->release = video_device_release_empty;
vdev->fops = &vimc_cap_fops;
--
2.21.0