ALSA: emu10k1: simplify E-MU card FPGA reset sequence
authorOswald Buddenhagen <oswald.buddenhagen@gmx.de>
Sun, 28 Apr 2024 09:37:14 +0000 (11:37 +0200)
committerTakashi Iwai <tiwai@suse.de>
Sun, 28 Apr 2024 10:00:36 +0000 (12:00 +0200)
Firstly, it is pointless to explicitly disable the power to the dock
prior to resetting the FPGA, as the latter will do the former anyway.

Secondly, it doesn't make much sense to check whether the FPGA is
already programmed. It's much simpler to just presume it is, and issue
the self-reset command. If it isn't, the effect isn't worse than the
checks themselves. As a side effect, we lose the info if the reset
fails, but there is no plausible way how that could happen unless the
card burns out while operating, and in that case we'll detect a firmware
upload failure a bit later anyway.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20240428093717.3198716-2-oswald.buddenhagen@gmx.de>

sound/pci/emu10k1/emu10k1_main.c

index 8ccc0178360ce8c0a5d70b920d212ca299310fd6..353dd3b61c6153fc9179ffd3c8c7ffc6cc5ca543 100644 (file)
@@ -864,28 +864,9 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
 
        snd_emu1010_fpga_lock(emu);
 
-       /* Disable 48Volt power to Audio Dock */
-       snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, 0);
-
-       /* ID, should read & 0x7f = 0x55. (Bit 7 is the IRQ bit) */
-       snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
-       dev_dbg(emu->card->dev, "reg1 = 0x%x\n", reg);
-       if ((reg & 0x3f) == 0x15) {
-               /* FPGA netlist already present so clear it */
-               /* Return to programming mode */
-
-               snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_HANA);
-       }
-       snd_emu1010_fpga_read(emu, EMU_HANA_ID, &reg);
-       dev_dbg(emu->card->dev, "reg2 = 0x%x\n", reg);
-       if ((reg & 0x3f) == 0x15) {
-               /* FPGA failed to return to programming mode */
-               dev_info(emu->card->dev,
-                        "emu1010: FPGA failed to return to programming mode\n");
-               return -ENODEV;
-       }
-       dev_info(emu->card->dev, "emu1010: EMU_HANA_ID = 0x%x\n", reg);
-
+       dev_info(emu->card->dev, "emu1010: Loading Hana Firmware\n");
+       snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG,
+                              EMU_HANA_FPGA_CONFIG_HANA);
        err = snd_emu1010_load_firmware(emu, 0, &emu->firmware);
        if (err < 0) {
                dev_info(emu->card->dev, "emu1010: Loading Firmware failed\n");