[alsa-devel] Backported sbxfi driver (UNTESTED!)

Takashi Iwai tiwai at suse.de
Sat Oct 11 19:41:59 CEST 2008


At Sat, 11 Oct 2008 12:36:09 -0500,
William Pitcock wrote:
> 
> Hello,
> 
> Serial console output from my try with this driver in various modes:
> 
> nenolod at petrie:~$ aplay -D hw:2,0 ~/13\ -\ Emerge\ \(Junkie\ XL\ Remix
> \)\ \[Explicit\].wav 
> Playing WAVE '/home/nenolod/13 - Emerge (Junkie XL Remix)
> [Explicit].wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
> XFi DAC reset timeout
> XFi DAC reset timeout
> XFi DAC reset timeout
> XFi DAC reset timeout
> XFi DAC reset timeout
> XFi DAC reset timeout
> ^C
> <system hardlocks on interrupt>

Could you build with XXX_CONST_TIMER defined?  This will disable the
adaptive timer-resolution handling I added to the driver, which doesn't
exist in OSS sbxfi code at all.

> Noise is now on the right channel only.

Does it mean that the left channel plays normally as expected?
Also, which sample rate are you using?  I'm curious whether the sample
rate tracking is correct...

> It might make more sense to poll for the DAC reset in the interrupt
> handler. I have noticed that the card generates an interrupt request in
> Windows once the DAC is online.

Interesting...  Maybe putting some debug prints in interrupt handler
and else would help a bit for more understanding.

> Something leads me to believe that the DMA mask is 32 bits, but given
> that the behaviour is similar in both instances, I am unsure.

This isn't a critical issue right now.  It can be figured out safely
later.

Also, could you show the hardware information I asked in other posts?
There are certainly cases that the driver works and hangs.  The
difference likely comes from the board type, I guess.


thanks,

Takashi

> 
> William
> 
> On Sat, 2008-10-11 at 18:01 +0200, Takashi Iwai wrote:
> > At Fri, 10 Oct 2008 13:17:32 -0500,
> > William Pitcock wrote:
> > > 
> > > With this patch, the driver does output audio, but the DAC dies and we
> > > only get noise. Going to try to whack at this with a larger hammer, it's
> > > a fairly obvious bug, it just needs some debugging. The noise sounds
> > > like the write pointer is off-by-one; it sort of resembles the source
> > > audio.
> > 
> > OK, good to hear that it's not always locking up.
> > 
> > > Some patches for mixer stuff are coming soon (next few hours
> > > probably)... as well as chip revision detection and some other
> > > niceities.
> > 
> > Great.  I'm looking forward to your patches.
> > 
> > Meanwhile, the patch below might improve something.
> > Basically test sets the DMA mask, and use the continuous pages instead of
> > SG buffers (in case it's the error cause).
> > Give it a try.  (And I'll update the git tree, too).
> > 
> > Also, try different XXX_* flags in sbxfi.c.  The default setting isn't
> > completely identical with OSS v4 driver.
> > 
> > 
> > thanks,
> > 
> > Takashi
> > 
> > diff --git a/sound/pci/sbxfi/sbxfi.c b/sound/pci/sbxfi/sbxfi.c
> > index 8a0eea0..86dd025 100644
> > --- a/sound/pci/sbxfi/sbxfi.c
> > +++ b/sound/pci/sbxfi/sbxfi.c
> > @@ -66,6 +66,9 @@ enum {
> >  #define SBXFI_MAX_BUFFER	(SBXFI_TLB_PAGES * SBXFI_PAGE_SIZE)
> >  #define SBXFI_MAX_SRCS		128	/* 256 / 2 */
> >  #define SBXFI_TIMER_FREQ	96000
> > +/* FIXME: which mask? */
> > +/* #define SBXFI_DMA_MASK		DMA_32BIT_MASK */
> > +#define SBXFI_DMA_MASK		DMA_28BIT_MASK
> >  
> >  #define MAX_CHANNELS		2
> >  
> > @@ -154,6 +157,9 @@ struct sbxfi {
> >  /* constant ticks */
> >  /* #define XXX_CONST_TICKS		(96000 * 5 / 1000) */
> >  
> > +/* SG or continuous buffer */
> > +#undef XXX_USE_SG
> > +
> >  #ifdef XXX_48K_ONLY
> >  #define BASE_RATE	48000
> >  #else
> > @@ -796,8 +802,13 @@ static int sbxfi_setup_tlb(struct sbxfi *chip, struct sbxfi_port *port,
> >  
> >  	pgtbl = (u32*)chip->tlb.area;
> >  	pgtbl += port->tlb_index;
> > +#ifdef XXX_USE_SG
> >  	for (p = 0; p < pages; p++, pgtbl++)
> >  		*pgtbl = snd_pcm_sgbuf_get_addr(substream, p * SBXFI_PAGE_SIZE);
> > +#else
> > +	for (p = 0; p < pages; p++, pgtbl++)
> > +		*pgtbl = substream->runtime->dma_addr + p * SBXFI_PAGE_SIZE;
> > +#endif
> >  
> >  	return 0;
> >  }
> > @@ -1319,7 +1330,9 @@ static struct snd_pcm_ops sbxfi_playback_ops = {
> >  	.prepare = sbxfi_playback_prepare,
> >  	.trigger = sbxfi_playback_trigger,
> >  	.pointer = sbxfi_pcm_pointer,
> > +#ifdef XXX_USE_SG
> >  	.page = snd_pcm_sgbuf_ops_page,
> > +#endif
> >  };
> >  
> >  static struct snd_pcm_ops sbxfi_capture_ops = {
> > @@ -1331,7 +1344,9 @@ static struct snd_pcm_ops sbxfi_capture_ops = {
> >  	.prepare = sbxfi_capture_prepare,
> >  	.trigger = sbxfi_capture_trigger,
> >  	.pointer = sbxfi_pcm_pointer,
> > +#ifdef XXX_USE_SG
> >  	.page = snd_pcm_sgbuf_ops_page,
> > +#endif
> >  };
> >  
> >  static int __devinit sbxfi_create_pcm(struct sbxfi *chip)
> > @@ -1351,9 +1366,15 @@ static int __devinit sbxfi_create_pcm(struct sbxfi *chip)
> >  	pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
> >  #endif
> >  	strcpy(pcm->name, "SB-XFi");
> > +#ifdef XXX_USE_SG
> >  	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
> >  					      snd_dma_pci_data(chip->pci),
> >  					      1024 * 64, 32 * 1024 * 1024);
> > +#else
> > +	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
> > +					      snd_dma_pci_data(chip->pci),
> > +					      1024 * 64, 32 * 1024 * 1024);
> > +#endif
> >  	chip->pcm = pcm;
> >  	return 0;
> >  }
> > @@ -1781,6 +1802,13 @@ static int __devinit sbxfi_create(struct snd_card *card, struct pci_dev *pci,
> >  	if (err < 0)
> >  		goto error;
> >  
> > +	if (pci_set_dma_mask(pci, SBXFI_DMA_MASK) < 0 ||
> > +	    pci_set_consistent_dma_mask(pci, SBXFI_DMA_MASK) < 0) {
> > +		printk(KERN_ERR PFX "Unable to set DMA mask\n");
> > +		err = -EINVAL;
> > +		goto error;
> > +	}
> > +
> >  	err = sbxfi_alloc_buffer(chip);
> >  	if (err < 0)
> >  		goto error;
> > _______________________________________________
> > Alsa-devel mailing list
> > Alsa-devel at alsa-project.org
> > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> > 


More information about the Alsa-devel mailing list