media: intel/ipu6: Abstract buf ready function

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>
This commit is contained in:
Stanislaw Gruszka
2025-03-19 13:10:43 +01:00
committed by Hans Verkuil
parent 36b9d0521e
commit 95d1033c8d

View 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,