aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/bebob/bebob_pcm.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-06-08ALSA: firewire: arrange common PCM info/constraints for AMDTP engine applicationsTakashi Sakamoto1-21/+0
In ALSA firewire stack, 8 drivers uses IEC 61883-1/6 engine for data transmission. They have common PCM info/constraints and duplicated codes. This commit unifies the codes into fireiwre-lib. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-07ALSA: firewire: process packets in 'struct snd_pcm_ops.ack' callbackTakashi Sakamoto1-0/+16
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>
2017-05-22ALSA: firewire: remove support for 16 bit PCM samples in playback substreamTakashi Sakamoto1-4/+0
In IEC 61883-6, AM824 is described as format of data block. In this format, one data block consists of several data channels, which is aligned to 32 bit. One data channel has 8 bit label field and 24 bit data field. PCM frames are transferred in Multi Bit Linear Audio (MBLA) data channel. This channel can include 16/20/24 bit PCM sample. As long as I know, models which support IEC 61883-1/6 doesn't allow to switch bit length of PCM sample in MBLA data channel. They always transmit/receive PCM frames of 24 bit length. This can be seen for the other models which support protocols similar to IEC 61883-1/6. On the other hand, current drivers for these protocols supports 16 bit length PCM sample in playback substream. In this case, PCM sample is put into the MBLA data channel with 8 bit padding in LSB side. Although 16 bit PCM sample is major because it's in CD format, this doesn't represent device capability as is. This commit removes support for 16 bit PCM samples in playback substream. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-01-05ALSA: bebob: enclose identifiers referred by single functionTakashi Sakamoto1-26/+25
Some identifiers are referred just by one functions. In this case, they can be put into the function definition. This brings two merits; readers can easily follow codes related to the identifiers, developers are free from name conflict. This commit moves such identifiers to each function definition. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-02-20ALSA: bebob: change type of substream counter from atomic_t to unsigned intTakashi Sakamoto1-4/+4
The counter is incremented/decremented in critical section protected with mutex. Therefore, no need to use atomic_t. This commit changes the type to unsigned int. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-02-20ALSA: bebob: move mutex from function callee to callersTakashi Sakamoto1-4/+16
Currently, critical section is protected by mutex in functions of fireworks_stream.c. Callers increments/decrements substreams counter before calling the functions. Moving mutex to the callers code allows to change type of the substream counter from atomic_t to unsigned int. This commit is a preparation for obsoleting usage of atomic_t for substream counter. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-11ALSA: bebob: constify various snd_bebob structuresJulia Lawall1-1/+1
The structures of type snd_bebob_clock_spec, snd_bebob_rate_spec, snd_bebob_meter_spec, and snd_bebob_spec are never modified after they are initialized. Make them all const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: rename macros with AM824 prefixTakashi Sakamoto1-2/+2
This commit renames some macros just related to AM824 format. In later commit, they're moved to AM824 layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: rename PCM format helper functionTakashi Sakamoto1-4/+4
Setting the format of PCM substream to AMDTP stream structure is important to set a handler to copy actual PCM samples between buffers. The processing should be in data block processing layer because essentially it has no relationship to packet streaming. This commit renames PCM format setting function to prepare for integrating AM824 layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: move PCM substream constraint to AM824 layerTakashi Sakamoto1-1/+1
In IEC 61883-6, PCM frames are transferred in Multi Bit Linear Audio data channel. The data channel transfers 16/20/24 bit PCM samples. Thus, PCM substream has a constrain about it. This commit moves codes related to the constraint from packet streaming layer to AM824 data block processing layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-29ALSA: fireworks/bebob/dice/oxfw: fix substreams counting at vmalloc failureTakashi Sakamoto1-4/+16
In PCM core, when hw_params() in each driver returns error, the state of PCM substream is kept as 'open'. In this case, current drivers for sound units on IEEE 1394 bus doesn't decrement substream counter in hw_free() correctly. This causes these drivers to keep streams even if not required. This commit fixes this bug. When snd_pcm_lib_alloc_vmalloc_buffer() fails, hw_params function in each driver returns without incrementing the counter. Reported-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: keep duplex streams always to keep internal multiplexer properlyTakashi Sakamoto1-4/+4
Behringer FCA610 transmits packets with periodic noisy PCM samples when receiving no streams, and generates a bit noisy sound. ALSA BeBoB driver is programmed to establish both in/out connections when starting streaming, then transfers packets as userspace applications requested. This means that there's a case that one of incoming/outgoing streams is running, to save CPU and bandwidth usage. Although, it's natural to start transferring packets in both direction. This commit makes this driver to keeps duplex streams always. Tested-by: Kim Tore Jensen <kim@incendio.no> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: add SYT-Match supportTakashi Sakamoto1-5/+0
In previous commits, this driver can detect the source of clock as mush as possible. SYT-Match mode is also available. This commit purge the restriction. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: use normalized representation for the type of clock sourceTakashi Sakamoto1-3/+8
This commit changes function prototype and its processing. As a result, function caller can execute additional processing according to detected clock source. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: bebob: Prepare for device specific operationsTakashi Sakamoto1-1/+2
This commit is for some devices which have its own operations or quirks. Many functionality should be implemented in user land. Then this commit adds functionality related to stream such as sampling frequency or clock source. For help to debug, this commit adds the functionality to get metering information if it's available. To help these functionalities, this commit adds some AV/C commands defined in 'AV/C Audio Subunit Specification (1394TA). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: bebob: Add hwdep interfaceTakashi Sakamoto1-4/+12
This interface is designed for mixer/control application. By using hwdep interface, the application can get information about firewire node, can lock/unlock kernel streaming and can get notification at starting/stopping kernel streaming. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: bebob: Add PCM interfaceTakashi Sakamoto1-0/+369
This commit adds a functionality to capture/playback PCM samples. When AMDTP stream is already running for PCM or the source of clock is not internal, available sampling rate is limited at current one. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>