aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorEliot Blennerhassett <eblennerhassett@audioscience.com>2011-03-24 22:25:47 -0400
committerTakashi Iwai <tiwai@suse.de>2011-03-25 07:42:45 -0400
commit26aebef420f8036213419b8a46e3a07db51439cd (patch)
treefa15570ca88e3deb8d05454f5cd2066a49337e1d /sound/pci
parent7bf76c33e9a1ecb2a15f1a066d4e032b5d0922a7 (diff)
ALSA: asihpi - Improve non-busmaster adapter operation
Make playback silence callback a no-op, card automatically outputs silence when written data runs out. Increasing update interval and thus minimum period avoids xrun on startup or because of timer jitter. Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/asihpi/asihpi.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index 22606e3b08f4..c90d77ad681b 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -1012,6 +1012,7 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
1012 1012
1013 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 1013 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
1014 card->update_interval_frames); 1014 card->update_interval_frames);
1015
1015 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 1016 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
1016 card->update_interval_frames * 2, UINT_MAX); 1017 card->update_interval_frames * 2, UINT_MAX);
1017 1018
@@ -1054,7 +1055,7 @@ static int snd_card_asihpi_playback_copy(struct snd_pcm_substream *substream,
1054 hpi_handle_error(hpi_outstream_write_buf(dpcm->h_stream, 1055 hpi_handle_error(hpi_outstream_write_buf(dpcm->h_stream,
1055 runtime->dma_area, len, &dpcm->format)); 1056 runtime->dma_area, len, &dpcm->format));
1056 1057
1057 dpcm->pcm_buf_host_rw_ofs = dpcm->pcm_buf_host_rw_ofs + len; 1058 dpcm->pcm_buf_host_rw_ofs += len;
1058 1059
1059 return 0; 1060 return 0;
1060} 1061}
@@ -1064,16 +1065,11 @@ static int snd_card_asihpi_playback_silence(struct snd_pcm_substream *
1064 snd_pcm_uframes_t pos, 1065 snd_pcm_uframes_t pos,
1065 snd_pcm_uframes_t count) 1066 snd_pcm_uframes_t count)
1066{ 1067{
1067 unsigned int len; 1068 /* Usually writes silence to DMA buffer, which should be overwritten
1068 struct snd_pcm_runtime *runtime = substream->runtime; 1069 by real audio later. Our fifos cannot be overwritten, and are not
1069 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; 1070 free-running DMAs. Silence is output on fifo underflow.
1070 1071 This callback is still required to allow the copy callback to be used.
1071 len = frames_to_bytes(runtime, count); 1072 */
1072 VPRINTK1(KERN_INFO "playback silence %u bytes\n", len);
1073
1074 memset(runtime->dma_area, 0, len);
1075 hpi_handle_error(hpi_outstream_write_buf(dpcm->h_stream,
1076 runtime->dma_area, len, &dpcm->format));
1077 return 0; 1073 return 0;
1078} 1074}
1079 1075
@@ -2885,6 +2881,9 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2885 if (err) 2881 if (err)
2886 asihpi->update_interval_frames = 512; 2882 asihpi->update_interval_frames = 512;
2887 2883
2884 if (!asihpi->support_mmap)
2885 asihpi->update_interval_frames *= 2;
2886
2888 hpi_handle_error(hpi_instream_open(asihpi->adapter_index, 2887 hpi_handle_error(hpi_instream_open(asihpi->adapter_index,
2889 0, &h_stream)); 2888 0, &h_stream));
2890 2889