aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2016-06-13 09:17:10 -0400
committerMark Brown <broonie@kernel.org>2016-06-13 11:45:37 -0400
commita4f2d87c63571d4cd9467d369f2fbf2362646043 (patch)
tree9ba1c814757a52c9f18c2be6bf0fd85f3c0d0e2a /include/sound
parent1a695a905c18548062509178b98bc91e67510864 (diff)
ALSA: compress: Add function to indicate the stream has gone bad
Currently, the avail IOCTL doesn't pass any error status, which means typically on error it simply shows no data available. This can lead to situations where user-space is waiting indefinitely for data that will never come as the DSP has suffered an unrecoverable error. Add snd_compr_stop_error which end drivers can call to indicate the stream has suffered an unrecoverable error and stop it. The avail and poll IOCTLs are then updated to report if the stream is in an error state to user-space. Allowing the error to propagate out. Processing of the actual snd_compr_stop needs to be deferred to a worker thread as the end driver may detect the errors during an existing operation callback. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/compress_driver.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index c0abcdc11470..cee8c00f3d3e 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -68,6 +68,7 @@ struct snd_compr_runtime {
68 * @ops: pointer to DSP callbacks 68 * @ops: pointer to DSP callbacks
69 * @runtime: pointer to runtime structure 69 * @runtime: pointer to runtime structure
70 * @device: device pointer 70 * @device: device pointer
71 * @error_work: delayed work used when closing the stream due to an error
71 * @direction: stream direction, playback/recording 72 * @direction: stream direction, playback/recording
72 * @metadata_set: metadata set flag, true when set 73 * @metadata_set: metadata set flag, true when set
73 * @next_track: has userspace signal next track transition, true when set 74 * @next_track: has userspace signal next track transition, true when set
@@ -78,6 +79,7 @@ struct snd_compr_stream {
78 struct snd_compr_ops *ops; 79 struct snd_compr_ops *ops;
79 struct snd_compr_runtime *runtime; 80 struct snd_compr_runtime *runtime;
80 struct snd_compr *device; 81 struct snd_compr *device;
82 struct delayed_work error_work;
81 enum snd_compr_direction direction; 83 enum snd_compr_direction direction;
82 bool metadata_set; 84 bool metadata_set;
83 bool next_track; 85 bool next_track;
@@ -187,4 +189,7 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
187 wake_up(&stream->runtime->sleep); 189 wake_up(&stream->runtime->sleep);
188} 190}
189 191
192int snd_compr_stop_error(struct snd_compr_stream *stream,
193 snd_pcm_state_t state);
194
190#endif 195#endif