]> git.openfabrics.org - ~shefty/rdma-dev.git/commit
ASoC: davinci-pcm: convert to BATCH mode
authorBen Gardiner <bengardiner@nanometrics.ca>
Tue, 24 May 2011 18:50:20 +0000 (14:50 -0400)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 25 May 2011 11:14:31 +0000 (19:14 +0800)
commit52e2c5d38ea6f13a19c29da7ba5183e6fac55400
tree7824cdb94a0f448862eb975795c8054c5aab5bca
parent10ab3bfda41ea21419f6a8d1e5a645521fea4b32
ASoC: davinci-pcm: convert to BATCH mode

The davinci-pcm driver's snd_pcm_ops pointer function currently calls into
the edma controller driver to read the current positions of the edma channels
to determine pos to return to the ALSA framework. In particular,
davinci_pcm_pointer() calls edma_get_position() and the latter has a comment
indicating that "Its channel should not be active when this is called" whereas
the channel is surely active when snd_pcm_ops.pointer is called.

The operation of davinci-pcm in capture and playback appears to follow close
the other pcm drivers who export SNDRV_PCM_INFO_BATCH except that davinci-pcm
does not report it's positions from pointer() using the last transferred
chunk. Instead it peeks directly into the edma controller to determine the
current position as discussed above.

Convert the davinci-pcm driver to BATCH mode: count the periods elapsed in the
prtd->period member and use its value to report the 'pos' to the alsa
framework in the davinci_pcm_pointer function.

There is a phase offset of 2 periods between the position used by dma setup
and the position reported in the pointer function. Either +2 in the dma
setup or -2 in the pointer function (with wrapping, both) accounts for this
offset -- I opted for the latter since it makes the first-time setup clearer.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: Steven Faludi <stevenfaludi@nanometrics.ca>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/davinci/davinci-pcm.c