diff options
author | James Morris <jmorris@namei.org> | 2009-03-26 17:28:11 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-03-26 17:28:11 -0400 |
commit | 1987f17d2266e882862528841429b5bf67bc8fe5 (patch) | |
tree | 5c3fbee88018ab7259a18c10e6320e575d0ed679 /sound/pci/ca0106 | |
parent | 7198e2eeb44b3fe7cc97f997824002da47a9c644 (diff) | |
parent | 0384e2959127a56d0640505d004d8dd92f9c29f5 (diff) |
Merge branch 'master' into next
Diffstat (limited to 'sound/pci/ca0106')
-rw-r--r-- | sound/pci/ca0106/ca0106_main.c | 105 |
1 files changed, 82 insertions, 23 deletions
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 0e62205d4081..df757575798a 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -255,6 +255,14 @@ static struct snd_ca0106_details ca0106_chip_details[] = { | |||
255 | .gpio_type = 2, | 255 | .gpio_type = 2, |
256 | .i2c_adc = 1, | 256 | .i2c_adc = 1, |
257 | .spi_dac = 1 } , | 257 | .spi_dac = 1 } , |
258 | /* Giga-byte GA-G1975X mobo | ||
259 | * Novell bnc#395807 | ||
260 | */ | ||
261 | /* FIXME: the GPIO and I2C setting aren't tested well */ | ||
262 | { .serial = 0x1458a006, | ||
263 | .name = "Giga-byte GA-G1975X", | ||
264 | .gpio_type = 1, | ||
265 | .i2c_adc = 1 }, | ||
258 | /* Shuttle XPC SD31P which has an onboard Creative Labs | 266 | /* Shuttle XPC SD31P which has an onboard Creative Labs |
259 | * Sound Blaster Live! 24-bit EAX | 267 | * Sound Blaster Live! 24-bit EAX |
260 | * high-definition 7.1 audio processor". | 268 | * high-definition 7.1 audio processor". |
@@ -404,7 +412,9 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, | |||
404 | } | 412 | } |
405 | 413 | ||
406 | tmp = reg << 25 | value << 16; | 414 | tmp = reg << 25 | value << 16; |
407 | // snd_printk("I2C-write:reg=0x%x, value=0x%x\n", reg, value); | 415 | /* |
416 | snd_printk(KERN_DEBUG "I2C-write:reg=0x%x, value=0x%x\n", reg, value); | ||
417 | */ | ||
408 | /* Not sure what this I2C channel controls. */ | 418 | /* Not sure what this I2C channel controls. */ |
409 | /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */ | 419 | /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */ |
410 | 420 | ||
@@ -422,7 +432,7 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, | |||
422 | /* Wait till the transaction ends */ | 432 | /* Wait till the transaction ends */ |
423 | while (1) { | 433 | while (1) { |
424 | status = snd_ca0106_ptr_read(emu, I2C_A, 0); | 434 | status = snd_ca0106_ptr_read(emu, I2C_A, 0); |
425 | //snd_printk("I2C:status=0x%x\n", status); | 435 | /*snd_printk(KERN_DEBUG "I2C:status=0x%x\n", status);*/ |
426 | timeout++; | 436 | timeout++; |
427 | if ((status & I2C_A_ADC_START) == 0) | 437 | if ((status & I2C_A_ADC_START) == 0) |
428 | break; | 438 | break; |
@@ -521,7 +531,10 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr | |||
521 | channel->number = channel_id; | 531 | channel->number = channel_id; |
522 | 532 | ||
523 | channel->use = 1; | 533 | channel->use = 1; |
524 | //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); | 534 | /* |
535 | printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", | ||
536 | channel_id, chip, channel); | ||
537 | */ | ||
525 | //channel->interrupt = snd_ca0106_pcm_channel_interrupt; | 538 | //channel->interrupt = snd_ca0106_pcm_channel_interrupt; |
526 | channel->epcm = epcm; | 539 | channel->epcm = epcm; |
527 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) | 540 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) |
@@ -614,7 +627,10 @@ static int snd_ca0106_pcm_open_capture_channel(struct snd_pcm_substream *substre | |||
614 | channel->number = channel_id; | 627 | channel->number = channel_id; |
615 | 628 | ||
616 | channel->use = 1; | 629 | channel->use = 1; |
617 | //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); | 630 | /* |
631 | printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", | ||
632 | channel_id, chip, channel); | ||
633 | */ | ||
618 | //channel->interrupt = snd_ca0106_pcm_channel_interrupt; | 634 | //channel->interrupt = snd_ca0106_pcm_channel_interrupt; |
619 | channel->epcm = epcm; | 635 | channel->epcm = epcm; |
620 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) | 636 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) |
@@ -705,9 +721,20 @@ static int snd_ca0106_pcm_prepare_playback(struct snd_pcm_substream *substream) | |||
705 | u32 reg71; | 721 | u32 reg71; |
706 | int i; | 722 | int i; |
707 | 723 | ||
708 | //snd_printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, periods=%u, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1)); | 724 | #if 0 /* debug */ |
709 | //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); | 725 | snd_printk(KERN_DEBUG |
710 | //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); | 726 | "prepare:channel_number=%d, rate=%d, format=0x%x, " |
727 | "channels=%d, buffer_size=%ld, period_size=%ld, " | ||
728 | "periods=%u, frames_to_bytes=%d\n", | ||
729 | channel, runtime->rate, runtime->format, | ||
730 | runtime->channels, runtime->buffer_size, | ||
731 | runtime->period_size, runtime->periods, | ||
732 | frames_to_bytes(runtime, 1)); | ||
733 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", | ||
734 | runtime->dma_addr, runtime->dma_area, table_base); | ||
735 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", | ||
736 | emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); | ||
737 | #endif /* debug */ | ||
711 | /* Rate can be set per channel. */ | 738 | /* Rate can be set per channel. */ |
712 | /* reg40 control host to fifo */ | 739 | /* reg40 control host to fifo */ |
713 | /* reg71 controls DAC rate. */ | 740 | /* reg71 controls DAC rate. */ |
@@ -799,9 +826,20 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream) | |||
799 | u32 reg71_set = 0; | 826 | u32 reg71_set = 0; |
800 | u32 reg71; | 827 | u32 reg71; |
801 | 828 | ||
802 | //snd_printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, periods=%u, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1)); | 829 | #if 0 /* debug */ |
803 | //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); | 830 | snd_printk(KERN_DEBUG |
804 | //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); | 831 | "prepare:channel_number=%d, rate=%d, format=0x%x, " |
832 | "channels=%d, buffer_size=%ld, period_size=%ld, " | ||
833 | "periods=%u, frames_to_bytes=%d\n", | ||
834 | channel, runtime->rate, runtime->format, | ||
835 | runtime->channels, runtime->buffer_size, | ||
836 | runtime->period_size, runtime->periods, | ||
837 | frames_to_bytes(runtime, 1)); | ||
838 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", | ||
839 | runtime->dma_addr, runtime->dma_area, table_base); | ||
840 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", | ||
841 | emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); | ||
842 | #endif /* debug */ | ||
805 | /* reg71 controls ADC rate. */ | 843 | /* reg71 controls ADC rate. */ |
806 | switch (runtime->rate) { | 844 | switch (runtime->rate) { |
807 | case 44100: | 845 | case 44100: |
@@ -846,7 +884,14 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream) | |||
846 | } | 884 | } |
847 | 885 | ||
848 | 886 | ||
849 | //printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, frames_to_bytes(runtime, 1)); | 887 | /* |
888 | printk(KERN_DEBUG | ||
889 | "prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, " | ||
890 | "buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n", | ||
891 | channel, runtime->rate, runtime->format, runtime->channels, | ||
892 | runtime->buffer_size, runtime->period_size, | ||
893 | frames_to_bytes(runtime, 1)); | ||
894 | */ | ||
850 | snd_ca0106_ptr_write(emu, 0x13, channel, 0); | 895 | snd_ca0106_ptr_write(emu, 0x13, channel, 0); |
851 | snd_ca0106_ptr_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr); | 896 | snd_ca0106_ptr_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr); |
852 | snd_ca0106_ptr_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size)<<16); // buffer size in bytes | 897 | snd_ca0106_ptr_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size)<<16); // buffer size in bytes |
@@ -888,13 +933,13 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream, | |||
888 | runtime = s->runtime; | 933 | runtime = s->runtime; |
889 | epcm = runtime->private_data; | 934 | epcm = runtime->private_data; |
890 | channel = epcm->channel_id; | 935 | channel = epcm->channel_id; |
891 | /* snd_printk("channel=%d\n",channel); */ | 936 | /* snd_printk(KERN_DEBUG "channel=%d\n", channel); */ |
892 | epcm->running = running; | 937 | epcm->running = running; |
893 | basic |= (0x1 << channel); | 938 | basic |= (0x1 << channel); |
894 | extended |= (0x10 << channel); | 939 | extended |= (0x10 << channel); |
895 | snd_pcm_trigger_done(s, substream); | 940 | snd_pcm_trigger_done(s, substream); |
896 | } | 941 | } |
897 | /* snd_printk("basic=0x%x, extended=0x%x\n",basic, extended); */ | 942 | /* snd_printk(KERN_DEBUG "basic=0x%x, extended=0x%x\n",basic, extended); */ |
898 | 943 | ||
899 | switch (cmd) { | 944 | switch (cmd) { |
900 | case SNDRV_PCM_TRIGGER_START: | 945 | case SNDRV_PCM_TRIGGER_START: |
@@ -972,8 +1017,13 @@ snd_ca0106_pcm_pointer_playback(struct snd_pcm_substream *substream) | |||
972 | ptr=ptr2; | 1017 | ptr=ptr2; |
973 | if (ptr >= runtime->buffer_size) | 1018 | if (ptr >= runtime->buffer_size) |
974 | ptr -= runtime->buffer_size; | 1019 | ptr -= runtime->buffer_size; |
975 | //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate); | 1020 | /* |
976 | 1021 | printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " | |
1022 | "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", | ||
1023 | ptr1, ptr2, ptr, (int)runtime->buffer_size, | ||
1024 | (int)runtime->period_size, (int)runtime->frame_bits, | ||
1025 | (int)runtime->rate); | ||
1026 | */ | ||
977 | return ptr; | 1027 | return ptr; |
978 | } | 1028 | } |
979 | 1029 | ||
@@ -995,8 +1045,13 @@ snd_ca0106_pcm_pointer_capture(struct snd_pcm_substream *substream) | |||
995 | ptr=ptr2; | 1045 | ptr=ptr2; |
996 | if (ptr >= runtime->buffer_size) | 1046 | if (ptr >= runtime->buffer_size) |
997 | ptr -= runtime->buffer_size; | 1047 | ptr -= runtime->buffer_size; |
998 | //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate); | 1048 | /* |
999 | 1049 | printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " | |
1050 | "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", | ||
1051 | ptr1, ptr2, ptr, (int)runtime->buffer_size, | ||
1052 | (int)runtime->period_size, (int)runtime->frame_bits, | ||
1053 | (int)runtime->rate); | ||
1054 | */ | ||
1000 | return ptr; | 1055 | return ptr; |
1001 | } | 1056 | } |
1002 | 1057 | ||
@@ -1181,8 +1236,12 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id) | |||
1181 | return IRQ_NONE; | 1236 | return IRQ_NONE; |
1182 | 1237 | ||
1183 | stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0); | 1238 | stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0); |
1184 | //snd_printk("interrupt status = 0x%08x, stat76=0x%08x\n", status, stat76); | 1239 | /* |
1185 | //snd_printk("ptr=0x%08x\n",snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0)); | 1240 | snd_printk(KERN_DEBUG "interrupt status = 0x%08x, stat76=0x%08x\n", |
1241 | status, stat76); | ||
1242 | snd_printk(KERN_DEBUG "ptr=0x%08x\n", | ||
1243 | snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0)); | ||
1244 | */ | ||
1186 | mask = 0x11; /* 0x1 for one half, 0x10 for the other half period. */ | 1245 | mask = 0x11; /* 0x1 for one half, 0x10 for the other half period. */ |
1187 | for(i = 0; i < 4; i++) { | 1246 | for(i = 0; i < 4; i++) { |
1188 | pchannel = &(chip->playback_channels[i]); | 1247 | pchannel = &(chip->playback_channels[i]); |
@@ -1470,7 +1529,7 @@ static void ca0106_init_chip(struct snd_ca0106 *chip, int resume) | |||
1470 | int size, n; | 1529 | int size, n; |
1471 | 1530 | ||
1472 | size = ARRAY_SIZE(i2c_adc_init); | 1531 | size = ARRAY_SIZE(i2c_adc_init); |
1473 | /* snd_printk("I2C:array size=0x%x\n", size); */ | 1532 | /* snd_printk(KERN_DEBUG "I2C:array size=0x%x\n", size); */ |
1474 | for (n = 0; n < size; n++) | 1533 | for (n = 0; n < size; n++) |
1475 | snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], | 1534 | snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], |
1476 | i2c_adc_init[n][1]); | 1535 | i2c_adc_init[n][1]); |
@@ -1707,9 +1766,9 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci, | |||
1707 | return -ENOENT; | 1766 | return -ENOENT; |
1708 | } | 1767 | } |
1709 | 1768 | ||
1710 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1769 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1711 | if (card == NULL) | 1770 | if (err < 0) |
1712 | return -ENOMEM; | 1771 | return err; |
1713 | 1772 | ||
1714 | err = snd_ca0106_create(dev, card, pci, &chip); | 1773 | err = snd_ca0106_create(dev, card, pci, &chip); |
1715 | if (err < 0) | 1774 | if (err < 0) |