[alsa-devel] [PATCHv2.1-CA0132 HDA Codec 1/1] Draft DSP loader update #2

Takashi Iwai tiwai at suse.de
Wed Aug 22 15:39:22 CEST 2012

At Tue, 21 Aug 2012 18:36:01 -0700,
Ian Minett wrote:
> >There shouldn't be any addition of controls, etc, at this point.
> >Just do load the firmware.  This is the very first start.
> >
> >I can help debugging or give review / advise.  But obviously you are
> >at the better position start writing it since you have the test
> >hardware and the firmware data, both of which are missing for other
> >developers (including me).
> >
> >Once when a draft patch is ready or you face to a problem, let me
> >know.
> Ok, thanks.
> We do seem to be having problems in the DSP load prepare function:
> void *(*load_dsp_prepare)(struct hda_codec *codec, unsigned int format,
>                           unsigned int byte_size);
> This is the place where the buffer gets allocated, and BDL and DMA set up, and the
> pointer returned.
> Is there any sample code or other info you could provide, to give us a better idea
> of how the function and these actions should be implemented?

Maybe better to start from a bit clean up of SG buffer handling code
in general.  The first patch below makes the sg-buffer helpers more
generic so that they can be called even without sg-buffer support.

Then, setup_bdle() in hda_intel.c can be changed cleanly by passing
struct snd_dma_buffer pointer, as found in the second patch.

The rest of the second patch is the additions of callbacks supposedly
needed for your case.

load_dsp_prepare() callback takes parameters of the format value
(encoded by snd_hda_calc_stream_format()), the byte size of the buffer
to allocate, and a pointer to struct snd_dma_buffer.  It'll return the
stream tag in success, or a negative error code.  The allocated buffer
is stored in snd_dma_buffer.area pointer.  It'll be an SG-buffer, but
can be accessed linearly by that pointer.

Then, the caller should set up the codec by itself.  Unlike PCM
prepare, it doesn't set up the codec, as the DSP loading might need
more special setups.

After setting up these and the buffer is filled, call
load_dsp_trigger() callback.  It's a simple start/stop of the

Then call load_dsp_clean() callback.  The buffer will be released
there, too.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ALSA-Make-snd_sgbuf_get_-ptr-addr-available-for-non-.patch
Type: application/octet-stream
Size: 6939 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20120822/8de9f3f7/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hda-dsp-load-callbacks.diff
Type: application/octet-stream
Size: 4375 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20120822/8de9f3f7/attachment-0001.obj>

More information about the Alsa-devel mailing list