[3/5] media: atomisp: Prefix firmware paths with "intel/ipu/"

Message ID 20240603132057.255917-3-hdegoede@redhat.com (mailing list archive)
State New
Headers
Series [1/5] media: atomisp: Remove unused mipicsi_flag module parameter |

Commit Message

Hans de Goede June 3, 2024, 1:20 p.m. UTC
  The atomisp firmwares have been added to upstream linux-firmware
under intel/ipu/ add this prefix to the firmware name passed
to request_firmware().

Fall back to the old location if this fails to avoid breaking existing
setups.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
  

Comments

Andy Shevchenko June 3, 2024, 7:36 p.m. UTC | #1
On Mon, Jun 03, 2024 at 03:20:55PM +0200, Hans de Goede wrote:
> The atomisp firmwares have been added to upstream linux-firmware
> under intel/ipu/ add this prefix to the firmware name passed
> to request_firmware().
> 
> Fall back to the old location if this fails to avoid breaking existing
> setups.

...

> +	/* Fallback to old fw_path with "intel/ipu/" prefix */
> +	if (rc)
> +		rc = request_firmware(&fw, strrchr(fw_path, '/') + 1, isp->dev);

Perhaps kbasename() ?
  

Patch

diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index cfdfbf96c3fe..9d7f57d37b27 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -1099,17 +1099,17 @@  atomisp_load_firmware(struct atomisp_device *isp)
 
 	if ((isp->media_dev.hw_revision >> ATOMISP_HW_REVISION_SHIFT) ==
 	    ATOMISP_HW_REVISION_ISP2401)
-		fw_path = "shisp_2401a0_v21.bin";
+		fw_path = "intel/ipu/shisp_2401a0_v21.bin";
 
 	if (isp->media_dev.hw_revision ==
 	    ((ATOMISP_HW_REVISION_ISP2401_LEGACY << ATOMISP_HW_REVISION_SHIFT) |
 	     ATOMISP_HW_STEPPING_A0))
-		fw_path = "shisp_2401a0_legacy_v21.bin";
+		fw_path = "intel/ipu/shisp_2401a0_legacy_v21.bin";
 
 	if (isp->media_dev.hw_revision ==
 	    ((ATOMISP_HW_REVISION_ISP2400 << ATOMISP_HW_REVISION_SHIFT) |
 	     ATOMISP_HW_STEPPING_B0))
-		fw_path = "shisp_2400b0_v21.bin";
+		fw_path = "intel/ipu/shisp_2400b0_v21.bin";
 
 	if (!fw_path) {
 		dev_err(isp->dev, "Unsupported hw_revision 0x%x\n",
@@ -1118,6 +1118,9 @@  atomisp_load_firmware(struct atomisp_device *isp)
 	}
 
 	rc = request_firmware(&fw, fw_path, isp->dev);
+	/* Fallback to old fw_path with "intel/ipu/" prefix */
+	if (rc)
+		rc = request_firmware(&fw, strrchr(fw_path, '/') + 1, isp->dev);
 	if (rc) {
 		dev_err(isp->dev,
 			"atomisp: Error %d while requesting firmware %s\n",