Re: DMA Transfer Synchronization Issue in Out-of-Tree Sound Card Driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 22/05/24 - 07:52, Takashi Iwai a écrit :
> On Tue, 21 May 2024 20:32:59 +0200,
> Mark Brown wrote:
> > 
> > On Tue, May 21, 2024 at 10:31:12AM +0200, Louis Chauvet wrote:
> > 
> > > To address this DMA issue, I have created a patch [1] that guarantees the 
> > > completion of the DMA transfer upon the return of xdma_synchronize. This 
> > > means xdma_synchronize now sleeps, but looking at other drivers around it 
> > > appears expected to be able to do so.
> > 
> > You need to set the nonatomic flag for the PCM to allow this, the
> > default is that triggers run in atomic context.
> 
> Right, that's a most straightforward solution.  It implies that the
> period updates must be in non-atomic, i.e. use a threaded irq handler
> in most cases.
> 
> If the synchronization is needed for assuring the hardware stop, there
> is an alternative with PCM sync_stop callback, too.  The callback is
> called at each time after a stream gets stopped before the next action
> (that is, either prepare, hw_params or close).  It's only for
> stopping, and there is no similar way for sync of a stream start,
> though.
> 
> 
> thanks,
> 
> Takashi
> 

Hi!

Thank you for your prompt responses!

I have currently implemented the solution with sync_stop, as it is 
precisely what I need to do, and it works perfectly.

As I may need to backport this driver up to 4.19, sync_stop was not yet 
available, so I will look into the threaded IRQ solution, which sounds 
promising.

Thank you both very much!

Best regards,
Louis Chauvet

-- 
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux