Skip to contentSkip to conversation

Echoaudio - new firmware

PATCH In review Giuliano Pochini 1 participant 1 message Jan 1, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Echoaudio - new firmware

This patchset adds support for the new firmware for "3G" cards. It fixes clicks/pops during simultaneous audio and midi i/o and it uses the same DSP firmware for both the Gina3G and the Layla 3G.

I announced this patch two months ago asking for someone to test it on a Layla3G, but nobody cared. I tested it a lot on the Gina3G. The patch is against the latest anonymous CVS version.

pci/echoaudio/echo3g.c +2 -4
diff -dup alsa-driver__orig/pci/echoaudio/echo3g.c alsa-driver/pci/echoaudio/echo3g.c
@@ -68,13 +68,11 @@
 #include "echoaudio.h"
 
 #define FW_361_LOADER	0
-#define FW_GINA3G_DSP	1
-#define FW_ECHO3G_DSP	2
-#define FW_3G_ASIC	3
+#define FW_ECHO3G_DSP	1
+#define FW_3G_ASIC	2
 
 static const struct firmware card_fw[] = {
 	{0, "loader_dsp.fw"},
-	{0, "gina3g_dsp.fw"},
 	{0, "echo3g_dsp.fw"},
 	{0, "3g_asic.fw"}
 };
pci/echoaudio/echo3g_dsp.c +21 -32

75 lines not on this page · raw message

pci/echoaudio/echoaudio.h +1 -1
diff -dup alsa-driver__orig/pci/echoaudio/echoaudio.h alsa-driver/pci/echoaudio/echoaudio.h
@@ -204,6 +204,7 @@
 #define ECHO_MAXAUDIOINPUTS	32	// Max audio input channels
 #define ECHO_MAXAUDIOOUTPUTS	32	// Max audio output channels
 #define ECHO_MAXAUDIOPIPES	32	// Max number of input and output pipes
+#define E3G_MAX_OUTPUTS		16
 #define ECHO_MAXMIDIJACKS	1	// Max MIDI ports
 #define ECHO_MIDI_QUEUE_SZ 	512	// Max MIDI input queue entries
 #define ECHO_MTC_QUEUE_SZ	32	// Max MIDI time code input queue entries
@@ -378,7 +379,6 @@ struct echoaudio_chip {
 	u8 clock_state;				/* Gina20, Darla20, Darla24 - only */
 	u8 input_clock;				/* Currently selected sample clock source */
 	u8 output_clock;			/* Layla20 only */
-	u8 e3g_box_type;			/* The loaded fw supports this box type */
 
 	char meters_enabled;			/* VU-meters status */
 	char asic_loaded;			/* Set TRUE when ASIC loaded */
pci/echoaudio/echoaudio_3g.c +11 -23
diff -dup alsa-driver__orig/pci/echoaudio/echoaudio_3g.c alsa-driver/pci/echoaudio/echoaudio_3g.c
@@ -35,7 +35,6 @@
 static int check_asic_status(echoaudio_t *chip)
 {
 	u32 box_status;
-	u8 box_type;
 
 	if (wait_handshake(chip))
 		return -EIO;
@@ -51,21 +50,13 @@ static int check_asic_status(echoaudio_t
 		return -EIO;
 	}
 
-	/* What box type was set? */
 	box_status = le32_to_cpu(chip->comm_page->ext_box_status);
-	if (box_status == E3G_ASIC_NOT_LOADED) {
-		DE_INIT(("box not conected\n"));
+	DE_INIT(("box_status=%x\n", box_status));
+	if (box_status == E3G_ASIC_NOT_LOADED)
 		return -ENODEV;
-	}
-
-	box_type = box_status & E3G_BOX_TYPE_MASK;
-	if (box_type != chip->e3g_box_type) {
-		DE_INIT(("wrong box type: %x\n", box_type));
-		return box_type + 1;
-	}
 
 	chip->asic_loaded = TRUE;
-	return 0;
+	return box_status & E3G_BOX_TYPE_MASK;
 }
 
 
@@ -114,9 +105,6 @@ static int set_digital_mode(echoaudio_t 
 	u8 previous_mode;
 	int err, i, o;
 
-	if (chip->bad_board)
-		return -EIO;
-
 	/* All audio channels must be closed before changing the digital mode */
 	snd_assert(!chip->pipe_alloc_mask, return -EAGAIN);
 
@@ -240,8 +228,7 @@ static u32 detect_input_clocks(const ech
 
 static int load_asic(echoaudio_t *chip)
 {
-	u32 control_reg;
-	int err;
+	int box_type, err;
 
 	if (chip->asic_loaded)
 		return 0;
@@ -258,15 +245,16 @@ static int load_asic(echoaudio_t *chip)
 	/* Now give the new ASIC a little time to set up */
 	mdelay(2);
 	/* See if it worked */
-	err = check_asic_status(chip);
+	box_type = check_asic_status(chip);
 
 	/* Set up the control register if the load succeeded - 48 kHz, internal clock, S/PDIF RCA mode */
-	if (!err) {
-		control_reg = E3G_48KHZ;
-		err = write_control_reg(chip, control_reg, E3G_FREQ_REG_DEFAULT, TRUE);	// TRUE == force write
+	if (box_type >= 0) {
+		err = write_control_reg(chip, E3G_48KHZ, E3G_FREQ_REG_DEFAULT, TRUE);
+		if (err < 0)
+			return err;
 	}
-	DE_INIT(("load_asic() err=%d\n", err));
-	return err;
+
+	return box_type;
 }
 
 
pci/echoaudio/echoaudio_dsp.c +12 -7
diff -dup alsa-driver__orig/pci/echoaudio/echoaudio_dsp.c alsa-driver/pci/echoaudio/echoaudio_dsp.c
@@ -526,14 +526,14 @@ static int load_dsp(echoaudio_t *chip, u
 static int load_firmware(echoaudio_t *chip)
 {
 	const struct firmware *fw;
-	int err;
+	int box_type, err;
 
 	snd_assert(chip->dsp_code_to_load && chip->comm_page, return -EPERM);
 
 	/* See if the ASIC is present and working - only if the DSP is already loaded */
 	if (chip->dsp_code) {
-		if (check_asic_status(chip) == 0)
-			return 0;
+		if ((box_type = check_asic_status(chip)) >= 0)
+			return box_type;
 		/* ASIC check failed; force the DSP to reload */
 		chip->dsp_code = NULL;
 	}
@@ -545,12 +545,13 @@ static int load_firmware(echoaudio_t *ch
 	if (err < 0)
 		return err;
 
-	/* Load the ASIC if the DSP load succeeded. >0 means it did not fail
-	but we cannot continue (eg. we loaded the wrong firmware) */
-	if ((err = load_asic(chip)) != 0)
+	if ((box_type = load_asic(chip)) < 0)
+		return box_type;	/* error */
+
+	if ((err = restore_dsp_rettings(chip)) < 0)
 		return err;
 
-	return restore_dsp_rettings(chip);
+	return box_type;
 }
 
 
@@ -687,6 +688,10 @@ static void get_audio_meters(echoaudio_t
 	for (; n < 32; n++)
 		meters[n] = 0;
 
+#ifdef ECHOCARD_ECHO3G
+	m = E3G_MAX_OUTPUTS;	/* Skip unused meters */
+#endif
+
 	for (i = 0; i < num_busses_in(chip); i++, m++) {
 		meters[n++] = chip->comm_page->vu_meter[m];
 		meters[n++] = chip->comm_page->peak_meter[m];
pci/echoaudio/echoaudio_dsp.h +1 -1
diff -dup alsa-driver__orig/pci/echoaudio/echoaudio_dsp.h alsa-driver/pci/echoaudio/echoaudio_dsp.h
@@ -541,7 +541,7 @@ SET_LAYLA24_FREQUENCY_REG command.
 #define E3G_ADAT_MODE		0x1000
 #define E3G_SPDIF_OPTICAL_MODE	0x2000
 
-#define E3G_CLOCK_CLEAR_MASK		0xffffbff0
+#define E3G_CLOCK_CLEAR_MASK		0xbfffbff0
 #define E3G_DIGITAL_MODE_CLEAR_MASK	0xffffcfff
 #define E3G_SPDIF_FORMAT_CLEAR_MASK	0xfffff01f
 

--
Giuliano.

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click