[alsa-devel] sound/pci/au88x0/au88x0_core.c:2464 vortex_interrupt() warn: if();

Takashi Iwai tiwai at suse.de
Thu Oct 25 13:41:44 CEST 2012


At Thu, 25 Oct 2012 12:05:03 +0800,
Raymond Yau wrote:
> 
> 2012-10-23 下午10:35 於 "Takashi Iwai" <tiwai at suse.de> 寫道:
> >
> > At Tue, 23 Oct 2012 22:16:42 +0800,
> > Fengguang Wu wrote:
> > >
> > > Hi,
> > >
> > > smatch warns about a weird "if();" in sound/pci/au88x0/au88x0_core.c
> > > Any ideas to fix it?
> > >
> > >         2461 #ifndef CHIP_AU8810
> > >         2462                 for (i = 0; i < NR_WT; i++) {
> > >         2463                         if (vortex->dma_wt[i].fifo_status
> == FIFO_START) {
> > > ==>     2464                                 if
> (vortex_wtdma_bufshift(vortex, i)) ;
> > >         2465                                 spin_unlock(&vortex->lock);
> > >         2466
> snd_pcm_period_elapsed(vortex->dma_wt[i].
> > >         2467
>  substream);
> > >         2468                                 spin_lock(&vortex->lock);
> > >         2469                         }
> > >         2470                 }
> > >         2471 #endif
> >
> > A quick fix is below, but I'm not 100% sure about it yet.
> > Let's see.
> 
> using aplay with  VORTEX_PCM_WT , only a very low high frequency signal is
> heard  and after 10 seconds
> 
> aplay: pcm_write:1702: write error: Input/output error
> 
> refer to the patent 6167465 the wavetable DMA channels operate slightly
> different from the non-wavetable DMA channels

OK, so the return value isn't reliable in this case, so we should keep
the code as is but better with some comment.

> it seem that the driver still cannot send the increment wavetable pointer
> signal and the increment count signal , thus fifo controller does not reach
> the trigger level to request for a dma transfer
> 
> may need some code to use the sound card's timer interrupt to send
> increment wavetable pointer signal to provide pitching by perform sample
> rate conversion on the data through interpolation and looping
> 
> BTW au88x0 still missing channel map

All below are irrelevant with this issue.  Please start separate mail
threads if needed.

In short: give a patch for au88x0 chmap support if you'd like to
have :)  For emu10k1 and trident, chmap is supported rather in
alsa-lib configuration.  It's not 100% perfect but it's good enough to
cover 99% use cases.


Takashi


> 
> /* pre-allocation of Scatter-Gather buffers */
> 
> snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
>       snd_dma_pci_data(chip->pci_dev),
>       0x10000, 0x10000);
> 
> +if (VORTEX_PCM_TYPE(pcm) == VORTEX_PCM_ADB) {
> +       err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
> +                                    snd_pcm_std_chmaps, 4, 0, NULL);
> +       if (err < 0)
> +               return err;
> +  }
> if (VORTEX_PCM_TYPE(pcm) == VORTEX_PCM_SPDIF) {
> 
> http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=3fc13d6f5b08edee49b106cd711d51bf3aef6ab7;hp=662f79d4ec6b52bbaab28d5a9b60cc8bcdf042f9
> 
> how about capture stream since test/chmap can open capture stream ?
> 
> case 's':
>                        if (*optarg == 'c' || *optarg == 'C')
>                                stream = SND_PCM_STREAM_CAPTURE;
>                        else
>                                stream = SND_PCM_STREAM_PLAYBACK;
>                        break;
> 
> do VORTEX_PCM_A3D need a mono channel map since device 2 only support mono
> playback with spatalization to stereo output ?
> 
> how about the mono channel map of emu10k1 and trident ?
> >
> >
> > thanks,
> >
> > Takashi
> >
> > ---
> > diff --git a/sound/pci/au88x0/au88x0_core.c
> b/sound/pci/au88x0/au88x0_core.c
> > index 525f881..3fe3dbe 100644
> > --- a/sound/pci/au88x0/au88x0_core.c
> > +++ b/sound/pci/au88x0/au88x0_core.c
> > @@ -2461,7 +2461,8 @@ static irqreturn_t vortex_interrupt(int irq, void
> *dev_id)
> >  #ifndef CHIP_AU8810
> >                 for (i = 0; i < NR_WT; i++) {
> >                         if (vortex->dma_wt[i].fifo_status == FIFO_START) {
> > -                               if (vortex_wtdma_bufshift(vortex, i)) ;
> > +                               if (!vortex_wtdma_bufshift(vortex, i))
> > +                                       continue;
> >                                 spin_unlock(&vortex->lock);
> >                                 snd_pcm_period_elapsed(vortex->dma_wt[i].
> >                                                        substream);


More information about the Alsa-devel mailing list