aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@intel.com>2013-11-07 10:08:22 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-29 11:27:58 -0800
commit8e04b5d8e4204a216a5674dc316ca9fa0800fd93 (patch)
tree33a9d33bfc83aa210db4371eb28b84d46ca2fb49 /include
parent7c276704b729d8d063620c836762f204e191aaf0 (diff)
ALSA: compress: fix drain calls blocking other compress functions (v6)
commit f44f2a5417b2968a8724b352cc0b2545a6bcb1f4 upstream. The drain and drain_notify callback were blocked by low level driver until 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 releasing the lock so that other ops can go ahead. [ The commit 917f4b5cba78 was wrongly applied from the preliminary patch. This commit corrects to the final version. Sorry for inconvenience! -- tiwai ] Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/sound/compress_driver.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index 175ab3237b5..ae6c3b8ed2f 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -48,8 +48,6 @@ struct snd_compr_ops;
* the ring buffer
* @total_bytes_transferred: cumulative bytes transferred by offload DSP
* @sleep: poll sleep
- * @wait: drain wait queue
- * @drain_wake: condition for drain wake
*/
struct snd_compr_runtime {
snd_pcm_state_t state;
@@ -61,8 +59,6 @@ struct snd_compr_runtime {
u64 total_bytes_available;
u64 total_bytes_transferred;
wait_queue_head_t sleep;
- wait_queue_head_t wait;
- unsigned int drain_wake;
void *private_data;
};
@@ -177,10 +173,11 @@ static inline void snd_compr_fragment_elapsed(struct snd_compr_stream *stream)
static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
{
- snd_BUG_ON(!stream);
+ if (snd_BUG_ON(!stream))
+ return;
- stream->runtime->drain_wake = 1;
- wake_up(&stream->runtime->wait);
+ stream->runtime->state = SNDRV_PCM_STATE_SETUP;
+ wake_up(&stream->runtime->sleep);
}
#endif