diff options
Diffstat (limited to 'sound/pci/emu10k1/emupcm.c')
-rw-r--r-- | sound/pci/emu10k1/emupcm.c | 147 |
1 files changed, 115 insertions, 32 deletions
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index 717e92ec9e0a..ab4f5df5241b 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c | |||
@@ -147,7 +147,7 @@ static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm * epcm, int voic | |||
147 | 1, | 147 | 1, |
148 | &epcm->extra); | 148 | &epcm->extra); |
149 | if (err < 0) { | 149 | if (err < 0) { |
150 | // printk("pcm_channel_alloc: failed extra: voices=%d, frame=%d\n", voices, frame); | 150 | /* printk("pcm_channel_alloc: failed extra: voices=%d, frame=%d\n", voices, frame); */ |
151 | for (i = 0; i < voices; i++) { | 151 | for (i = 0; i < voices; i++) { |
152 | snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); | 152 | snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); |
153 | epcm->voices[i] = NULL; | 153 | epcm->voices[i] = NULL; |
@@ -339,7 +339,7 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu, | |||
339 | } | 339 | } |
340 | } | 340 | } |
341 | 341 | ||
342 | // setup routing | 342 | /* setup routing */ |
343 | if (emu->audigy) { | 343 | if (emu->audigy) { |
344 | snd_emu10k1_ptr_write(emu, A_FXRT1, voice, | 344 | snd_emu10k1_ptr_write(emu, A_FXRT1, voice, |
345 | snd_emu10k1_compose_audigy_fxrt1(send_routing)); | 345 | snd_emu10k1_compose_audigy_fxrt1(send_routing)); |
@@ -353,12 +353,15 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu, | |||
353 | } else | 353 | } else |
354 | snd_emu10k1_ptr_write(emu, FXRT, voice, | 354 | snd_emu10k1_ptr_write(emu, FXRT, voice, |
355 | snd_emu10k1_compose_send_routing(send_routing)); | 355 | snd_emu10k1_compose_send_routing(send_routing)); |
356 | // Stop CA | 356 | /* Stop CA */ |
357 | // Assumption that PT is already 0 so no harm overwriting | 357 | /* Assumption that PT is already 0 so no harm overwriting */ |
358 | snd_emu10k1_ptr_write(emu, PTRX, voice, (send_amount[0] << 8) | send_amount[1]); | 358 | snd_emu10k1_ptr_write(emu, PTRX, voice, (send_amount[0] << 8) | send_amount[1]); |
359 | snd_emu10k1_ptr_write(emu, DSL, voice, end_addr | (send_amount[3] << 24)); | 359 | snd_emu10k1_ptr_write(emu, DSL, voice, end_addr | (send_amount[3] << 24)); |
360 | snd_emu10k1_ptr_write(emu, PSST, voice, start_addr | (send_amount[2] << 24)); | 360 | snd_emu10k1_ptr_write(emu, PSST, voice, start_addr | (send_amount[2] << 24)); |
361 | pitch_target = emu10k1_calc_pitch_target(runtime->rate); | 361 | if (emu->card_capabilities->emu1010) |
362 | pitch_target = PITCH_48000; /* Disable interpolators on emu1010 card */ | ||
363 | else | ||
364 | pitch_target = emu10k1_calc_pitch_target(runtime->rate); | ||
362 | if (extra) | 365 | if (extra) |
363 | snd_emu10k1_ptr_write(emu, CCCA, voice, start_addr | | 366 | snd_emu10k1_ptr_write(emu, CCCA, voice, start_addr | |
364 | emu10k1_select_interprom(pitch_target) | | 367 | emu10k1_select_interprom(pitch_target) | |
@@ -367,14 +370,14 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu, | |||
367 | snd_emu10k1_ptr_write(emu, CCCA, voice, (start_addr + ccis) | | 370 | snd_emu10k1_ptr_write(emu, CCCA, voice, (start_addr + ccis) | |
368 | emu10k1_select_interprom(pitch_target) | | 371 | emu10k1_select_interprom(pitch_target) | |
369 | (w_16 ? 0 : CCCA_8BITSELECT)); | 372 | (w_16 ? 0 : CCCA_8BITSELECT)); |
370 | // Clear filter delay memory | 373 | /* Clear filter delay memory */ |
371 | snd_emu10k1_ptr_write(emu, Z1, voice, 0); | 374 | snd_emu10k1_ptr_write(emu, Z1, voice, 0); |
372 | snd_emu10k1_ptr_write(emu, Z2, voice, 0); | 375 | snd_emu10k1_ptr_write(emu, Z2, voice, 0); |
373 | // invalidate maps | 376 | /* invalidate maps */ |
374 | silent_page = ((unsigned int)emu->silent_page.addr << 1) | MAP_PTI_MASK; | 377 | silent_page = ((unsigned int)emu->silent_page.addr << 1) | MAP_PTI_MASK; |
375 | snd_emu10k1_ptr_write(emu, MAPA, voice, silent_page); | 378 | snd_emu10k1_ptr_write(emu, MAPA, voice, silent_page); |
376 | snd_emu10k1_ptr_write(emu, MAPB, voice, silent_page); | 379 | snd_emu10k1_ptr_write(emu, MAPB, voice, silent_page); |
377 | // modulation envelope | 380 | /* modulation envelope */ |
378 | snd_emu10k1_ptr_write(emu, CVCF, voice, 0xffff); | 381 | snd_emu10k1_ptr_write(emu, CVCF, voice, 0xffff); |
379 | snd_emu10k1_ptr_write(emu, VTFT, voice, 0xffff); | 382 | snd_emu10k1_ptr_write(emu, VTFT, voice, 0xffff); |
380 | snd_emu10k1_ptr_write(emu, ATKHLDM, voice, 0); | 383 | snd_emu10k1_ptr_write(emu, ATKHLDM, voice, 0); |
@@ -385,12 +388,12 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu, | |||
385 | snd_emu10k1_ptr_write(emu, TREMFRQ, voice, 0); | 388 | snd_emu10k1_ptr_write(emu, TREMFRQ, voice, 0); |
386 | snd_emu10k1_ptr_write(emu, FM2FRQ2, voice, 0); | 389 | snd_emu10k1_ptr_write(emu, FM2FRQ2, voice, 0); |
387 | snd_emu10k1_ptr_write(emu, ENVVAL, voice, 0x8000); | 390 | snd_emu10k1_ptr_write(emu, ENVVAL, voice, 0x8000); |
388 | // volume envelope | 391 | /* volume envelope */ |
389 | snd_emu10k1_ptr_write(emu, ATKHLDV, voice, 0x7f7f); | 392 | snd_emu10k1_ptr_write(emu, ATKHLDV, voice, 0x7f7f); |
390 | snd_emu10k1_ptr_write(emu, ENVVOL, voice, 0x0000); | 393 | snd_emu10k1_ptr_write(emu, ENVVOL, voice, 0x0000); |
391 | // filter envelope | 394 | /* filter envelope */ |
392 | snd_emu10k1_ptr_write(emu, PEFE_FILTERAMOUNT, voice, 0x7f); | 395 | snd_emu10k1_ptr_write(emu, PEFE_FILTERAMOUNT, voice, 0x7f); |
393 | // pitch envelope | 396 | /* pitch envelope */ |
394 | snd_emu10k1_ptr_write(emu, PEFE_PITCHAMOUNT, voice, 0); | 397 | snd_emu10k1_ptr_write(emu, PEFE_PITCHAMOUNT, voice, 0); |
395 | 398 | ||
396 | spin_unlock_irqrestore(&emu->reg_lock, flags); | 399 | spin_unlock_irqrestore(&emu->reg_lock, flags); |
@@ -468,7 +471,7 @@ static int snd_emu10k1_efx_playback_hw_free(struct snd_pcm_substream *substream) | |||
468 | snd_emu10k1_voice_free(epcm->emu, epcm->extra); | 471 | snd_emu10k1_voice_free(epcm->emu, epcm->extra); |
469 | epcm->extra = NULL; | 472 | epcm->extra = NULL; |
470 | } | 473 | } |
471 | for (i=0; i < NUM_EFX_PLAYBACK; i++) { | 474 | for (i = 0; i < NUM_EFX_PLAYBACK; i++) { |
472 | if (epcm->voices[i]) { | 475 | if (epcm->voices[i]) { |
473 | snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); | 476 | snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); |
474 | epcm->voices[i] = NULL; | 477 | epcm->voices[i] = NULL; |
@@ -637,7 +640,7 @@ static void snd_emu10k1_playback_invalidate_cache(struct snd_emu10k1 *emu, int e | |||
637 | stereo = (!extra && runtime->channels == 2); | 640 | stereo = (!extra && runtime->channels == 2); |
638 | sample = snd_pcm_format_width(runtime->format) == 16 ? 0 : 0x80808080; | 641 | sample = snd_pcm_format_width(runtime->format) == 16 ? 0 : 0x80808080; |
639 | ccis = emu10k1_ccis(stereo, sample == 0); | 642 | ccis = emu10k1_ccis(stereo, sample == 0); |
640 | // set cs to 2 * number of cache registers beside the invalidated | 643 | /* set cs to 2 * number of cache registers beside the invalidated */ |
641 | cs = (sample == 0) ? (32-ccis) : (64-ccis+1) >> 1; | 644 | cs = (sample == 0) ? (32-ccis) : (64-ccis+1) >> 1; |
642 | if (cs > 16) cs = 16; | 645 | if (cs > 16) cs = 16; |
643 | for (i = 0; i < cs; i++) { | 646 | for (i = 0; i < cs; i++) { |
@@ -646,14 +649,14 @@ static void snd_emu10k1_playback_invalidate_cache(struct snd_emu10k1 *emu, int e | |||
646 | snd_emu10k1_ptr_write(emu, CD0 + i, voice + 1, sample); | 649 | snd_emu10k1_ptr_write(emu, CD0 + i, voice + 1, sample); |
647 | } | 650 | } |
648 | } | 651 | } |
649 | // reset cache | 652 | /* reset cache */ |
650 | snd_emu10k1_ptr_write(emu, CCR_CACHEINVALIDSIZE, voice, 0); | 653 | snd_emu10k1_ptr_write(emu, CCR_CACHEINVALIDSIZE, voice, 0); |
651 | snd_emu10k1_ptr_write(emu, CCR_READADDRESS, voice, cra); | 654 | snd_emu10k1_ptr_write(emu, CCR_READADDRESS, voice, cra); |
652 | if (stereo) { | 655 | if (stereo) { |
653 | snd_emu10k1_ptr_write(emu, CCR_CACHEINVALIDSIZE, voice + 1, 0); | 656 | snd_emu10k1_ptr_write(emu, CCR_CACHEINVALIDSIZE, voice + 1, 0); |
654 | snd_emu10k1_ptr_write(emu, CCR_READADDRESS, voice + 1, cra); | 657 | snd_emu10k1_ptr_write(emu, CCR_READADDRESS, voice + 1, cra); |
655 | } | 658 | } |
656 | // fill cache | 659 | /* fill cache */ |
657 | snd_emu10k1_ptr_write(emu, CCR_CACHEINVALIDSIZE, voice, ccis); | 660 | snd_emu10k1_ptr_write(emu, CCR_CACHEINVALIDSIZE, voice, ccis); |
658 | if (stereo) { | 661 | if (stereo) { |
659 | snd_emu10k1_ptr_write(emu, CCR_CACHEINVALIDSIZE, voice+1, ccis); | 662 | snd_emu10k1_ptr_write(emu, CCR_CACHEINVALIDSIZE, voice+1, ccis); |
@@ -698,7 +701,10 @@ static void snd_emu10k1_playback_trigger_voice(struct snd_emu10k1 *emu, struct s | |||
698 | voice = evoice->number; | 701 | voice = evoice->number; |
699 | 702 | ||
700 | pitch = snd_emu10k1_rate_to_pitch(runtime->rate) >> 8; | 703 | pitch = snd_emu10k1_rate_to_pitch(runtime->rate) >> 8; |
701 | pitch_target = emu10k1_calc_pitch_target(runtime->rate); | 704 | if (emu->card_capabilities->emu1010) |
705 | pitch_target = PITCH_48000; /* Disable interpolators on emu1010 card */ | ||
706 | else | ||
707 | pitch_target = emu10k1_calc_pitch_target(runtime->rate); | ||
702 | snd_emu10k1_ptr_write(emu, PTRX_PITCHTARGET, voice, pitch_target); | 708 | snd_emu10k1_ptr_write(emu, PTRX_PITCHTARGET, voice, pitch_target); |
703 | if (master || evoice->epcm->type == PLAYBACK_EFX) | 709 | if (master || evoice->epcm->type == PLAYBACK_EFX) |
704 | snd_emu10k1_ptr_write(emu, CPF_CURRENTPITCH, voice, pitch_target); | 710 | snd_emu10k1_ptr_write(emu, CPF_CURRENTPITCH, voice, pitch_target); |
@@ -732,7 +738,7 @@ static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream, | |||
732 | struct snd_emu10k1_pcm_mixer *mix; | 738 | struct snd_emu10k1_pcm_mixer *mix; |
733 | int result = 0; | 739 | int result = 0; |
734 | 740 | ||
735 | // printk("trigger - emu10k1 = 0x%x, cmd = %i, pointer = %i\n", (int)emu, cmd, substream->ops->pointer(substream)); | 741 | /* printk("trigger - emu10k1 = 0x%x, cmd = %i, pointer = %i\n", (int)emu, cmd, substream->ops->pointer(substream)); */ |
736 | spin_lock(&emu->reg_lock); | 742 | spin_lock(&emu->reg_lock); |
737 | switch (cmd) { | 743 | switch (cmd) { |
738 | case SNDRV_PCM_TRIGGER_START: | 744 | case SNDRV_PCM_TRIGGER_START: |
@@ -778,10 +784,10 @@ static int snd_emu10k1_capture_trigger(struct snd_pcm_substream *substream, | |||
778 | switch (cmd) { | 784 | switch (cmd) { |
779 | case SNDRV_PCM_TRIGGER_START: | 785 | case SNDRV_PCM_TRIGGER_START: |
780 | case SNDRV_PCM_TRIGGER_RESUME: | 786 | case SNDRV_PCM_TRIGGER_RESUME: |
781 | // hmm this should cause full and half full interrupt to be raised? | 787 | /* hmm this should cause full and half full interrupt to be raised? */ |
782 | outl(epcm->capture_ipr, emu->port + IPR); | 788 | outl(epcm->capture_ipr, emu->port + IPR); |
783 | snd_emu10k1_intr_enable(emu, epcm->capture_inte); | 789 | snd_emu10k1_intr_enable(emu, epcm->capture_inte); |
784 | // printk("adccr = 0x%x, adcbs = 0x%x\n", epcm->adccr, epcm->adcbs); | 790 | /* printk("adccr = 0x%x, adcbs = 0x%x\n", epcm->adccr, epcm->adcbs); */ |
785 | switch (epcm->type) { | 791 | switch (epcm->type) { |
786 | case CAPTURE_AC97ADC: | 792 | case CAPTURE_AC97ADC: |
787 | snd_emu10k1_ptr_write(emu, ADCCR, 0, epcm->capture_cr_val); | 793 | snd_emu10k1_ptr_write(emu, ADCCR, 0, epcm->capture_cr_val); |
@@ -790,6 +796,7 @@ static int snd_emu10k1_capture_trigger(struct snd_pcm_substream *substream, | |||
790 | if (emu->audigy) { | 796 | if (emu->audigy) { |
791 | snd_emu10k1_ptr_write(emu, A_FXWC1, 0, epcm->capture_cr_val); | 797 | snd_emu10k1_ptr_write(emu, A_FXWC1, 0, epcm->capture_cr_val); |
792 | snd_emu10k1_ptr_write(emu, A_FXWC2, 0, epcm->capture_cr_val2); | 798 | snd_emu10k1_ptr_write(emu, A_FXWC2, 0, epcm->capture_cr_val2); |
799 | snd_printdd("cr_val=0x%x, cr_val2=0x%x\n", epcm->capture_cr_val, epcm->capture_cr_val2); | ||
793 | } else | 800 | } else |
794 | snd_emu10k1_ptr_write(emu, FXWC, 0, epcm->capture_cr_val); | 801 | snd_emu10k1_ptr_write(emu, FXWC, 0, epcm->capture_cr_val); |
795 | break; | 802 | break; |
@@ -851,7 +858,7 @@ static snd_pcm_uframes_t snd_emu10k1_playback_pointer(struct snd_pcm_substream * | |||
851 | ptr -= runtime->buffer_size; | 858 | ptr -= runtime->buffer_size; |
852 | } | 859 | } |
853 | #endif | 860 | #endif |
854 | // printk("ptr = 0x%x, buffer_size = 0x%x, period_size = 0x%x\n", ptr, runtime->buffer_size, runtime->period_size); | 861 | /* printk("ptr = 0x%x, buffer_size = 0x%x, period_size = 0x%x\n", ptr, runtime->buffer_size, runtime->period_size); */ |
855 | return ptr; | 862 | return ptr; |
856 | } | 863 | } |
857 | 864 | ||
@@ -868,7 +875,7 @@ static int snd_emu10k1_efx_playback_trigger(struct snd_pcm_substream *substream, | |||
868 | spin_lock(&emu->reg_lock); | 875 | spin_lock(&emu->reg_lock); |
869 | switch (cmd) { | 876 | switch (cmd) { |
870 | case SNDRV_PCM_TRIGGER_START: | 877 | case SNDRV_PCM_TRIGGER_START: |
871 | // prepare voices | 878 | /* prepare voices */ |
872 | for (i = 0; i < NUM_EFX_PLAYBACK; i++) { | 879 | for (i = 0; i < NUM_EFX_PLAYBACK; i++) { |
873 | snd_emu10k1_playback_invalidate_cache(emu, 0, epcm->voices[i]); | 880 | snd_emu10k1_playback_invalidate_cache(emu, 0, epcm->voices[i]); |
874 | } | 881 | } |
@@ -917,7 +924,7 @@ static snd_pcm_uframes_t snd_emu10k1_capture_pointer(struct snd_pcm_substream *s | |||
917 | if (!epcm->running) | 924 | if (!epcm->running) |
918 | return 0; | 925 | return 0; |
919 | if (epcm->first_ptr) { | 926 | if (epcm->first_ptr) { |
920 | udelay(50); // hack, it takes awhile until capture is started | 927 | udelay(50); /* hack, it takes awhile until capture is started */ |
921 | epcm->first_ptr = 0; | 928 | epcm->first_ptr = 0; |
922 | } | 929 | } |
923 | ptr = snd_emu10k1_ptr_read(emu, epcm->capture_idx_reg, 0) & 0x0000ffff; | 930 | ptr = snd_emu10k1_ptr_read(emu, epcm->capture_idx_reg, 0) & 0x0000ffff; |
@@ -972,6 +979,28 @@ static struct snd_pcm_hardware snd_emu10k1_capture = | |||
972 | .fifo_size = 0, | 979 | .fifo_size = 0, |
973 | }; | 980 | }; |
974 | 981 | ||
982 | static struct snd_pcm_hardware snd_emu10k1_capture_efx = | ||
983 | { | ||
984 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | ||
985 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | ||
986 | SNDRV_PCM_INFO_RESUME | | ||
987 | SNDRV_PCM_INFO_MMAP_VALID), | ||
988 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
989 | .rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | | ||
990 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | | ||
991 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000, | ||
992 | .rate_min = 44100, | ||
993 | .rate_max = 192000, | ||
994 | .channels_min = 8, | ||
995 | .channels_max = 8, | ||
996 | .buffer_bytes_max = (64*1024), | ||
997 | .period_bytes_min = 384, | ||
998 | .period_bytes_max = (64*1024), | ||
999 | .periods_min = 2, | ||
1000 | .periods_max = 2, | ||
1001 | .fifo_size = 0, | ||
1002 | }; | ||
1003 | |||
975 | /* | 1004 | /* |
976 | * | 1005 | * |
977 | */ | 1006 | */ |
@@ -1016,7 +1045,7 @@ static int snd_emu10k1_efx_playback_close(struct snd_pcm_substream *substream) | |||
1016 | struct snd_emu10k1_pcm_mixer *mix; | 1045 | struct snd_emu10k1_pcm_mixer *mix; |
1017 | int i; | 1046 | int i; |
1018 | 1047 | ||
1019 | for (i=0; i < NUM_EFX_PLAYBACK; i++) { | 1048 | for (i = 0; i < NUM_EFX_PLAYBACK; i++) { |
1020 | mix = &emu->efx_pcm_mixer[i]; | 1049 | mix = &emu->efx_pcm_mixer[i]; |
1021 | mix->epcm = NULL; | 1050 | mix->epcm = NULL; |
1022 | snd_emu10k1_pcm_efx_mixer_notify(emu, i, 0); | 1051 | snd_emu10k1_pcm_efx_mixer_notify(emu, i, 0); |
@@ -1045,7 +1074,7 @@ static int snd_emu10k1_efx_playback_open(struct snd_pcm_substream *substream) | |||
1045 | runtime->private_free = snd_emu10k1_pcm_free_substream; | 1074 | runtime->private_free = snd_emu10k1_pcm_free_substream; |
1046 | runtime->hw = snd_emu10k1_efx_playback; | 1075 | runtime->hw = snd_emu10k1_efx_playback; |
1047 | 1076 | ||
1048 | for (i=0; i < NUM_EFX_PLAYBACK; i++) { | 1077 | for (i = 0; i < NUM_EFX_PLAYBACK; i++) { |
1049 | mix = &emu->efx_pcm_mixer[i]; | 1078 | mix = &emu->efx_pcm_mixer[i]; |
1050 | mix->send_routing[0][0] = i; | 1079 | mix->send_routing[0][0] = i; |
1051 | memset(&mix->send_volume, 0, sizeof(mix->send_volume)); | 1080 | memset(&mix->send_volume, 0, sizeof(mix->send_volume)); |
@@ -1199,15 +1228,69 @@ static int snd_emu10k1_capture_efx_open(struct snd_pcm_substream *substream) | |||
1199 | epcm->capture_idx_reg = FXIDX; | 1228 | epcm->capture_idx_reg = FXIDX; |
1200 | substream->runtime->private_data = epcm; | 1229 | substream->runtime->private_data = epcm; |
1201 | substream->runtime->private_free = snd_emu10k1_pcm_free_substream; | 1230 | substream->runtime->private_free = snd_emu10k1_pcm_free_substream; |
1202 | runtime->hw = snd_emu10k1_capture; | 1231 | runtime->hw = snd_emu10k1_capture_efx; |
1203 | runtime->hw.rates = SNDRV_PCM_RATE_48000; | 1232 | runtime->hw.rates = SNDRV_PCM_RATE_48000; |
1204 | runtime->hw.rate_min = runtime->hw.rate_max = 48000; | 1233 | runtime->hw.rate_min = runtime->hw.rate_max = 48000; |
1205 | spin_lock_irq(&emu->reg_lock); | 1234 | spin_lock_irq(&emu->reg_lock); |
1206 | runtime->hw.channels_min = runtime->hw.channels_max = 0; | 1235 | if (emu->card_capabilities->emu1010) { |
1207 | for (idx = 0; idx < nefx; idx++) { | 1236 | /* TODO |
1208 | if (emu->efx_voices_mask[idx/32] & (1 << (idx%32))) { | 1237 | * SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE |
1209 | runtime->hw.channels_min++; | 1238 | * SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | |
1210 | runtime->hw.channels_max++; | 1239 | * SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | |
1240 | * SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000 | ||
1241 | * rate_min = 44100, | ||
1242 | * rate_max = 192000, | ||
1243 | * channels_min = 8, | ||
1244 | * channels_max = 8, | ||
1245 | * Need to add mixer control to fix sample rate | ||
1246 | * | ||
1247 | * There are 16 mono channels of 16bits each. | ||
1248 | * 24bit Audio uses 2x channels over 16bit | ||
1249 | * 96kHz uses 2x channels over 48kHz | ||
1250 | * 192kHz uses 4x channels over 48kHz | ||
1251 | * So, for 48kHz 24bit, one has 8 channels | ||
1252 | * for 96kHz 24bit, one has 4 channels | ||
1253 | * for 192kHz 24bit, one has 2 channels | ||
1254 | */ | ||
1255 | #if 1 | ||
1256 | switch (emu->emu1010.internal_clock) { | ||
1257 | case 0: | ||
1258 | /* For 44.1kHz */ | ||
1259 | runtime->hw.rates = SNDRV_PCM_RATE_44100; | ||
1260 | runtime->hw.rate_min = runtime->hw.rate_max = 44100; | ||
1261 | runtime->hw.channels_min = runtime->hw.channels_max = 8; | ||
1262 | break; | ||
1263 | case 1: | ||
1264 | /* For 48kHz */ | ||
1265 | runtime->hw.rates = SNDRV_PCM_RATE_48000; | ||
1266 | runtime->hw.rate_min = runtime->hw.rate_max = 48000; | ||
1267 | runtime->hw.channels_min = runtime->hw.channels_max = 8; | ||
1268 | break; | ||
1269 | }; | ||
1270 | #endif | ||
1271 | #if 0 | ||
1272 | /* For 96kHz */ | ||
1273 | runtime->hw.rates = SNDRV_PCM_RATE_96000; | ||
1274 | runtime->hw.rate_min = runtime->hw.rate_max = 96000; | ||
1275 | runtime->hw.channels_min = runtime->hw.channels_max = 4; | ||
1276 | #endif | ||
1277 | #if 0 | ||
1278 | /* For 192kHz */ | ||
1279 | runtime->hw.rates = SNDRV_PCM_RATE_192000; | ||
1280 | runtime->hw.rate_min = runtime->hw.rate_max = 192000; | ||
1281 | runtime->hw.channels_min = runtime->hw.channels_max = 2; | ||
1282 | #endif | ||
1283 | runtime->hw.formats = SNDRV_PCM_FMTBIT_S32_LE; | ||
1284 | /* efx_voices_mask[0] is expected to be zero | ||
1285 | * efx_voices_mask[1] is expected to have 16bits set | ||
1286 | */ | ||
1287 | } else { | ||
1288 | runtime->hw.channels_min = runtime->hw.channels_max = 0; | ||
1289 | for (idx = 0; idx < nefx; idx++) { | ||
1290 | if (emu->efx_voices_mask[idx/32] & (1 << (idx%32))) { | ||
1291 | runtime->hw.channels_min++; | ||
1292 | runtime->hw.channels_max++; | ||
1293 | } | ||
1211 | } | 1294 | } |
1212 | } | 1295 | } |
1213 | epcm->capture_cr_val = emu->efx_voices_mask[0]; | 1296 | epcm->capture_cr_val = emu->efx_voices_mask[0]; |
@@ -1460,7 +1543,7 @@ static void snd_emu10k1_fx8010_playback_tram_poke1(unsigned short *dst_left, | |||
1460 | unsigned int count, | 1543 | unsigned int count, |
1461 | unsigned int tram_shift) | 1544 | unsigned int tram_shift) |
1462 | { | 1545 | { |
1463 | // printk("tram_poke1: dst_left = 0x%p, dst_right = 0x%p, src = 0x%p, count = 0x%x\n", dst_left, dst_right, src, count); | 1546 | /* printk("tram_poke1: dst_left = 0x%p, dst_right = 0x%p, src = 0x%p, count = 0x%x\n", dst_left, dst_right, src, count); */ |
1464 | if ((tram_shift & 1) == 0) { | 1547 | if ((tram_shift & 1) == 0) { |
1465 | while (count--) { | 1548 | while (count--) { |
1466 | *dst_left-- = *src++; | 1549 | *dst_left-- = *src++; |
@@ -1537,7 +1620,7 @@ static int snd_emu10k1_fx8010_playback_prepare(struct snd_pcm_substream *substre | |||
1537 | struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; | 1620 | struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; |
1538 | unsigned int i; | 1621 | unsigned int i; |
1539 | 1622 | ||
1540 | // printk("prepare: etram_pages = 0x%p, dma_area = 0x%x, buffer_size = 0x%x (0x%x)\n", emu->fx8010.etram_pages, runtime->dma_area, runtime->buffer_size, runtime->buffer_size << 2); | 1623 | /* printk("prepare: etram_pages = 0x%p, dma_area = 0x%x, buffer_size = 0x%x (0x%x)\n", emu->fx8010.etram_pages, runtime->dma_area, runtime->buffer_size, runtime->buffer_size << 2); */ |
1541 | memset(&pcm->pcm_rec, 0, sizeof(pcm->pcm_rec)); | 1624 | memset(&pcm->pcm_rec, 0, sizeof(pcm->pcm_rec)); |
1542 | pcm->pcm_rec.hw_buffer_size = pcm->buffer_size * 2; /* byte size */ | 1625 | pcm->pcm_rec.hw_buffer_size = pcm->buffer_size * 2; /* byte size */ |
1543 | pcm->pcm_rec.sw_buffer_size = snd_pcm_lib_buffer_bytes(substream); | 1626 | pcm->pcm_rec.sw_buffer_size = snd_pcm_lib_buffer_bytes(substream); |