Linux Media Controller development
 help / color / mirror / Atom feed
From: Antti Laakso <antti.laakso@linux.intel.com>
To: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com,
	sarang.sapre@intel.com, divyamani.tripathi@intel.com
Cc: manik.bajpai@intel.com
Subject: [PATCH 3/7] media: ipu6: Pass the fw context to the ipu7 boot helpers
Date: Thu,  1 Oct 2026 15:45:36 +0300	[thread overview]
Message-ID: <20261001124540.2129309-4-antti.laakso@linux.intel.com> (raw)
In-Reply-To: <20261001124540.2129309-1-antti.laakso@linux.intel.com>

Keep the ipu7 boot helpers sub-system agnostic by passing the
firmware context explicitly. No functional change.

Assisted-by: LLM
Signed-off-by: Antti Laakso <antti.laakso@linux.intel.com>
---
 drivers/media/pci/intel/ipu6/ipu7-boot.c    | 26 +++++++--------------
 drivers/media/pci/intel/ipu6/ipu7-boot.h    |  7 ++++--
 drivers/media/pci/intel/ipu6/ipu7-fw-isys.c |  9 ++++---
 3 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/drivers/media/pci/intel/ipu6/ipu7-boot.c b/drivers/media/pci/intel/ipu6/ipu7-boot.c
index 952c73efd237..f695d668d46b 100644
--- a/drivers/media/pci/intel/ipu6/ipu7-boot.c
+++ b/drivers/media/pci/intel/ipu6/ipu7-boot.c
@@ -12,7 +12,6 @@
 #include "ipu6-bus.h"
 #include "ipu6-buttress.h"
 #include "ipu6-dma.h"
-#include "ipu6-isys.h"
 #include "ipu6-platform-buttress-regs.h"
 #include "ipu7-boot.h"
 #include "ipu7-platform-regs.h"
@@ -163,11 +162,10 @@ static void ipu7_boot_cell_stop(const struct ipu6_bus_device *adev)
 	writel(val, base + regs->status_ctrl_reg);
 }
 
-static int ipu7_boot_cell_init(const struct ipu6_bus_device *adev)
+static int ipu7_boot_cell_init(const struct ipu6_bus_device *adev,
+			       const struct ipu7_fw_com_context *fwctx)
 {
 	const struct boot_regs *regs = &boot_regs[adev->ctrl->subsys_id];
-	struct ipu6_isys *isys = ipu6_bus_get_drvdata(adev);
-	struct ipu7_fw_com_context *fwctx = isys->fwctx;
 	void __iomem *base = adev->isp->base;
 
 	writel(fwctx->fw_entry, base + regs->fw_start_address_reg);
@@ -191,12 +189,11 @@ static void init_cfg_versions(struct ipu7_boot_abi_cfg *boot_cfg, u32 length, u8
 }
 
 int ipu6_ipu7_init_boot_config(struct ipu6_bus_device *adev,
+			       struct ipu7_fw_com_context *fwctx,
 			       struct ipu7_fw_com_queue_config *qconfigs,
 			       int num_queues, u32 uc_freq,
 			       dma_addr_t subsys_config, u8 major)
 {
-	struct ipu6_isys *isys = ipu6_bus_get_drvdata(adev);
-	struct ipu7_fw_com_context *fwctx = isys->fwctx;
 	struct ipu7_boot_abi_cfg *boot_config;
 	struct ipu7_fw_com_queue_params_config *cfgs;
 	struct device *dev = &adev->auxdev.dev;
@@ -269,16 +266,12 @@ int ipu6_ipu7_init_boot_config(struct ipu6_bus_device *adev,
 }
 EXPORT_SYMBOL_NS_GPL(ipu6_ipu7_init_boot_config, "INTEL_IPU6");
 
-void ipu6_ipu7_release_boot_config(struct ipu6_bus_device *adev)
+void ipu6_ipu7_release_boot_config(struct ipu6_bus_device *adev,
+				   struct ipu7_fw_com_context *fwctx)
 {
-	struct ipu6_isys *isys = ipu6_bus_get_drvdata(adev);
-	struct ipu7_fw_com_context *fwctx;
-
-	if (!isys || !isys->fwctx)
+	if (!fwctx)
 		return;
 
-	fwctx = isys->fwctx;
-
 	if (fwctx->queue_mem) {
 		ipu6_dma_free(adev, fwctx->queue_mem_size,
 			      fwctx->queue_mem,
@@ -297,18 +290,17 @@ void ipu6_ipu7_release_boot_config(struct ipu6_bus_device *adev)
 }
 EXPORT_SYMBOL_NS_GPL(ipu6_ipu7_release_boot_config, "INTEL_IPU6");
 
-int ipu6_ipu7_boot_start_fw(const struct ipu6_bus_device *adev)
+int ipu6_ipu7_boot_start_fw(const struct ipu6_bus_device *adev,
+			    struct ipu7_fw_com_context *fwctx)
 {
 	const struct device *dev = &adev->auxdev.dev;
-	struct ipu6_isys *isys = ipu6_bus_get_drvdata(adev);
-	struct ipu7_fw_com_context *fwctx = isys->fwctx;
 	u32 timeout = IPU7_FW_START_STOP_TIMEOUT;
 	void __iomem *base = adev->isp->base;
 	u32 boot_state, last_boot_state;
 	u32 indices_addr, msg_ver, id;
 	int ret;
 
-	ret = ipu7_boot_cell_init(adev);
+	ret = ipu7_boot_cell_init(adev, fwctx);
 	if (ret)
 		return ret;
 
diff --git a/drivers/media/pci/intel/ipu6/ipu7-boot.h b/drivers/media/pci/intel/ipu6/ipu7-boot.h
index f2172b53bed5..48b7cbbde3d3 100644
--- a/drivers/media/pci/intel/ipu6/ipu7-boot.h
+++ b/drivers/media/pci/intel/ipu6/ipu7-boot.h
@@ -36,11 +36,14 @@ struct ipu7_boot_abi_cfg {
 } __packed;
 
 int ipu6_ipu7_init_boot_config(struct ipu6_bus_device *adev,
+			       struct ipu7_fw_com_context *fwctx,
 			       struct ipu7_fw_com_queue_config *qconfigs,
 			       int num_queues, u32 uc_freq,
 			       dma_addr_t subsys_config, u8 major);
-void ipu6_ipu7_release_boot_config(struct ipu6_bus_device *adev);
-int ipu6_ipu7_boot_start_fw(const struct ipu6_bus_device *adev);
+void ipu6_ipu7_release_boot_config(struct ipu6_bus_device *adev,
+				   struct ipu7_fw_com_context *fwctx);
+int ipu6_ipu7_boot_start_fw(const struct ipu6_bus_device *adev,
+			    struct ipu7_fw_com_context *fwctx);
 int ipu6_ipu7_boot_stop_fw(const struct ipu6_bus_device *adev);
 
 #endif
diff --git a/drivers/media/pci/intel/ipu6/ipu7-fw-isys.c b/drivers/media/pci/intel/ipu6/ipu7-fw-isys.c
index ae8f40f94cc9..b22a01cf6f1b 100644
--- a/drivers/media/pci/intel/ipu6/ipu7-fw-isys.c
+++ b/drivers/media/pci/intel/ipu6/ipu7-fw-isys.c
@@ -25,7 +25,7 @@ static void ipu7_fw_isys_cleanup(struct ipu6_isys *isys)
 	if (!fwctx)
 		return;
 
-	ipu6_ipu7_release_boot_config(adev);
+	ipu6_ipu7_release_boot_config(adev, fwctx);
 
 	if (fwctx->fw_config) {
 		ipu6_dma_free(adev, sizeof(*fwctx->fw_config), fwctx->fw_config,
@@ -41,7 +41,7 @@ static void ipu7_fw_isys_cleanup(struct ipu6_isys *isys)
 
 static int ipu7_fw_isys_open(struct ipu6_isys *isys)
 {
-	return ipu6_ipu7_boot_start_fw(isys->adev);
+	return ipu6_ipu7_boot_start_fw(isys->adev, isys->fwctx);
 }
 
 static int ipu7_fw_isys_close(struct ipu6_isys *isys)
@@ -133,9 +133,8 @@ static int ipu7_fw_isys_init(struct ipu6_isys *isys, unsigned int num_streams)
 
 	isys->fwctx = fwctx;
 
-	/* IPU8 firmware expects boot-message major version 2, not 1 */
-	ret = ipu6_ipu7_init_boot_config(adev, queue_configs, num_queues,
-					 freq, fw_config_dma_addr,
+	ret = ipu6_ipu7_init_boot_config(adev, fwctx, queue_configs,
+					 num_queues, freq, fw_config_dma_addr,
 					 IS_IPU8(adev->isp) ? 2U : 1U);
 	if (ret) {
 		ipu7_fw_isys_cleanup(isys);
-- 
2.55.0


  parent reply	other threads:[~2026-10-01 12:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 12:45 [PATCH 0/7] Make ipu7 fw boot code subsystem agnostic Antti Laakso
2026-10-01 12:45 ` [PATCH 1/7] media: ipu6: Fix media entity names for different ipu versions Antti Laakso
2026-10-01 12:45 ` [PATCH 2/7] media: ipu6: Forward declare struct ipu6_mmu Antti Laakso
2026-10-01 12:45 ` Antti Laakso [this message]
2026-10-01 12:45 ` [PATCH 4/7] media: ipu6: Make ipu7 fw config subsystem agnostic Antti Laakso
2026-10-01 12:45 ` [PATCH 5/7] media: ipu6: Export the ipu7 firmware boot state Antti Laakso
2026-10-01 12:45 ` [PATCH 6/7] media: ipu6: Add the ipu7 psys buttress support Antti Laakso
2026-10-01 12:45 ` [PATCH 7/7] media: ipu6: Move ipu7 fw logger and watchdog configuration Antti Laakso

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=20261001124540.2129309-4-antti.laakso@linux.intel.com \
    --to=antti.laakso@linux.intel.com \
    --cc=divyamani.tripathi@intel.com \
    --cc=linux-media@vger.kernel.org \
    --cc=manik.bajpai@intel.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sarang.sapre@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