Commit 8972ed6e authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: atomisp: Remove deferred firmware loading support

Make atomisp behave like any other drivers and have it load the firmware
at probe time (as it was already doing by default).

The deferred firmware loading support needlessly complicates the
v4l2_file_operations.open callback (atomisp_open()), getting in
the way of allowing multiple opens like a normal v4l2 device would.
Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent ebfa8f5e
...@@ -757,25 +757,6 @@ static int atomisp_open(struct file *file) ...@@ -757,25 +757,6 @@ static int atomisp_open(struct file *file)
mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
asd->subdev.devnode = vdev; asd->subdev.devnode = vdev;
/* Deferred firmware loading case. */
if (isp->css_env.isp_css_fw.bytes == 0) {
dev_err(isp->dev, "Deferred firmware load.\n");
isp->firmware = atomisp_load_firmware(isp);
if (!isp->firmware) {
dev_err(isp->dev, "Failed to load ISP firmware.\n");
ret = -ENOENT;
goto error;
}
ret = atomisp_css_load_firmware(isp);
if (ret) {
dev_err(isp->dev, "Failed to init css.\n");
goto error;
}
/* No need to keep FW in memory anymore. */
release_firmware(isp->firmware);
isp->firmware = NULL;
isp->css_env.isp_css_fw.data = NULL;
}
if (!isp->input_cnt) { if (!isp->input_cnt) {
dev_err(isp->dev, "no camera attached\n"); dev_err(isp->dev, "no camera attached\n");
...@@ -901,12 +882,6 @@ static int atomisp_release(struct file *file) ...@@ -901,12 +882,6 @@ static int atomisp_release(struct file *file)
atomisp_destroy_pipes_stream_force(asd); atomisp_destroy_pipes_stream_force(asd);
if (defer_fw_load) {
ia_css_unload_firmware();
isp->css_env.isp_css_fw.data = NULL;
isp->css_env.isp_css_fw.bytes = 0;
}
ret = v4l2_subdev_call(isp->flash, core, s_power, 0); ret = v4l2_subdev_call(isp->flash, core, s_power, 0);
if (ret < 0 && ret != -ENODEV && ret != -ENOIOCTLCMD) if (ret < 0 && ret != -ENODEV && ret != -ENOIOCTLCMD)
dev_warn(isp->dev, "Failed to power-off flash\n"); dev_warn(isp->dev, "Failed to power-off flash\n");
......
...@@ -33,6 +33,4 @@ int atomisp_qbuffers_to_css(struct atomisp_sub_device *asd); ...@@ -33,6 +33,4 @@ int atomisp_qbuffers_to_css(struct atomisp_sub_device *asd);
extern const struct v4l2_file_operations atomisp_fops; extern const struct v4l2_file_operations atomisp_fops;
extern bool defer_fw_load;
#endif /* __ATOMISP_FOPS_H__ */ #endif /* __ATOMISP_FOPS_H__ */
...@@ -58,12 +58,6 @@ static uint skip_fwload; ...@@ -58,12 +58,6 @@ static uint skip_fwload;
module_param(skip_fwload, uint, 0644); module_param(skip_fwload, uint, 0644);
MODULE_PARM_DESC(skip_fwload, "Skip atomisp firmware load"); MODULE_PARM_DESC(skip_fwload, "Skip atomisp firmware load");
/* memory optimization: deferred firmware loading */
bool defer_fw_load;
module_param(defer_fw_load, bool, 0644);
MODULE_PARM_DESC(defer_fw_load,
"Defer FW loading until device is opened (default:disable)");
/* cross componnet debug message flag */ /* cross componnet debug message flag */
int dbg_level; int dbg_level;
module_param(dbg_level, int, 0644); module_param(dbg_level, int, 0644);
...@@ -1514,21 +1508,17 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i ...@@ -1514,21 +1508,17 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
isp->max_isr_latency = ATOMISP_MAX_ISR_LATENCY; isp->max_isr_latency = ATOMISP_MAX_ISR_LATENCY;
/* Load isp firmware from user space */ /* Load isp firmware from user space */
if (!defer_fw_load) { isp->firmware = atomisp_load_firmware(isp);
isp->firmware = atomisp_load_firmware(isp); if (!isp->firmware) {
if (!isp->firmware) { err = -ENOENT;
err = -ENOENT; dev_dbg(&pdev->dev, "Firmware load failed\n");
dev_dbg(&pdev->dev, "Firmware load failed\n"); goto load_fw_fail;
goto load_fw_fail; }
}
err = sh_css_check_firmware_version(isp->dev, isp->firmware->data); err = sh_css_check_firmware_version(isp->dev, isp->firmware->data);
if (err) { if (err) {
dev_dbg(&pdev->dev, "Firmware version check failed\n"); dev_dbg(&pdev->dev, "Firmware version check failed\n");
goto fw_validation_fail; goto fw_validation_fail;
}
} else {
dev_info(&pdev->dev, "Firmware load will be deferred\n");
} }
pci_set_master(pdev); pci_set_master(pdev);
...@@ -1628,14 +1618,10 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i ...@@ -1628,14 +1618,10 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
} }
/* Load firmware into ISP memory */ /* Load firmware into ISP memory */
if (!defer_fw_load) { err = atomisp_css_load_firmware(isp);
err = atomisp_css_load_firmware(isp); if (err) {
if (err) { dev_err(&pdev->dev, "Failed to init css.\n");
dev_err(&pdev->dev, "Failed to init css.\n"); goto css_init_fail;
goto css_init_fail;
}
} else {
dev_dbg(&pdev->dev, "Skip css init.\n");
} }
/* Clear FW image from memory */ /* Clear FW image from memory */
release_firmware(isp->firmware); release_firmware(isp->firmware);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment