summaryrefslogtreecommitdiff
path: root/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
diff options
context:
space:
mode:
authorBingbu Cao <bingbu.cao@intel.com>2024-01-31 17:51:05 +0800
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2024-04-29 14:56:38 +0200
commitd3bd039cd2a00989f7bd4ab3677b504ae0f63eac (patch)
treed641becfb83e6f0884d9b9752cd25ec63f576306 /drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
parent7c833d204f6b9247c6df4321f475df5c3cb80600 (diff)
media: intel/ipu6: support line-based metadata capture support
Some camera sensor can output the embedded data in specific data type. This patch adds the support for metadata capture in IPU6 ISYS driver. Signed-off-by: Hongju Wang <hongju.wang@intel.com> Signed-off-by: Bingbu Cao <bingbu.cao@intel.com> Co-developed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media/pci/intel/ipu6/ipu6-isys-queue.c')
-rw-r--r--drivers/media/pci/intel/ipu6/ipu6-isys-queue.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
index be37c0ba9711..11cd2c977abe 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
+++ b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
@@ -28,7 +28,7 @@ static int queue_setup(struct vb2_queue *q, unsigned int *num_buffers,
struct ipu6_isys_queue *aq = vb2_queue_to_isys_queue(q);
struct ipu6_isys_video *av = ipu6_isys_queue_to_video(aq);
struct device *dev = &av->isys->adev->auxdev.dev;
- u32 size = av->pix_fmt.sizeimage;
+ u32 size = ipu6_isys_get_data_size(av);
/* num_planes == 0: we're being called through VIDIOC_REQBUFS */
if (!*num_planes) {
@@ -49,17 +49,17 @@ static int ipu6_isys_buf_prepare(struct vb2_buffer *vb)
struct ipu6_isys_queue *aq = vb2_queue_to_isys_queue(vb->vb2_queue);
struct ipu6_isys_video *av = ipu6_isys_queue_to_video(aq);
struct device *dev = &av->isys->adev->auxdev.dev;
+ u32 bytesperline = ipu6_isys_get_bytes_per_line(av);
+ u32 height = ipu6_isys_get_frame_height(av);
+ u32 size = ipu6_isys_get_data_size(av);
dev_dbg(dev, "buffer: %s: configured size %u, buffer size %lu\n",
- av->vdev.name, av->pix_fmt.sizeimage,
- vb2_plane_size(vb, 0));
+ av->vdev.name, size, vb2_plane_size(vb, 0));
- if (av->pix_fmt.sizeimage > vb2_plane_size(vb, 0))
+ if (size > vb2_plane_size(vb, 0))
return -EINVAL;
- vb2_set_plane_payload(vb, 0, av->pix_fmt.bytesperline *
- av->pix_fmt.height);
- vb->planes[0].data_offset = 0;
+ vb2_set_plane_payload(vb, 0, bytesperline * height);
return 0;
}
@@ -328,15 +328,12 @@ static void buf_queue(struct vb2_buffer *vb)
struct isys_fw_msgs *msg;
unsigned long flags;
dma_addr_t dma;
- unsigned int i;
int ret;
dev_dbg(dev, "queue buffer %u for %s\n", vb->index, av->vdev.name);
- for (i = 0; i < vb->num_planes; i++) {
- dma = vb2_dma_contig_plane_dma_addr(vb, i);
- dev_dbg(dev, "iova: plane %u iova %pad\n", i, &dma);
- }
+ dma = vb2_dma_contig_plane_dma_addr(vb, 0);
+ dev_dbg(dev, "iova: iova %pad\n", &dma);
spin_lock_irqsave(&aq->lock, flags);
list_add(&ib->head, &aq->incoming);
@@ -409,7 +406,7 @@ static int ipu6_isys_link_fmt_validate(struct ipu6_isys_queue *aq)
struct media_pad *remote_pad =
media_pad_remote_pad_first(av->vdev.entity.pads);
struct v4l2_subdev *sd;
- u32 r_stream;
+ u32 r_stream, code;
int ret;
if (!remote_pad)
@@ -427,17 +424,19 @@ static int ipu6_isys_link_fmt_validate(struct ipu6_isys_queue *aq)
return ret;
}
- if (format.width != av->pix_fmt.width ||
- format.height != av->pix_fmt.height) {
- dev_dbg(dev, "wrong width or height %ux%u (%ux%u expected)\n",
- av->pix_fmt.width, av->pix_fmt.height,
- format.width, format.height);
+ if (format.width != ipu6_isys_get_frame_width(av) ||
+ format.height != ipu6_isys_get_frame_height(av)) {
+ dev_err(dev, "wrong width or height %ux%u (%ux%u expected)\n",
+ ipu6_isys_get_frame_width(av),
+ ipu6_isys_get_frame_height(av), format.width,
+ format.height);
return -EINVAL;
}
- if (format.code != av->pfmt->code) {
+ code = ipu6_isys_get_isys_format(ipu6_isys_get_format(av), 0)->code;
+ if (format.code != code) {
dev_dbg(dev, "wrong mbus code 0x%8.8x (0x%8.8x expected)\n",
- av->pfmt->code, format.code);
+ code, format.code);
return -EINVAL;
}
@@ -509,14 +508,16 @@ static int start_streaming(struct vb2_queue *q, unsigned int count)
struct ipu6_isys_queue *aq = vb2_queue_to_isys_queue(q);
struct ipu6_isys_video *av = ipu6_isys_queue_to_video(aq);
struct device *dev = &av->isys->adev->auxdev.dev;
+ const struct ipu6_isys_pixelformat *pfmt =
+ ipu6_isys_get_isys_format(ipu6_isys_get_format(av), 0);
struct ipu6_isys_buffer_list __bl, *bl = NULL;
struct ipu6_isys_stream *stream;
struct media_entity *source_entity = NULL;
int nr_queues, ret;
dev_dbg(dev, "stream: %s: width %u, height %u, css pixelformat %u\n",
- av->vdev.name, av->pix_fmt.width, av->pix_fmt.height,
- av->pfmt->css_pixelformat);
+ av->vdev.name, ipu6_isys_get_frame_width(av),
+ ipu6_isys_get_frame_height(av), pfmt->css_pixelformat);
ret = ipu6_isys_setup_video(av, &source_entity, &nr_queues);
if (ret < 0) {