]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: intel/ipu6: Abstract buf ready function
authorStanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Wed, 19 Mar 2025 12:10:43 +0000 (13:10 +0100)
committerHans Verkuil <hverkuil@xs4all.nl>
Fri, 25 Apr 2025 08:15:22 +0000 (10:15 +0200)
Extract values needed by ipu6_queue_buf_ready() function from fw abi
structure. This will allow to reuse same buf ready code when fw abi
change.

Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/pci/intel/ipu6/ipu6-isys-queue.c

index c68dc577daf07bb4754070ea37778b343c29f901..55d45d2d8768694c6d6c17e3f028b3cd3d0c69d5 100644 (file)
@@ -734,10 +734,11 @@ static void ipu6_isys_queue_buf_done(struct ipu6_isys_buffer *ib)
        }
 }
 
-void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream,
-                              struct ipu6_fw_isys_resp_info_abi *info)
+static void
+ipu6_stream_buf_ready(struct ipu6_isys_stream *stream, u8 pin_id, u32 pin_addr,
+                     u64 time, bool error_check)
 {
-       struct ipu6_isys_queue *aq = stream->output_pins[info->pin_id].aq;
+       struct ipu6_isys_queue *aq = stream->output_pins[pin_id].aq;
        struct ipu6_isys *isys = stream->isys;
        struct device *dev = &isys->adev->auxdev.dev;
        struct ipu6_isys_buffer *ib;
@@ -745,7 +746,6 @@ void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream,
        unsigned long flags;
        bool first = true;
        struct vb2_v4l2_buffer *buf;
-       u64 time = (u64)info->timestamp[1] << 32 | info->timestamp[0];
 
        spin_lock_irqsave(&aq->lock, flags);
        if (list_empty(&aq->active)) {
@@ -764,7 +764,7 @@ void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream,
                ivb = vb2_buffer_to_ipu6_isys_video_buffer(vvb);
                addr = ivb->dma_addr;
 
-               if (info->pin.addr != addr) {
+               if (pin_addr != addr) {
                        if (first)
                                dev_err(dev, "Unexpected buffer address %pad\n",
                                        &addr);
@@ -772,8 +772,7 @@ void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream,
                        continue;
                }
 
-               if (info->error_info.error ==
-                   IPU6_FW_ISYS_ERROR_HW_REPORTED_STR2MMIO) {
+               if (error_check) {
                        /*
                         * Check for error message:
                         * 'IPU6_FW_ISYS_ERROR_HW_REPORTED_STR2MMIO'
@@ -800,6 +799,15 @@ void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream,
        spin_unlock_irqrestore(&aq->lock, flags);
 }
 
+void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream,
+                              struct ipu6_fw_isys_resp_info_abi *info)
+{
+       u64 time = (u64)info->timestamp[1] << 32 | info->timestamp[0];
+       bool err = info->error_info.error == IPU6_FW_ISYS_ERROR_HW_REPORTED_STR2MMIO;
+
+       ipu6_stream_buf_ready(stream, info->pin_id, info->pin.addr, time, err);
+}
+
 static const struct vb2_ops ipu6_isys_queue_ops = {
        .queue_setup = ipu6_isys_queue_setup,
        .buf_init = ipu6_isys_buf_init,