[ALSA] Don't use request_firmware if internal firmwares are defined
Don't use request_firmware() if the internal firmwares are defined via Kconfig. Otherwise it results in a significant delay at loading time (minutes). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
This commit is contained in:
parent
f223a9fc3d
commit
b7dd2b349a
|
@ -161,13 +161,17 @@ int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep)
|
||||||
*/
|
*/
|
||||||
static void snd_sb_csp_free(struct snd_hwdep *hwdep)
|
static void snd_sb_csp_free(struct snd_hwdep *hwdep)
|
||||||
{
|
{
|
||||||
|
#ifndef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL
|
||||||
int i;
|
int i;
|
||||||
|
#endif
|
||||||
struct snd_sb_csp *p = hwdep->private_data;
|
struct snd_sb_csp *p = hwdep->private_data;
|
||||||
if (p) {
|
if (p) {
|
||||||
if (p->running & SNDRV_SB_CSP_ST_RUNNING)
|
if (p->running & SNDRV_SB_CSP_ST_RUNNING)
|
||||||
snd_sb_csp_stop(p);
|
snd_sb_csp_stop(p);
|
||||||
|
#ifndef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL
|
||||||
for (i = 0; i < ARRAY_SIZE(p->csp_programs); ++i)
|
for (i = 0; i < ARRAY_SIZE(p->csp_programs); ++i)
|
||||||
release_firmware(p->csp_programs[i]);
|
release_firmware(p->csp_programs[i]);
|
||||||
|
#endif
|
||||||
kfree(p);
|
kfree(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -712,22 +716,19 @@ static int snd_sb_csp_firmware_load(struct snd_sb_csp *p, int index, int flags)
|
||||||
"sb16/ima_adpcm_capture.csp",
|
"sb16/ima_adpcm_capture.csp",
|
||||||
};
|
};
|
||||||
const struct firmware *program;
|
const struct firmware *program;
|
||||||
int err;
|
|
||||||
|
|
||||||
BUILD_BUG_ON(ARRAY_SIZE(names) != CSP_PROGRAM_COUNT);
|
BUILD_BUG_ON(ARRAY_SIZE(names) != CSP_PROGRAM_COUNT);
|
||||||
program = p->csp_programs[index];
|
program = p->csp_programs[index];
|
||||||
if (!program) {
|
if (!program) {
|
||||||
err = request_firmware(&program, names[index],
|
|
||||||
p->chip->card->dev);
|
|
||||||
if (err >= 0)
|
|
||||||
p->csp_programs[index] = program;
|
|
||||||
else {
|
|
||||||
#ifdef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL
|
#ifdef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL
|
||||||
program = &snd_sb_csp_static_programs[index];
|
program = &snd_sb_csp_static_programs[index];
|
||||||
#else
|
#else
|
||||||
|
int err = request_firmware(&program, names[index],
|
||||||
|
p->chip->card->dev);
|
||||||
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
#endif
|
#endif
|
||||||
}
|
p->csp_programs[index] = program;
|
||||||
}
|
}
|
||||||
return snd_sb_csp_load(p, program->data, program->size, flags);
|
return snd_sb_csp_load(p, program->data, program->size, flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,21 +256,21 @@ snd_wavefront_fx_start (snd_wavefront_t *dev)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int err;
|
int err;
|
||||||
const struct firmware *firmware;
|
const struct firmware *firmware = NULL;
|
||||||
|
|
||||||
if (dev->fx_initialized)
|
if (dev->fx_initialized)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
#ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL
|
||||||
|
firmware = &yss225_registers_firmware;
|
||||||
|
#else
|
||||||
err = request_firmware(&firmware, "yamaha/yss225_registers.bin",
|
err = request_firmware(&firmware, "yamaha/yss225_registers.bin",
|
||||||
dev->card->dev);
|
dev->card->dev);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
#ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL
|
|
||||||
firmware = &yss225_registers_firmware;
|
|
||||||
#else
|
|
||||||
err = -1;
|
err = -1;
|
||||||
goto out;
|
goto out;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i + 1 < firmware->size; i += 2) {
|
for (i = 0; i + 1 < firmware->size; i += 2) {
|
||||||
if (firmware->data[i] >= 8 && firmware->data[i] < 16) {
|
if (firmware->data[i] >= 8 && firmware->data[i] < 16) {
|
||||||
|
@ -293,9 +293,8 @@ snd_wavefront_fx_start (snd_wavefront_t *dev)
|
||||||
err = 0;
|
err = 0;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
#ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL
|
#ifndef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL
|
||||||
if (firmware != &yss225_registers_firmware)
|
release_firmware(firmware);
|
||||||
#endif
|
#endif
|
||||||
release_firmware(firmware);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2340,26 +2340,25 @@ static int __devinit snd_korg1212_create(struct snd_card *card, struct pci_dev *
|
||||||
korg1212->AdatTimeCodePhy = korg1212->sharedBufferPhy +
|
korg1212->AdatTimeCodePhy = korg1212->sharedBufferPhy +
|
||||||
offsetof(struct KorgSharedBuffer, AdatTimeCode);
|
offsetof(struct KorgSharedBuffer, AdatTimeCode);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL
|
||||||
|
dsp_code = &static_dsp_code;
|
||||||
|
#else
|
||||||
err = request_firmware(&dsp_code, "korg/k1212.dsp", &pci->dev);
|
err = request_firmware(&dsp_code, "korg/k1212.dsp", &pci->dev);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
release_firmware(dsp_code);
|
release_firmware(dsp_code);
|
||||||
#ifdef CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL
|
|
||||||
dsp_code = &static_dsp_code;
|
|
||||||
#else
|
|
||||||
snd_printk(KERN_ERR "firmware not available\n");
|
snd_printk(KERN_ERR "firmware not available\n");
|
||||||
snd_korg1212_free(korg1212);
|
snd_korg1212_free(korg1212);
|
||||||
return err;
|
return err;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
|
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
|
||||||
dsp_code->size, &korg1212->dma_dsp) < 0) {
|
dsp_code->size, &korg1212->dma_dsp) < 0) {
|
||||||
snd_printk(KERN_ERR "korg1212: cannot allocate dsp code memory (%zd bytes)\n", dsp_code->size);
|
snd_printk(KERN_ERR "korg1212: cannot allocate dsp code memory (%zd bytes)\n", dsp_code->size);
|
||||||
snd_korg1212_free(korg1212);
|
snd_korg1212_free(korg1212);
|
||||||
#ifdef CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL
|
#ifndef CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL
|
||||||
if (dsp_code != &static_dsp_code)
|
release_firmware(dsp_code);
|
||||||
#endif
|
#endif
|
||||||
release_firmware(dsp_code);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2369,10 +2368,9 @@ static int __devinit snd_korg1212_create(struct snd_card *card, struct pci_dev *
|
||||||
|
|
||||||
memcpy(korg1212->dma_dsp.area, dsp_code->data, dsp_code->size);
|
memcpy(korg1212->dma_dsp.area, dsp_code->data, dsp_code->size);
|
||||||
|
|
||||||
#ifdef CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL
|
#ifndef CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL
|
||||||
if (dsp_code != &static_dsp_code)
|
release_firmware(dsp_code);
|
||||||
#endif
|
#endif
|
||||||
release_firmware(dsp_code);
|
|
||||||
|
|
||||||
rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_RebootCard, 0, 0, 0, 0);
|
rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_RebootCard, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
|
|
@ -2240,7 +2240,7 @@ static const struct firmware assp_minisrc = {
|
||||||
.size = sizeof assp_minisrc_image
|
.size = sizeof assp_minisrc_image
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL */
|
#else /* CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL */
|
||||||
|
|
||||||
#ifdef __LITTLE_ENDIAN
|
#ifdef __LITTLE_ENDIAN
|
||||||
static inline void snd_m3_convert_from_le(const struct firmware *fw) { }
|
static inline void snd_m3_convert_from_le(const struct firmware *fw) { }
|
||||||
|
@ -2255,6 +2255,8 @@ static void snd_m3_convert_from_le(const struct firmware *fw)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize ASSP
|
* initialize ASSP
|
||||||
|
@ -2548,14 +2550,10 @@ static int snd_m3_free(struct snd_m3 *chip)
|
||||||
if (chip->iobase)
|
if (chip->iobase)
|
||||||
pci_release_regions(chip->pci);
|
pci_release_regions(chip->pci);
|
||||||
|
|
||||||
#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
|
#ifndef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
|
||||||
if (chip->assp_kernel_image != &assp_kernel)
|
release_firmware(chip->assp_kernel_image);
|
||||||
|
release_firmware(chip->assp_minisrc_image);
|
||||||
#endif
|
#endif
|
||||||
release_firmware(chip->assp_kernel_image);
|
|
||||||
#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
|
|
||||||
if (chip->assp_minisrc_image != &assp_minisrc)
|
|
||||||
#endif
|
|
||||||
release_firmware(chip->assp_minisrc_image);
|
|
||||||
|
|
||||||
pci_disable_device(chip->pci);
|
pci_disable_device(chip->pci);
|
||||||
kfree(chip);
|
kfree(chip);
|
||||||
|
@ -2745,29 +2743,29 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
|
||||||
|
chip->assp_kernel_image = &assp_kernel;
|
||||||
|
#else
|
||||||
err = request_firmware(&chip->assp_kernel_image,
|
err = request_firmware(&chip->assp_kernel_image,
|
||||||
"ess/maestro3_assp_kernel.fw", &pci->dev);
|
"ess/maestro3_assp_kernel.fw", &pci->dev);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
|
|
||||||
chip->assp_kernel_image = &assp_kernel;
|
|
||||||
#else
|
|
||||||
snd_m3_free(chip);
|
snd_m3_free(chip);
|
||||||
return err;
|
return err;
|
||||||
#endif
|
|
||||||
} else
|
} else
|
||||||
snd_m3_convert_from_le(chip->assp_kernel_image);
|
snd_m3_convert_from_le(chip->assp_kernel_image);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
|
||||||
|
chip->assp_minisrc_image = &assp_minisrc;
|
||||||
|
#else
|
||||||
err = request_firmware(&chip->assp_minisrc_image,
|
err = request_firmware(&chip->assp_minisrc_image,
|
||||||
"ess/maestro3_assp_minisrc.fw", &pci->dev);
|
"ess/maestro3_assp_minisrc.fw", &pci->dev);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
|
|
||||||
chip->assp_minisrc_image = &assp_minisrc;
|
|
||||||
#else
|
|
||||||
snd_m3_free(chip);
|
snd_m3_free(chip);
|
||||||
return err;
|
return err;
|
||||||
#endif
|
|
||||||
} else
|
} else
|
||||||
snd_m3_convert_from_le(chip->assp_minisrc_image);
|
snd_m3_convert_from_le(chip->assp_minisrc_image);
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((err = pci_request_regions(pci, card->driver)) < 0) {
|
if ((err = pci_request_regions(pci, card->driver)) < 0) {
|
||||||
snd_m3_free(chip);
|
snd_m3_free(chip);
|
||||||
|
|
|
@ -2016,6 +2016,24 @@ static struct firmware snd_ymfpci_controller_1e_microcode = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
|
||||||
|
static int snd_ymfpci_request_firmware(struct snd_ymfpci *chip)
|
||||||
|
{
|
||||||
|
chip->dsp_microcode = &snd_ymfpci_dsp_microcode;
|
||||||
|
if (chip->device_id == PCI_DEVICE_ID_YAMAHA_724F ||
|
||||||
|
chip->device_id == PCI_DEVICE_ID_YAMAHA_740C ||
|
||||||
|
chip->device_id == PCI_DEVICE_ID_YAMAHA_744 ||
|
||||||
|
chip->device_id == PCI_DEVICE_ID_YAMAHA_754)
|
||||||
|
chip->controller_microcode =
|
||||||
|
&snd_ymfpci_controller_1e_microcode;
|
||||||
|
else
|
||||||
|
chip->controller_microcode =
|
||||||
|
&snd_ymfpci_controller_microcode;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* use fw_loader */
|
||||||
|
|
||||||
#ifdef __LITTLE_ENDIAN
|
#ifdef __LITTLE_ENDIAN
|
||||||
static inline void snd_ymfpci_convert_from_le(const struct firmware *fw) { }
|
static inline void snd_ymfpci_convert_from_le(const struct firmware *fw) { }
|
||||||
#else
|
#else
|
||||||
|
@ -2044,13 +2062,8 @@ static int snd_ymfpci_request_firmware(struct snd_ymfpci *chip)
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (err < 0) {
|
if (err < 0)
|
||||||
#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
|
|
||||||
chip->dsp_microcode = &snd_ymfpci_dsp_microcode;
|
|
||||||
#else
|
|
||||||
return err;
|
return err;
|
||||||
#endif
|
|
||||||
}
|
|
||||||
is_1e = chip->device_id == PCI_DEVICE_ID_YAMAHA_724F ||
|
is_1e = chip->device_id == PCI_DEVICE_ID_YAMAHA_724F ||
|
||||||
chip->device_id == PCI_DEVICE_ID_YAMAHA_740C ||
|
chip->device_id == PCI_DEVICE_ID_YAMAHA_740C ||
|
||||||
chip->device_id == PCI_DEVICE_ID_YAMAHA_744 ||
|
chip->device_id == PCI_DEVICE_ID_YAMAHA_744 ||
|
||||||
|
@ -2067,17 +2080,11 @@ static int snd_ymfpci_request_firmware(struct snd_ymfpci *chip)
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (err < 0) {
|
if (err < 0)
|
||||||
#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
|
|
||||||
chip->controller_microcode =
|
|
||||||
is_1e ? &snd_ymfpci_controller_1e_microcode
|
|
||||||
: &snd_ymfpci_controller_microcode;
|
|
||||||
#else
|
|
||||||
return err;
|
return err;
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void snd_ymfpci_download_image(struct snd_ymfpci *chip)
|
static void snd_ymfpci_download_image(struct snd_ymfpci *chip)
|
||||||
{
|
{
|
||||||
|
@ -2257,15 +2264,10 @@ static int snd_ymfpci_free(struct snd_ymfpci *chip)
|
||||||
pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl);
|
pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl);
|
||||||
|
|
||||||
pci_disable_device(chip->pci);
|
pci_disable_device(chip->pci);
|
||||||
#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
|
#ifndef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
|
||||||
if (chip->dsp_microcode != &snd_ymfpci_dsp_microcode)
|
release_firmware(chip->dsp_microcode);
|
||||||
|
release_firmware(chip->controller_microcode);
|
||||||
#endif
|
#endif
|
||||||
release_firmware(chip->dsp_microcode);
|
|
||||||
#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
|
|
||||||
if (chip->controller_microcode != &snd_ymfpci_controller_microcode &&
|
|
||||||
chip->controller_microcode != &snd_ymfpci_controller_1e_microcode)
|
|
||||||
#endif
|
|
||||||
release_firmware(chip->controller_microcode);
|
|
||||||
kfree(chip);
|
kfree(chip);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue