public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
To: linux-media@vger.kernel.org
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Bingbu Cao <bingbu.cao@intel.com>
Subject: [PATCH 4/5] media: intel/ipu6: Abstart buf ready function
Date: Thu, 13 Mar 2025 11:24:26 +0100	[thread overview]
Message-ID: <20250313102427.131832-5-stanislaw.gruszka@linux.intel.com> (raw)
In-Reply-To: <20250313102427.131832-1-stanislaw.gruszka@linux.intel.com>

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>
---
 .../media/pci/intel/ipu6/ipu6-isys-queue.c    | 28 ++++++++++++-------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
index c68dc577daf0..c7f302df2dcc 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
+++ b/drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
@@ -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 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)) {
@@ -757,23 +757,22 @@ void ipu6_isys_queue_buf_ready(struct ipu6_isys_stream *stream,
 	list_for_each_entry_reverse(ib, &aq->active, head) {
 		struct ipu6_isys_video_buffer *ivb;
 		struct vb2_v4l2_buffer *vvb;
-		dma_addr_t addr;
+		dma_addr_t dma_addr;
 
 		vb = ipu6_isys_buffer_to_vb2_buffer(ib);
 		vvb = to_vb2_v4l2_buffer(vb);
 		ivb = vb2_buffer_to_ipu6_isys_video_buffer(vvb);
-		addr = ivb->dma_addr;
+		dma_addr = ivb->dma_addr;
 
-		if (info->pin.addr != addr) {
+		if (addr != dma_addr) {
 			if (first)
 				dev_err(dev, "Unexpected buffer address %pad\n",
-					&addr);
+					&dma_addr);
 			first = false;
 			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,
-- 
2.34.1


  parent reply	other threads:[~2025-03-13 10:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 10:24 [PATCH 0/5] media: intel/ipu6: Cleanups and small refactor Stanislaw Gruszka
2025-03-13 10:24 ` [PATCH 1/5] media: intel/ipu6: Add missing new line character in error message Stanislaw Gruszka
2025-03-13 10:24 ` [PATCH 2/5] media: intel/ipu6: Make two functions static Stanislaw Gruszka
2025-03-13 10:24 ` [PATCH 3/5] media: intel/ipu6: Use timestamp value directly Stanislaw Gruszka
2025-03-13 10:24 ` Stanislaw Gruszka [this message]
2025-03-13 10:55   ` [PATCH 4/5] media: intel/ipu6: Abstart buf ready function Sakari Ailus
2025-03-13 10:24 ` [PATCH 5/5] media: intel/ipu6: Remove unused dev field from ipu6_isys_queue Stanislaw Gruszka
2025-03-13 10:54   ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250313102427.131832-5-stanislaw.gruszka@linux.intel.com \
    --to=stanislaw.gruszka@linux.intel.com \
    --cc=bingbu.cao@intel.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox