diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2017-06-07 02:38:05 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-06-07 07:53:32 +0200 |
commit | 875becf8412c60ffae93c5f69e95a4d023f0e8ee (patch) | |
tree | 04baa851c60f7c068d8b8218aeea20947cd40ba7 /sound/firewire/tascam | |
parent | ALSA: doc: Update copy_user, copy_kernel and fill_silence PCM ops (diff) | |
download | linux-875becf8412c60ffae93c5f69e95a4d023f0e8ee.tar.xz linux-875becf8412c60ffae93c5f69e95a4d023f0e8ee.zip |
ALSA: firewire: process packets in 'struct snd_pcm_ops.ack' callback
In recent commit for ALSA PCM core, some arrangement is done for
'struct snd_pcm_ops.ack' callback. This is called when appl_ptr is
explicitly moved in intermediate buffer for PCM frames, except for
some cases described later.
For drivers in ALSA firewire stack, usage of this callback has a merit to
reduce latency between time of PCM frame queueing and handling actual
packets in recent isochronous cycle, because no need to wait for software
IRQ context from isochronous context of OHCI 1394.
If this works well in a case that mapped page frame is used for the
intermediate buffer, user process should execute some commands for ioctl(2)
to tell the number of handled PCM frames in the intermediate buffer just
after handling them. Therefore, at present, with a combination of below
conditions, this doesn't work as expected and user process should wait for
the software IRQ context as usual:
- when ALSA PCM core judges page frame mapping is available for status
data (struct snd_pcm_mmap_status) and control data
(struct snd_pcm_mmap_control).
- user process handles PCM frames by loop just with 'snd_pcm_mmap_begin()'
and 'snd_pcm_mmap_commit()'.
- user process uses PCM hw plugin in alsa-lib to operate I/O without
'sync_ptr_ioctl' option.
Unfortunately, major use case include these three conditions.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/tascam')
-rw-r--r-- | sound/firewire/tascam/tascam-pcm.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sound/firewire/tascam/tascam-pcm.c b/sound/firewire/tascam/tascam-pcm.c index 6207588d7c73..3c4482aa7231 100644 --- a/sound/firewire/tascam/tascam-pcm.c +++ b/sound/firewire/tascam/tascam-pcm.c @@ -263,6 +263,20 @@ static snd_pcm_uframes_t pcm_playback_pointer(struct snd_pcm_substream *sbstrm) return amdtp_stream_pcm_pointer(&tscm->rx_stream); } +static int pcm_capture_ack(struct snd_pcm_substream *substream) +{ + struct snd_tscm *tscm = substream->private_data; + + return amdtp_stream_pcm_ack(&tscm->tx_stream); +} + +static int pcm_playback_ack(struct snd_pcm_substream *substream) +{ + struct snd_tscm *tscm = substream->private_data; + + return amdtp_stream_pcm_ack(&tscm->rx_stream); +} + int snd_tscm_create_pcm_devices(struct snd_tscm *tscm) { static const struct snd_pcm_ops capture_ops = { @@ -274,6 +288,7 @@ int snd_tscm_create_pcm_devices(struct snd_tscm *tscm) .prepare = pcm_capture_prepare, .trigger = pcm_capture_trigger, .pointer = pcm_capture_pointer, + .ack = pcm_capture_ack, .page = snd_pcm_lib_get_vmalloc_page, }; static const struct snd_pcm_ops playback_ops = { @@ -285,6 +300,7 @@ int snd_tscm_create_pcm_devices(struct snd_tscm *tscm) .prepare = pcm_playback_prepare, .trigger = pcm_playback_trigger, .pointer = pcm_playback_pointer, + .ack = pcm_playback_ack, .page = snd_pcm_lib_get_vmalloc_page, .mmap = snd_pcm_lib_mmap_vmalloc, }; |