vserver 2.0 rc7
[linux-2.6.git] / sound / pci / ca0106 / ca0106_main.c
index a6f3fa5..82533b4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  Copyright (c) 2004 James Courtier-Dutton <James@superbug.demon.co.uk>
  *  Driver CA0106 chips. e.g. Sound Blaster Audigy LS and Live 24bit
- *  Version: 0.0.21
+ *  Version: 0.0.22
  *
  *  FEATURES currently supported:
  *    Front, Rear and Center/LFE.
@@ -75,6 +75,8 @@
  *  0.0.21
  *    Add 4 capture channels. (SPDIF only comes in on channel 0. )
  *    Add SPDIF capture using optional digital I/O module for SB Live 24bit. (Analog capture does not yet work.)
+ *  0.0.22
+ *    Add support for MSI K8N Diamond Motherboard with onboard SB Live 24bit without AC97. From kiksen, bug #901
  *
  *  BUGS:
  *    Some stability problems when unloading the snd-ca0106 kernel module.
@@ -169,6 +171,7 @@ static ca0106_names_t ca0106_chip_names[] = {
         { 0x10051102, "AudigyLS [SB0310b]"} , /* Unknown AudigyLS that also says SB0310 on it */
         { 0x10061102, "Live! 7.1 24bit [SB0410]"} , /* New Sound Blaster Live! 7.1 24bit. This does not have an AC97. 53SB041000001 */
         { 0x10071102, "Live! 7.1 24bit [SB0413]"} , /* New Dell Sound Blaster Live! 7.1 24bit. This does not have an AC97.  */
+        { 0x10091462, "MSI K8N Diamond MB [SB0438]"}, /* MSI K8N Diamond Motherboard with onboard SB Live 24bit without AC97 */
         { 0, "AudigyLS [Unknown]" }
 };
 
@@ -184,9 +187,9 @@ static snd_pcm_hardware_t snd_ca0106_playback_hw = {
        .rate_max =             192000,
        .channels_min =         2,  //1,
        .channels_max =         2,  //6,
-       .buffer_bytes_max =     (32*1024),
+       .buffer_bytes_max =     ((65536 - 64) * 8),
        .period_bytes_min =     64,
-       .period_bytes_max =     (16*1024),
+       .period_bytes_max =     (65536 - 64),
        .periods_min =          2,
        .periods_max =          8,
        .fifo_size =            0,
@@ -203,9 +206,9 @@ static snd_pcm_hardware_t snd_ca0106_capture_hw = {
        .rate_max =             48000,
        .channels_min =         2,
        .channels_max =         2,
-       .buffer_bytes_max =     (32*1024),
+       .buffer_bytes_max =     ((65536 - 64) * 8),
        .period_bytes_min =     64,
-       .period_bytes_max =     (16*1024),
+       .period_bytes_max =     (65536 - 64),
        .periods_min =          2,
        .periods_max =          2,
        .fifo_size =            0,
@@ -510,6 +513,8 @@ static int snd_ca0106_pcm_prepare_playback(snd_pcm_substream_t *substream)
        snd_ca0106_ptr_write(emu, PLAYBACK_LIST_PTR, channel, 0);
        snd_ca0106_ptr_write(emu, PLAYBACK_DMA_ADDR, channel, runtime->dma_addr);
        snd_ca0106_ptr_write(emu, PLAYBACK_PERIOD_SIZE, channel, frames_to_bytes(runtime, runtime->period_size)<<16); // buffer size in bytes
+       /* FIXME  test what 0 bytes does. */
+       snd_ca0106_ptr_write(emu, PLAYBACK_PERIOD_SIZE, channel, 0); // buffer size in bytes
        snd_ca0106_ptr_write(emu, PLAYBACK_POINTER, channel, 0);
        snd_ca0106_ptr_write(emu, 0x07, channel, 0x0);
        snd_ca0106_ptr_write(emu, 0x08, channel, 0);
@@ -1133,7 +1138,9 @@ static int __devinit snd_ca0106_create(snd_card_t *card,
         snd_ca0106_ptr_write(chip, CAPTURE_SOURCE, 0x0, 0x333300e4); /* Select MIC, Line in, TAD in, AUX in */
        chip->capture_source = 3; /* Set CAPTURE_SOURCE */
 
-        if ((chip->serial == 0x10061102) || (chip->serial == 0x10071102) ) { /* The SB0410 and SB0413 use GPIO differently. */
+        if ((chip->serial == 0x10061102) || 
+           (chip->serial == 0x10071102) ||
+           (chip->serial == 0x10091462)) { /* The SB0410 and SB0413 use GPIO differently. */
                /* FIXME: Still need to find out what the other GPIO bits do. E.g. For digital spdif out. */
                outl(0x0, chip->port+GPIO);
                //outl(0x00f0e000, chip->port+GPIO); /* Analog */
@@ -1200,7 +1207,9 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci,
                snd_card_free(card);
                return err;
        }
-        if ((chip->serial != 0x10061102) && (chip->serial != 0x10071102) ) { /* The SB0410 and SB0413 do not have an ac97 chip. */
+        if ((chip->serial != 0x10061102) && 
+           (chip->serial != 0x10071102) && 
+           (chip->serial != 0x10091462) ) { /* The SB0410 and SB0413 do not have an ac97 chip. */
                if ((err = snd_ca0106_ac97(chip)) < 0) {
                        snd_card_free(card);
                        return err;