[alsa-devel] Can DMA address, periods, buffer size, etc change after hw_params is called?

Timur Tabi timur at freescale.com
Thu Jan 29 23:30:11 CET 2009

On Thu, Jan 29, 2009 at 1:18 AM, Hans-Christian Egtvedt
<hans-christian.egtvedt at atmel.com> wrote:

> Should I after the open and hw_params calls be ready to handle any
> change at all regarding DMA buffer address, periods and/or number of
> periods?

You would need to do this, if you allocate your DMA buffer in the
hw_params function.  However, I recommend that you allocate it in the
_new/_open function instead (I can't remember what it's called) for
the maximum size possible, and in _hw_params, just remember what the
size is supposed to be.  That way, you won't need to free/realloc your
DMA buffer.  Trust me, it's a lot easier this way.

Take a look at commit bf9c8c9ddef7ef761ae9747349175adad0ef16ce, where
I modify my driver to move the DMA allocation from _hw_params to

Timur Tabi
Linux kernel developer at Freescale

More information about the Alsa-devel mailing list