Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
To: linux-sound@vger.kernel.org
Cc: Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>,
	Pietro Caruso <pietrocaruso50@gmail.com>
Subject: [PATCH 06/10] ALSA: emu10k1: simplify E-MU card FPGA reset sequence
Date: Sun, 21 Apr 2024 22:47:03 +0200	[thread overview]
Message-ID: <20240421204707.2487686-7-oswald.buddenhagen@gmx.de> (raw)
In-Reply-To: <20240421204707.2487686-1-oswald.buddenhagen@gmx.de>

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>
---
 sound/pci/emu10k1/emu10k1_main.c | 25 +++----------------------
 1 file changed, 3 insertions(+), 22 deletions(-)

diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 8ccc0178360c..353dd3b61c61 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -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");
-- 
2.44.0.701.g2cf7baacf3.dirty


  parent reply	other threads:[~2024-04-21 20:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-21 20:46 [PATCH 00/10] ALSA: emu10k1: fixes related to uploading firmware to the E-MU dock Oswald Buddenhagen
2024-04-21 20:46 ` [PATCH 01/10] ALSA: emu10k1: fix E-MU card dock presence monitoring Oswald Buddenhagen
2024-04-21 20:46 ` [PATCH 02/10] ALSA: emu10k1: factor out snd_emu1010_load_dock_firmware() Oswald Buddenhagen
2024-04-21 20:47 ` [PATCH 03/10] ALSA: emu10k1: move the whole GPIO event handling to the workqueue Oswald Buddenhagen
2024-04-21 20:47 ` [PATCH 04/10] ALSA: emu10k1: use mutex for E-MU FPGA access locking Oswald Buddenhagen
2024-04-21 20:47 ` [PATCH 05/10] ALSA: emu10k1: fix E-MU dock initialization Oswald Buddenhagen
2024-04-21 20:47 ` Oswald Buddenhagen [this message]
2024-04-21 20:47 ` [PATCH 07/10] ALSA: emu10k1: make snd_emu1010_load_firmware_entry() void Oswald Buddenhagen
2024-04-21 20:47 ` [PATCH 08/10] ALSA: emu10k1: move entering E-MU card FPGA programming mode Oswald Buddenhagen
2024-04-21 20:47 ` [PATCH 09/10] ALSA: emu10k1: move snd_emu1010_load_firmware_entry() to io.c Oswald Buddenhagen
2024-04-21 20:47 ` [PATCH 10/10] ALSA: emu10k1: make E-MU FPGA writes potentially more reliable Oswald Buddenhagen
2024-04-22 19:29 ` [PATCH 00/10] ALSA: emu10k1: fixes related to uploading firmware to the E-MU dock Takashi Iwai
2024-04-23  7:21   ` Oswald Buddenhagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240421204707.2487686-7-oswald.buddenhagen@gmx.de \
    --to=oswald.buddenhagen@gmx.de \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pietrocaruso50@gmail.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox