hw_params function and OSS emulation

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

 



I'm working on an ASoC driver, and I noticed that with OSS emulation enabled, 
my snd_pcm_ops.hw_params and and snd_pcm_ops.hw_free are called multiple times 
when an OSS driver uses the OSS emulation.  In my case, .hw_params is called 
*four* times, each time with a different DMA buffer size and number of periods.

The problem is that my driver allocates a DMA buffer in my .hw_params 
function.  For now, I have it deallocate the buffers at the top of the 
function and then allocate new ones based on the new hw_params values.

This is really annoying.  So I have a few questions:

1) Is there any way this can be fixed?  Can't the OSS emulation code figure 
out what it needs and wait until it's done before it calls .hw_params?

As a solution to the DMA buffer deallocate/reallocate hack I'm using, would it 
be okay to move the actual allocations to snd_pcm_ops.prepare()?  My 
.hw_params function will collect the relevant data and keep them in some 
private structure.  Then when .prepare() is called, I do the actual buffer 
allocation.

2) Can I assume that .prepare() is called only once?

3) Can I assume that .hw_params() is never called after .prepare() is called?

-- 
Timur Tabi
Linux Kernel Developer @ Freescale
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

  Powered by Linux