Commit 1ddc8a97 authored by Boris Brezillon's avatar Boris Brezillon Committed by Mauro Carvalho Chehab

media: v4l2: Make sure all drivers set _MPLANE caps in vdev->device_caps

This is needed if we want the core to be able to check _MPLANE support
without having to call the ->vidioc_querycap() hook.
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 0864c9ce
...@@ -298,8 +298,6 @@ static int gsc_m2m_querycap(struct file *file, void *fh, ...@@ -298,8 +298,6 @@ static int gsc_m2m_querycap(struct file *file, void *fh,
strscpy(cap->card, GSC_MODULE_NAME " gscaler", sizeof(cap->card)); strscpy(cap->card, GSC_MODULE_NAME " gscaler", sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
dev_name(&gsc->pdev->dev)); dev_name(&gsc->pdev->dev));
cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -763,6 +761,8 @@ int gsc_register_m2m_device(struct gsc_dev *gsc) ...@@ -763,6 +761,8 @@ int gsc_register_m2m_device(struct gsc_dev *gsc)
gsc->vdev.lock = &gsc->lock; gsc->vdev.lock = &gsc->lock;
gsc->vdev.vfl_dir = VFL_DIR_M2M; gsc->vdev.vfl_dir = VFL_DIR_M2M;
gsc->vdev.v4l2_dev = &gsc->v4l2_dev; gsc->vdev.v4l2_dev = &gsc->v4l2_dev;
gsc->vdev.device_caps = V4L2_CAP_STREAMING |
V4L2_CAP_VIDEO_M2M_MPLANE;
snprintf(gsc->vdev.name, sizeof(gsc->vdev.name), "%s.%d:m2m", snprintf(gsc->vdev.name, sizeof(gsc->vdev.name), "%s.%d:m2m",
GSC_MODULE_NAME, gsc->id); GSC_MODULE_NAME, gsc->id);
......
...@@ -37,15 +37,12 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity) ...@@ -37,15 +37,12 @@ struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity)
} }
EXPORT_SYMBOL(fimc_find_remote_sensor); EXPORT_SYMBOL(fimc_find_remote_sensor);
void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap, void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap)
unsigned int caps)
{ {
strscpy(cap->driver, dev->driver->name, sizeof(cap->driver)); strscpy(cap->driver, dev->driver->name, sizeof(cap->driver));
strscpy(cap->card, dev->driver->name, sizeof(cap->card)); strscpy(cap->card, dev->driver->name, sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info), snprintf(cap->bus_info, sizeof(cap->bus_info),
"platform:%s", dev_name(dev)); "platform:%s", dev_name(dev));
cap->device_caps = caps;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
} }
EXPORT_SYMBOL(__fimc_vidioc_querycap); EXPORT_SYMBOL(__fimc_vidioc_querycap);
......
...@@ -12,5 +12,4 @@ ...@@ -12,5 +12,4 @@
#include <media/v4l2-subdev.h> #include <media/v4l2-subdev.h>
struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity); struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity);
void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap, void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap);
unsigned int caps);
...@@ -728,8 +728,7 @@ static int fimc_cap_querycap(struct file *file, void *priv, ...@@ -728,8 +728,7 @@ static int fimc_cap_querycap(struct file *file, void *priv,
{ {
struct fimc_dev *fimc = video_drvdata(file); struct fimc_dev *fimc = video_drvdata(file);
__fimc_vidioc_querycap(&fimc->pdev->dev, cap, V4L2_CAP_STREAMING | __fimc_vidioc_querycap(&fimc->pdev->dev, cap);
V4L2_CAP_VIDEO_CAPTURE_MPLANE);
return 0; return 0;
} }
...@@ -1765,6 +1764,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc, ...@@ -1765,6 +1764,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc,
vfd->release = video_device_release_empty; vfd->release = video_device_release_empty;
vfd->queue = q; vfd->queue = q;
vfd->lock = &fimc->lock; vfd->lock = &fimc->lock;
vfd->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE_MPLANE;
video_set_drvdata(vfd, fimc); video_set_drvdata(vfd, fimc);
vid_cap = &fimc->vid_cap; vid_cap = &fimc->vid_cap;
......
...@@ -349,7 +349,7 @@ static int isp_video_querycap(struct file *file, void *priv, ...@@ -349,7 +349,7 @@ static int isp_video_querycap(struct file *file, void *priv,
{ {
struct fimc_isp *isp = video_drvdata(file); struct fimc_isp *isp = video_drvdata(file);
__fimc_vidioc_querycap(&isp->pdev->dev, cap, V4L2_CAP_STREAMING); __fimc_vidioc_querycap(&isp->pdev->dev, cap);
return 0; return 0;
} }
...@@ -614,6 +614,7 @@ int fimc_isp_video_device_register(struct fimc_isp *isp, ...@@ -614,6 +614,7 @@ int fimc_isp_video_device_register(struct fimc_isp *isp,
vdev->minor = -1; vdev->minor = -1;
vdev->release = video_device_release_empty; vdev->release = video_device_release_empty;
vdev->lock = &isp->video_lock; vdev->lock = &isp->video_lock;
vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE_MPLANE;
iv->pad.flags = MEDIA_PAD_FL_SINK; iv->pad.flags = MEDIA_PAD_FL_SINK;
ret = media_entity_pads_init(&vdev->entity, 1, &iv->pad); ret = media_entity_pads_init(&vdev->entity, 1, &iv->pad);
......
...@@ -658,9 +658,6 @@ static int fimc_lite_querycap(struct file *file, void *priv, ...@@ -658,9 +658,6 @@ static int fimc_lite_querycap(struct file *file, void *priv,
strscpy(cap->card, FIMC_LITE_DRV_NAME, sizeof(cap->card)); strscpy(cap->card, FIMC_LITE_DRV_NAME, sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
dev_name(&fimc->pdev->dev)); dev_name(&fimc->pdev->dev));
cap->device_caps = V4L2_CAP_STREAMING;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -1282,6 +1279,7 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd) ...@@ -1282,6 +1279,7 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd)
vfd->minor = -1; vfd->minor = -1;
vfd->release = video_device_release_empty; vfd->release = video_device_release_empty;
vfd->queue = q; vfd->queue = q;
vfd->device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_STREAMING;
fimc->reqbufs_count = 0; fimc->reqbufs_count = 0;
INIT_LIST_HEAD(&fimc->pending_buf_q); INIT_LIST_HEAD(&fimc->pending_buf_q);
......
...@@ -236,9 +236,8 @@ static int fimc_m2m_querycap(struct file *file, void *fh, ...@@ -236,9 +236,8 @@ static int fimc_m2m_querycap(struct file *file, void *fh,
struct v4l2_capability *cap) struct v4l2_capability *cap)
{ {
struct fimc_dev *fimc = video_drvdata(file); struct fimc_dev *fimc = video_drvdata(file);
unsigned int caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE;
__fimc_vidioc_querycap(&fimc->pdev->dev, cap, caps); __fimc_vidioc_querycap(&fimc->pdev->dev, cap);
return 0; return 0;
} }
...@@ -736,6 +735,7 @@ int fimc_register_m2m_device(struct fimc_dev *fimc, ...@@ -736,6 +735,7 @@ int fimc_register_m2m_device(struct fimc_dev *fimc,
vfd->release = video_device_release_empty; vfd->release = video_device_release_empty;
vfd->lock = &fimc->lock; vfd->lock = &fimc->lock;
vfd->vfl_dir = VFL_DIR_M2M; vfd->vfl_dir = VFL_DIR_M2M;
vfd->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE;
set_bit(V4L2_FL_QUIRK_INVERTED_CROP, &vfd->flags); set_bit(V4L2_FL_QUIRK_INVERTED_CROP, &vfd->flags);
snprintf(vfd->name, sizeof(vfd->name), "fimc.%d.m2m", fimc->id); snprintf(vfd->name, sizeof(vfd->name), "fimc.%d.m2m", fimc->id);
......
...@@ -671,8 +671,6 @@ static int jpu_querycap(struct file *file, void *priv, ...@@ -671,8 +671,6 @@ static int jpu_querycap(struct file *file, void *priv,
strscpy(cap->driver, DRV_NAME, sizeof(cap->driver)); strscpy(cap->driver, DRV_NAME, sizeof(cap->driver));
snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
dev_name(ctx->jpu->dev)); dev_name(ctx->jpu->dev));
cap->device_caps |= V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE;
cap->capabilities = V4L2_CAP_DEVICE_CAPS | cap->device_caps;
memset(cap->reserved, 0, sizeof(cap->reserved)); memset(cap->reserved, 0, sizeof(cap->reserved));
return 0; return 0;
...@@ -1662,6 +1660,8 @@ static int jpu_probe(struct platform_device *pdev) ...@@ -1662,6 +1660,8 @@ static int jpu_probe(struct platform_device *pdev)
jpu->vfd_encoder.lock = &jpu->mutex; jpu->vfd_encoder.lock = &jpu->mutex;
jpu->vfd_encoder.v4l2_dev = &jpu->v4l2_dev; jpu->vfd_encoder.v4l2_dev = &jpu->v4l2_dev;
jpu->vfd_encoder.vfl_dir = VFL_DIR_M2M; jpu->vfd_encoder.vfl_dir = VFL_DIR_M2M;
jpu->vfd_encoder.device_caps = V4L2_CAP_STREAMING |
V4L2_CAP_VIDEO_M2M_MPLANE;
ret = video_register_device(&jpu->vfd_encoder, VFL_TYPE_GRABBER, -1); ret = video_register_device(&jpu->vfd_encoder, VFL_TYPE_GRABBER, -1);
if (ret) { if (ret) {
...@@ -1679,6 +1679,8 @@ static int jpu_probe(struct platform_device *pdev) ...@@ -1679,6 +1679,8 @@ static int jpu_probe(struct platform_device *pdev)
jpu->vfd_decoder.lock = &jpu->mutex; jpu->vfd_decoder.lock = &jpu->mutex;
jpu->vfd_decoder.v4l2_dev = &jpu->v4l2_dev; jpu->vfd_decoder.v4l2_dev = &jpu->v4l2_dev;
jpu->vfd_decoder.vfl_dir = VFL_DIR_M2M; jpu->vfd_decoder.vfl_dir = VFL_DIR_M2M;
jpu->vfd_decoder.device_caps = V4L2_CAP_STREAMING |
V4L2_CAP_VIDEO_M2M_MPLANE;
ret = video_register_device(&jpu->vfd_decoder, VFL_TYPE_GRABBER, -1); ret = video_register_device(&jpu->vfd_decoder, VFL_TYPE_GRABBER, -1);
if (ret) { if (ret) {
......
...@@ -1348,6 +1348,7 @@ static int s5p_mfc_probe(struct platform_device *pdev) ...@@ -1348,6 +1348,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)
vfd->lock = &dev->mfc_mutex; vfd->lock = &dev->mfc_mutex;
vfd->v4l2_dev = &dev->v4l2_dev; vfd->v4l2_dev = &dev->v4l2_dev;
vfd->vfl_dir = VFL_DIR_M2M; vfd->vfl_dir = VFL_DIR_M2M;
vfd->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
set_bit(V4L2_FL_QUIRK_INVERTED_CROP, &vfd->flags); set_bit(V4L2_FL_QUIRK_INVERTED_CROP, &vfd->flags);
snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_DEC_NAME); snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_DEC_NAME);
dev->vfd_dec = vfd; dev->vfd_dec = vfd;
...@@ -1366,6 +1367,7 @@ static int s5p_mfc_probe(struct platform_device *pdev) ...@@ -1366,6 +1367,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)
vfd->lock = &dev->mfc_mutex; vfd->lock = &dev->mfc_mutex;
vfd->v4l2_dev = &dev->v4l2_dev; vfd->v4l2_dev = &dev->v4l2_dev;
vfd->vfl_dir = VFL_DIR_M2M; vfd->vfl_dir = VFL_DIR_M2M;
vfd->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_ENC_NAME); snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_ENC_NAME);
dev->vfd_enc = vfd; dev->vfd_enc = vfd;
video_set_drvdata(vfd, dev); video_set_drvdata(vfd, dev);
......
...@@ -275,13 +275,6 @@ static int vidioc_querycap(struct file *file, void *priv, ...@@ -275,13 +275,6 @@ static int vidioc_querycap(struct file *file, void *priv,
strscpy(cap->card, dev->vfd_dec->name, sizeof(cap->card)); strscpy(cap->card, dev->vfd_dec->name, sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
dev_name(&dev->plat_dev->dev)); dev_name(&dev->plat_dev->dev));
/*
* This is only a mem-to-mem video device. The capture and output
* device capability flags are left only for backward compatibility
* and are scheduled for removal.
*/
cap->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
......
...@@ -1317,13 +1317,6 @@ static int vidioc_querycap(struct file *file, void *priv, ...@@ -1317,13 +1317,6 @@ static int vidioc_querycap(struct file *file, void *priv,
strscpy(cap->card, dev->vfd_enc->name, sizeof(cap->card)); strscpy(cap->card, dev->vfd_enc->name, sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
dev_name(&dev->plat_dev->dev)); dev_name(&dev->plat_dev->dev));
/*
* This is only a mem-to-mem video device. The capture and output
* device capability flags are left only for backward compatibility
* and are scheduled for removal.
*/
cap->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
......
...@@ -1495,8 +1495,6 @@ static int vpe_querycap(struct file *file, void *priv, ...@@ -1495,8 +1495,6 @@ static int vpe_querycap(struct file *file, void *priv,
strscpy(cap->card, VPE_MODULE_NAME, sizeof(cap->card)); strscpy(cap->card, VPE_MODULE_NAME, sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
VPE_MODULE_NAME); VPE_MODULE_NAME);
cap->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
return 0; return 0;
} }
...@@ -2411,6 +2409,7 @@ static const struct video_device vpe_videodev = { ...@@ -2411,6 +2409,7 @@ static const struct video_device vpe_videodev = {
.minor = -1, .minor = -1,
.release = video_device_release_empty, .release = video_device_release_empty,
.vfl_dir = VFL_DIR_M2M, .vfl_dir = VFL_DIR_M2M,
.device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING,
}; };
static const struct v4l2_m2m_ops m2m_ops = { static const struct v4l2_m2m_ops m2m_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment