ASoC: Intel: Sample Baytrail DSP DMA pointer only after each period
authorJarkko Nikula <jarkko.nikula@linux.intel.com>
Thu, 8 May 2014 13:07:21 +0000 (16:07 +0300)
committerMark Brown <broonie@linaro.org>
Mon, 12 May 2014 21:02:17 +0000 (22:02 +0100)
commitc83649e3cdb6e78cfbc3abda7207ff44ba7bea75
tree8c422f3e44a74b3f896f903bec5c4c1b650d8b30
parentb9d4cf74b93e4255ac90d75f9bc3f85510a71378
ASoC: Intel: Sample Baytrail DSP DMA pointer only after each period

This is for preparing suspend/resume support but can give also more
safeguard against concurrent timestamp structure access between DSP firmware
and host.

Now DSP DMA pointer is sampled in each pcm pointer callback in
sst_byt_pcm_pointer() but that is unneeded since DSP updates the timestamp
period basis and can potentially be racy if sst_byt_pcm_pointer() is called
when DSP is updating the timestamp.

By taking DSP DMA pointer only after period elapsed IPC messages in
byt_notify_pointer() and returning stored hw pointer in
sst_byt_pcm_pointer() there is less risk for concurrent access.

The same stored hw pointer can be also used in suspend/resume code for
restarting the stream at the same position.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/intel/sst-baytrail-pcm.c