aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-04-26 08:13:44 -0400
committerJaroslav Kysela <perex@suse.cz>2007-05-11 10:56:11 -0400
commitb7dd2b349a9fa9e4347780c2bbb41e51484b5bb5 (patch)
treef5b896fd062a410e46bc35963fe15cdaed38f654 /sound
parentf223a9fc3d5707c354588570e2cf1f3abf6b1f84 (diff)
[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>
Diffstat (limited to 'sound')
-rw-r--r--sound/isa/sb/sb16_csp.c17
-rw-r--r--sound/isa/wavefront/wavefront_fx.c15
-rw-r--r--sound/pci/korg1212/korg1212.c18
-rw-r--r--sound/pci/maestro3.c30
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c46
5 files changed, 62 insertions, 64 deletions
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
index ef71e50744e9..92e2bc413178 100644
--- a/sound/isa/sb/sb16_csp.c
+++ b/sound/isa/sb/sb16_csp.c
@@ -161,13 +161,17 @@ int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep)
161 */ 161 */
162static void snd_sb_csp_free(struct snd_hwdep *hwdep) 162static void snd_sb_csp_free(struct snd_hwdep *hwdep)
163{ 163{
164#ifndef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL
164 int i; 165 int i;
166#endif
165 struct snd_sb_csp *p = hwdep->private_data; 167 struct snd_sb_csp *p = hwdep->private_data;
166 if (p) { 168 if (p) {
167 if (p->running & SNDRV_SB_CSP_ST_RUNNING) 169 if (p->running & SNDRV_SB_CSP_ST_RUNNING)
168 snd_sb_csp_stop(p); 170 snd_sb_csp_stop(p);
171#ifndef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL
169 for (i = 0; i < ARRAY_SIZE(p->csp_programs); ++i) 172 for (i = 0; i < ARRAY_SIZE(p->csp_programs); ++i)
170 release_firmware(p->csp_programs[i]); 173 release_firmware(p->csp_programs[i]);
174#endif
171 kfree(p); 175 kfree(p);
172 } 176 }
173} 177}
@@ -712,22 +716,19 @@ static int snd_sb_csp_firmware_load(struct snd_sb_csp *p, int index, int flags)
712 "sb16/ima_adpcm_capture.csp", 716 "sb16/ima_adpcm_capture.csp",
713 }; 717 };
714 const struct firmware *program; 718 const struct firmware *program;
715 int err;
716 719
717 BUILD_BUG_ON(ARRAY_SIZE(names) != CSP_PROGRAM_COUNT); 720 BUILD_BUG_ON(ARRAY_SIZE(names) != CSP_PROGRAM_COUNT);
718 program = p->csp_programs[index]; 721 program = p->csp_programs[index];
719 if (!program) { 722 if (!program) {
720 err = request_firmware(&program, names[index],
721 p->chip->card->dev);
722 if (err >= 0)
723 p->csp_programs[index] = program;
724 else {
725#ifdef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL 723#ifdef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL
726 program = &snd_sb_csp_static_programs[index]; 724 program = &snd_sb_csp_static_programs[index];
727#else 725#else
726 int err = request_firmware(&program, names[index],
727 p->chip->card->dev);
728 if (err < 0)
728 return err; 729 return err;
729#endif 730#endif
730 } 731 p->csp_programs[index] = program;
731 } 732 }
732 return snd_sb_csp_load(p, program->data, program->size, flags); 733 return snd_sb_csp_load(p, program->data, program->size, flags);
733} 734}
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c
index 3a8c0565d676..0e948a9a7205 100644
--- a/sound/isa/wavefront/wavefront_fx.c
+++ b/sound/isa/wavefront/wavefront_fx.c
@@ -256,21 +256,21 @@ snd_wavefront_fx_start (snd_wavefront_t *dev)
256{ 256{
257 unsigned int i; 257 unsigned int i;
258 int err; 258 int err;
259 const struct firmware *firmware; 259 const struct firmware *firmware = NULL;
260 260
261 if (dev->fx_initialized) 261 if (dev->fx_initialized)
262 return 0; 262 return 0;
263 263
264#ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL
265 firmware = &yss225_registers_firmware;
266#else
264 err = request_firmware(&firmware, "yamaha/yss225_registers.bin", 267 err = request_firmware(&firmware, "yamaha/yss225_registers.bin",
265 dev->card->dev); 268 dev->card->dev);
266 if (err < 0) { 269 if (err < 0) {
267#ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL
268 firmware = &yss225_registers_firmware;
269#else
270 err = -1; 270 err = -1;
271 goto out; 271 goto out;
272#endif
273 } 272 }
273#endif
274 274
275 for (i = 0; i + 1 < firmware->size; i += 2) { 275 for (i = 0; i + 1 < firmware->size; i += 2) {
276 if (firmware->data[i] >= 8 && firmware->data[i] < 16) { 276 if (firmware->data[i] >= 8 && firmware->data[i] < 16) {
@@ -293,9 +293,8 @@ snd_wavefront_fx_start (snd_wavefront_t *dev)
293 err = 0; 293 err = 0;
294 294
295out: 295out:
296#ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL 296#ifndef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL
297 if (firmware != &yss225_registers_firmware) 297 release_firmware(firmware);
298#endif 298#endif
299 release_firmware(firmware);
300 return err; 299 return err;
301} 300}
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index e2e59cae2f6e..bd7c816bf6a7 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2340,26 +2340,25 @@ static int __devinit snd_korg1212_create(struct snd_card *card, struct pci_dev *
2340 korg1212->AdatTimeCodePhy = korg1212->sharedBufferPhy + 2340 korg1212->AdatTimeCodePhy = korg1212->sharedBufferPhy +
2341 offsetof(struct KorgSharedBuffer, AdatTimeCode); 2341 offsetof(struct KorgSharedBuffer, AdatTimeCode);
2342 2342
2343#ifdef CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL
2344 dsp_code = &static_dsp_code;
2345#else
2343 err = request_firmware(&dsp_code, "korg/k1212.dsp", &pci->dev); 2346 err = request_firmware(&dsp_code, "korg/k1212.dsp", &pci->dev);
2344 if (err < 0) { 2347 if (err < 0) {
2345 release_firmware(dsp_code); 2348 release_firmware(dsp_code);
2346#ifdef CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL
2347 dsp_code = &static_dsp_code;
2348#else
2349 snd_printk(KERN_ERR "firmware not available\n"); 2349 snd_printk(KERN_ERR "firmware not available\n");
2350 snd_korg1212_free(korg1212); 2350 snd_korg1212_free(korg1212);
2351 return err; 2351 return err;
2352#endif
2353 } 2352 }
2353#endif
2354 2354
2355 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 2355 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
2356 dsp_code->size, &korg1212->dma_dsp) < 0) { 2356 dsp_code->size, &korg1212->dma_dsp) < 0) {
2357 snd_printk(KERN_ERR "korg1212: cannot allocate dsp code memory (%zd bytes)\n", dsp_code->size); 2357 snd_printk(KERN_ERR "korg1212: cannot allocate dsp code memory (%zd bytes)\n", dsp_code->size);
2358 snd_korg1212_free(korg1212); 2358 snd_korg1212_free(korg1212);
2359#ifdef CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL 2359#ifndef CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL
2360 if (dsp_code != &static_dsp_code) 2360 release_firmware(dsp_code);
2361#endif 2361#endif
2362 release_firmware(dsp_code);
2363 return -ENOMEM; 2362 return -ENOMEM;
2364 } 2363 }
2365 2364
@@ -2369,10 +2368,9 @@ static int __devinit snd_korg1212_create(struct snd_card *card, struct pci_dev *
2369 2368
2370 memcpy(korg1212->dma_dsp.area, dsp_code->data, dsp_code->size); 2369 memcpy(korg1212->dma_dsp.area, dsp_code->data, dsp_code->size);
2371 2370
2372#ifdef CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL 2371#ifndef CONFIG_SND_KORG1212_FIRMWARE_IN_KERNEL
2373 if (dsp_code != &static_dsp_code) 2372 release_firmware(dsp_code);
2374#endif 2373#endif
2375 release_firmware(dsp_code);
2376 2374
2377 rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_RebootCard, 0, 0, 0, 0); 2375 rc = snd_korg1212_Send1212Command(korg1212, K1212_DB_RebootCard, 0, 0, 0, 0);
2378 2376
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 9badbb3bfbd1..4c1af425ce75 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2240,7 +2240,7 @@ static const struct firmware assp_minisrc = {
2240 .size = sizeof assp_minisrc_image 2240 .size = sizeof assp_minisrc_image
2241}; 2241};
2242 2242
2243#endif /* CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL */ 2243#else /* CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL */
2244 2244
2245#ifdef __LITTLE_ENDIAN 2245#ifdef __LITTLE_ENDIAN
2246static inline void snd_m3_convert_from_le(const struct firmware *fw) { } 2246static 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)
2255} 2255}
2256#endif 2256#endif
2257 2257
2258#endif /* CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL */
2259
2258 2260
2259/* 2261/*
2260 * initialize ASSP 2262 * initialize ASSP
@@ -2548,14 +2550,10 @@ static int snd_m3_free(struct snd_m3 *chip)
2548 if (chip->iobase) 2550 if (chip->iobase)
2549 pci_release_regions(chip->pci); 2551 pci_release_regions(chip->pci);
2550 2552
2551#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL 2553#ifndef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
2552 if (chip->assp_kernel_image != &assp_kernel) 2554 release_firmware(chip->assp_kernel_image);
2555 release_firmware(chip->assp_minisrc_image);
2553#endif 2556#endif
2554 release_firmware(chip->assp_kernel_image);
2555#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
2556 if (chip->assp_minisrc_image != &assp_minisrc)
2557#endif
2558 release_firmware(chip->assp_minisrc_image);
2559 2557
2560 pci_disable_device(chip->pci); 2558 pci_disable_device(chip->pci);
2561 kfree(chip); 2559 kfree(chip);
@@ -2745,29 +2743,29 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2745 return -ENOMEM; 2743 return -ENOMEM;
2746 } 2744 }
2747 2745
2746#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
2747 chip->assp_kernel_image = &assp_kernel;
2748#else
2748 err = request_firmware(&chip->assp_kernel_image, 2749 err = request_firmware(&chip->assp_kernel_image,
2749 "ess/maestro3_assp_kernel.fw", &pci->dev); 2750 "ess/maestro3_assp_kernel.fw", &pci->dev);
2750 if (err < 0) { 2751 if (err < 0) {
2751#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
2752 chip->assp_kernel_image = &assp_kernel;
2753#else
2754 snd_m3_free(chip); 2752 snd_m3_free(chip);
2755 return err; 2753 return err;
2756#endif
2757 } else 2754 } else
2758 snd_m3_convert_from_le(chip->assp_kernel_image); 2755 snd_m3_convert_from_le(chip->assp_kernel_image);
2756#endif
2759 2757
2758#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
2759 chip->assp_minisrc_image = &assp_minisrc;
2760#else
2760 err = request_firmware(&chip->assp_minisrc_image, 2761 err = request_firmware(&chip->assp_minisrc_image,
2761 "ess/maestro3_assp_minisrc.fw", &pci->dev); 2762 "ess/maestro3_assp_minisrc.fw", &pci->dev);
2762 if (err < 0) { 2763 if (err < 0) {
2763#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
2764 chip->assp_minisrc_image = &assp_minisrc;
2765#else
2766 snd_m3_free(chip); 2764 snd_m3_free(chip);
2767 return err; 2765 return err;
2768#endif
2769 } else 2766 } else
2770 snd_m3_convert_from_le(chip->assp_minisrc_image); 2767 snd_m3_convert_from_le(chip->assp_minisrc_image);
2768#endif
2771 2769
2772 if ((err = pci_request_regions(pci, card->driver)) < 0) { 2770 if ((err = pci_request_regions(pci, card->driver)) < 0) {
2773 snd_m3_free(chip); 2771 snd_m3_free(chip);
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index b34c3bce270b..3d4beca31c8b 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2016,6 +2016,24 @@ static struct firmware snd_ymfpci_controller_1e_microcode = {
2016}; 2016};
2017#endif 2017#endif
2018 2018
2019#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
2020static int snd_ymfpci_request_firmware(struct snd_ymfpci *chip)
2021{
2022 chip->dsp_microcode = &snd_ymfpci_dsp_microcode;
2023 if (chip->device_id == PCI_DEVICE_ID_YAMAHA_724F ||
2024 chip->device_id == PCI_DEVICE_ID_YAMAHA_740C ||
2025 chip->device_id == PCI_DEVICE_ID_YAMAHA_744 ||
2026 chip->device_id == PCI_DEVICE_ID_YAMAHA_754)
2027 chip->controller_microcode =
2028 &snd_ymfpci_controller_1e_microcode;
2029 else
2030 chip->controller_microcode =
2031 &snd_ymfpci_controller_microcode;
2032 return 0;
2033}
2034
2035#else /* use fw_loader */
2036
2019#ifdef __LITTLE_ENDIAN 2037#ifdef __LITTLE_ENDIAN
2020static inline void snd_ymfpci_convert_from_le(const struct firmware *fw) { } 2038static inline void snd_ymfpci_convert_from_le(const struct firmware *fw) { }
2021#else 2039#else
@@ -2044,13 +2062,8 @@ static int snd_ymfpci_request_firmware(struct snd_ymfpci *chip)
2044 err = -EINVAL; 2062 err = -EINVAL;
2045 } 2063 }
2046 } 2064 }
2047 if (err < 0) { 2065 if (err < 0)
2048#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
2049 chip->dsp_microcode = &snd_ymfpci_dsp_microcode;
2050#else
2051 return err; 2066 return err;
2052#endif
2053 }
2054 is_1e = chip->device_id == PCI_DEVICE_ID_YAMAHA_724F || 2067 is_1e = chip->device_id == PCI_DEVICE_ID_YAMAHA_724F ||
2055 chip->device_id == PCI_DEVICE_ID_YAMAHA_740C || 2068 chip->device_id == PCI_DEVICE_ID_YAMAHA_740C ||
2056 chip->device_id == PCI_DEVICE_ID_YAMAHA_744 || 2069 chip->device_id == PCI_DEVICE_ID_YAMAHA_744 ||
@@ -2067,17 +2080,11 @@ static int snd_ymfpci_request_firmware(struct snd_ymfpci *chip)
2067 err = -EINVAL; 2080 err = -EINVAL;
2068 } 2081 }
2069 } 2082 }
2070 if (err < 0) { 2083 if (err < 0)
2071#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
2072 chip->controller_microcode =
2073 is_1e ? &snd_ymfpci_controller_1e_microcode
2074 : &snd_ymfpci_controller_microcode;
2075#else
2076 return err; 2084 return err;
2077#endif
2078 }
2079 return 0; 2085 return 0;
2080} 2086}
2087#endif
2081 2088
2082static void snd_ymfpci_download_image(struct snd_ymfpci *chip) 2089static void snd_ymfpci_download_image(struct snd_ymfpci *chip)
2083{ 2090{
@@ -2257,15 +2264,10 @@ static int snd_ymfpci_free(struct snd_ymfpci *chip)
2257 pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl); 2264 pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl);
2258 2265
2259 pci_disable_device(chip->pci); 2266 pci_disable_device(chip->pci);
2260#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL 2267#ifndef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
2261 if (chip->dsp_microcode != &snd_ymfpci_dsp_microcode) 2268 release_firmware(chip->dsp_microcode);
2262#endif 2269 release_firmware(chip->controller_microcode);
2263 release_firmware(chip->dsp_microcode);
2264#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
2265 if (chip->controller_microcode != &snd_ymfpci_controller_microcode &&
2266 chip->controller_microcode != &snd_ymfpci_controller_1e_microcode)
2267#endif 2270#endif
2268 release_firmware(chip->controller_microcode);
2269 kfree(chip); 2271 kfree(chip);
2270 return 0; 2272 return 0;
2271} 2273}