aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVaibhav Agarwal <vaibhav.agarwal@linaro.org>2016-07-12 04:56:00 -0500
committerAlex Elder <elder@linaro.org>2016-07-13 13:48:07 -0500
commit12ce523147e485fc605599f7ec94fbbc6be0fc01 (patch)
tree27ad563c798da90f04df0bee52eec8f7f7587027
parentgreybus: audio: Fix incorrect codec state modification (diff)
downloadlinux-dev-12ce523147e485fc605599f7ec94fbbc6be0fc01.tar.xz
linux-dev-12ce523147e485fc605599f7ec94fbbc6be0fc01.zip
greybus: audio: Maintain proper codec state during shutdown sequence.
During shutdown sequence, in case all modules are already removed, codec state is not updated. Though it's not causing any harm for now, but it's good to maintain proper codec state. Fix this. Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org> Reviewed-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Alex Elder <elder@linaro.org>
-rw-r--r--drivers/staging/greybus/audio_codec.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index 5e05375bb71e..9c7bec737875 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -460,6 +460,8 @@ static void gbcodec_shutdown(struct snd_pcm_substream *substream,
if (list_empty(&codec->module_list)) {
dev_err(codec->dev, "No codec module available\n");
+ codec->stream[substream->stream].state = GBAUDIO_CODEC_SHUTDOWN;
+ codec->stream[substream->stream].dai_name = NULL;
mutex_unlock(&codec->lock);
pm_relax(dai->dev);
return;
@@ -733,8 +735,14 @@ static int gbcodec_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
mutex_lock(&codec->lock);
if (list_empty(&codec->module_list)) {
dev_err(codec->dev, "No codec module available\n");
+ if (mute) {
+ codec->stream[stream].state = GBAUDIO_CODEC_STOP;
+ ret = 0;
+ } else {
+ ret = -ENODEV;
+ }
mutex_unlock(&codec->lock);
- return -ENODEV;
+ return ret;
}
list_for_each_entry(module, &codec->module_list, list) {