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>
This commit is contained in:
Vaibhav Agarwal 2016-04-22 11:13:19 -07:00 коммит произвёл Akash Choudhari
Родитель f35fdb2fbd
Коммит f2bf63a365
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -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;
}