Commit fe506d6b authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/emu10k1' into for-linus

parents c9294e4b 730d45f9
...@@ -103,7 +103,10 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw) ...@@ -103,7 +103,10 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw)
int ch; int ch;
vp = &emu->voices[best[i].voice]; vp = &emu->voices[best[i].voice];
if ((ch = vp->ch) < 0) { if ((ch = vp->ch) < 0) {
//printk("synth_get_voice: ch < 0 (%d) ??", i); /*
printk(KERN_WARNING
"synth_get_voice: ch < 0 (%d) ??", i);
*/
continue; continue;
} }
vp->emu->num_voices--; vp->emu->num_voices--;
...@@ -335,7 +338,7 @@ start_voice(struct snd_emux_voice *vp) ...@@ -335,7 +338,7 @@ start_voice(struct snd_emux_voice *vp)
return -EINVAL; return -EINVAL;
emem->map_locked++; emem->map_locked++;
if (snd_emu10k1_memblk_map(hw, emem) < 0) { if (snd_emu10k1_memblk_map(hw, emem) < 0) {
// printk("emu: cannot map!\n"); /* printk(KERN_ERR "emu: cannot map!\n"); */
return -ENOMEM; return -ENOMEM;
} }
mapped_offset = snd_emu10k1_memblk_offset(emem) >> 1; mapped_offset = snd_emu10k1_memblk_offset(emem) >> 1;
......
...@@ -711,8 +711,7 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, const char *filena ...@@ -711,8 +711,7 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, const char *filena
static int emu1010_firmware_thread(void *data) static int emu1010_firmware_thread(void *data)
{ {
struct snd_emu10k1 *emu = data; struct snd_emu10k1 *emu = data;
int tmp, tmp2; u32 tmp, tmp2, reg;
int reg;
int err; int err;
for (;;) { for (;;) {
...@@ -758,7 +757,8 @@ static int emu1010_firmware_thread(void *data) ...@@ -758,7 +757,8 @@ static int emu1010_firmware_thread(void *data)
snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n");
snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp); snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp);
snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2); snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2);
snd_printk("Audio Dock ver:%d.%d\n", tmp, tmp2); snd_printk(KERN_INFO "Audio Dock ver: %u.%u\n",
tmp, tmp2);
/* Sync clocking between 1010 and Dock */ /* Sync clocking between 1010 and Dock */
/* Allow DLL to settle */ /* Allow DLL to settle */
msleep(10); msleep(10);
...@@ -804,8 +804,7 @@ static int emu1010_firmware_thread(void *data) ...@@ -804,8 +804,7 @@ static int emu1010_firmware_thread(void *data)
static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu) static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
{ {
unsigned int i; unsigned int i;
int tmp, tmp2; u32 tmp, tmp2, reg;
int reg;
int err; int err;
const char *filename = NULL; const char *filename = NULL;
...@@ -887,7 +886,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu) ...@@ -887,7 +886,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n"); snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n");
snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp); snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp);
snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2); snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2);
snd_printk("emu1010: Hana version: %d.%d\n", tmp, tmp2); snd_printk(KERN_INFO "emu1010: Hana version: %u.%u\n", tmp, tmp2);
/* Enable 48Volt power to Audio Dock */ /* Enable 48Volt power to Audio Dock */
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON); snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON);
......
...@@ -1519,7 +1519,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) ...@@ -1519,7 +1519,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
/* A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS); */ /* A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS); */
if (emu->card_capabilities->emu_model) { if (emu->card_capabilities->emu_model) {
/* EMU1010 Outputs from PCM Front, Rear, Center, LFE, Side */ /* EMU1010 Outputs from PCM Front, Rear, Center, LFE, Side */
snd_printk("EMU outputs on\n"); snd_printk(KERN_INFO "EMU outputs on\n");
for (z = 0; z < 8; z++) { for (z = 0; z < 8; z++) {
if (emu->card_capabilities->ca0108_chip) { if (emu->card_capabilities->ca0108_chip) {
A_OP(icode, &ptr, iACC3, A3_EMU32OUT(z), A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + z), A_C_00000000, A_C_00000000); A_OP(icode, &ptr, iACC3, A3_EMU32OUT(z), A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + z), A_C_00000000, A_C_00000000);
...@@ -1567,7 +1567,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) ...@@ -1567,7 +1567,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
if (emu->card_capabilities->emu_model) { if (emu->card_capabilities->emu_model) {
if (emu->card_capabilities->ca0108_chip) { if (emu->card_capabilities->ca0108_chip) {
snd_printk("EMU2 inputs on\n"); snd_printk(KERN_INFO "EMU2 inputs on\n");
for (z = 0; z < 0x10; z++) { for (z = 0; z < 0x10; z++) {
snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp,
bit_shifter16, bit_shifter16,
...@@ -1575,10 +1575,13 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) ...@@ -1575,10 +1575,13 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
A_FXBUS2(z*2) ); A_FXBUS2(z*2) );
} }
} else { } else {
snd_printk("EMU inputs on\n"); snd_printk(KERN_INFO "EMU inputs on\n");
/* Capture 16 (originally 8) channels of S32_LE sound */ /* Capture 16 (originally 8) channels of S32_LE sound */
/* printk("emufx.c: gpr=0x%x, tmp=0x%x\n",gpr, tmp); */ /*
printk(KERN_DEBUG "emufx.c: gpr=0x%x, tmp=0x%x\n",
gpr, tmp);
*/
/* For the EMU1010: How to get 32bit values from the DSP. High 16bits into L, low 16bits into R. */ /* For the EMU1010: How to get 32bit values from the DSP. High 16bits into L, low 16bits into R. */
/* A_P16VIN(0) is delayed by one sample, /* A_P16VIN(0) is delayed by one sample,
* so all other A_P16VIN channels will need to also be delayed * so all other A_P16VIN channels will need to also be delayed
......
...@@ -44,7 +44,7 @@ static void snd_emu10k1_pcm_interrupt(struct snd_emu10k1 *emu, ...@@ -44,7 +44,7 @@ static void snd_emu10k1_pcm_interrupt(struct snd_emu10k1 *emu,
if (epcm->substream == NULL) if (epcm->substream == NULL)
return; return;
#if 0 #if 0
printk("IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n", printk(KERN_DEBUG "IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n",
epcm->substream->runtime->hw->pointer(emu, epcm->substream), epcm->substream->runtime->hw->pointer(emu, epcm->substream),
snd_pcm_lib_period_bytes(epcm->substream), snd_pcm_lib_period_bytes(epcm->substream),
snd_pcm_lib_buffer_bytes(epcm->substream)); snd_pcm_lib_buffer_bytes(epcm->substream));
...@@ -146,7 +146,11 @@ static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm * epcm, int voic ...@@ -146,7 +146,11 @@ static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm * epcm, int voic
1, 1,
&epcm->extra); &epcm->extra);
if (err < 0) { if (err < 0) {
/* printk("pcm_channel_alloc: failed extra: voices=%d, frame=%d\n", voices, frame); */ /*
printk(KERN_DEBUG "pcm_channel_alloc: "
"failed extra: voices=%d, frame=%d\n",
voices, frame);
*/
for (i = 0; i < voices; i++) { for (i = 0; i < voices; i++) {
snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]);
epcm->voices[i] = NULL; epcm->voices[i] = NULL;
...@@ -737,7 +741,10 @@ static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream, ...@@ -737,7 +741,10 @@ static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream,
struct snd_emu10k1_pcm_mixer *mix; struct snd_emu10k1_pcm_mixer *mix;
int result = 0; int result = 0;
/* printk("trigger - emu10k1 = 0x%x, cmd = %i, pointer = %i\n", (int)emu, cmd, substream->ops->pointer(substream)); */ /*
printk(KERN_DEBUG "trigger - emu10k1 = 0x%x, cmd = %i, pointer = %i\n",
(int)emu, cmd, substream->ops->pointer(substream))
*/
spin_lock(&emu->reg_lock); spin_lock(&emu->reg_lock);
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
...@@ -786,7 +793,10 @@ static int snd_emu10k1_capture_trigger(struct snd_pcm_substream *substream, ...@@ -786,7 +793,10 @@ static int snd_emu10k1_capture_trigger(struct snd_pcm_substream *substream,
/* hmm this should cause full and half full interrupt to be raised? */ /* hmm this should cause full and half full interrupt to be raised? */
outl(epcm->capture_ipr, emu->port + IPR); outl(epcm->capture_ipr, emu->port + IPR);
snd_emu10k1_intr_enable(emu, epcm->capture_inte); snd_emu10k1_intr_enable(emu, epcm->capture_inte);
/* printk("adccr = 0x%x, adcbs = 0x%x\n", epcm->adccr, epcm->adcbs); */ /*
printk(KERN_DEBUG "adccr = 0x%x, adcbs = 0x%x\n",
epcm->adccr, epcm->adcbs);
*/
switch (epcm->type) { switch (epcm->type) {
case CAPTURE_AC97ADC: case CAPTURE_AC97ADC:
snd_emu10k1_ptr_write(emu, ADCCR, 0, epcm->capture_cr_val); snd_emu10k1_ptr_write(emu, ADCCR, 0, epcm->capture_cr_val);
...@@ -857,7 +867,11 @@ static snd_pcm_uframes_t snd_emu10k1_playback_pointer(struct snd_pcm_substream * ...@@ -857,7 +867,11 @@ static snd_pcm_uframes_t snd_emu10k1_playback_pointer(struct snd_pcm_substream *
ptr -= runtime->buffer_size; ptr -= runtime->buffer_size;
} }
#endif #endif
/* printk("ptr = 0x%x, buffer_size = 0x%x, period_size = 0x%x\n", ptr, runtime->buffer_size, runtime->period_size); */ /*
printk(KERN_DEBUG
"ptr = 0x%x, buffer_size = 0x%x, period_size = 0x%x\n",
ptr, runtime->buffer_size, runtime->period_size);
*/
return ptr; return ptr;
} }
...@@ -1546,7 +1560,11 @@ static void snd_emu10k1_fx8010_playback_tram_poke1(unsigned short *dst_left, ...@@ -1546,7 +1560,11 @@ static void snd_emu10k1_fx8010_playback_tram_poke1(unsigned short *dst_left,
unsigned int count, unsigned int count,
unsigned int tram_shift) unsigned int tram_shift)
{ {
/* printk("tram_poke1: dst_left = 0x%p, dst_right = 0x%p, src = 0x%p, count = 0x%x\n", dst_left, dst_right, src, count); */ /*
printk(KERN_DEBUG "tram_poke1: dst_left = 0x%p, dst_right = 0x%p, "
"src = 0x%p, count = 0x%x\n",
dst_left, dst_right, src, count);
*/
if ((tram_shift & 1) == 0) { if ((tram_shift & 1) == 0) {
while (count--) { while (count--) {
*dst_left-- = *src++; *dst_left-- = *src++;
...@@ -1623,7 +1641,12 @@ static int snd_emu10k1_fx8010_playback_prepare(struct snd_pcm_substream *substre ...@@ -1623,7 +1641,12 @@ static int snd_emu10k1_fx8010_playback_prepare(struct snd_pcm_substream *substre
struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number];
unsigned int i; unsigned int i;
/* 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); */ /*
printk(KERN_DEBUG "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);
*/
memset(&pcm->pcm_rec, 0, sizeof(pcm->pcm_rec)); memset(&pcm->pcm_rec, 0, sizeof(pcm->pcm_rec));
pcm->pcm_rec.hw_buffer_size = pcm->buffer_size * 2; /* byte size */ pcm->pcm_rec.hw_buffer_size = pcm->buffer_size * 2; /* byte size */
pcm->pcm_rec.sw_buffer_size = snd_pcm_lib_buffer_bytes(substream); pcm->pcm_rec.sw_buffer_size = snd_pcm_lib_buffer_bytes(substream);
......
...@@ -226,7 +226,9 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, ...@@ -226,7 +226,9 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu,
break; break;
if (timeout > 1000) { if (timeout > 1000) {
snd_printk("emu10k1:I2C:timeout status=0x%x\n", status); snd_printk(KERN_WARNING
"emu10k1:I2C:timeout status=0x%x\n",
status);
break; break;
} }
} }
......
...@@ -168,7 +168,7 @@ static void snd_p16v_pcm_free_substream(struct snd_pcm_runtime *runtime) ...@@ -168,7 +168,7 @@ static void snd_p16v_pcm_free_substream(struct snd_pcm_runtime *runtime)
struct snd_emu10k1_pcm *epcm = runtime->private_data; struct snd_emu10k1_pcm *epcm = runtime->private_data;
if (epcm) { if (epcm) {
//snd_printk("epcm free: %p\n", epcm); /* snd_printk(KERN_DEBUG "epcm free: %p\n", epcm); */
kfree(epcm); kfree(epcm);
} }
} }
...@@ -183,14 +183,16 @@ static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substrea ...@@ -183,14 +183,16 @@ static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substrea
int err; int err;
epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
//snd_printk("epcm kcalloc: %p\n", epcm); /* snd_printk(KERN_DEBUG "epcm kcalloc: %p\n", epcm); */
if (epcm == NULL) if (epcm == NULL)
return -ENOMEM; return -ENOMEM;
epcm->emu = emu; epcm->emu = emu;
epcm->substream = substream; epcm->substream = substream;
//snd_printk("epcm device=%d, channel_id=%d\n", substream->pcm->device, channel_id); /*
snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n",
substream->pcm->device, channel_id);
*/
runtime->private_data = epcm; runtime->private_data = epcm;
runtime->private_free = snd_p16v_pcm_free_substream; runtime->private_free = snd_p16v_pcm_free_substream;
...@@ -200,10 +202,15 @@ static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substrea ...@@ -200,10 +202,15 @@ static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substrea
channel->number = channel_id; channel->number = channel_id;
channel->use=1; channel->use=1;
//snd_printk("p16v: open channel_id=%d, channel=%p, use=0x%x\n", channel_id, channel, channel->use); #if 0 /* debug */
//printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); snd_printk(KERN_DEBUG
//channel->interrupt = snd_p16v_pcm_channel_interrupt; "p16v: open channel_id=%d, channel=%p, use=0x%x\n",
channel->epcm=epcm; channel_id, channel, channel->use);
printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n",
channel_id, chip, channel);
#endif /* debug */
/* channel->interrupt = snd_p16v_pcm_channel_interrupt; */
channel->epcm = epcm;
if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
return err; return err;
...@@ -224,14 +231,16 @@ static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream ...@@ -224,14 +231,16 @@ static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream
int err; int err;
epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
//snd_printk("epcm kcalloc: %p\n", epcm); /* snd_printk(KERN_DEBUG "epcm kcalloc: %p\n", epcm); */
if (epcm == NULL) if (epcm == NULL)
return -ENOMEM; return -ENOMEM;
epcm->emu = emu; epcm->emu = emu;
epcm->substream = substream; epcm->substream = substream;
//snd_printk("epcm device=%d, channel_id=%d\n", substream->pcm->device, channel_id); /*
snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n",
substream->pcm->device, channel_id);
*/
runtime->private_data = epcm; runtime->private_data = epcm;
runtime->private_free = snd_p16v_pcm_free_substream; runtime->private_free = snd_p16v_pcm_free_substream;
...@@ -241,10 +250,15 @@ static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream ...@@ -241,10 +250,15 @@ static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream
channel->number = channel_id; channel->number = channel_id;
channel->use=1; channel->use=1;
//snd_printk("p16v: open channel_id=%d, channel=%p, use=0x%x\n", channel_id, channel, channel->use); #if 0 /* debug */
//printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); snd_printk(KERN_DEBUG
//channel->interrupt = snd_p16v_pcm_channel_interrupt; "p16v: open channel_id=%d, channel=%p, use=0x%x\n",
channel->epcm=epcm; channel_id, channel, channel->use);
printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n",
channel_id, chip, channel);
#endif /* debug */
/* channel->interrupt = snd_p16v_pcm_channel_interrupt; */
channel->epcm = epcm;
if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
return err; return err;
...@@ -334,9 +348,19 @@ static int snd_p16v_pcm_prepare_playback(struct snd_pcm_substream *substream) ...@@ -334,9 +348,19 @@ static int snd_p16v_pcm_prepare_playback(struct snd_pcm_substream *substream)
int i; int i;
u32 tmp; u32 tmp;
//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)); #if 0 /* debug */
//snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); snd_printk(KERN_DEBUG "prepare:channel_number=%d, rate=%d, "
//snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->p16v_buffer.addr, emu->p16v_buffer.area, emu->p16v_buffer.bytes); "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));
snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n",
runtime->dma_addr, runtime->dma_area, table_base);
snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",
emu->p16v_buffer.addr, emu->p16v_buffer.area,
emu->p16v_buffer.bytes);
#endif /* debug */
tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel); tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel);
switch (runtime->rate) { switch (runtime->rate) {
case 44100: case 44100:
...@@ -379,7 +403,15 @@ static int snd_p16v_pcm_prepare_capture(struct snd_pcm_substream *substream) ...@@ -379,7 +403,15 @@ static int snd_p16v_pcm_prepare_capture(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
int channel = substream->pcm->device - emu->p16v_device_offset; int channel = substream->pcm->device - emu->p16v_device_offset;
u32 tmp; u32 tmp;
//printk("prepare capture: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));
/*
printk(KERN_DEBUG "prepare capture: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));
*/
tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel); tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel);
switch (runtime->rate) { switch (runtime->rate) {
case 44100: case 44100:
...@@ -459,13 +491,13 @@ static int snd_p16v_pcm_trigger_playback(struct snd_pcm_substream *substream, ...@@ -459,13 +491,13 @@ static int snd_p16v_pcm_trigger_playback(struct snd_pcm_substream *substream,
runtime = s->runtime; runtime = s->runtime;
epcm = runtime->private_data; epcm = runtime->private_data;
channel = substream->pcm->device-emu->p16v_device_offset; channel = substream->pcm->device-emu->p16v_device_offset;
//snd_printk("p16v channel=%d\n",channel); /* snd_printk(KERN_DEBUG "p16v channel=%d\n", channel); */
epcm->running = running; epcm->running = running;
basic |= (0x1<<channel); basic |= (0x1<<channel);
inte |= (INTE2_PLAYBACK_CH_0_LOOP<<channel); inte |= (INTE2_PLAYBACK_CH_0_LOOP<<channel);
snd_pcm_trigger_done(s, substream); snd_pcm_trigger_done(s, substream);
} }
//snd_printk("basic=0x%x, inte=0x%x\n",basic, inte); /* snd_printk(KERN_DEBUG "basic=0x%x, inte=0x%x\n", basic, inte); */
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
...@@ -558,8 +590,13 @@ snd_p16v_pcm_pointer_capture(struct snd_pcm_substream *substream) ...@@ -558,8 +590,13 @@ snd_p16v_pcm_pointer_capture(struct snd_pcm_substream *substream)
ptr -= runtime->buffer_size; ptr -= runtime->buffer_size;
printk(KERN_WARNING "buffer capture limited!\n"); printk(KERN_WARNING "buffer capture limited!\n");
} }
//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); /*
printk(KERN_DEBUG "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);
*/
return ptr; return ptr;
} }
...@@ -592,7 +629,10 @@ int snd_p16v_free(struct snd_emu10k1 *chip) ...@@ -592,7 +629,10 @@ int snd_p16v_free(struct snd_emu10k1 *chip)
// release the data // release the data
if (chip->p16v_buffer.area) { if (chip->p16v_buffer.area) {
snd_dma_free_pages(&chip->p16v_buffer); snd_dma_free_pages(&chip->p16v_buffer);
//snd_printk("period lables free: %p\n", &chip->p16v_buffer); /*
snd_printk(KERN_DEBUG "period lables free: %p\n",
&chip->p16v_buffer);
*/
} }
return 0; return 0;
} }
...@@ -604,7 +644,7 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm * ...@@ -604,7 +644,7 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm *
int err; int err;
int capture=1; int capture=1;
//snd_printk("snd_p16v_pcm called. device=%d\n", device); /* snd_printk("KERN_DEBUG snd_p16v_pcm called. device=%d\n", device); */
emu->p16v_device_offset = device; emu->p16v_device_offset = device;
if (rpcm) if (rpcm)
*rpcm = NULL; *rpcm = NULL;
...@@ -631,7 +671,10 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm * ...@@ -631,7 +671,10 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm *
snd_dma_pci_data(emu->pci), snd_dma_pci_data(emu->pci),
((65536 - 64) * 8), ((65536 - 64) * 8))) < 0) ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0)
return err; return err;
//snd_printk("preallocate playback substream: err=%d\n", err); /*
snd_printk(KERN_DEBUG
"preallocate playback substream: err=%d\n", err);
*/
} }
for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
...@@ -642,7 +685,10 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm * ...@@ -642,7 +685,10 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm *
snd_dma_pci_data(emu->pci), snd_dma_pci_data(emu->pci),
65536 - 64, 65536 - 64)) < 0) 65536 - 64, 65536 - 64)) < 0)
return err; return err;
//snd_printk("preallocate capture substream: err=%d\n", err); /*
snd_printk(KERN_DEBUG
"preallocate capture substream: err=%d\n", err);
*/
} }
if (rpcm) if (rpcm)
......
...@@ -53,7 +53,10 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number, ...@@ -53,7 +53,10 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number,
*rvoice = NULL; *rvoice = NULL;
first_voice = last_voice = 0; first_voice = last_voice = 0;
for (i = emu->next_free_voice, j = 0; j < NUM_G ; i += number, j += number) { for (i = emu->next_free_voice, j = 0; j < NUM_G ; i += number, j += number) {
// printk("i %d j %d next free %d!\n", i, j, emu->next_free_voice); /*
printk(KERN_DEBUG "i %d j %d next free %d!\n",
i, j, emu->next_free_voice);
*/
i %= NUM_G; i %= NUM_G;
/* stereo voices must be even/odd */ /* stereo voices must be even/odd */
...@@ -71,7 +74,7 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number, ...@@ -71,7 +74,7 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number,
} }
} }
if (!skip) { if (!skip) {
// printk("allocated voice %d\n", i); /* printk(KERN_DEBUG "allocated voice %d\n", i); */
first_voice = i; first_voice = i;
last_voice = (i + number) % NUM_G; last_voice = (i + number) % NUM_G;
emu->next_free_voice = last_voice; emu->next_free_voice = last_voice;
...@@ -84,7 +87,10 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number, ...@@ -84,7 +87,10 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number,
for (i = 0; i < number; i++) { for (i = 0; i < number; i++) {
voice = &emu->voices[(first_voice + i) % NUM_G]; voice = &emu->voices[(first_voice + i) % NUM_G];
// printk("voice alloc - %i, %i of %i\n", voice->number, idx-first_voice+1, number); /*
printk(kERN_DEBUG "voice alloc - %i, %i of %i\n",
voice->number, idx-first_voice+1, number);
*/
voice->use = 1; voice->use = 1;
switch (type) { switch (type) {
case EMU10K1_PCM: case EMU10K1_PCM:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment