aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ca0106/ca0106_main.c91
1 files changed, 71 insertions, 20 deletions
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 3aac7e6489c6..dac8a5f040ef 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -412,7 +412,9 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu,
412 } 412 }
413 413
414 tmp = reg << 25 | value << 16; 414 tmp = reg << 25 | value << 16;
415 // 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 */
416 /* Not sure what this I2C channel controls. */ 418 /* Not sure what this I2C channel controls. */
417 /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */ 419 /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */
418 420
@@ -430,7 +432,7 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu,
430 /* Wait till the transaction ends */ 432 /* Wait till the transaction ends */
431 while (1) { 433 while (1) {
432 status = snd_ca0106_ptr_read(emu, I2C_A, 0); 434 status = snd_ca0106_ptr_read(emu, I2C_A, 0);
433 //snd_printk("I2C:status=0x%x\n", status); 435 /*snd_printk(KERN_DEBUG "I2C:status=0x%x\n", status);*/
434 timeout++; 436 timeout++;
435 if ((status & I2C_A_ADC_START) == 0) 437 if ((status & I2C_A_ADC_START) == 0)
436 break; 438 break;
@@ -529,7 +531,10 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr
529 channel->number = channel_id; 531 channel->number = channel_id;
530 532
531 channel->use = 1; 533 channel->use = 1;
532 //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 */
533 //channel->interrupt = snd_ca0106_pcm_channel_interrupt; 538 //channel->interrupt = snd_ca0106_pcm_channel_interrupt;
534 channel->epcm = epcm; 539 channel->epcm = epcm;
535 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)
@@ -622,7 +627,10 @@ static int snd_ca0106_pcm_open_capture_channel(struct snd_pcm_substream *substre
622 channel->number = channel_id; 627 channel->number = channel_id;
623 628
624 channel->use = 1; 629 channel->use = 1;
625 //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 */
626 //channel->interrupt = snd_ca0106_pcm_channel_interrupt; 634 //channel->interrupt = snd_ca0106_pcm_channel_interrupt;
627 channel->epcm = epcm; 635 channel->epcm = epcm;
628 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)
@@ -713,9 +721,20 @@ static int snd_ca0106_pcm_prepare_playback(struct snd_pcm_substream *substream)
713 u32 reg71; 721 u32 reg71;
714 int i; 722 int i;
715 723
716 //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 */
717 //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
718 //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 */
719 /* Rate can be set per channel. */ 738 /* Rate can be set per channel. */
720 /* reg40 control host to fifo */ 739 /* reg40 control host to fifo */
721 /* reg71 controls DAC rate. */ 740 /* reg71 controls DAC rate. */
@@ -807,9 +826,20 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream)
807 u32 reg71_set = 0; 826 u32 reg71_set = 0;
808 u32 reg71; 827 u32 reg71;
809 828
810 //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 */
811 //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
812 //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 */
813 /* reg71 controls ADC rate. */ 843 /* reg71 controls ADC rate. */
814 switch (runtime->rate) { 844 switch (runtime->rate) {
815 case 44100: 845 case 44100:
@@ -854,7 +884,14 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream)
854 } 884 }
855 885
856 886
857 //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 */
858 snd_ca0106_ptr_write(emu, 0x13, channel, 0); 895 snd_ca0106_ptr_write(emu, 0x13, channel, 0);
859 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);
860 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
@@ -896,13 +933,13 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream,
896 runtime = s->runtime; 933 runtime = s->runtime;
897 epcm = runtime->private_data; 934 epcm = runtime->private_data;
898 channel = epcm->channel_id; 935 channel = epcm->channel_id;
899 /* snd_printk("channel=%d\n",channel); */ 936 /* snd_printk(KERN_DEBUG "channel=%d\n", channel); */
900 epcm->running = running; 937 epcm->running = running;
901 basic |= (0x1 << channel); 938 basic |= (0x1 << channel);
902 extended |= (0x10 << channel); 939 extended |= (0x10 << channel);
903 snd_pcm_trigger_done(s, substream); 940 snd_pcm_trigger_done(s, substream);
904 } 941 }
905 /* 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); */
906 943
907 switch (cmd) { 944 switch (cmd) {
908 case SNDRV_PCM_TRIGGER_START: 945 case SNDRV_PCM_TRIGGER_START:
@@ -980,8 +1017,13 @@ snd_ca0106_pcm_pointer_playback(struct snd_pcm_substream *substream)
980 ptr=ptr2; 1017 ptr=ptr2;
981 if (ptr >= runtime->buffer_size) 1018 if (ptr >= runtime->buffer_size)
982 ptr -= runtime->buffer_size; 1019 ptr -= runtime->buffer_size;
983 //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 /*
984 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 */
985 return ptr; 1027 return ptr;
986} 1028}
987 1029
@@ -1003,8 +1045,13 @@ snd_ca0106_pcm_pointer_capture(struct snd_pcm_substream *substream)
1003 ptr=ptr2; 1045 ptr=ptr2;
1004 if (ptr >= runtime->buffer_size) 1046 if (ptr >= runtime->buffer_size)
1005 ptr -= runtime->buffer_size; 1047 ptr -= runtime->buffer_size;
1006 //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 /*
1007 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 */
1008 return ptr; 1055 return ptr;
1009} 1056}
1010 1057
@@ -1189,8 +1236,12 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id)
1189 return IRQ_NONE; 1236 return IRQ_NONE;
1190 1237
1191 stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0); 1238 stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0);
1192 //snd_printk("interrupt status = 0x%08x, stat76=0x%08x\n", status, stat76); 1239 /*
1193 //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 */
1194 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. */
1195 for(i = 0; i < 4; i++) { 1246 for(i = 0; i < 4; i++) {
1196 pchannel = &(chip->playback_channels[i]); 1247 pchannel = &(chip->playback_channels[i]);
@@ -1478,7 +1529,7 @@ static void ca0106_init_chip(struct snd_ca0106 *chip, int resume)
1478 int size, n; 1529 int size, n;
1479 1530
1480 size = ARRAY_SIZE(i2c_adc_init); 1531 size = ARRAY_SIZE(i2c_adc_init);
1481 /* snd_printk("I2C:array size=0x%x\n", size); */ 1532 /* snd_printk(KERN_DEBUG "I2C:array size=0x%x\n", size); */
1482 for (n = 0; n < size; n++) 1533 for (n = 0; n < size; n++)
1483 snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], 1534 snd_ca0106_i2c_write(chip, i2c_adc_init[n][0],
1484 i2c_adc_init[n][1]); 1535 i2c_adc_init[n][1]);