[PATCH] [UBUNTU:sound] Fix sound output for Sound Blaster Audigy SE [SB0570] and Shuttle XPC SD11G5

crimsun at fungus.sh.nu crimsun at fungus.sh.nu
Sat Jan 14 01:58:35 UTC 2006


Hi all,

Attached please find git-format-patch output against 2.6.15-12.18 (WIP)
that fixes sound output for two devices that use the snd-ca0106 ALSA
driver. Both fixes have already been committed in ALSA cvs.

Thanks,
-- 
Daniel T. Chen            crimsun at ubuntu.com
GPG key:   www.sh.nu/~crimsun/pubkey.gpg.asc
-------------- next part --------------
Subject: [PATCH] [UBUNTU:sound] Fix sound output for Sound Blaster Audigy SE [SB0570] and Shuttle XPC SD11G5

UpstreamStatus: Committed in upstream cvs

Reference: http://cvs.sourceforge.net/viewcvs.py/alsa/alsa-kernel/pci/ca0106/ca0106_main.c (revisions 1.2[7-9]), ALSA bugs #1636 and #1600

A new Sound Blaster Audigy SE model [SB0570] uses a new DAC, requiring
an update, otherwise only static is heard when snd-ca0106 is loaded
regardless of manipulating the mixer controls. Confirmed fix in
debugging with "EloraKun" on Friday, January 13, 2006 in #ubuntu (this
is another instance of ALSA bug #1636). Additionally, the Shuttle XPC
SD11G5 device has a Sound Blaster Live! 24-bit EAX high-definition 7.1
audio processor that uses this ca0106 driver (this is ALSA bug #1600).
Both fixes were committed by James Courtier-Dutton.

Signed-off-by: Daniel T Chen <crimsun at fungus.sh.nu>

---

 sound/pci/ca0106/ca0106.h      |    1 
 sound/pci/ca0106/ca0106_main.c |   83 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+), 0 deletions(-)

b1a84c45c63548c4341a188c62313ec1280ff09b
diff --git a/sound/pci/ca0106/ca0106.h b/sound/pci/ca0106/ca0106.h
index 9a4b640..9e92fac 100644
--- a/sound/pci/ca0106/ca0106.h
+++ b/sound/pci/ca0106/ca0106.h
@@ -579,6 +579,7 @@ typedef struct {
         int ac97;
 	int gpio_type;
 	int i2c_adc;
+	int spi_dac;
 } ca0106_details_t;
 
 // definition of the chip-specific record
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 389d967..0950883 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -183,6 +183,17 @@ static ca0106_details_t ca0106_chip_deta
 	   .name   = "Live! 7.1 24bit [SB0413]",
 	   .gpio_type = 1,
 	   .i2c_adc = 1 } ,
+	 /* New Audigy SE. Has a different DAC. */
+	 /* SB0570:
+	  * CTRL:CA0106-DAT
+	  * ADC: WM8768GEDS
+	  * DAC: WM8775EDS
+	  */
+	 { .serial = 0x100a1102,
+	   .name   = "Audigy SE [SB0570]",
+	   .gpio_type = 1,
+	   .i2c_adc = 1,
+	   .spi_dac = 1 } ,
 	 /* MSI K8N Diamond Motherboard with onboard SB Live 24bit without AC97 */
 	 { .serial = 0x10091462,
 	   .name   = "MSI K8N Diamond MB [SB0438]",
@@ -196,6 +207,15 @@ static ca0106_details_t ca0106_chip_deta
 	   .name   = "Shuttle XPC SD31P [SD31P]",
 	   .gpio_type = 1,
 	   .i2c_adc = 1 } ,
+	 /* Shuttle XPC SD11G5 which has an onboard Creative Labs
+	  * Sound Blaster Live! 24-bit EAX
+	  * high-definition 7.1 audio processor".
+	  * Fixes ALSA bug#1600
+	  */
+	 { .serial = 0x30411297,
+	   .name = "Shuttle XPC SD11G5 [SD11G5]",
+	   .gpio_type = 1,
+	   .i2c_adc = 1 } ,
 	 { .serial = 0,
 	   .name   = "AudigyLS [Unknown]" }
 };
@@ -271,6 +291,38 @@ void snd_ca0106_ptr_write(ca0106_t *emu,
 	spin_unlock_irqrestore(&emu->emu_lock, flags);
 }
 
+int snd_ca0106_spi_write(ca0106_t *emu,
+				  unsigned int data)
+{
+	unsigned int reset, set;
+	unsigned int reg, tmp;
+	int n, result;
+	reg = SPI;
+	if (data > 0xffff) /* Only 16bit values allowed */
+		return 1;
+	tmp = snd_ca0106_ptr_read(emu, reg, 0);
+	reset = (tmp & ~0x3ffff) | 0x20000; /* Set xxx20000 */
+	set = reset | 0x10000; /* Set xxx1xxxx */
+	snd_ca0106_ptr_write(emu, reg, 0, reset | data);
+	tmp = snd_ca0106_ptr_read(emu, reg, 0); /* write post */
+	snd_ca0106_ptr_write(emu, reg, 0, set | data);
+	result = 1;
+	/* Wait for status bit to return to 0 */
+	for (n = 0; n < 100; n++) {
+		udelay(10);
+		tmp = snd_ca0106_ptr_read(emu, reg, 0);
+		if (!(tmp & 0x10000)) {
+			result = 0;
+			break;
+		}
+	}
+	if (result) /* Timed out */
+		return 1;
+	snd_ca0106_ptr_write(emu, reg, 0, reset | data);
+	tmp = snd_ca0106_ptr_read(emu, reg, 0); /* Write post */
+	return 0;
+}
+ 
 int snd_ca0106_i2c_write(ca0106_t *emu,
 				u32 reg,
 				u32 value)
@@ -1140,6 +1192,30 @@ static int __devinit snd_ca0106_pcm(ca01
 	return 0;
 }
 
+static unsigned int spi_dac_init[] = {
+	0x00ff,
+	0x02ff,
+	0x0400,
+	0x0520,
+	0x0600,
+	0x08ff,
+	0x0aff,
+	0x0cff,
+	0x0eff,
+	0x10ff,
+	0x1200,
+	0x1400,
+	0x1480,
+	0x1800,
+	0x1aff,
+	0x1cff,
+	0x1e00,
+	0x0530,
+	0x0602,
+	0x0622,
+	0x1400,
+};
+
 static int __devinit snd_ca0106_create(snd_card_t *card,
 					 struct pci_dev *pci,
 					 ca0106_t **rchip)
@@ -1320,6 +1396,13 @@ static int __devinit snd_ca0106_create(s
         if (chip->details->i2c_adc == 1) { /* The SB0410 and SB0413 use I2C to control ADC. */
 	        snd_ca0106_i2c_write(chip, ADC_MUX, ADC_MUX_LINEIN); /* Enable Line-in capture. MIC in currently untested. */
 	}
+	if (chip->details->spi_dac == 1) { /* The SB0570 use SPI to control DAC. */
+		int size, n;
+
+		size = ARRAY_SIZE(spi_dac_init);
+		for (n=0; n < size; n++)
+			snd_ca0106_spi_write(chip, spi_dac_init[n]);
+	}
 
 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
 				  chip, &ops)) < 0) {
-- 
1.0.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20060113/a9147e4f/attachment.sig>


More information about the kernel-team mailing list