From 703745fc3d034fa0763303fc06f66e4af1072a0c Mon Sep 17 00:00:00 2001 From: Surapusetty Naresh Babu Date: Thu, 19 Oct 2023 03:24:39 -0700 Subject: [PATCH] Revert "ALSA: compress: Allow pause and resume during draining" This reverts commit a771206007d51b8ea00443853c9eb33a6f232941. Change-Id: Id3bf7573d24aad7df2abc4efc7a8e381f93e401b Signed-off-by: Surapusetty Naresh Babu --- include/sound/compress_driver.h | 22 ---------------- sound/core/compress_offload.c | 45 ++++++--------------------------- 2 files changed, 8 insertions(+), 59 deletions(-) diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h index 6dc3ca65cc50..e9a34ca60703 100644 --- a/include/sound/compress_driver.h +++ b/include/sound/compress_driver.h @@ -59,7 +59,6 @@ struct snd_compr_runtime { * @direction: stream direction, playback/recording * @metadata_set: metadata set flag, true when set * @next_track: has userspace signal next track transition, true when set - * @pause_in_draining: paused during draining state, true when set * @private_data: pointer to DSP private data */ struct snd_compr_stream { @@ -71,9 +70,6 @@ struct snd_compr_stream { enum snd_compr_direction direction; bool metadata_set; bool next_track; -#ifndef CONFIG_AUDIO_QGKI - bool pause_in_draining; -#endif void *private_data; #ifdef CONFIG_AUDIO_QGKI struct snd_soc_pcm_runtime *be; @@ -144,7 +140,6 @@ struct snd_compr_ops { * @direction: Playback or capture direction * @lock: device lock * @device: device id - * @use_pause_in_draining: allow pause in draining, true when set */ struct snd_compr { const char *name; @@ -155,9 +150,6 @@ struct snd_compr { unsigned int direction; struct mutex lock; int device; -#ifndef CONFIG_AUDIO_QGKI - bool use_pause_in_draining; -#endif #ifdef CONFIG_SND_VERBOSE_PROCFS /* private: */ char id[64]; @@ -172,20 +164,6 @@ int snd_compress_deregister(struct snd_compr *device); int snd_compress_new(struct snd_card *card, int device, int type, const char *id, struct snd_compr *compr); -/** - * snd_compr_use_pause_in_draining - Allow pause and resume in draining state - * @substream: compress substream to set - * - * Allow pause and resume in draining state. - * Only HW driver supports this transition can call this API. - */ -#ifndef CONFIG_AUDIO_QGKI -static inline void snd_compr_use_pause_in_draining(struct snd_compr_stream *substream) -{ - substream->device->use_pause_in_draining = true; -} -#endif - /* dsp driver callback apis * For playback: driver should call snd_compress_fragment_elapsed() to let the * framework know that a fragment has been consumed from the ring buffer diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index c1c48207149f..4f3fb5ce4b31 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -698,24 +698,11 @@ static int snd_compr_pause(struct snd_compr_stream *stream) { int retval; - switch (stream->runtime->state) { - case SNDRV_PCM_STATE_RUNNING: - retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_PUSH); - if (!retval) - stream->runtime->state = SNDRV_PCM_STATE_PAUSED; - break; -#ifndef CONFIG_AUDIO_QGKI - case SNDRV_PCM_STATE_DRAINING: - if (!stream->device->use_pause_in_draining) - return -EPERM; - retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_PUSH); - if (!retval) - stream->pause_in_draining = true; - break; -#endif - default: + if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING) return -EPERM; - } + retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_PUSH); + if (!retval) + stream->runtime->state = SNDRV_PCM_STATE_PAUSED; return retval; } @@ -723,24 +710,11 @@ static int snd_compr_resume(struct snd_compr_stream *stream) { int retval; - switch (stream->runtime->state) { - case SNDRV_PCM_STATE_PAUSED: - retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_RELEASE); - if (!retval) - stream->runtime->state = SNDRV_PCM_STATE_RUNNING; - break; -#ifndef CONFIG_AUDIO_QGKI - case SNDRV_PCM_STATE_DRAINING: - if (!stream->pause_in_draining) - return -EPERM; - retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_RELEASE); - if (!retval) - stream->pause_in_draining = false; - break; -#endif - default: + if (stream->runtime->state != SNDRV_PCM_STATE_PAUSED) return -EPERM; - } + retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_RELEASE); + if (!retval) + stream->runtime->state = SNDRV_PCM_STATE_RUNNING; return retval; } @@ -780,9 +754,6 @@ static int snd_compr_stop(struct snd_compr_stream *stream) retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP); if (!retval) { -#ifndef CONFIG_AUDIO_QGKI - stream->pause_in_draining = false; -#endif snd_compr_drain_notify(stream); stream->runtime->total_bytes_available = 0; stream->runtime->total_bytes_transferred = 0;