ASoC: kirkwood: implement NO_PERIOD_WAKEUP support
authorRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 26 Jun 2014 14:23:20 +0000 (15:23 +0100)
committerMark Brown <broonie@linaro.org>
Sat, 28 Jun 2014 12:18:46 +0000 (13:18 +0100)
Permit ALSA to run without hardware interrupts from the audio interface.
Instead, ALSA will use a kernel timer to decide when to check the buffer
state, resulting in a lighter workload for the CPU.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/kirkwood/kirkwood-dma.c
sound/soc/kirkwood/kirkwood-i2s.c

index aac22fccdcdc3e3954b35493df9773d4fd8c98fe..4cf2245950d79e91cf343ed9658f51f4fd3dc6df 100644 (file)
@@ -28,11 +28,12 @@ static struct kirkwood_dma_data *kirkwood_priv(struct snd_pcm_substream *subs)
 }
 
 static struct snd_pcm_hardware kirkwood_dma_snd_hw = {
-       .info = (SNDRV_PCM_INFO_INTERLEAVED |
-                SNDRV_PCM_INFO_MMAP |
-                SNDRV_PCM_INFO_MMAP_VALID |
-                SNDRV_PCM_INFO_BLOCK_TRANSFER |
-                SNDRV_PCM_INFO_PAUSE),
+       .info = SNDRV_PCM_INFO_INTERLEAVED |
+               SNDRV_PCM_INFO_MMAP |
+               SNDRV_PCM_INFO_MMAP_VALID |
+               SNDRV_PCM_INFO_BLOCK_TRANSFER |
+               SNDRV_PCM_INFO_PAUSE |
+               SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
        .buffer_bytes_max       = KIRKWOOD_SND_MAX_BUFFER_BYTES,
        .period_bytes_min       = KIRKWOOD_SND_MIN_PERIOD_BYTES,
        .period_bytes_max       = KIRKWOOD_SND_MAX_PERIOD_BYTES,
index e98650c01ebaf634de07c75bbbaa04a41c571ba0..0704cd6d2314402af10978e6408bb943b12aec93 100644 (file)
@@ -234,6 +234,7 @@ static unsigned kirkwood_i2s_play_mute(unsigned ctl)
 static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream,
                                int cmd, struct snd_soc_dai *dai)
 {
+       struct snd_pcm_runtime *runtime = substream->runtime;
        struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
        uint32_t ctl, value;
 
@@ -271,9 +272,11 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream,
                writel(value, priv->io + KIRKWOOD_PLAYCTL);
 
                /* enable interrupts */
-               value = readl(priv->io + KIRKWOOD_INT_MASK);
-               value |= KIRKWOOD_INT_CAUSE_PLAY_BYTES;
-               writel(value, priv->io + KIRKWOOD_INT_MASK);
+               if (!runtime->no_period_wakeup) {
+                       value = readl(priv->io + KIRKWOOD_INT_MASK);
+                       value |= KIRKWOOD_INT_CAUSE_PLAY_BYTES;
+                       writel(value, priv->io + KIRKWOOD_INT_MASK);
+               }
 
                /* enable playback */
                writel(ctl, priv->io + KIRKWOOD_PLAYCTL);