Modified: trunk/sound/soc/blackfin/bf5xx-ac97-pcm.c (5338 => 5339)
--- trunk/sound/soc/blackfin/bf5xx-ac97-pcm.c 2008-09-25 09:02:06 UTC (rev 5338)
+++ trunk/sound/soc/blackfin/bf5xx-ac97-pcm.c 2008-09-25 10:27:11 UTC (rev 5339)
@@ -56,6 +56,7 @@
sport->tx_pos += runtime->period_size;
if (sport->tx_pos >= runtime->buffer_size)
sport->tx_pos %= runtime->buffer_size;
+ sport->tx_delay_pos = sport->tx_pos;
} else {
bf5xx_ac97_to_pcm(
(struct ac97_frame *)sport->rx_dma_buf + sport->rx_pos,
@@ -72,7 +73,15 @@
struct snd_pcm_substream *pcm = data;
#if defined(CONFIG_SND_MMAP_SUPPORT)
struct snd_pcm_runtime *runtime = pcm->runtime;
+ struct sport_device *sport = runtime->private_data;
bf5xx_mmap_copy(pcm, runtime->period_size);
+ if (pcm->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ if (sport-> 0) {
+ snd_pcm_period_elapsed(pcm);
+ bf5xx_mmap_copy(pcm, runtime->period_size);
+ sport->
+ }
+ }
#endif
snd_pcm_period_elapsed(pcm);
}
@@ -114,6 +123,10 @@
static int bf5xx_pcm_hw_free(struct snd_pcm_substream *substream)
{
+ struct snd_pcm_runtime *runtime = substream->runtime;
+
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ memset(runtime->dma_area, 0, runtime->buffer_size);
snd_pcm_lib_free_pages(substream);
return 0;
}
@@ -127,12 +140,8 @@
* SPORT working in TMD mode(include AC97).
*/
#if defined(CONFIG_SND_MMAP_SUPPORT)
- size_t size = bf5xx_pcm_hardware.buffer_bytes_max
- * sizeof(struct ac97_frame) / 4;
- /*clean up intermediate buffer*/
- memset(sport->tx_dma_buf, 0, size);
- memset(sport->rx_dma_buf, 0, size);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
sport_set_tx_callback(sport, bf5xx_dma_irq, substream);
sport_config_tx_dma(sport, sport->tx_dma_buf, runtime->periods,
runtime->period_size * sizeof(struct ac97_frame));
@@ -165,8 +174,12 @@
cmd?" start":" stop");
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ bf5xx_mmap_copy(substream, runtime->period_size);
+ snd_pcm_period_elapsed(substream);
+ sport->tx_delay_pos = 0;
sport_tx_start(sport);
+ }
else
sport_rx_start(sport);
break;
@@ -199,7 +212,7 @@
#if defined(CONFIG_SND_MMAP_SUPPORT)
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
- curr = sport->tx_pos;
+ curr = sport->tx_delay_pos;
else
curr = sport->rx_pos;
#else
@@ -243,9 +256,16 @@
static int bf5xx_pcm_close(struct snd_pcm_substream *substream)
{
+ struct snd_pcm_runtime *runtime = substream->runtime;
+ struct sport_device *sport = runtime->private_data;
+
pr_debug("%s enter\n", __func__);
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+ sport->
+ memset(sport->tx_dma_buf, 0, runtime->buffer_size * sizeof(struct ac97_frame));
+ } else
+ memset(sport->rx_dma_buf, 0, runtime->buffer_size * sizeof(struct ac97_frame));
- /* Nothing need to be cleared here */
return 0;
}
@@ -425,7 +445,7 @@
if (ret)
goto out;
}
- out:
+out:
return ret;
}
Modified: trunk/sound/soc/blackfin/bf5xx-sport.h (5338 => 5339)
--- trunk/sound/soc/blackfin/bf5xx-sport.h 2008-09-25 09:02:06 UTC (rev 5338)
+++ trunk/sound/soc/blackfin/bf5xx-sport.h 2008-09-25 10:27:11 UTC (rev 5339)
@@ -123,6 +123,8 @@
int rx_pos;
unsigned int tx_buffer_size;
unsigned int rx_buffer_size;
+ int tx_delay_pos;
+ int once;
#endif
void *private_data;
};