Commit f2bf63a3 authored by Vaibhav Agarwal's avatar Vaibhav Agarwal Committed by Akash Choudhari

greybus: audio: acquire wakelock during active playback

use pm_stay_awake & pm_relax to avoid suspend sequence during
active playback

testing Done:
Music Playback ongoing
$ cat /sys/devices/soc.0/qcom,ara-codec.82/power/wakeup_active
1
Music Playback stopped
$ cat /sys/devices/soc.0/qcom,ara-codec.82/power/wakeup_active
0
Tested-by: default avatarDavid Lin <dtwlin@google.com>
Reviewed-by: default avatarDavid Lin <dtwlin@google.com>
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarAkash Choudhari <akashtc@google.com>
Signed-off-by: default avatarVaibhav Agarwal <vaibhav.agarwal@linaro.org>
parent f35fdb2f
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pm_runtime.h>
#include <sound/soc.h> #include <sound/soc.h>
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include <uapi/linux/input.h> #include <uapi/linux/input.h>
...@@ -388,6 +389,8 @@ static int gbcodec_startup(struct snd_pcm_substream *substream, ...@@ -388,6 +389,8 @@ static int gbcodec_startup(struct snd_pcm_substream *substream,
codec->stream[substream->stream].state = state; codec->stream[substream->stream].state = state;
codec->stream[substream->stream].dai_name = dai->name; codec->stream[substream->stream].dai_name = dai->name;
mutex_unlock(&codec->lock); mutex_unlock(&codec->lock);
/* to prevent suspend in case of active audio */
pm_stay_awake(dai->dev);
return ret; return ret;
} }
...@@ -470,6 +473,7 @@ static void gbcodec_shutdown(struct snd_pcm_substream *substream, ...@@ -470,6 +473,7 @@ static void gbcodec_shutdown(struct snd_pcm_substream *substream,
codec->stream[substream->stream].state = state; codec->stream[substream->stream].state = state;
codec->stream[substream->stream].dai_name = NULL; codec->stream[substream->stream].dai_name = NULL;
mutex_unlock(&codec->lock); mutex_unlock(&codec->lock);
pm_relax(dai->dev);
return; return;
} }
...@@ -1094,7 +1098,7 @@ static int gbcodec_probe(struct snd_soc_codec *codec) ...@@ -1094,7 +1098,7 @@ static int gbcodec_probe(struct snd_soc_codec *codec)
snd_soc_codec_set_drvdata(codec, info); snd_soc_codec_set_drvdata(codec, info);
gbcodec = info; gbcodec = info;
/* Empty function for now */ device_init_wakeup(codec->dev, 1);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment