@@ -757,7 +757,7 @@ int atomisp_css_init(struct atomisp_device *isp)
return ret;
/* Init ISP */
- err = ia_css_init(isp->dev, &isp->css_env.isp_css_env, NULL,
+ err = ia_css_init(isp->dev, &isp->css_env.isp_css_env,
(uint32_t)mmu_base_addr, IA_CSS_IRQ_TYPE_PULSE);
if (err) {
dev_err(isp->dev, "css init failed --- bad firmware?\n");
@@ -55,10 +55,6 @@
/* G-Min addition: pull this in from intel_mid_pm.h */
#define CSTATE_EXIT_LATENCY_C1 1
-static uint skip_fwload;
-module_param(skip_fwload, uint, 0644);
-MODULE_PARM_DESC(skip_fwload, "Skip atomisp firmware load");
-
/* cross componnet debug message flag */
int dbg_level;
module_param(dbg_level, int, 0644);
@@ -1161,9 +1157,6 @@ atomisp_load_firmware(struct atomisp_device *isp)
int rc;
char *fw_path = NULL;
- if (skip_fwload)
- return NULL;
-
if (firmware_name[0] != '\0') {
fw_path = firmware_name;
} else {
@@ -1591,8 +1584,6 @@ static void atomisp_pci_remove(struct pci_dev *pdev)
atomisp_msi_irq_uninit(isp);
atomisp_unregister_entities(isp);
-
- release_firmware(isp->firmware);
}
static const struct pci_device_id atomisp_pci_tbl[] = {
@@ -30,39 +30,28 @@
* environment in which the CSS code runs. This is
* used for host side memory access and message
* printing. May not be NULL.
- * @param[in] fw Firmware package containing the firmware for all
- * predefined ISP binaries.
- * if fw is NULL the firmware must be loaded before
- * through a call of ia_css_load_firmware
* @param[in] l1_base Base index (isp2400)
* of the L1 page table. This is a physical
* address or index.
* @param[in] irq_type The type of interrupt to be used (edge or level)
- * @return Returns -EINVAL in case of any
+ * @return Returns -EINVAL in case of any
* errors and 0 otherwise.
*
* This function initializes the API which includes allocating and initializing
- * internal data structures. This also interprets the firmware package. All
- * contents of this firmware package are copied into local data structures, so
- * the fw pointer could be freed after this function completes.
+ * internal data structures.
+ * ia_css_load_firmware() must be called to load the firmware before calling
+ * this function.
*/
int ia_css_init(struct device *dev,
- const struct ia_css_env *env,
- const struct ia_css_fw *fw,
- u32 l1_base,
- enum ia_css_irq_type irq_type);
+ const struct ia_css_env *env,
+ u32 l1_base,
+ enum ia_css_irq_type irq_type);
/* @brief Un-initialize the CSS API.
* @return None
*
- * This function deallocates all memory that has been allocated by the CSS API
- * Exception: if you explicitly loaded firmware through ia_css_load_firmware
- * you need to call ia_css_unload_firmware to deallocate the memory reserved
- * for the firmware.
- * After this function is called, no other CSS functions should be called
- * with the exception of ia_css_init which will re-initialize the CSS code,
- * ia_css_unload_firmware to unload the firmware or ia_css_load_firmware
- * to load new firmware
+ * This function deallocates all memory that has been allocated by the CSS API.
+ * After this function is called, no other CSS functions should be called.
*/
void
ia_css_uninit(void);
@@ -46,10 +46,6 @@ struct device;
* This function interprets the firmware package. All
* contents of this firmware package are copied into local data structures, so
* the fw pointer could be freed after this function completes.
- *
- * Rationale for this function is that it can be called before ia_css_init, and thus
- * speeds up ia_css_init (ia_css_init is called each time a stream is created but the
- * firmware only needs to be loaded once).
*/
int
ia_css_load_firmware(struct device *dev, const struct ia_css_env *env,
@@ -61,6 +57,8 @@ ia_css_load_firmware(struct device *dev, const struct ia_css_env *env,
* This function unloads the firmware loaded by ia_css_load_firmware.
* It is pointless to call this function if no firmware is loaded,
* but it won't harm. Use this to deallocate all memory associated with the firmware.
+ * This function may only be called when the CSS API is in uninitialized state
+ * (e.g. after calling ia_css_uninit()).
*/
void
ia_css_unload_firmware(void);
@@ -174,8 +174,6 @@ static struct sh_css_hmm_buffer_record hmm_buffer_record[MAX_HMM_BUFFER_NUM];
#define GPIO_FLASH_PIN_MASK BIT(HIVE_GPIO_STROBE_TRIGGER_PIN)
-static bool fw_explicitly_loaded;
-
/*
* Local prototypes
*/
@@ -1360,7 +1358,6 @@ ia_css_unload_firmware(void)
ia_css_binary_uninit();
sh_css_unload_firmware();
}
- fw_explicitly_loaded = false;
}
static void
@@ -1405,13 +1402,9 @@ ia_css_load_firmware(struct device *dev, const struct ia_css_env *env,
my_css.flush = env->cpu_mem_env.flush;
}
- ia_css_unload_firmware(); /* in case we are called twice */
err = sh_css_load_firmware(dev, fw->data, fw->bytes);
- if (!err) {
+ if (!err)
err = ia_css_binary_init_infos();
- if (!err)
- fw_explicitly_loaded = true;
- }
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_load_firmware() leave\n");
return err;
@@ -1419,9 +1412,7 @@ ia_css_load_firmware(struct device *dev, const struct ia_css_env *env,
int
ia_css_init(struct device *dev, const struct ia_css_env *env,
- const struct ia_css_fw *fw,
- u32 mmu_l1_base,
- enum ia_css_irq_type irq_type)
+ u32 mmu_l1_base, enum ia_css_irq_type irq_type)
{
int err;
ia_css_spctrl_cfg spctrl_cfg;
@@ -1466,8 +1457,6 @@ ia_css_init(struct device *dev, const struct ia_css_env *env,
/* Check struct ia_css_init_dmem_cfg */
COMPILATION_ERROR_IF(sizeof(struct ia_css_sp_init_dmem_cfg) != SIZE_OF_IA_CSS_SP_INIT_DMEM_CFG_STRUCT);
- if (!fw && !fw_explicitly_loaded)
- return -EINVAL;
if (!env)
return -EINVAL;
@@ -1543,22 +1532,7 @@ ia_css_init(struct device *dev, const struct ia_css_env *env,
IA_CSS_LEAVE_ERR(err);
return err;
}
- if (fw) {
- ia_css_unload_firmware(); /* in case we already had firmware loaded */
- err = sh_css_load_firmware(dev, fw->data, fw->bytes);
- if (err) {
- IA_CSS_LEAVE_ERR(err);
- return err;
- }
- err = ia_css_binary_init_infos();
- if (err) {
- IA_CSS_LEAVE_ERR(err);
- return err;
- }
- fw_explicitly_loaded = false;
- my_css_save.loaded_fw = (struct ia_css_fw *)fw;
- }
if (!sh_css_setup_spctrl_config(&sh_css_sp_fw, SP_PROG_NAME, &spctrl_cfg))
return -EINVAL;
@@ -2163,9 +2137,6 @@ ia_css_uninit(void)
ifmtr_set_if_blocking_mode_reset = true;
}
- if (!fw_explicitly_loaded)
- ia_css_unload_firmware();
-
ia_css_spctrl_unload_fw(SP0_ID);
sh_css_sp_set_sp_running(false);
/* check and free any remaining mipi frames */
There is a bunch of dead code left from the deferred firmware loading support which was removed in commit 8972ed6ea7a0 ("media: atomisp: Remove deferred firmware loading support"). Remove this dead code: - Remove the skip_fwload module parameter - Remove the now always NULL fw argument from ia_css_init() - Remove the fw_explicitly_loaded boolean from sh_css.c (this was always true now) - Adjust some function kernel-doc comments to match Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- .../media/atomisp/pci/atomisp_compat_css20.c | 2 +- .../staging/media/atomisp/pci/atomisp_v4l2.c | 9 ----- .../media/atomisp/pci/ia_css_control.h | 29 +++++----------- .../media/atomisp/pci/ia_css_firmware.h | 6 ++-- drivers/staging/media/atomisp/pci/sh_css.c | 33 ++----------------- 5 files changed, 14 insertions(+), 65 deletions(-)