summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/tegra/tegra_pcm.c18
-rw-r--r--sound/soc/tegra/tegra_soc.h8
2 files changed, 26 insertions, 0 deletions
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c
index 8ee01173d6c0..4b0554522be2 100644
--- a/sound/soc/tegra/tegra_pcm.c
+++ b/sound/soc/tegra/tegra_pcm.c
@@ -129,6 +129,9 @@ static int tegra_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+#ifdef CONFIG_HAS_WAKELOCK
+ wake_lock(&prtd->wake_lock);
+#endif
prtd->dma_state = STATE_INIT;
tegra_pcm_queue_dma(prtd); /* dma enqueue req1 */
tegra_pcm_queue_dma(prtd); /* dma enqueue req2 */
@@ -148,6 +151,9 @@ static int tegra_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
prtd->dma_head_idx = 0;
prtd->dma_tail_idx = DMA_REQ_QCOUNT - 1;
}
+#ifdef CONFIG_HAS_WAKELOCK
+ wake_unlock(&prtd->wake_lock);
+#endif
break;
default:
@@ -241,6 +247,15 @@ static int tegra_pcm_open(struct snd_pcm_substream *substream)
goto fail;
}
+#ifdef CONFIG_HAS_WAKELOCK
+ snprintf(prtd->wake_lock_name, sizeof(prtd->wake_lock_name),
+ "tegra-pcm-%s-%d",
+ (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? "out" : "in",
+ substream->pcm->device);
+ wake_lock_init(&prtd->wake_lock, WAKE_LOCK_SUSPEND,
+ prtd->wake_lock_name);
+#endif
+
/* Set HW params now that initialization is complete */
snd_soc_set_runtime_hwparams(substream, &tegra_pcm_hardware);
@@ -274,6 +289,9 @@ static int tegra_pcm_close(struct snd_pcm_substream *substream)
return 0;
}
+#ifdef CONFIG_HAS_WAKELOCK
+ wake_lock_destroy(&prtd->wake_lock);
+#endif
if (prtd->dma_chan) {
prtd->dma_state = STATE_EXIT;
for (i = 0; i < DMA_REQ_QCOUNT; i++) {
diff --git a/sound/soc/tegra/tegra_soc.h b/sound/soc/tegra/tegra_soc.h
index 45726cbde45a..539b46fbaa5b 100644
--- a/sound/soc/tegra/tegra_soc.h
+++ b/sound/soc/tegra/tegra_soc.h
@@ -59,6 +59,10 @@
#include <asm/mach-types.h>
#include <asm/hardware/scoop.h>
+#ifdef CONFIG_HAS_WAKELOCK
+#include <linux/wakelock.h>
+#endif
+
#define STATE_INIT 0
#define STATE_ABORT 1
#define STATE_EXIT 2
@@ -100,6 +104,10 @@ struct tegra_runtime_data {
int dma_state;
struct tegra_dma_req dma_req[DMA_REQ_QCOUNT];
struct tegra_dma_channel *dma_chan;
+#ifdef CONFIG_HAS_WAKELOCK
+ struct wake_lock wake_lock;
+ char wake_lock_name[32];
+#endif
};
struct tegra_audio_data {