diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-03-23 19:35:50 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-03-23 19:35:50 -0400 |
commit | e0d2054fd3cf167395390dc1758644486c782707 (patch) | |
tree | 108fd3138f0246f5fa17454680d6d04a670ed6d8 /sound/pci/ca0106 | |
parent | d807500a2472445d05ce641bf09438e3d72eeb4f (diff) | |
parent | c468ac29e63b9927275a94379d00b367f0f97c43 (diff) |
Merge branch 'topic/misc' into for-linus
Diffstat (limited to 'sound/pci/ca0106')
-rw-r--r-- | sound/pci/ca0106/ca0106_main.c | 91 |
1 files changed, 71 insertions, 20 deletions
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index b116456e7707..a38ff9dd07eb 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -404,7 +404,9 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, | |||
404 | } | 404 | } |
405 | 405 | ||
406 | tmp = reg << 25 | value << 16; | 406 | tmp = reg << 25 | value << 16; |
407 | // snd_printk("I2C-write:reg=0x%x, value=0x%x\n", reg, value); | 407 | /* |
408 | snd_printk(KERN_DEBUG "I2C-write:reg=0x%x, value=0x%x\n", reg, value); | ||
409 | */ | ||
408 | /* Not sure what this I2C channel controls. */ | 410 | /* Not sure what this I2C channel controls. */ |
409 | /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */ | 411 | /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */ |
410 | 412 | ||
@@ -422,7 +424,7 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, | |||
422 | /* Wait till the transaction ends */ | 424 | /* Wait till the transaction ends */ |
423 | while (1) { | 425 | while (1) { |
424 | status = snd_ca0106_ptr_read(emu, I2C_A, 0); | 426 | status = snd_ca0106_ptr_read(emu, I2C_A, 0); |
425 | //snd_printk("I2C:status=0x%x\n", status); | 427 | /*snd_printk(KERN_DEBUG "I2C:status=0x%x\n", status);*/ |
426 | timeout++; | 428 | timeout++; |
427 | if ((status & I2C_A_ADC_START) == 0) | 429 | if ((status & I2C_A_ADC_START) == 0) |
428 | break; | 430 | break; |
@@ -521,7 +523,10 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr | |||
521 | channel->number = channel_id; | 523 | channel->number = channel_id; |
522 | 524 | ||
523 | channel->use = 1; | 525 | channel->use = 1; |
524 | //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); | 526 | /* |
527 | printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", | ||
528 | channel_id, chip, channel); | ||
529 | */ | ||
525 | //channel->interrupt = snd_ca0106_pcm_channel_interrupt; | 530 | //channel->interrupt = snd_ca0106_pcm_channel_interrupt; |
526 | channel->epcm = epcm; | 531 | channel->epcm = epcm; |
527 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) | 532 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) |
@@ -614,7 +619,10 @@ static int snd_ca0106_pcm_open_capture_channel(struct snd_pcm_substream *substre | |||
614 | channel->number = channel_id; | 619 | channel->number = channel_id; |
615 | 620 | ||
616 | channel->use = 1; | 621 | channel->use = 1; |
617 | //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); | 622 | /* |
623 | printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", | ||
624 | channel_id, chip, channel); | ||
625 | */ | ||
618 | //channel->interrupt = snd_ca0106_pcm_channel_interrupt; | 626 | //channel->interrupt = snd_ca0106_pcm_channel_interrupt; |
619 | channel->epcm = epcm; | 627 | channel->epcm = epcm; |
620 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) | 628 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) |
@@ -705,9 +713,20 @@ static int snd_ca0106_pcm_prepare_playback(struct snd_pcm_substream *substream) | |||
705 | u32 reg71; | 713 | u32 reg71; |
706 | int i; | 714 | int i; |
707 | 715 | ||
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)); | 716 | #if 0 /* debug */ |
709 | //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); | 717 | 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); | 718 | "prepare:channel_number=%d, rate=%d, format=0x%x, " |
719 | "channels=%d, buffer_size=%ld, period_size=%ld, " | ||
720 | "periods=%u, frames_to_bytes=%d\n", | ||
721 | channel, runtime->rate, runtime->format, | ||
722 | runtime->channels, runtime->buffer_size, | ||
723 | runtime->period_size, runtime->periods, | ||
724 | frames_to_bytes(runtime, 1)); | ||
725 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", | ||
726 | runtime->dma_addr, runtime->dma_area, table_base); | ||
727 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", | ||
728 | emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); | ||
729 | #endif /* debug */ | ||
711 | /* Rate can be set per channel. */ | 730 | /* Rate can be set per channel. */ |
712 | /* reg40 control host to fifo */ | 731 | /* reg40 control host to fifo */ |
713 | /* reg71 controls DAC rate. */ | 732 | /* reg71 controls DAC rate. */ |
@@ -799,9 +818,20 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream) | |||
799 | u32 reg71_set = 0; | 818 | u32 reg71_set = 0; |
800 | u32 reg71; | 819 | u32 reg71; |
801 | 820 | ||
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)); | 821 | #if 0 /* debug */ |
803 | //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); | 822 | 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); | 823 | "prepare:channel_number=%d, rate=%d, format=0x%x, " |
824 | "channels=%d, buffer_size=%ld, period_size=%ld, " | ||
825 | "periods=%u, frames_to_bytes=%d\n", | ||
826 | channel, runtime->rate, runtime->format, | ||
827 | runtime->channels, runtime->buffer_size, | ||
828 | runtime->period_size, runtime->periods, | ||
829 | frames_to_bytes(runtime, 1)); | ||
830 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", | ||
831 | runtime->dma_addr, runtime->dma_area, table_base); | ||
832 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", | ||
833 | emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); | ||
834 | #endif /* debug */ | ||
805 | /* reg71 controls ADC rate. */ | 835 | /* reg71 controls ADC rate. */ |
806 | switch (runtime->rate) { | 836 | switch (runtime->rate) { |
807 | case 44100: | 837 | case 44100: |
@@ -846,7 +876,14 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream) | |||
846 | } | 876 | } |
847 | 877 | ||
848 | 878 | ||
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)); | 879 | /* |
880 | printk(KERN_DEBUG | ||
881 | "prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, " | ||
882 | "buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n", | ||
883 | channel, runtime->rate, runtime->format, runtime->channels, | ||
884 | runtime->buffer_size, runtime->period_size, | ||
885 | frames_to_bytes(runtime, 1)); | ||
886 | */ | ||
850 | snd_ca0106_ptr_write(emu, 0x13, channel, 0); | 887 | snd_ca0106_ptr_write(emu, 0x13, channel, 0); |
851 | snd_ca0106_ptr_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr); | 888 | 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 | 889 | snd_ca0106_ptr_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size)<<16); // buffer size in bytes |
@@ -888,13 +925,13 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream, | |||
888 | runtime = s->runtime; | 925 | runtime = s->runtime; |
889 | epcm = runtime->private_data; | 926 | epcm = runtime->private_data; |
890 | channel = epcm->channel_id; | 927 | channel = epcm->channel_id; |
891 | /* snd_printk("channel=%d\n",channel); */ | 928 | /* snd_printk(KERN_DEBUG "channel=%d\n", channel); */ |
892 | epcm->running = running; | 929 | epcm->running = running; |
893 | basic |= (0x1 << channel); | 930 | basic |= (0x1 << channel); |
894 | extended |= (0x10 << channel); | 931 | extended |= (0x10 << channel); |
895 | snd_pcm_trigger_done(s, substream); | 932 | snd_pcm_trigger_done(s, substream); |
896 | } | 933 | } |
897 | /* snd_printk("basic=0x%x, extended=0x%x\n",basic, extended); */ | 934 | /* snd_printk(KERN_DEBUG "basic=0x%x, extended=0x%x\n",basic, extended); */ |
898 | 935 | ||
899 | switch (cmd) { | 936 | switch (cmd) { |
900 | case SNDRV_PCM_TRIGGER_START: | 937 | case SNDRV_PCM_TRIGGER_START: |
@@ -972,8 +1009,13 @@ snd_ca0106_pcm_pointer_playback(struct snd_pcm_substream *substream) | |||
972 | ptr=ptr2; | 1009 | ptr=ptr2; |
973 | if (ptr >= runtime->buffer_size) | 1010 | if (ptr >= runtime->buffer_size) |
974 | ptr -= runtime->buffer_size; | 1011 | 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); | 1012 | /* |
976 | 1013 | printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " | |
1014 | "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", | ||
1015 | ptr1, ptr2, ptr, (int)runtime->buffer_size, | ||
1016 | (int)runtime->period_size, (int)runtime->frame_bits, | ||
1017 | (int)runtime->rate); | ||
1018 | */ | ||
977 | return ptr; | 1019 | return ptr; |
978 | } | 1020 | } |
979 | 1021 | ||
@@ -995,8 +1037,13 @@ snd_ca0106_pcm_pointer_capture(struct snd_pcm_substream *substream) | |||
995 | ptr=ptr2; | 1037 | ptr=ptr2; |
996 | if (ptr >= runtime->buffer_size) | 1038 | if (ptr >= runtime->buffer_size) |
997 | ptr -= runtime->buffer_size; | 1039 | 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); | 1040 | /* |
999 | 1041 | printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " | |
1042 | "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", | ||
1043 | ptr1, ptr2, ptr, (int)runtime->buffer_size, | ||
1044 | (int)runtime->period_size, (int)runtime->frame_bits, | ||
1045 | (int)runtime->rate); | ||
1046 | */ | ||
1000 | return ptr; | 1047 | return ptr; |
1001 | } | 1048 | } |
1002 | 1049 | ||
@@ -1181,8 +1228,12 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id) | |||
1181 | return IRQ_NONE; | 1228 | return IRQ_NONE; |
1182 | 1229 | ||
1183 | stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0); | 1230 | stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0); |
1184 | //snd_printk("interrupt status = 0x%08x, stat76=0x%08x\n", status, stat76); | 1231 | /* |
1185 | //snd_printk("ptr=0x%08x\n",snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0)); | 1232 | snd_printk(KERN_DEBUG "interrupt status = 0x%08x, stat76=0x%08x\n", |
1233 | status, stat76); | ||
1234 | snd_printk(KERN_DEBUG "ptr=0x%08x\n", | ||
1235 | snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0)); | ||
1236 | */ | ||
1186 | mask = 0x11; /* 0x1 for one half, 0x10 for the other half period. */ | 1237 | mask = 0x11; /* 0x1 for one half, 0x10 for the other half period. */ |
1187 | for(i = 0; i < 4; i++) { | 1238 | for(i = 0; i < 4; i++) { |
1188 | pchannel = &(chip->playback_channels[i]); | 1239 | pchannel = &(chip->playback_channels[i]); |
@@ -1470,7 +1521,7 @@ static void ca0106_init_chip(struct snd_ca0106 *chip, int resume) | |||
1470 | int size, n; | 1521 | int size, n; |
1471 | 1522 | ||
1472 | size = ARRAY_SIZE(i2c_adc_init); | 1523 | size = ARRAY_SIZE(i2c_adc_init); |
1473 | /* snd_printk("I2C:array size=0x%x\n", size); */ | 1524 | /* snd_printk(KERN_DEBUG "I2C:array size=0x%x\n", size); */ |
1474 | for (n = 0; n < size; n++) | 1525 | for (n = 0; n < size; n++) |
1475 | snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], | 1526 | snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], |
1476 | i2c_adc_init[n][1]); | 1527 | i2c_adc_init[n][1]); |