From f2bf63a365425fa7df56c4e1dbe5a6bb29680324 Mon Sep 17 00:00:00 2001 From: Vaibhav Agarwal Date: Fri, 22 Apr 2016 11:13:19 -0700 Subject: [PATCH] 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: David Lin Reviewed-by: David Lin Reviewed-by: Viresh Kumar Signed-off-by: Akash Choudhari Signed-off-by: Vaibhav Agarwal --- drivers/staging/greybus/audio_codec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index ba3bd36f0c0a..9ed35c4da280 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -7,6 +7,7 @@ */ #include #include +#include #include #include #include @@ -388,6 +389,8 @@ static int gbcodec_startup(struct snd_pcm_substream *substream, codec->stream[substream->stream].state = state; codec->stream[substream->stream].dai_name = dai->name; mutex_unlock(&codec->lock); + /* to prevent suspend in case of active audio */ + pm_stay_awake(dai->dev); return ret; } @@ -470,6 +473,7 @@ static void gbcodec_shutdown(struct snd_pcm_substream *substream, codec->stream[substream->stream].state = state; codec->stream[substream->stream].dai_name = NULL; mutex_unlock(&codec->lock); + pm_relax(dai->dev); return; } @@ -1094,7 +1098,7 @@ static int gbcodec_probe(struct snd_soc_codec *codec) snd_soc_codec_set_drvdata(codec, info); gbcodec = info; - /* Empty function for now */ + device_init_wakeup(codec->dev, 1); return 0; } -- 2.20.1