[ALSA] snd-ca0106: Fixes sound output for Creative Audigy SE aka.SB0570.

Modules: CA0106 driver

Fixes ALSA bug#1636

Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 5964cdc..1cf6f1f 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -183,6 +183,17 @@
 	   .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]",
@@ -273,6 +284,20 @@
 	spin_unlock_irqrestore(&emu->emu_lock, flags);
 }
 
+int snd_ca0106_spi_write(struct snd_ca0106 *emu,
+				u32 value)
+{
+	snd_ca0106_ptr_write(emu, SPI, 0, value);
+	return 0;
+}
+
+int snd_ca0106_spi_read(struct snd_ca0106 *emu,
+				u32 *value)
+{
+	*value = snd_ca0106_ptr_read(emu, SPI, 0);
+	return 0;
+}
+		
 int snd_ca0106_i2c_write(struct snd_ca0106 *emu,
 				u32 reg,
 				u32 value)
@@ -1304,6 +1329,13 @@
         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. */
+		u32 tmp;
+	        snd_ca0106_spi_write(chip, 0xf0622); /* Enable speakers output. */
+	        snd_ca0106_spi_read(chip, &tmp); /* Read the value. */
+	        snd_ca0106_spi_write(chip, 0xe1400);
+	        snd_ca0106_spi_read(chip, &tmp); /* Read the value. */
+	}
 
 	if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,
 				  chip, &ops)) < 0) {