[alsa-devel] [PATCH 3/3] Add ALSA driver for Atmel AC97 controller

Takashi Iwai tiwai at suse.de
Wed Feb 4 16:08:53 CET 2009


At Wed, 4 Feb 2009 16:02:14 +0100,
Hans-Christian Egtvedt wrote:
> 
> On Wed, 04 Feb 2009 13:09:37 +0100
> Takashi Iwai <tiwai at suse.de> wrote:
> 
> > At Wed,  4 Feb 2009 12:48:34 +0100,
> > Hans-Christian Egtvedt wrote:
> 
> <snipp>
> 
> > > +static int atmel_ac97c_playback_hw_params(struct snd_pcm_substream
> > > *substream,
> > > +		struct snd_pcm_hw_params *hw_params)
> > > +{
> > > +	struct atmel_ac97c *chip =
> > > snd_pcm_substream_chip(substream);
> > > +	int retval;
> > > +
> > > +	retval = snd_pcm_lib_malloc_pages(substream,
> > > +
> > > params_buffer_bytes(hw_params));
> > > +	if (retval)
> > > +		return retval;
> > 
> > Should be a negative-check.
> > 
> 
> For some reason if I only check for < 0, then the buffer is not
> configured properly. Seems like the preallocation goes wrong for some
> reason.
> 
> Any pointers to why?

Could it be due to multiple hw_params calls?
You can check the sequence of PCM callbacks.

Oh wait, is it an error from atmel_ac97c_prepare_dma()?
Looking through the code, it uses runtime->buffer_size and
runtime->period_size.  These aren't set yet inside hw_params.
I think this setup can be done better in prepare callback.


Takashi


More information about the Alsa-devel mailing list