Skip to contentSkip to conversation

Declare isp firmware binary file

PATCH In review Pratap Nirujogi 3 participants 11 messages Sep 3, 2025 – Sep 4, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Declare isp firmware binary file

Hello,

As suggested, patch v1 is split into multiple patches. Please take a look at the latest patch series and let us know your thoughts.

Thanks,
Pratap

----

Changes v1 -> v2:

* Split into multiple patches as per the review feedback.
* First-patch: Moves isp firmware load from generic amdgpu_isp driver into isp version specific isp_v4_1_x driver modules.
* Second-patch: Declares isp firmware file isp_4_1_1.bin required by isp4.1.1 device present on HP ZBook Ultra G1.

---

Pratap Nirujogi (2):
drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules drm/amd/amdgpu: Declare isp firmware binary file

 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 22 +++++++++-------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h |  2 ++
 drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c | 12 +++++++++++-
 drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h |  2 +-
 drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c | 14 +++++++++++++-
 drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h |  2 +-
 6 files changed, 37 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/2 drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Move isp firmware load from generic amdgpu_isp driver to isp version specific driver modules isp_v4_1_0 and isp_v4_1_1.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 22 +++++++++-------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h |  2 ++
 drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c | 12 +++++++++++-
 drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h |  2 +-
 drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c | 12 +++++++++++-
 drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h |  2 +-
 6 files changed, 35 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +9 -13
index 9cddbf50442a..90af35ee8f6e 100644
@@ -68,7 +68,7 @@ static int isp_hw_fini(struct amdgpu_ip_block *ip_block)
 	return -ENODEV;
 }
 
-static int isp_load_fw_by_psp(struct amdgpu_device *adev)
+int isp_load_fw_by_psp(struct amdgpu_device *adev)
 {
 	const struct common_firmware_header *hdr;
 	char ucode_prefix[10];
@@ -80,7 +80,7 @@ static int isp_load_fw_by_psp(struct amdgpu_device *adev)
 
 	/* read isp fw */
 	r = amdgpu_ucode_request(adev, &adev->isp.fw, AMDGPU_UCODE_OPTIONAL,
-				"amdgpu/%s.bin", ucode_prefix);
+				 "amdgpu/%s.bin", ucode_prefix);
 	if (r) {
 		amdgpu_ucode_release(&adev->isp.fw);
 		return r;
@@ -103,27 +103,23 @@ static int isp_early_init(struct amdgpu_ip_block *ip_block)
 
 	struct amdgpu_device *adev = ip_block->adev;
 	struct amdgpu_isp *isp = &adev->isp;
+	int r;
+
+	isp->adev = adev;
+	isp->parent = adev->dev;
 
 	switch (amdgpu_ip_version(adev, ISP_HWIP, 0)) {
 	case IP_VERSION(4, 1, 0):
-		isp_v4_1_0_set_isp_funcs(isp);
+		r = isp_v4_1_0_set_isp_funcs(isp);
 		break;
 	case IP_VERSION(4, 1, 1):
-		isp_v4_1_1_set_isp_funcs(isp);
+		r = isp_v4_1_1_set_isp_funcs(isp);
 		break;
 	default:
 		return -EINVAL;
 	}
 
-	isp->adev = adev;
-	isp->parent = adev->dev;
-
-	if (isp_load_fw_by_psp(adev)) {
-		DRM_DEBUG_DRIVER("%s: isp fw load failed\n", __func__);
-		return -ENOENT;
-	}
-
-	return 0;
+	return r;
 }
 
 static bool isp_is_idle(struct amdgpu_ip_block *ip_block)
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h +2 -0
index d6f4ffa4c97c..36750123ed46 100644
@@ -57,4 +57,6 @@ struct amdgpu_isp {
 extern const struct amdgpu_ip_block_version isp_v4_1_0_ip_block;
 extern const struct amdgpu_ip_block_version isp_v4_1_1_ip_block;
 
+int isp_load_fw_by_psp(struct amdgpu_device *adev);
+
 #endif /* __AMDGPU_ISP_H__ */
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c +11 -1
index 0027a639c7e6..926947a612a4 100644
@@ -185,7 +185,17 @@ static const struct isp_funcs isp_v4_1_0_funcs = {
 	.hw_fini = isp_v4_1_0_hw_fini,
 };
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
 {
+	struct amdgpu_device *adev = isp->adev;
+
 	isp->funcs = &isp_v4_1_0_funcs;
+
+	/* load isp firmware */
+	if (isp_load_fw_by_psp(adev)) {
+		drm_err(&adev->ddev, "isp fw load failed\n");
+		return -ENOENT;
+	}
+
+	return 0;
 }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h +1 -1
index 4d239198edd0..5e43ba064708 100644
@@ -45,6 +45,6 @@
 #define ISP410_GPIO_SENSOR_OFFSET 0x6613C
 #define ISP410_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
 
 #endif
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c +11 -1
index a887df520414..9766c6056dc4 100644
@@ -369,7 +369,17 @@ static const struct isp_funcs isp_v4_1_1_funcs = {
 	.hw_fini = isp_v4_1_1_hw_fini,
 };
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
 {
+	struct amdgpu_device *adev = isp->adev;
+
 	isp->funcs = &isp_v4_1_1_funcs;
+
+	/* load isp firmware */
+	if (isp_load_fw_by_psp(adev)) {
+		drm_err(&adev->ddev, "isp fw load failed\n");
+		return -ENOENT;
+	}
+
+	return 0;
 }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h +1 -1
index fe45d70d87f1..b221d8b81983 100644
@@ -44,6 +44,6 @@
 #define ISP411_GPIO_SENSOR_OFFSET 0x6613C
 #define ISP411_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
 
 #endif
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Quoted 2 lines · Pratap

Move isp firmware load from generic amdgpu_isp driver to isp version specific driver modules isp_v4_1_0 and isp_v4_1_1.

I don't really understand why to do this change. Isn't it just more code duplication with this patch?

Quoted 149 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 22 +++++++++-------------
  drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h |  2 ++
  drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c | 12 +++++++++++-
  drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h |  2 +-
  drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c | 12 +++++++++++-
  drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h |  2 +-
  6 files changed, 35 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +9 -13
index 9cddbf50442a..90af35ee8f6e 100644
@@ -68,7 +68,7 @@ static int isp_hw_fini(struct amdgpu_ip_block *ip_block)
  	return -ENODEV;
  }
 
-static int isp_load_fw_by_psp(struct amdgpu_device *adev)
+int isp_load_fw_by_psp(struct amdgpu_device *adev)
  {
  	const struct common_firmware_header *hdr;
  	char ucode_prefix[10];
@@ -80,7 +80,7 @@ static int isp_load_fw_by_psp(struct amdgpu_device *adev)
 
  	/* read isp fw */
  	r = amdgpu_ucode_request(adev, &adev->isp.fw, AMDGPU_UCODE_OPTIONAL,
-				"amdgpu/%s.bin", ucode_prefix);
+				 "amdgpu/%s.bin", ucode_prefix);
  	if (r) {
  		amdgpu_ucode_release(&adev->isp.fw);
  		return r;
@@ -103,27 +103,23 @@ static int isp_early_init(struct amdgpu_ip_block *ip_block)
 
  	struct amdgpu_device *adev = ip_block->adev;
  	struct amdgpu_isp *isp = &adev->isp;
+	int r;
+
+	isp->adev = adev;
+	isp->parent = adev->dev;
 
  	switch (amdgpu_ip_version(adev, ISP_HWIP, 0)) {
  	case IP_VERSION(4, 1, 0):
-		isp_v4_1_0_set_isp_funcs(isp);
+		r = isp_v4_1_0_set_isp_funcs(isp);
  		break;
  	case IP_VERSION(4, 1, 1):
-		isp_v4_1_1_set_isp_funcs(isp);
+		r = isp_v4_1_1_set_isp_funcs(isp);
  		break;
  	default:
  		return -EINVAL;
  	}
 
-	isp->adev = adev;
-	isp->parent = adev->dev;
-
-	if (isp_load_fw_by_psp(adev)) {
-		DRM_DEBUG_DRIVER("%s: isp fw load failed\n", __func__);
-		return -ENOENT;
-	}
-
-	return 0;
+	return r;
  }
 
  static bool isp_is_idle(struct amdgpu_ip_block *ip_block)
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h +2 -0
index d6f4ffa4c97c..36750123ed46 100644
@@ -57,4 +57,6 @@ struct amdgpu_isp {
  extern const struct amdgpu_ip_block_version isp_v4_1_0_ip_block;
  extern const struct amdgpu_ip_block_version isp_v4_1_1_ip_block;
 
+int isp_load_fw_by_psp(struct amdgpu_device *adev);
+
  #endif /* __AMDGPU_ISP_H__ */
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c +11 -1
index 0027a639c7e6..926947a612a4 100644
@@ -185,7 +185,17 @@ static const struct isp_funcs isp_v4_1_0_funcs = {
  	.hw_fini = isp_v4_1_0_hw_fini,
  };
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
  {
+	struct amdgpu_device *adev = isp->adev;
+
  	isp->funcs = &isp_v4_1_0_funcs;
+
+	/* load isp firmware */
+	if (isp_load_fw_by_psp(adev)) {
+		drm_err(&adev->ddev, "isp fw load failed\n");
+		return -ENOENT;
+	}
+
+	return 0;
  }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h +1 -1
index 4d239198edd0..5e43ba064708 100644
@@ -45,6 +45,6 @@
  #define ISP410_GPIO_SENSOR_OFFSET 0x6613C
  #define ISP410_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
 
  #endif
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c +11 -1
index a887df520414..9766c6056dc4 100644
@@ -369,7 +369,17 @@ static const struct isp_funcs isp_v4_1_1_funcs = {
  	.hw_fini = isp_v4_1_1_hw_fini,
  };
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
  {
+	struct amdgpu_device *adev = isp->adev;
+
  	isp->funcs = &isp_v4_1_1_funcs;
+
+	/* load isp firmware */
+	if (isp_load_fw_by_psp(adev)) {
+		drm_err(&adev->ddev, "isp fw load failed\n");
+		return -ENOENT;
+	}
+
+	return 0;
  }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h +1 -1
index fe45d70d87f1..b221d8b81983 100644
@@ -44,6 +44,6 @@
  #define ISP411_GPIO_SENSOR_OFFSET 0x6613C
  #define ISP411_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
 
  #endif
#3 lore raw

RE: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Wednesday, September 3, 2025 4:40 PM
To: Nirujogi, Pratap <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Limonciello, Mario <[email protected]>
Cc: Chan, Benjamin (Koon Pan) <[email protected]>; Du, Bin <[email protected]>; Rosikopulos, Gjorgji <[email protected]>; Li, King <[email protected]>; Antony, Dominic <[email protected]>; Jawich, Phil <[email protected]>; [email protected]
Subject: Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Quoted 2 lines · Pratap

Move isp firmware load from generic amdgpu_isp driver to isp version specific driver modules isp_v4_1_0 and isp_v4_1_1.

I don't really understand why to do this change. Isn't it just more code duplication with this patch?

Hi Mario, I have added this to show the reference of calling the fw load in the same file where MODULE_FIRMWARE is added. This aligns with the approach followed in other drivers (amdgpu_vcn, gfx_v11_0 etc.).

Thanks,
Pratap

Quoted 157 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 22 +++++++++-------------
  drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h |  2 ++
  drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c | 12 +++++++++++-
  drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h |  2 +-
  drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c | 12 +++++++++++-
  drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h |  2 +-
  6 files changed, 35 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +2 -2
index 9cddbf50442a..90af35ee8f6e 100644
@@ -68,7 +68,7 @@ static int isp_hw_fini(struct amdgpu_ip_block *ip_block)
      return -ENODEV;
  }
 
-static int isp_load_fw_by_psp(struct amdgpu_device *adev)
+int isp_load_fw_by_psp(struct amdgpu_device *adev)
  {
      const struct common_firmware_header *hdr;
      char ucode_prefix[10];
@@ -80,7 +80,7 @@ static int isp_load_fw_by_psp(struct amdgpu_device
 *adev)
 
      /* read isp fw */
      r = amdgpu_ucode_request(adev, &adev->isp.fw, AMDGPU_UCODE_OPTIONAL,
-                             "amdgpu/%s.bin", ucode_prefix);
+                              "amdgpu/%s.bin", ucode_prefix);
      if (r) {
              amdgpu_ucode_release(&adev->isp.fw);
              return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +7 -11
@@ -103,27 +103,23 @@ static int isp_early_init(struct amdgpu_ip_block
 *ip_block)
 
      struct amdgpu_device *adev = ip_block->adev;
      struct amdgpu_isp *isp = &adev->isp;
+     int r;
+
+     isp->adev = adev;
+     isp->parent = adev->dev;
 
      switch (amdgpu_ip_version(adev, ISP_HWIP, 0)) {
      case IP_VERSION(4, 1, 0):
-             isp_v4_1_0_set_isp_funcs(isp);
+             r = isp_v4_1_0_set_isp_funcs(isp);
              break;
      case IP_VERSION(4, 1, 1):
-             isp_v4_1_1_set_isp_funcs(isp);
+             r = isp_v4_1_1_set_isp_funcs(isp);
              break;
      default:
              return -EINVAL;
      }
 
-     isp->adev = adev;
-     isp->parent = adev->dev;
-
-     if (isp_load_fw_by_psp(adev)) {
-             DRM_DEBUG_DRIVER("%s: isp fw load failed\n", __func__);
-             return -ENOENT;
-     }
-
-     return 0;
+     return r;
  }
 

static bool isp_is_idle(struct amdgpu_ip_block *ip_block) diff --git
a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h
index d6f4ffa4c97c..36750123ed46 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h +2 -0
@@ -57,4 +57,6 @@ struct amdgpu_isp {
  extern const struct amdgpu_ip_block_version isp_v4_1_0_ip_block;
  extern const struct amdgpu_ip_block_version isp_v4_1_1_ip_block;
 
+int isp_load_fw_by_psp(struct amdgpu_device *adev);
+
  #endif /* __AMDGPU_ISP_H__ */
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c +11 -1
index 0027a639c7e6..926947a612a4 100644
@@ -185,7 +185,17 @@ static const struct isp_funcs isp_v4_1_0_funcs = {
      .hw_fini = isp_v4_1_0_hw_fini,
  };
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
  {
+     struct amdgpu_device *adev = isp->adev;
+
      isp->funcs = &isp_v4_1_0_funcs;
+
+     /* load isp firmware */
+     if (isp_load_fw_by_psp(adev)) {
+             drm_err(&adev->ddev, "isp fw load failed\n");
+             return -ENOENT;
+     }
+
+     return 0;
  }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h +1 -1
index 4d239198edd0..5e43ba064708 100644
@@ -45,6 +45,6 @@
  #define ISP410_GPIO_SENSOR_OFFSET 0x6613C
  #define ISP410_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
 
  #endif
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c +11 -1
index a887df520414..9766c6056dc4 100644
@@ -369,7 +369,17 @@ static const struct isp_funcs isp_v4_1_1_funcs = {
      .hw_fini = isp_v4_1_1_hw_fini,
  };
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
  {
+     struct amdgpu_device *adev = isp->adev;
+
      isp->funcs = &isp_v4_1_1_funcs;
+
+     /* load isp firmware */
+     if (isp_load_fw_by_psp(adev)) {
+             drm_err(&adev->ddev, "isp fw load failed\n");
+             return -ENOENT;
+     }
+
+     return 0;
  }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h +1 -1
index fe45d70d87f1..b221d8b81983 100644
@@ -44,6 +44,6 @@
  #define ISP411_GPIO_SENSOR_OFFSET 0x6613C
  #define ISP411_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
 
  #endif
#4 lore raw

Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Quoted 9 lines · Pratap

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Wednesday, September 3, 2025 4:40 PM
To: Nirujogi, Pratap <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Limonciello, Mario <[email protected]>
Cc: Chan, Benjamin (Koon Pan) <[email protected]>; Du, Bin <[email protected]>; Rosikopulos, Gjorgji <[email protected]>; Li, King <[email protected]>; Antony, Dominic <[email protected]>; Jawich, Phil <[email protected]>; [email protected]
Subject: Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Quoted 8 lines
Quoted 2 lines · Pratap

Move isp firmware load from generic amdgpu_isp driver to isp version specific driver modules isp_v4_1_0 and isp_v4_1_1.

I don't really understand why to do this change. Isn't it just more code duplication with this patch?

Hi Mario, I have added this to show the reference of calling the fw load in the same file where MODULE_FIRMWARE is added. This aligns with the approach followed in other drivers (amdgpu_vcn, gfx_v11_0 etc.).

I guess I don't see a strong argument for doing it, but let's see what others think.

Quoted 161 lines

Thanks,
Pratap

Quoted 157 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 22 +++++++++-------------
   drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h |  2 ++
   drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c | 12 +++++++++++-
   drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h |  2 +-
   drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c | 12 +++++++++++-
   drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h |  2 +-
   6 files changed, 35 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +2 -2
index 9cddbf50442a..90af35ee8f6e 100644
@@ -68,7 +68,7 @@ static int isp_hw_fini(struct amdgpu_ip_block *ip_block)
       return -ENODEV;
   }
 
-static int isp_load_fw_by_psp(struct amdgpu_device *adev)
+int isp_load_fw_by_psp(struct amdgpu_device *adev)
   {
       const struct common_firmware_header *hdr;
       char ucode_prefix[10];
@@ -80,7 +80,7 @@ static int isp_load_fw_by_psp(struct amdgpu_device
 *adev)
 
       /* read isp fw */
       r = amdgpu_ucode_request(adev, &adev->isp.fw, AMDGPU_UCODE_OPTIONAL,
-                             "amdgpu/%s.bin", ucode_prefix);
+                              "amdgpu/%s.bin", ucode_prefix);
       if (r) {
               amdgpu_ucode_release(&adev->isp.fw);
               return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +7 -11
@@ -103,27 +103,23 @@ static int isp_early_init(struct amdgpu_ip_block
 *ip_block)
 
       struct amdgpu_device *adev = ip_block->adev;
       struct amdgpu_isp *isp = &adev->isp;
+     int r;
+
+     isp->adev = adev;
+     isp->parent = adev->dev;
 
       switch (amdgpu_ip_version(adev, ISP_HWIP, 0)) {
       case IP_VERSION(4, 1, 0):
-             isp_v4_1_0_set_isp_funcs(isp);
+             r = isp_v4_1_0_set_isp_funcs(isp);
               break;
       case IP_VERSION(4, 1, 1):
-             isp_v4_1_1_set_isp_funcs(isp);
+             r = isp_v4_1_1_set_isp_funcs(isp);
               break;
       default:
               return -EINVAL;
       }
 
-     isp->adev = adev;
-     isp->parent = adev->dev;
-
-     if (isp_load_fw_by_psp(adev)) {
-             DRM_DEBUG_DRIVER("%s: isp fw load failed\n", __func__);
-             return -ENOENT;
-     }
-
-     return 0;
+     return r;
   }
 
   static bool isp_is_idle(struct amdgpu_ip_block *ip_block) diff --git

a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h
index d6f4ffa4c97c..36750123ed46 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h +2 -0
@@ -57,4 +57,6 @@ struct amdgpu_isp {
   extern const struct amdgpu_ip_block_version isp_v4_1_0_ip_block;
   extern const struct amdgpu_ip_block_version isp_v4_1_1_ip_block;
 
+int isp_load_fw_by_psp(struct amdgpu_device *adev);
+
   #endif /* __AMDGPU_ISP_H__ */
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c +11 -1
index 0027a639c7e6..926947a612a4 100644
@@ -185,7 +185,17 @@ static const struct isp_funcs isp_v4_1_0_funcs = {
       .hw_fini = isp_v4_1_0_hw_fini,
   };
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
   {
+     struct amdgpu_device *adev = isp->adev;
+
       isp->funcs = &isp_v4_1_0_funcs;
+
+     /* load isp firmware */
+     if (isp_load_fw_by_psp(adev)) {
+             drm_err(&adev->ddev, "isp fw load failed\n");
+             return -ENOENT;
+     }
+
+     return 0;
   }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h +1 -1
index 4d239198edd0..5e43ba064708 100644
@@ -45,6 +45,6 @@
   #define ISP410_GPIO_SENSOR_OFFSET 0x6613C
   #define ISP410_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
 
   #endif
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c +11 -1
index a887df520414..9766c6056dc4 100644
@@ -369,7 +369,17 @@ static const struct isp_funcs isp_v4_1_1_funcs = {
       .hw_fini = isp_v4_1_1_hw_fini,
   };
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
   {
+     struct amdgpu_device *adev = isp->adev;
+
       isp->funcs = &isp_v4_1_1_funcs;
+
+     /* load isp firmware */
+     if (isp_load_fw_by_psp(adev)) {
+             drm_err(&adev->ddev, "isp fw load failed\n");
+             return -ENOENT;
+     }
+
+     return 0;
   }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h +1 -1
index fe45d70d87f1..b221d8b81983 100644
@@ -44,6 +44,6 @@
   #define ISP411_GPIO_SENSOR_OFFSET 0x6613C
   #define ISP411_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
 
   #endif
#5 lore raw

Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Quoted 11 lines · Mario
Quoted 9 lines · Pratap

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Wednesday, September 3, 2025 4:40 PM
To: Nirujogi, Pratap <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Limonciello, Mario <[email protected]>
Cc: Chan, Benjamin (Koon Pan) <[email protected]>; Du, Bin <[email protected]>; Rosikopulos, Gjorgji <[email protected]>; Li, King <[email protected]>; Antony, Dominic <[email protected]>; Jawich, Phil <[email protected]>; [email protected]
Subject: Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Quoted 8 lines
Quoted 8 lines · Pratap
Quoted 2 lines

Move isp firmware load from generic amdgpu_isp driver to isp version specific driver modules isp_v4_1_0 and isp_v4_1_1.

I don't really understand why to do this change. Isn't it just more code duplication with this patch?

Hi Mario, I have added this to show the reference of calling the fw load in the same file where MODULE_FIRMWARE is added. This aligns with the approach followed in other drivers (amdgpu_vcn, gfx_v11_0 etc.).

I think it depends a bit on the individual IP. VCN has all of the firmware handling in a common helper because it's common for all VCN versions. Each GFX IP has has its own firmware handling because there are IP specific handlings required. I think it's fine to keep the ISP firwmare handling in once place unless you feel it would make sense to have it per IP version for some reason going forward.

Alex

Quoted 166 lines

I guess I don't see a strong argument for doing it, but let's see what others think.

Quoted 161 lines

Thanks,
Pratap

Quoted 157 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 22 +++++++++-------------
   drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h |  2 ++
   drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c | 12 +++++++++++-
   drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h |  2 +-
   drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c | 12 +++++++++++-
   drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h |  2 +-
   6 files changed, 35 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +2 -2
index 9cddbf50442a..90af35ee8f6e 100644
@@ -68,7 +68,7 @@ static int isp_hw_fini(struct amdgpu_ip_block *ip_block)
       return -ENODEV;
   }
 
-static int isp_load_fw_by_psp(struct amdgpu_device *adev)
+int isp_load_fw_by_psp(struct amdgpu_device *adev)
   {
       const struct common_firmware_header *hdr;
       char ucode_prefix[10];
@@ -80,7 +80,7 @@ static int isp_load_fw_by_psp(struct amdgpu_device
 *adev)
 
       /* read isp fw */
       r = amdgpu_ucode_request(adev, &adev->isp.fw, AMDGPU_UCODE_OPTIONAL,
-                             "amdgpu/%s.bin", ucode_prefix);
+                              "amdgpu/%s.bin", ucode_prefix);
       if (r) {
               amdgpu_ucode_release(&adev->isp.fw);
               return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +7 -11
@@ -103,27 +103,23 @@ static int isp_early_init(struct amdgpu_ip_block
 *ip_block)
 
       struct amdgpu_device *adev = ip_block->adev;
       struct amdgpu_isp *isp = &adev->isp;
+     int r;
+
+     isp->adev = adev;
+     isp->parent = adev->dev;
 
       switch (amdgpu_ip_version(adev, ISP_HWIP, 0)) {
       case IP_VERSION(4, 1, 0):
-             isp_v4_1_0_set_isp_funcs(isp);
+             r = isp_v4_1_0_set_isp_funcs(isp);
               break;
       case IP_VERSION(4, 1, 1):
-             isp_v4_1_1_set_isp_funcs(isp);
+             r = isp_v4_1_1_set_isp_funcs(isp);
               break;
       default:
               return -EINVAL;
       }
 
-     isp->adev = adev;
-     isp->parent = adev->dev;
-
-     if (isp_load_fw_by_psp(adev)) {
-             DRM_DEBUG_DRIVER("%s: isp fw load failed\n", __func__);
-             return -ENOENT;
-     }
-
-     return 0;
+     return r;
   }
 
   static bool isp_is_idle(struct amdgpu_ip_block *ip_block) diff --git

a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h
index d6f4ffa4c97c..36750123ed46 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h +2 -0
@@ -57,4 +57,6 @@ struct amdgpu_isp {
   extern const struct amdgpu_ip_block_version isp_v4_1_0_ip_block;
   extern const struct amdgpu_ip_block_version isp_v4_1_1_ip_block;
 
+int isp_load_fw_by_psp(struct amdgpu_device *adev);
+
   #endif /* __AMDGPU_ISP_H__ */
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c +11 -1
index 0027a639c7e6..926947a612a4 100644
@@ -185,7 +185,17 @@ static const struct isp_funcs isp_v4_1_0_funcs = {
       .hw_fini = isp_v4_1_0_hw_fini,
   };
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
   {
+     struct amdgpu_device *adev = isp->adev;
+
       isp->funcs = &isp_v4_1_0_funcs;
+
+     /* load isp firmware */
+     if (isp_load_fw_by_psp(adev)) {
+             drm_err(&adev->ddev, "isp fw load failed\n");
+             return -ENOENT;
+     }
+
+     return 0;
   }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h +1 -1
index 4d239198edd0..5e43ba064708 100644
@@ -45,6 +45,6 @@
   #define ISP410_GPIO_SENSOR_OFFSET 0x6613C
   #define ISP410_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
 
   #endif
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c +11 -1
index a887df520414..9766c6056dc4 100644
@@ -369,7 +369,17 @@ static const struct isp_funcs isp_v4_1_1_funcs = {
       .hw_fini = isp_v4_1_1_hw_fini,
   };
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
   {
+     struct amdgpu_device *adev = isp->adev;
+
       isp->funcs = &isp_v4_1_1_funcs;
+
+     /* load isp firmware */
+     if (isp_load_fw_by_psp(adev)) {
+             drm_err(&adev->ddev, "isp fw load failed\n");
+             return -ENOENT;
+     }
+
+     return 0;
   }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h +1 -1
index fe45d70d87f1..b221d8b81983 100644
@@ -44,6 +44,6 @@
   #define ISP411_GPIO_SENSOR_OFFSET 0x6613C
   #define ISP411_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
 
   #endif
#6 lore raw

RE: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, September 4, 2025 9:41 AM
To: Limonciello, Mario <[email protected]>
Cc: Nirujogi, Pratap <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Chan, Benjamin (Koon Pan) <[email protected]>; Du, Bin <[email protected]>; Rosikopulos, Gjorgji <[email protected]>; Li, King <[email protected]>; Antony, Dominic <[email protected]>; Jawich, Phil <[email protected]>; [email protected]
Subject: Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Quoted 20 lines · Mario
Quoted 18 lines · Pratap

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Wednesday, September 3, 2025 4:40 PM
To: Nirujogi, Pratap <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Limonciello, Mario <[email protected]>
Cc: Chan, Benjamin (Koon Pan) <[email protected]>; Du, Bin <[email protected]>; Rosikopulos, Gjorgji <[email protected]>; Li, King <[email protected]>; Antony, Dominic <[email protected]>; Jawich, Phil <[email protected]>; [email protected]
Subject: Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Quoted 8 lines
Quoted 8 lines · Pratap
Quoted 2 lines

Move isp firmware load from generic amdgpu_isp driver to isp version specific driver modules isp_v4_1_0 and isp_v4_1_1.

I don't really understand why to do this change. Isn't it just more code duplication with this patch?

Hi Mario, I have added this to show the reference of calling the fw load in the same file where MODULE_FIRMWARE is added. This aligns with the approach followed in other drivers (amdgpu_vcn, gfx_v11_0 etc.).

I think it depends a bit on the individual IP. VCN has all of the firmware handling in a common helper because it's common for all VCN versions. Each GFX IP has has its own firmware handling because there are IP specific handlings required. I think it's fine to keep the ISP firwmare handling in once place unless you feel it would make sense to have it per IP version for some reason going forward.

Hi Alex, thanks for your feedback. I see amdgpu_isp implementation is closely related amdgpu_vcn and I'm fine moving the declaration of all ISP firmware files to amdgpu_isp file instead of keeping them in IP specific source files. If this approach is acceptable, I’ll submit a new patch that adds MODULE_FIRMWARE in amdgpu_isp and reverts all other changes introduced in v2.

Thanks,
Pratap

Alex

Quoted 168 lines

I guess I don't see a strong argument for doing it, but let's see what others think.

Quoted 163 lines

Thanks,
Pratap

Quoted 159 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 22 +++++++++-------------
   drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h |  2 ++
   drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c | 12 +++++++++++-
   drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h |  2 +-
   drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c | 12 +++++++++++-
   drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h |  2 +-
   6 files changed, 35 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +1 -1
index 9cddbf50442a..90af35ee8f6e 100644
@@ -68,7 +68,7 @@ static int isp_hw_fini(struct amdgpu_ip_block *ip_block)
       return -ENODEV;
   }
 
-static int isp_load_fw_by_psp(struct amdgpu_device *adev)
+int isp_load_fw_by_psp(struct amdgpu_device *adev)
   {
       const struct common_firmware_header *hdr;
       char ucode_prefix[10];
@@ -80,7 +80,7 @@ static int isp_load_fw_by_psp(struct

amdgpu_device
*adev)

       /* read isp fw */
       r = amdgpu_ucode_request(adev, &adev->isp.fw, AMDGPU_UCODE_OPTIONAL,
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +1 -1
-                             "amdgpu/%s.bin", ucode_prefix);
+                              "amdgpu/%s.bin", ucode_prefix);
       if (r) {
               amdgpu_ucode_release(&adev->isp.fw);
               return r;
@@ -103,27 +103,23 @@ static int isp_early_init(struct

amdgpu_ip_block
*ip_block)

       struct amdgpu_device *adev = ip_block->adev;
       struct amdgpu_isp *isp = &adev->isp;
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +7 -12
+     int r;
+
+     isp->adev = adev;
+     isp->parent = adev->dev;
 
       switch (amdgpu_ip_version(adev, ISP_HWIP, 0)) {
       case IP_VERSION(4, 1, 0):
-             isp_v4_1_0_set_isp_funcs(isp);
+             r = isp_v4_1_0_set_isp_funcs(isp);
               break;
       case IP_VERSION(4, 1, 1):
-             isp_v4_1_1_set_isp_funcs(isp);
+             r = isp_v4_1_1_set_isp_funcs(isp);
               break;
       default:
               return -EINVAL;
       }
 
-     isp->adev = adev;
-     isp->parent = adev->dev;
-
-     if (isp_load_fw_by_psp(adev)) {
-             DRM_DEBUG_DRIVER("%s: isp fw load failed\n", __func__);
-             return -ENOENT;
-     }
-
-     return 0;
+     return r;
   }
 
   static bool isp_is_idle(struct amdgpu_ip_block *ip_block) diff
--git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h

b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h
index d6f4ffa4c97c..36750123ed46 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h +2 -0
@@ -57,4 +57,6 @@ struct amdgpu_isp {
   extern const struct amdgpu_ip_block_version isp_v4_1_0_ip_block;
   extern const struct amdgpu_ip_block_version isp_v4_1_1_ip_block;
 
+int isp_load_fw_by_psp(struct amdgpu_device *adev);
+
   #endif /* __AMDGPU_ISP_H__ */
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c +11 -1
index 0027a639c7e6..926947a612a4 100644
@@ -185,7 +185,17 @@ static const struct isp_funcs isp_v4_1_0_funcs = {
       .hw_fini = isp_v4_1_0_hw_fini,
   };
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
   {
+     struct amdgpu_device *adev = isp->adev;
+
       isp->funcs = &isp_v4_1_0_funcs;
+
+     /* load isp firmware */
+     if (isp_load_fw_by_psp(adev)) {
+             drm_err(&adev->ddev, "isp fw load failed\n");
+             return -ENOENT;
+     }
+
+     return 0;
   }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h +1 -1
index 4d239198edd0..5e43ba064708 100644
@@ -45,6 +45,6 @@
   #define ISP410_GPIO_SENSOR_OFFSET 0x6613C
   #define ISP410_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
 
   #endif
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c +11 -1
index a887df520414..9766c6056dc4 100644
@@ -369,7 +369,17 @@ static const struct isp_funcs isp_v4_1_1_funcs = {
       .hw_fini = isp_v4_1_1_hw_fini,
   };
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
   {
+     struct amdgpu_device *adev = isp->adev;
+
       isp->funcs = &isp_v4_1_1_funcs;
+
+     /* load isp firmware */
+     if (isp_load_fw_by_psp(adev)) {
+             drm_err(&adev->ddev, "isp fw load failed\n");
+             return -ENOENT;
+     }
+
+     return 0;
   }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h +1 -1
index fe45d70d87f1..b221d8b81983 100644
@@ -44,6 +44,6 @@
   #define ISP411_GPIO_SENSOR_OFFSET 0x6613C
   #define ISP411_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
 
   #endif
#7 lore raw

Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Quoted 37 lines · Pratap

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, September 4, 2025 9:41 AM
To: Limonciello, Mario <[email protected]>
Cc: Nirujogi, Pratap <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Chan, Benjamin (Koon Pan) <[email protected]>; Du, Bin <[email protected]>; Rosikopulos, Gjorgji <[email protected]>; Li, King <[email protected]>; Antony, Dominic <[email protected]>; Jawich, Phil <[email protected]>; [email protected]
Subject: Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Quoted 24 lines · Mario
Quoted 22 lines · Pratap

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Wednesday, September 3, 2025 4:40 PM
To: Nirujogi, Pratap <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Limonciello, Mario <[email protected]>
Cc: Chan, Benjamin (Koon Pan) <[email protected]>; Du, Bin <[email protected]>; Rosikopulos, Gjorgji <[email protected]>; Li, King <[email protected]>; Antony, Dominic <[email protected]>; Jawich, Phil <[email protected]>; [email protected]
Subject: Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Quoted 2 lines · Pratap

Move isp firmware load from generic amdgpu_isp driver to isp version specific driver modules isp_v4_1_0 and isp_v4_1_1.

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

I don't really understand why to do this change. Isn't it just more code duplication with this patch?

Hi Mario, I have added this to show the reference of calling the fw load in the same file where MODULE_FIRMWARE is added. This aligns with the approach followed in other drivers (amdgpu_vcn, gfx_v11_0 etc.).

I think it depends a bit on the individual IP. VCN has all of the firmware handling in a common helper because it's common for all VCN versions. Each GFX IP has has its own firmware handling because there are IP specific handlings required. I think it's fine to keep the ISP firwmare handling in once place unless you feel it would make sense to have it per IP version for some reason going forward.

Hi Alex, thanks for your feedback. I see amdgpu_isp implementation is closely related amdgpu_vcn and I'm fine moving the declaration of all ISP firmware files to amdgpu_isp file instead of keeping them in IP specific source files. If this approach is acceptable, I’ll submit a new patch that adds MODULE_FIRMWARE in amdgpu_isp and reverts all other changes introduced in v2.

IMO - the MODULE_FIRMWARE() macro location doesn't really matter. All the files link together and the macro is used to put the information on the module itself. That is you could just have your v2 2/2 patch and things should be fine.

It feels more logical to me to put it in the IP specific version, but totally up to you.

Quoted 174 lines

Thanks,
Pratap

Alex

Quoted 168 lines

I guess I don't see a strong argument for doing it, but let's see what others think.

Quoted 163 lines

Thanks,
Pratap

Quoted 159 lines
---
    drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 22 +++++++++-------------
    drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h |  2 ++
    drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c | 12 +++++++++++-
    drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h |  2 +-
    drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c | 12 +++++++++++-
    drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h |  2 +-
    6 files changed, 35 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +1 -1
index 9cddbf50442a..90af35ee8f6e 100644
@@ -68,7 +68,7 @@ static int isp_hw_fini(struct amdgpu_ip_block *ip_block)
        return -ENODEV;
    }
 
-static int isp_load_fw_by_psp(struct amdgpu_device *adev)
+int isp_load_fw_by_psp(struct amdgpu_device *adev)
    {
        const struct common_firmware_header *hdr;
        char ucode_prefix[10];
@@ -80,7 +80,7 @@ static int isp_load_fw_by_psp(struct

amdgpu_device
*adev)

        /* read isp fw */
        r = amdgpu_ucode_request(adev, &adev->isp.fw, AMDGPU_UCODE_OPTIONAL,
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +1 -1
-                             "amdgpu/%s.bin", ucode_prefix);
+                              "amdgpu/%s.bin", ucode_prefix);
        if (r) {
                amdgpu_ucode_release(&adev->isp.fw);
                return r;
@@ -103,27 +103,23 @@ static int isp_early_init(struct

amdgpu_ip_block
*ip_block)

        struct amdgpu_device *adev = ip_block->adev;
        struct amdgpu_isp *isp = &adev->isp;
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +7 -12
+     int r;
+
+     isp->adev = adev;
+     isp->parent = adev->dev;
 
        switch (amdgpu_ip_version(adev, ISP_HWIP, 0)) {
        case IP_VERSION(4, 1, 0):
-             isp_v4_1_0_set_isp_funcs(isp);
+             r = isp_v4_1_0_set_isp_funcs(isp);
                break;
        case IP_VERSION(4, 1, 1):
-             isp_v4_1_1_set_isp_funcs(isp);
+             r = isp_v4_1_1_set_isp_funcs(isp);
                break;
        default:
                return -EINVAL;
        }
 
-     isp->adev = adev;
-     isp->parent = adev->dev;
-
-     if (isp_load_fw_by_psp(adev)) {
-             DRM_DEBUG_DRIVER("%s: isp fw load failed\n", __func__);
-             return -ENOENT;
-     }
-
-     return 0;
+     return r;
    }
 
    static bool isp_is_idle(struct amdgpu_ip_block *ip_block) diff
--git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h

b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h
index d6f4ffa4c97c..36750123ed46 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h +2 -0
@@ -57,4 +57,6 @@ struct amdgpu_isp {
    extern const struct amdgpu_ip_block_version isp_v4_1_0_ip_block;
    extern const struct amdgpu_ip_block_version isp_v4_1_1_ip_block;
 
+int isp_load_fw_by_psp(struct amdgpu_device *adev);
+
    #endif /* __AMDGPU_ISP_H__ */
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c +11 -1
index 0027a639c7e6..926947a612a4 100644
@@ -185,7 +185,17 @@ static const struct isp_funcs isp_v4_1_0_funcs = {
        .hw_fini = isp_v4_1_0_hw_fini,
    };
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
    {
+     struct amdgpu_device *adev = isp->adev;
+
        isp->funcs = &isp_v4_1_0_funcs;
+
+     /* load isp firmware */
+     if (isp_load_fw_by_psp(adev)) {
+             drm_err(&adev->ddev, "isp fw load failed\n");
+             return -ENOENT;
+     }
+
+     return 0;
    }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h +1 -1
index 4d239198edd0..5e43ba064708 100644
@@ -45,6 +45,6 @@
    #define ISP410_GPIO_SENSOR_OFFSET 0x6613C
    #define ISP410_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
 
    #endif
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c +11 -1
index a887df520414..9766c6056dc4 100644
@@ -369,7 +369,17 @@ static const struct isp_funcs isp_v4_1_1_funcs = {
        .hw_fini = isp_v4_1_1_hw_fini,
    };
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
    {
+     struct amdgpu_device *adev = isp->adev;
+
        isp->funcs = &isp_v4_1_1_funcs;
+
+     /* load isp firmware */
+     if (isp_load_fw_by_psp(adev)) {
+             drm_err(&adev->ddev, "isp fw load failed\n");
+             return -ENOENT;
+     }
+
+     return 0;
    }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h +1 -1
index fe45d70d87f1..b221d8b81983 100644
@@ -44,6 +44,6 @@
    #define ISP411_GPIO_SENSOR_OFFSET 0x6613C
    #define ISP411_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
 
    #endif
#8 lore raw

RE: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Thursday, September 4, 2025 12:40 PM
To: Nirujogi, Pratap <[email protected]>; Alex Deucher <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Chan, Benjamin (Koon Pan) <[email protected]>; Du, Bin <[email protected]>; Rosikopulos, Gjorgji <[email protected]>; Li, King <[email protected]>; Antony, Dominic <[email protected]>; Jawich, Phil <[email protected]>; [email protected]
Subject: Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Quoted 45 lines · Pratap

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Thursday, September 4, 2025 9:41 AM
To: Limonciello, Mario <[email protected]>
Cc: Nirujogi, Pratap <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Chan, Benjamin (Koon Pan) <[email protected]>; Du, Bin <[email protected]>; Rosikopulos, Gjorgji <[email protected]>; Li, King <[email protected]>; Antony, Dominic <[email protected]>; Jawich, Phil <[email protected]>; [email protected]
Subject: Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Quoted 24 lines · Mario
Quoted 22 lines · Pratap

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Limonciello, Mario <[email protected]>
Sent: Wednesday, September 3, 2025 4:40 PM
To: Nirujogi, Pratap <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Limonciello, Mario <[email protected]>
Cc: Chan, Benjamin (Koon Pan) <[email protected]>; Du, Bin <[email protected]>; Rosikopulos, Gjorgji <[email protected]>; Li, King <[email protected]>; Antony, Dominic <[email protected]>; Jawich, Phil <[email protected]>; [email protected]
Subject: Re: [PATCH v2 1/2] drm/amd/amdgpu: Move isp firmware load into isp_v4_1_x modules

Quoted 2 lines · Pratap

Move isp firmware load from generic amdgpu_isp driver to isp version specific driver modules isp_v4_1_0 and isp_v4_1_1.

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

I don't really understand why to do this change. Isn't it just more code duplication with this patch?

Hi Mario, I have added this to show the reference of calling the fw load in the same file where MODULE_FIRMWARE is added. This aligns with the approach followed in other drivers (amdgpu_vcn, gfx_v11_0 etc.).

I think it depends a bit on the individual IP. VCN has all of the firmware handling in a common helper because it's common for all VCN versions. Each GFX IP has has its own firmware handling because there are IP specific handlings required. I think it's fine to keep the ISP firwmare handling in once place unless you feel it would make sense to have it per IP version for some reason going forward.

Hi Alex, thanks for your feedback. I see amdgpu_isp implementation is closely related amdgpu_vcn and I'm fine moving the declaration of all ISP firmware files to amdgpu_isp file instead of keeping them in IP specific source files. If this approach is acceptable, I’ll submit a new patch that adds MODULE_FIRMWARE in amdgpu_isp and reverts all other changes introduced in v2.

IMO - the MODULE_FIRMWARE() macro location doesn't really matter. All the files link together and the macro is used to put the information on the module itself. That is you could just have your v2 2/2 patch and things should be fine.

It feels more logical to me to put it in the IP specific version, but totally up to you.

Thanks Mario. Yes I will be happy to proceed with v2 2/2 patch as well :) I will finalize and proceed with v2 2/2 if no other comments from others by EOD.

Quoted 175 lines

Thanks,
Pratap

Alex

Quoted 169 lines

I guess I don't see a strong argument for doing it, but let's see what others think.

Quoted 164 lines

Thanks,
Pratap

Quoted 160 lines
---
    drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 22 +++++++++-------------
    drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h |  2 ++
    drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c | 12 +++++++++++-
    drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h |  2 +-
    drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c | 12 +++++++++++-
    drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h |  2 +-
    6 files changed, 35 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +1 -1
index 9cddbf50442a..90af35ee8f6e 100644
@@ -68,7 +68,7 @@ static int isp_hw_fini(struct amdgpu_ip_block *ip_block)
        return -ENODEV;
    }
 
-static int isp_load_fw_by_psp(struct amdgpu_device *adev)
+int isp_load_fw_by_psp(struct amdgpu_device *adev)
    {
        const struct common_firmware_header *hdr;
        char ucode_prefix[10];
@@ -80,7 +80,7 @@ static int isp_load_fw_by_psp(struct

amdgpu_device
*adev)

        /* read isp fw */
        r = amdgpu_ucode_request(adev, &adev->isp.fw, AMDGPU_UCODE_OPTIONAL,
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +1 -1
-                             "amdgpu/%s.bin", ucode_prefix);
+                              "amdgpu/%s.bin", ucode_prefix);
        if (r) {
                amdgpu_ucode_release(&adev->isp.fw);
                return r;
@@ -103,27 +103,23 @@ static int isp_early_init(struct

amdgpu_ip_block
*ip_block)

        struct amdgpu_device *adev = ip_block->adev;
        struct amdgpu_isp *isp = &adev->isp;
drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c +7 -12
+     int r;
+
+     isp->adev = adev;
+     isp->parent = adev->dev;
 
        switch (amdgpu_ip_version(adev, ISP_HWIP, 0)) {
        case IP_VERSION(4, 1, 0):
-             isp_v4_1_0_set_isp_funcs(isp);
+             r = isp_v4_1_0_set_isp_funcs(isp);
                break;
        case IP_VERSION(4, 1, 1):
-             isp_v4_1_1_set_isp_funcs(isp);
+             r = isp_v4_1_1_set_isp_funcs(isp);
                break;
        default:
                return -EINVAL;
        }
 
-     isp->adev = adev;
-     isp->parent = adev->dev;
-
-     if (isp_load_fw_by_psp(adev)) {
-             DRM_DEBUG_DRIVER("%s: isp fw load failed\n", __func__);
-             return -ENOENT;
-     }
-
-     return 0;
+     return r;
    }
 
    static bool isp_is_idle(struct amdgpu_ip_block *ip_block) diff
--git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h

b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h
index d6f4ffa4c97c..36750123ed46 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h +2 -0
@@ -57,4 +57,6 @@ struct amdgpu_isp {
    extern const struct amdgpu_ip_block_version isp_v4_1_0_ip_block;
    extern const struct amdgpu_ip_block_version
 isp_v4_1_1_ip_block;
 
+int isp_load_fw_by_psp(struct amdgpu_device *adev);
+
    #endif /* __AMDGPU_ISP_H__ */
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.c +11 -1
index 0027a639c7e6..926947a612a4 100644
@@ -185,7 +185,17 @@ static const struct isp_funcs isp_v4_1_0_funcs = {
        .hw_fini = isp_v4_1_0_hw_fini,
    };
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp)
    {
+     struct amdgpu_device *adev = isp->adev;
+
        isp->funcs = &isp_v4_1_0_funcs;
+
+     /* load isp firmware */
+     if (isp_load_fw_by_psp(adev)) {
+             drm_err(&adev->ddev, "isp fw load failed\n");
+             return -ENOENT;
+     }
+
+     return 0;
    }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_0.h +1 -1
index 4d239198edd0..5e43ba064708 100644
@@ -45,6 +45,6 @@
    #define ISP410_GPIO_SENSOR_OFFSET 0x6613C
    #define ISP410_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_0_set_isp_funcs(struct amdgpu_isp *isp);
 
    #endif
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c +11 -1
index a887df520414..9766c6056dc4 100644
@@ -369,7 +369,17 @@ static const struct isp_funcs isp_v4_1_1_funcs = {
        .hw_fini = isp_v4_1_1_hw_fini,
    };
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp)
    {
+     struct amdgpu_device *adev = isp->adev;
+
        isp->funcs = &isp_v4_1_1_funcs;
+
+     /* load isp firmware */
+     if (isp_load_fw_by_psp(adev)) {
+             drm_err(&adev->ddev, "isp fw load failed\n");
+             return -ENOENT;
+     }
+
+     return 0;
    }
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.h +1 -1
index fe45d70d87f1..b221d8b81983 100644
@@ -44,6 +44,6 @@
    #define ISP411_GPIO_SENSOR_OFFSET 0x6613C
    #define ISP411_GPIO_SENSOR_SIZE 0x54
 
-void isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
+int isp_v4_1_1_set_isp_funcs(struct amdgpu_isp *isp);
 
    #endif
#9 lore raw

PATCH v2 2/2 drm/amd/amdgpu: Declare isp firmware binary file

In reply to Pratap Nirujogi

Declare isp firmware file isp_4_1_1.bin required by isp4.1.1 device.

---
 drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c +2 -0
index 9766c6056dc4..1e48d94e8706 100644
@@ -29,6 +29,8 @@
 #include "amdgpu.h"
 #include "isp_v4_1_1.h"
 
+MODULE_FIRMWARE("amdgpu/isp_4_1_1.bin");
+
 #define ISP_PERFORMANCE_STATE_LOW 0
 #define ISP_PERFORMANCE_STATE_HIGH 1
 
Signature · 1 line
2.43.0
Reviewed-by on v2 2/2
#10 lore raw

Re: [PATCH v2 2/2] drm/amd/amdgpu: Declare isp firmware binary file

Quoted 4 lines · Pratap Nirujogi

Declare isp firmware file isp_4_1_1.bin required by isp4.1.1 device.

Quoted 16 lines
  drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/isp_v4_1_1.c +2 -0
index 9766c6056dc4..1e48d94e8706 100644
@@ -29,6 +29,8 @@
  #include "amdgpu.h"
  #include "isp_v4_1_1.h"
 
+MODULE_FIRMWARE("amdgpu/isp_4_1_1.bin");
+
  #define ISP_PERFORMANCE_STATE_LOW 0
  #define ISP_PERFORMANCE_STATE_HIGH 1