diff options
Diffstat (limited to 'sound/pci/ymfpci/ymfpci_main.c')
-rw-r--r-- | sound/pci/ymfpci/ymfpci_main.c | 46 |
1 files changed, 24 insertions, 22 deletions
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 | } |