diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-04-24 01:55:20 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-04-24 02:11:49 -0400 |
commit | e08b34e86dfdb72a62196ce0f03d33f48958d8b9 (patch) | |
tree | 9e677f274f4bc9459ff3ac2cfb0b8f99a7625146 /sound/pci/emu10k1/emu10k1_main.c | |
parent | 3e0d611b2045b230c3acfb05c3b5ce53b09f6cdd (diff) |
ALSA: emu10k1: Fix dock firmware loading
The commit [b209c4df: ALSA: emu10k1: cache emu1010 firmware] broke the
firmware loading of the dock, just (mistakenly) ignoring a different
firmware for docks on some models. This patch revives them again.
Bugzilla: https://bugs.archlinux.org/task/34865
Reported-and-tested-by: Tobias Powalowski <tobias.powalowski@googlemail.com>
Cc: <stable@vger.kernel.org> [v3.8+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/emu10k1/emu10k1_main.c')
-rw-r--r-- | sound/pci/emu10k1/emu10k1_main.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index e6b016693240..bdd888ec9a84 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -657,14 +657,14 @@ static int snd_emu10k1_cardbus_init(struct snd_emu10k1 *emu) | |||
657 | return 0; | 657 | return 0; |
658 | } | 658 | } |
659 | 659 | ||
660 | static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu) | 660 | static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, |
661 | const struct firmware *fw_entry) | ||
661 | { | 662 | { |
662 | int n, i; | 663 | int n, i; |
663 | int reg; | 664 | int reg; |
664 | int value; | 665 | int value; |
665 | unsigned int write_post; | 666 | unsigned int write_post; |
666 | unsigned long flags; | 667 | unsigned long flags; |
667 | const struct firmware *fw_entry = emu->firmware; | ||
668 | 668 | ||
669 | if (!fw_entry) | 669 | if (!fw_entry) |
670 | return -EIO; | 670 | return -EIO; |
@@ -725,9 +725,34 @@ static int emu1010_firmware_thread(void *data) | |||
725 | /* Return to Audio Dock programming mode */ | 725 | /* Return to Audio Dock programming mode */ |
726 | snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n"); | 726 | snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n"); |
727 | snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK); | 727 | snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK); |
728 | err = snd_emu1010_load_firmware(emu); | 728 | |
729 | if (err != 0) | 729 | if (!emu->dock_fw) { |
730 | continue; | 730 | const char *filename = NULL; |
731 | switch (emu->card_capabilities->emu_model) { | ||
732 | case EMU_MODEL_EMU1010: | ||
733 | filename = DOCK_FILENAME; | ||
734 | break; | ||
735 | case EMU_MODEL_EMU1010B: | ||
736 | filename = MICRO_DOCK_FILENAME; | ||
737 | break; | ||
738 | case EMU_MODEL_EMU1616: | ||
739 | filename = MICRO_DOCK_FILENAME; | ||
740 | break; | ||
741 | } | ||
742 | if (filename) { | ||
743 | err = request_firmware(&emu->dock_fw, | ||
744 | filename, | ||
745 | &emu->pci->dev); | ||
746 | if (err) | ||
747 | continue; | ||
748 | } | ||
749 | } | ||
750 | |||
751 | if (emu->dock_fw) { | ||
752 | err = snd_emu1010_load_firmware(emu, emu->dock_fw); | ||
753 | if (err) | ||
754 | continue; | ||
755 | } | ||
731 | 756 | ||
732 | snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0); | 757 | snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0); |
733 | snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, ®); | 758 | snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, ®); |
@@ -862,7 +887,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu) | |||
862 | filename, emu->firmware->size); | 887 | filename, emu->firmware->size); |
863 | } | 888 | } |
864 | 889 | ||
865 | err = snd_emu1010_load_firmware(emu); | 890 | err = snd_emu1010_load_firmware(emu, emu->firmware); |
866 | if (err != 0) { | 891 | if (err != 0) { |
867 | snd_printk(KERN_INFO "emu1010: Loading Firmware failed\n"); | 892 | snd_printk(KERN_INFO "emu1010: Loading Firmware failed\n"); |
868 | return err; | 893 | return err; |
@@ -1253,6 +1278,8 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu) | |||
1253 | kthread_stop(emu->emu1010.firmware_thread); | 1278 | kthread_stop(emu->emu1010.firmware_thread); |
1254 | if (emu->firmware) | 1279 | if (emu->firmware) |
1255 | release_firmware(emu->firmware); | 1280 | release_firmware(emu->firmware); |
1281 | if (emu->dock_fw) | ||
1282 | release_firmware(emu->dock_fw); | ||
1256 | if (emu->irq >= 0) | 1283 | if (emu->irq >= 0) |
1257 | free_irq(emu->irq, emu); | 1284 | free_irq(emu->irq, emu); |
1258 | /* remove reserved page */ | 1285 | /* remove reserved page */ |