diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-04-26 08:13:44 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-05-11 10:56:11 -0400 |
commit | b7dd2b349a9fa9e4347780c2bbb41e51484b5bb5 (patch) | |
tree | f5b896fd062a410e46bc35963fe15cdaed38f654 /sound/pci | |
parent | f223a9fc3d5707c354588570e2cf1f3abf6b1f84 (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/pci')
-rw-r--r-- | sound/pci/korg1212/korg1212.c | 18 | ||||
-rw-r--r-- | sound/pci/maestro3.c | 30 | ||||
-rw-r--r-- | sound/pci/ymfpci/ymfpci_main.c | 46 |
3 files changed, 46 insertions, 48 deletions
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 |
2246 | static inline void snd_m3_convert_from_le(const struct firmware *fw) { } | 2246 | 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) | |||
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 | ||
2020 | static 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 |
2020 | static inline void snd_ymfpci_convert_from_le(const struct firmware *fw) { } | 2038 | static 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 | ||
2082 | static void snd_ymfpci_download_image(struct snd_ymfpci *chip) | 2089 | static 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 | } |