return status;
}
+static const struct firmware *fw_efx;
+
+static int request_firmware_cached(const struct firmware **firmware_p,
+ const char *name, struct device *device)
+{
+ if (*firmware_p)
+ return 0; /* already loaded */
+ return request_firmware(firmware_p, name, device);
+}
+
+static void release_cached_firmware(void)
+{
+ if (fw_efx) {
+ release_firmware(fw_efx);
+ fw_efx = NULL;
+ }
+}
+
static bool dspload_is_loaded(struct hda_codec *codec)
{
unsigned int data = 0;
{
bool dsp_loaded = false;
const struct dsp_image_seg *dsp_os_image;
- const struct firmware *fw_entry;
- if (request_firmware(&fw_entry, EFX_FILE, codec->bus->card->dev) != 0)
+ if (request_firmware_cached(&fw_efx, EFX_FILE,
+ codec->bus->card->dev) != 0)
return false;
- dsp_os_image = (struct dsp_image_seg *)(fw_entry->data);
+ dsp_os_image = (struct dsp_image_seg *)(fw_efx->data);
dspload_image(codec, dsp_os_image, 0, 0, true, 0);
dsp_loaded = dspload_wait_loaded(codec);
- release_firmware(fw_entry);
-
-
return dsp_loaded;
}
static void __exit patch_ca0132_exit(void)
{
+ release_cached_firmware();
snd_hda_delete_codec_preset(&ca0132_list);
}