ASoC: Intel: Clean data after SST fw fetch
Subsystems (3)
PATCH 1/1 ASoC: Intel: Clean data after SST fw fetch
From: Libin Yang <[email protected]>
The BDW audio firmware DSP manages the DMA and the DMA cannot be stopped exactly at the end of the playback stream. This means stale samples may be played at PCM stop unless the driver copies silence to the subsequent periods.
Signed-off-by Libin Yang <[email protected]>
Reviewed-by Liam Girdwood <[email protected]>
--- sound/soc/intel/sst-haswell-ipc.c | 29 ++++++++++++++++++ sound/soc/intel/sst-haswell-ipc.h | 9 ++++++ sound/soc/intel/sst-haswell-pcm.c | 64 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+)
sound/soc/intel/sst-haswell-ipc.c +29 -0
@@ -31,6 +31,7 @@#include <linux/dma-mapping.h> #include <linux/debugfs.h> #include <linux/pm_runtime.h> +#include <sound/asound.h> #include "sst-haswell-ipc.h" #include "sst-dsp.h"
@@ -240,6 +241,10 @@ struct sst_hsw_stream {u32 (*notify_position)(struct sst_hsw_stream *stream,void *data);void *pdata; +/* record the fw read position when playback */ +snd_pcm_uframes_t old_position; +bool play_silence; +struct list_head node; };
@@ -1476,6 +1481,30 @@ u32 sst_hsw_stream_get_vol_reg(struct sst_hsw *hsw,return stream->reply.volume_register_address[channel]; } +snd_pcm_uframes_t sst_hsw_stream_get_old_position (struct sst_hsw *hsw, +struct sst_hsw_stream *stream) +{ +return stream->old_position; +} + +void sst_hsw_stream_set_old_position (struct sst_hsw *hsw, +struct sst_hsw_stream *stream,snd_pcm_uframes_t val) +{ + stream->old_position = val; +} + +bool sst_hsw_stream_get_silence_start (struct sst_hsw *hsw, +struct sst_hsw_stream *stream) +{ +return stream->play_silence; +} + +void sst_hsw_stream_set_silence_start (struct sst_hsw *hsw, +struct sst_hsw_stream *stream,bool val) +{ + stream->play_silence = val; +} +int sst_hsw_mixer_get_info (struct sst_hsw *hsw) {struct sst_hsw_ipc_stream_info_reply *reply;
sound/soc/intel/sst-haswell-ipc.h +9 -0
@@ -20,6 +20,7 @@#include <linux/types.h> #include <linux/kernel.h> #include <linux/platform_device.h> +#include <sound/asound.h> #define SST_HSW_NO_CHANNELS 4#define SST_HSW_MAX_DX_REGIONS 14
@@ -452,6 +453,14 @@ u32 sst_hsw_stream_get_peak_reg(struct sst_hsw *hsw, struct sst_hsw_stream *stream, u32 channel);u32 sst_hsw_stream_get_vol_reg (struct sst_hsw *hsw,struct sst_hsw_stream *stream,u32 channel); +snd_pcm_uframes_t sst_hsw_stream_get_old_position (struct sst_hsw *hsw, +struct sst_hsw_stream *stream); +void sst_hsw_stream_set_old_position (struct sst_hsw *hsw, +struct sst_hsw_stream *stream,snd_pcm_uframes_t val); +bool sst_hsw_stream_get_silence_start (struct sst_hsw *hsw, +struct sst_hsw_stream *stream); +void sst_hsw_stream_set_silence_start (struct sst_hsw *hsw, +struct sst_hsw_stream *stream,bool val);int sst_hsw_mixer_get_info (struct sst_hsw *hsw);/* Stream ALSA trigger operations */
sound/soc/intel/sst-haswell-pcm.c +64 -0
102 lines not on this page · raw message
Signature · 1 line
1.9.1
Quoted 6 lines · On Sun, Jan 04, 2015 at 09:25:20AM +0800, [email protected] wrote:
From: Libin Yang <[email protected]>
The BDW audio firmware DSP manages the DMA and the DMA cannot be stopped exactly at the end of the playback stream. This means stale samples may be played at PCM stop unless the driver copies silence to the subsequent periods.
Applied, thanks.