aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/compress_driver.h
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@intel.com>2013-10-24 07:07:31 -0400
committerTakashi Iwai <tiwai@suse.de>2013-10-24 08:50:37 -0400
commit917f4b5cba78980a527098a910d94139d3e82c8d (patch)
treee84f98c5c5ea708b205e1ef34684b778d16c5a67 /include/sound/compress_driver.h
parenta5606f85611267047206d8ba055bc0e4ba166ad3 (diff)
ALSA: compress: fix drain calls blocking other compress functions
The drain and drain_notify callback were blocked by low level driver untill the draining was complete. Due to this being invoked with big fat mutex held, others ops like reading timestamp, calling pause, drop were blocked. So to fix this we add a new snd_compr_drain_notify() API. This would be required to be invoked by low level driver when drain or partial drain has been completed by the DSP. Thus we make the drain and partial_drain callback as non blocking and driver returns immediately after notifying DSP. The waiting is done while relasing the lock so that other ops can go ahead. Signed-off-by: Vinod Koul <vinod.koul@intel.com> CC: stable@vger.kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound/compress_driver.h')
-rw-r--r--include/sound/compress_driver.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index 9031a26249b5..175ab3237b58 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -48,6 +48,8 @@ struct snd_compr_ops;
48 * the ring buffer 48 * the ring buffer
49 * @total_bytes_transferred: cumulative bytes transferred by offload DSP 49 * @total_bytes_transferred: cumulative bytes transferred by offload DSP
50 * @sleep: poll sleep 50 * @sleep: poll sleep
51 * @wait: drain wait queue
52 * @drain_wake: condition for drain wake
51 */ 53 */
52struct snd_compr_runtime { 54struct snd_compr_runtime {
53 snd_pcm_state_t state; 55 snd_pcm_state_t state;
@@ -59,6 +61,8 @@ struct snd_compr_runtime {
59 u64 total_bytes_available; 61 u64 total_bytes_available;
60 u64 total_bytes_transferred; 62 u64 total_bytes_transferred;
61 wait_queue_head_t sleep; 63 wait_queue_head_t sleep;
64 wait_queue_head_t wait;
65 unsigned int drain_wake;
62 void *private_data; 66 void *private_data;
63}; 67};
64 68
@@ -171,4 +175,12 @@ static inline void snd_compr_fragment_elapsed(struct snd_compr_stream *stream)
171 wake_up(&stream->runtime->sleep); 175 wake_up(&stream->runtime->sleep);
172} 176}
173 177
178static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
179{
180 snd_BUG_ON(!stream);
181
182 stream->runtime->drain_wake = 1;
183 wake_up(&stream->runtime->wait);
184}
185
174#endif 186#endif