From 607e954ac50ed39944db72874d80240aab15004f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 29 May 2020 09:56:05 +0200 Subject: [PATCH] media: atomisp: allow passing firmware name at modprobe time It can be useful to be able to test different firmware files at modprobe time, in order to be able to test different variants without much efforts. Signed-off-by: Mauro Carvalho Chehab --- .../staging/media/atomisp/pci/atomisp_v4l2.c | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c index 5294bb19497f..16e9d27869ca 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c @@ -95,6 +95,10 @@ int mipicsi_flag; module_param(mipicsi_flag, int, 0644); MODULE_PARM_DESC(mipicsi_flag, "mipi csi compression predictor algorithm"); +static char firmware_name[256]; +module_param_string(firmware_name, firmware_name, sizeof(firmware_name), 0); +MODULE_PARM_DESC(firmware_name, "Firmware file name. Allows overriding the default firmware name."); + /*set to 16x16 since this is the amount of lines and pixels the sensor exports extra. If these are kept at the 10x8 that they were on, in yuv downscaling modes incorrect resolutions where requested to the sensor @@ -1449,19 +1453,23 @@ atomisp_load_firmware(struct atomisp_device *isp) if (skip_fwload) return NULL; - if ((isp->media_dev.hw_revision >> ATOMISP_HW_REVISION_SHIFT) - == ATOMISP_HW_REVISION_ISP2401) - fw_path = "shisp_2401a0_v21.bin"; + if (firmware_name[0] != '\0') { + fw_path = firmware_name; + } else { + if ((isp->media_dev.hw_revision >> ATOMISP_HW_REVISION_SHIFT) + == ATOMISP_HW_REVISION_ISP2401) + fw_path = "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"; + 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"; - if (isp->media_dev.hw_revision == - ((ATOMISP_HW_REVISION_ISP2400 << ATOMISP_HW_REVISION_SHIFT) - | ATOMISP_HW_STEPPING_B0)) - fw_path = "shisp_2400b0_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"; + } if (!fw_path) { dev_err(isp->dev, "Unsupported hw_revision 0x%x\n",