diff options
author | Vinod Koul <vinod.koul@intel.com> | 2013-11-07 04:08:22 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-11-07 04:12:27 -0500 |
commit | f44f2a5417b2968a8724b352cc0b2545a6bcb1f4 (patch) | |
tree | 4ea74e0d765b4d55429126770d72b107d66f4324 /include/sound/compress_driver.h | |
parent | ad8ff99e6beb8708b0bdefd9d5658324e90200f0 (diff) |
ALSA: compress: fix drain calls blocking other compress functions (v6)
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>
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.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h index 175ab3237b58..ae6c3b8ed2f5 100644 --- a/include/sound/compress_driver.h +++ b/include/sound/compress_driver.h | |||
@@ -48,8 +48,6 @@ 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 | ||
53 | */ | 51 | */ |
54 | struct snd_compr_runtime { | 52 | struct snd_compr_runtime { |
55 | snd_pcm_state_t state; | 53 | snd_pcm_state_t state; |
@@ -61,8 +59,6 @@ struct snd_compr_runtime { | |||
61 | u64 total_bytes_available; | 59 | u64 total_bytes_available; |
62 | u64 total_bytes_transferred; | 60 | u64 total_bytes_transferred; |
63 | wait_queue_head_t sleep; | 61 | wait_queue_head_t sleep; |
64 | wait_queue_head_t wait; | ||
65 | unsigned int drain_wake; | ||
66 | void *private_data; | 62 | void *private_data; |
67 | }; | 63 | }; |
68 | 64 | ||
@@ -177,10 +173,11 @@ static inline void snd_compr_fragment_elapsed(struct snd_compr_stream *stream) | |||
177 | 173 | ||
178 | static inline void snd_compr_drain_notify(struct snd_compr_stream *stream) | 174 | static inline void snd_compr_drain_notify(struct snd_compr_stream *stream) |
179 | { | 175 | { |
180 | snd_BUG_ON(!stream); | 176 | if (snd_BUG_ON(!stream)) |
177 | return; | ||
181 | 178 | ||
182 | stream->runtime->drain_wake = 1; | 179 | stream->runtime->state = SNDRV_PCM_STATE_SETUP; |
183 | wake_up(&stream->runtime->wait); | 180 | wake_up(&stream->runtime->sleep); |
184 | } | 181 | } |
185 | 182 | ||
186 | #endif | 183 | #endif |