Skip to contentSkip to conversation

ice1724/Audiotrak Prodigy 7.1 HiFi

DISCUSSION Julian Scheel 3 participants 8 messages Sep 15, 2006 – Sep 29, 2006

lore
Share & tools
lore
#0 lore raw

I just got a Audiotrak Prodigy 7.1 HiFi card, which is baed upon a Envy24HT chipset in combination with one WM8776 codec for front out and a WM8766 for channel 3-8.
I made the front out working, taking the code from pontis.c - Now I'd like to add support for the other channels, therefore I need to figure out the I2C-base-address for the WM8766 registers.
Can you provide me with some help on how to figure that out? I'm a newbie to alsa/soundcard driver development.
Reading the envy24ht-specs didn't help me, yet.

One more question: Should I merge my code into pontis.c, which would blow it a bit up, but would avoid duplicate code, or should I open a new prodigy_hifi.c/h?

Cheers,
Julian

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#1 lore raw

At Fri, 15 Sep 2006 21:11:03 +0200,

Quoted 9 lines · Julian Scheel

I just got a Audiotrak Prodigy 7.1 HiFi card, which is baed upon a Envy24HT chipset in combination with one WM8776 codec for front out and a WM8766 for channel 3-8.
I made the front out working, taking the code from pontis.c - Now I'd like to add support for the other channels, therefore I need to figure out the I2C-base-address for the WM8766 registers.
Can you provide me with some help on how to figure that out? I'm a newbie to alsa/soundcard driver development.

First you should make clear whether the codec chip is connected via the vt1724's standard connection or 3-wired SPI connection via GPIO. The most boards use the latter method while pontis board uses the former. In the latter case, the address is usually 2 bit, so you can do a wild guess more easily.

Quoted 5 lines

Reading the envy24ht-specs didn't help me, yet.

One more question: Should I merge my code into pontis.c, which would blow it a bit up, but would avoid duplicate code, or should I open a new prodigy_hifi.c/h?

Depends. Send us a patch, and let's decide this later.

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#2 lore raw

Am Dienstag, 19. September 2006 11:27 schrieb Takashi Iwai:

Quoted 6 lines

At Fri, 15 Sep 2006 21:11:03 +0200,
First you should make clear whether the codec chip is connected via the vt1724's standard connection or 3-wired SPI connection via GPIO. The most boards use the latter method while pontis board uses the former. In the latter case, the address is usually 2 bit, so you can do a wild guess more easily.

I figured out that the WM8766 is connected through a 3-wired SPI-connection. I also figured out that the GPIOs 16,17,18 are used.
pontis.c already includes a SPI-implementation, but according to the WM8766 specs (look at wolfsonmico.com) this device does not await an address, but only 2 bytes of data: register address/values.
Actually trying to initializing the chip leads to silence, in comparison to the noise coming out before, when the chip was in default mode.
I assume that there must be some timing problem with the data-transmission or similiar. I will do some more testing today.
Maybe I'll send in a patch if I can't find a problem, anyway.

-Julian

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#3 lore raw

Am Dienstag, 19. September 2006 11:40 schrieb Julian Scheel:

Quoted 8 lines

Am Dienstag, 19. September 2006 11:27 schrieb Takashi Iwai:

Quoted 6 lines

At Fri, 15 Sep 2006 21:11:03 +0200,
First you should make clear whether the codec chip is connected via the vt1724's standard connection or 3-wired SPI connection via GPIO. The most boards use the latter method while pontis board uses the former. In the latter case, the address is usually 2 bit, so you can do a wild guess more easily.

Quoted 10 lines

I figured out that the WM8766 is connected through a 3-wired SPI-connection. I also figured out that the GPIOs 16,17,18 are used. pontis.c already includes a SPI-implementation, but according to the WM8766 specs (look at wolfsonmico.com) this device does not await an address, but only 2 bytes of data: register address/values.
Actually trying to initializing the chip leads to silence, in comparison to the noise coming out before, when the chip was in default mode. I assume that there must be some timing problem with the data-transmission or similiar. I will do some more testing today.
Maybe I'll send in a patch if I can't find a problem, anyway.

Ok, attached is now what I've done so far. (patch against 1.0.13rc2) This causes the WM8766 to be silent. Only way to get the noise back is restarting the system without the init-code.
Couldn't find a reason for that behaviour. Maybe you have an idea what could be wrong with that code?

-Julian

alsa-kernel/pci/ice1712/pontis.c +99 -3
diff -ru alsa-driver-1.0.13rc2.orig/alsa-kernel/pci/ice1712/pontis.c alsa-driver-1.0.13rc2/alsa-kernel/pci/ice1712/pontis.c
@@ -67,6 +67,22 @@
 #define WM_OUT_MUX		0x16
 #define WM_RESET		0x17
 
+/* WM8766 registers */
+#define WM8766_DAC_CTRL		0x02   /* DAC Control */
+#define WM8766_INT_CTRL		0x03   /* Interface Control */
+#define WM8766_DAC_CTRL2	0x09
+#define WM8766_DAC_CTRL3	0x0a
+#define WM8766_RESET		0x1f
+#define WM8766_LDA1		0x00
+#define WM8766_LDA2		0x04
+#define WM8766_LDA3		0x06
+#define WM8766_RDA1		0x01
+#define WM8766_RDA2		0x05
+#define WM8766_RDA3		0x07
+#define WM8766_MUTE1		0x0C
+#define WM8766_MUTE2		0x0F
+
+
 /*
  * GPIO
  */
@@ -75,6 +91,10 @@
 #define PONTIS_CS_RDATA		(1<<6)	/* CS8416 -> VT1720 */
 #define PONTIS_CS_WDATA		(1<<7)	/* VT1720 -> CS8416 */
 
+#define WM8766_SPI_CLK		(1<<17) /* CLK, Pin97 on ICE1724 */
+#define WM8766_SPI_MD		(1<<16) /* DATA VT1724 -> WM8766, Pin96 */
+#define WM8766_SPI_ML		(1<<18) /* Latch, Pin98 */
+
 
 /*
  * get the current register value of WM codec
@@ -353,7 +373,12 @@
 		tmp |= bit;
 	else
 		tmp &= ~bit;
-	snd_ice1712_gpio_write(ice, tmp);
+/*printk("BIT: %08x\n", bit);
+printk("GPIO W: %08x\n", tmp);*/
+        snd_ice1712_gpio_write(ice, tmp);
+/*        udelay(1);
+tmp = snd_ice1712_gpio_read(ice);
+printk("GPIO R: %08x\n", tmp);*/
 }
 
 static void spi_send_byte(struct snd_ice1712 *ice, unsigned char data)
@@ -428,6 +453,39 @@
 	return val;
 }
 
+/*
+ * SPI implementation for WM8766 codec - only writing supported, no readback
+ */
+
+static void wm8766_spi_send_byte(struct snd_ice1712 *ice, unsigned char data)
+{
+	int i;
+	for (i = 0; i < 8; i++) {
+		set_gpio_bit(ice, WM8766_SPI_CLK, 0);
+		udelay(1);
+		set_gpio_bit(ice, WM8766_SPI_MD, data & 0x80);
+		udelay(1);
+		set_gpio_bit(ice, WM8766_SPI_CLK, 1);
+		udelay(1);
+		data <<= 1;
+	}
+}
+
+static void wm8766_spi_write(struct snd_ice1712 *ice, unsigned int reg, unsigned int data)
+{
+	snd_ice1712_gpio_set_dir(ice, WM8766_SPI_MD|WM8766_SPI_CLK|WM8766_SPI_ML);
+	snd_ice1712_gpio_set_mask(ice, ~(WM8766_SPI_MD|WM8766_SPI_CLK|WM8766_SPI_ML));
+	set_gpio_bit(ice, WM8766_SPI_ML, 0); /* latch must be low when writing */
+	wm8766_spi_send_byte(ice, reg); /* REGISTER ADDRESS */
+	wm8766_spi_send_byte(ice, data); /* DATA */
+	/* release latch */
+	set_gpio_bit(ice, WM8766_SPI_ML, 1);
+	udelay(1);
+	/* restore */
+	snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask);
+	snd_ice1712_gpio_set_dir(ice, ice->gpio.direction);
+}
+
 
 /*
  * SPDIF input source
@@ -776,6 +834,21 @@
 		WM_DAC_MUTE,	0x0000,	/* DAC unmute */
 		WM_ADC_MUX,	0x0003,	/* ADC unmute, both CD/Line On */
 	};
+        static unsigned short wm8766_inits[] = {
+/*                WM8766_RESET,		0x01,*/
+		WM8766_DAC_CTRL,	0x90,
+                WM8766_INT_CTRL,	0x22, /* I2S Normal Mode, 24 bit */
+                WM8766_DAC_CTRL2,	0x00,
+		WM8766_DAC_CTRL3,	0x10,
+		WM8766_LDA1,		0xff,
+		WM8766_LDA2,		0xff,
+		WM8766_LDA3,		0xff,
+		WM8766_RDA1,		0xff,
+		WM8766_RDA2,		0xff,
+		WM8766_RDA3,		0xff,
+		WM8766_MUTE1,		0x20,
+		WM8766_MUTE2,		0x10,
+        };
 	static unsigned char cs_inits[] = {
 		0x04,	0x80,	/* RUN, RXP0 */
 		0x05,	0x05,	/* slave, 24bit */
@@ -788,12 +861,19 @@
 	ice->vt1720 = 1;
 	ice->num_total_dacs = 2;
 	ice->num_total_adcs = 2;
+	ice->akm_codecs = 1;
+
+        switch (ice->eeprom.subvendor) {
+        case VT1720_SUBDEVICE_PRODIGY71_HIFI:
+		ice->vt1720 = 0;
+                ice->num_total_dacs = 8;
+                ice->akm_codecs = 2;
+        }
 
 	/* to remeber the register values */
-	ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
+        ice->akm = kcalloc(ice->akm_codecs, sizeof(struct snd_akm4xxx), GFP_KERNEL);
 	if (! ice->akm)
 		return -ENOMEM;
-	ice->akm_codecs = 1;
 
 	/* HACK - use this as the SPDIF source.
 	 * don't call snd_ice1712_gpio_get/put(), otherwise it's overwritten
@@ -807,6 +887,13 @@
 	for (i = 0; i < ARRAY_SIZE(wm_inits2); i += 2)
 		wm_put(ice, wm_inits2[i], wm_inits2[i+1]);
 
+        /* initialize WM8766 codec */
+        for (i = 0; i < ARRAY_SIZE(wm8766_inits); i += 2)
+{
+printk("SET WM8766 REGISTER\n");
+                wm8766_spi_write(ice, wm8766_inits[i], wm8766_inits[i+1]);
+}
+
 	/* initialize CS8416 codec */
 	/* assert PRST#; MT05 bit 7 */
 	outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD));
@@ -853,5 +940,14 @@
 		.eeprom_size = sizeof(pontis_eeprom),
 		.eeprom_data = pontis_eeprom,
 	},
+	{
+		.subvendor = VT1720_SUBDEVICE_PRODIGY71_HIFI,
+		.name = "Audiotrak Prodigy 7.1 HiFi",
+		.model = "prodigy71hifi",
+		.chip_init = pontis_init,
+		.build_controls = pontis_add_controls,
+		.eeprom_size = sizeof(pontis_eeprom),
+		.eeprom_data = pontis_eeprom,
+	},
 	{ } /* terminator */
 };

Only in alsa-driver-1.0.13rc2/alsa-kernel/pci/ice1712: pontis.c.orig

alsa-kernel/pci/ice1712/pontis.h +1 -0
diff -ru alsa-driver-1.0.13rc2.orig/alsa-kernel/pci/ice1712/pontis.h alsa-driver-1.0.13rc2/alsa-kernel/pci/ice1712/pontis.h
@@ -27,6 +27,7 @@
 #define PONTIS_DEVICE_DESC 	       "{Pontis,MS300},"
 
 #define VT1720_SUBDEVICE_PONTIS_MS300	0x00020002	/* a dummy id for MS300 */
+#define VT1720_SUBDEVICE_PRODIGY71_HIFI	0x38315441	/* audiotrak prodigy */
 
 extern struct snd_ice1712_card_info  snd_vt1720_pontis_cards[];
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#4 lore raw

Am Dienstag, 19. September 2006 13:56 schrieb Julian Scheel:

Quoted 6 lines

Ok, attached is now what I've done so far. (patch against 1.0.13rc2) This causes the WM8766 to be silent. Only way to get the noise back is restarting the system without the init-code.
Couldn't find a reason for that behaviour. Maybe you have an idea what could be wrong with that code?

One more note about that patch:
I know coding-style is quite horrible and it'd probably break pontis. It's just what I hacked together for testing, and as the DAC doesn't seem to understand what I am sending I'd like to get some feedback on the SPI-implementation, maybe that one is faulty? (The WM8766 sheet isn't very detailed about that)

-Julian

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#5 lore raw
Quoted 10 lines · Julian Scheel

Am Dienstag, 19. September 2006 13:56 schrieb Julian Scheel:

Quoted 7 lines

Ok, attached is now what I've done so far. (patch against 1.0.13rc2) This causes the WM8766 to be silent. Only way to get the noise back is restarting the system without the init-code.
Couldn't find a reason for that behaviour. Maybe you have an idea what could be wrong with that code?

Quoted 9 lines

One more note about that patch:
I know coding-style is quite horrible and it'd probably break pontis. It's just what I hacked together for testing, and as the DAC doesn't seem to understand what I am sending I'd like to get some feedback on the SPI-implementation, maybe that one is faulty? (The WM8766 sheet isn't very detailed about that)

-Julian

After our conversation on IRC and the resulting help I was able to give you, I understand that you managed to fix this.
When are you going to post the completed patch?

James

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#6 lore raw
Quoted 19 lines · James Courtier-Dutton
Quoted 18 lines · Julian Scheel

Am Dienstag, 19. September 2006 13:56 schrieb Julian Scheel:

Quoted 8 lines

Ok, attached is now what I've done so far. (patch against 1.0.13rc2) This
causes the WM8766 to be silent. Only way to get the noise back is restarting the system without the init-code.
Couldn't find a reason for that behaviour. Maybe you have an idea what could be wrong with that code?

One more note about that patch:
I know coding-style is quite horrible and it'd probably break pontis. It's just what I hacked together for testing, and as the DAC doesn't seem to understand what I am sending I'd like to get some feedback on the SPI-implementation, maybe that one is faulty? (The WM8766 sheet isn't very detailed about that)

Quoted 9 lines
Quoted 2 lines

-Julian

After our conversation on IRC and the resulting help I was able to give you, I understand that you managed to fix this.
When are you going to post the completed patch?

James

Sadly if been out of work for several days now, because of a tonsilitis. That's the reason, why I haven't finished up the work yet. Hopefully I'll do so next week and post the result then.
Though I haven't yet worked with digital out, which might need some more work, too. But I think I'd post analog-only patches first.

-Julian

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#7 lore raw

At Fri, 29 Sep 2006 17:37:31 +0200,

Quoted 28 lines · Julian Scheel
Quoted 26 lines · James Courtier-Dutton
Quoted 11 lines · Julian Scheel

Am Dienstag, 19. September 2006 13:56 schrieb Julian Scheel:

Quoted 8 lines

Ok, attached is now what I've done so far. (patch against 1.0.13rc2) This
causes the WM8766 to be silent. Only way to get the noise back is restarting the system without the init-code.
Couldn't find a reason for that behaviour. Maybe you have an idea what could be wrong with that code?

Quoted 9 lines

One more note about that patch:
I know coding-style is quite horrible and it'd probably break pontis. It's just what I hacked together for testing, and as the DAC doesn't seem to understand what I am sending I'd like to get some feedback on the SPI-implementation, maybe that one is faulty? (The WM8766 sheet isn't very detailed about that)

-Julian

After our conversation on IRC and the resulting help I was able to give you, I understand that you managed to fix this.
When are you going to post the completed patch?

Quoted 8 lines
Quoted 2 lines

James

Sadly if been out of work for several days now, because of a tonsilitis. That's the reason, why I haven't finished up the work yet. Hopefully I'll do so next week and post the result then.
Though I haven't yet worked with digital out, which might need some more work, too. But I think I'd post analog-only patches first.

Good to hear. The patch will be a 2.6.20-kernel material, so we have a couple of months until a complete version :)

Anyway, ALSA-1.0.13 is out, and the new patches are open for merge now. Please post a patch fore review at any time.

thanks,

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV