File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,6 +135,14 @@ static void dmaengine_pcm_dma_complete(void *arg)
135135 struct snd_pcm_substream * substream = arg ;
136136 struct dmaengine_pcm_runtime_data * prtd = substream_to_prtd (substream );
137137
138+ #ifdef CONFIG_SND_SOC_ROCKCHIP_VAD
139+ if (snd_pcm_vad_attached (substream )) {
140+ void * buf = substream -> runtime -> dma_area + prtd -> pos ;
141+
142+ snd_pcm_vad_preprocess (substream , buf ,
143+ substream -> runtime -> period_size );
144+ }
145+ #endif
138146 prtd -> pos += snd_pcm_lib_period_bytes (substream );
139147 if (prtd -> pos >= snd_pcm_lib_buffer_bytes (substream ))
140148 prtd -> pos = 0 ;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ struct dmaengine_mpcm_runtime_data {
2929 dma_cookie_t cookies [MAX_DAIS ];
3030 unsigned int * channel_maps ;
3131 int num_chans ;
32+ unsigned int pos ;
3233};
3334
3435static inline struct dmaengine_mpcm_runtime_data * substream_to_prtd (
@@ -90,7 +91,21 @@ static void snd_dmaengine_mpcm_set_config_from_dai_data(
9091static void dmaengine_mpcm_dma_complete (void * arg )
9192{
9293 struct snd_pcm_substream * substream = arg ;
94+ #ifdef CONFIG_SND_SOC_ROCKCHIP_VAD
95+ struct dmaengine_mpcm_runtime_data * prtd = substream_to_prtd (substream );
96+
97+ if (snd_pcm_vad_attached (substream )) {
98+ void * buf = substream -> runtime -> dma_area + prtd -> pos ;
99+
100+ snd_pcm_vad_preprocess (substream , buf ,
101+ substream -> runtime -> period_size );
102+ }
103+
104+ prtd -> pos += snd_pcm_lib_period_bytes (substream );
105+ if (prtd -> pos >= snd_pcm_lib_buffer_bytes (substream ))
106+ prtd -> pos = 0 ;
93107
108+ #endif
94109 snd_pcm_period_elapsed (substream );
95110}
96111
@@ -111,6 +126,7 @@ static int dmaengine_mpcm_prepare_and_submit(struct snd_pcm_substream *substream
111126 if (!substream -> runtime -> no_period_wakeup )
112127 flags |= DMA_PREP_INTERRUPT ;
113128
129+ prtd -> pos = 0 ;
114130 offset = 0 ;
115131 period_bytes = snd_pcm_lib_period_bytes (substream );
116132 buffer_bytes = snd_pcm_lib_buffer_bytes (substream );
You can’t perform that action at this time.
0 commit comments