From: Vaibhav Agarwal Date: Fri, 22 Apr 2016 18:13:19 +0000 (-0700) Subject: greybus: audio: acquire wakelock during active playback X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f2bf63a365425fa7df56c4e1dbe5a6bb29680324;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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; }