[alsa-devel] [PATCH 4/5] ASoC: sst_platform: fix the pulseaudio error
Koul, Vinod
vinod.koul at intel.com
Tue Feb 15 16:26:54 CET 2011
On Tue, 2011-02-15 at 20:16 +0530, Bensaid, Selma wrote:
> >
> > +static int sst_platform_pcm_hw_params(struct snd_pcm_substream
> > *substream,
> > + struct snd_pcm_hw_params *params)
> > +{
> > + snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
> > + memset(substream->runtime->dma_area, 0,
> > params_buffer_bytes(params));
> > +
> > + return 0;
> > +}
> >
> > static struct snd_pcm_ops sst_platform_ops = {
> > .open = sst_platform_open,
> > @@ -373,6 +381,7 @@ static struct snd_pcm_ops sst_platform_ops = {
> > .prepare = sst_platform_pcm_prepare,
> > .trigger = sst_platform_pcm_trigger,
> > .pointer = sst_platform_pcm_pointer,
> > + .hw_params = sst_platform_pcm_hw_params,
> > };
>
> Hi Vinod,
>
> The sst_soc_platform_drv provides also .pcm_new callback which pre-allocates
> the DMA memory for the PCM Streams. Is the pcm_new callback required?
Selma,
Quoting Takshi's Writing alsa driver [1] "snd_pcm_lib_malloc_pages() is
available only when the DMA buffers have been pre-allocated".
The .pcm_new in this case allocates the buffer using
snd_pcm_lib_preallocate_pages_for_all and in .hw_params we use the
snd_pcm_lic_malloc_pages.
This seems to be required for aplay with mmap option to work (which pa
seems to use as well), otherwise the mmap call fails
--
~Vinod Koul
Intel Corp.
[1]:
http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ch05s06.html#pcm-interface-operators-open-callback
More information about the Alsa-devel
mailing list