summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/audio_codec.c
diff options
context:
space:
mode:
authorVaibhav Agarwal <vaibhav.agarwal@linaro.org>2016-04-22 11:13:19 -0700
committerAkash Choudhari <akashtc@google.com>2016-04-22 11:29:21 -0700
commitf2bf63a365425fa7df56c4e1dbe5a6bb29680324 (patch)
treeef992dc18a46dada558225954841e211c78825de /drivers/staging/greybus/audio_codec.c
parentf35fdb2fbdc9435b723775b6aa561590413131c6 (diff)
downloadop-kernel-dev-f2bf63a365425fa7df56c4e1dbe5a6bb29680324.zip
op-kernel-dev-f2bf63a365425fa7df56c4e1dbe5a6bb29680324.tar.gz
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 <dtwlin@google.com> Reviewed-by: David Lin <dtwlin@google.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Akash Choudhari <akashtc@google.com> Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@linaro.org>
Diffstat (limited to 'drivers/staging/greybus/audio_codec.c')
-rw-r--r--drivers/staging/greybus/audio_codec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index ba3bd36..9ed35c4 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -7,6 +7,7 @@
*/
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/pm_runtime.h>
#include <sound/soc.h>
#include <sound/pcm_params.h>
#include <uapi/linux/input.h>
@@ -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;
}
OpenPOWER on IntegriCloud