aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-10-02ALSA: firewire-tascam: add data block processing layerTakashi Sakamoto3-1/+254
TASCAM FireWire series uses non-blocking transmission for AMDTP packet streaming, while the format of data blocks is unique. The CIP headers includes specific value in FMT field and no SYT information. In transmitted packets, the first data channel represents event counter, and the last data channel has status and control information. The rest has 24bit PCM samples with right padding. In received packets, all of data channels include 16, 24, 32bit PCM samples. There's no other kind of information. This commit adds support for this protocol. For convenience, the size of PCM samples in outgoing packet is limited by 16 and 24bit. The status and control information will be supported in future commits. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-02ALSA: firewire-tascam: add proc node to show firmware informationTakashi Sakamoto4-1/+101
TASCAM FireWire series has certain registers for firmware information. This commit adds proc node to show the information. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-02ALSA: firewire-tascam: add a structure for model-dependent parameters.Takashi Sakamoto2-0/+49
TASCAM FireWire series doesn't tell drivers their capabilities, thus the drivers should have model-dependent parameters and apply it to detected devices. This commit adds a structure to represent such parameters. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-02ALSA: firewire-tascam: add skeleton for TASCAM FireWire seriesTakashi Sakamoto5-0/+202
This commit adds a new driver for TASCAM FireWire series. In this commit, this driver just creates/removes card instance according to bus event. More functionalities will be added in following commits. TASCAM FireWire series consists of: * PDI 1394P23 for IEEE 1394 PHY layer * PDI 1394L40 for IEEE 1394 LINK layer and IEC 61883 interface * XILINX XC9536XL * XILINX Spartan-II XC2S100 * ATMEL AT91M42800A Ilya Zimnovich had investigated TASCAM FireWire series in 2011, and discover some features of his FW-1804. You can see a part of his research in FFADO project. http://subversion.ffado.org/wiki/Tascam A part of my work are based on Ilya's investigation, while this series doesn't support the FW-1804, because of a lack of config ROM information and its protocol detail, especially for PCM channels. I observed that FW-1884 and FW-1082 don't work properly with 1394 OHCI controller based on VT6315. The controller can actually communicate packets to these models, while these models generate no sounds. It may be due to the PHY/LINK layer issues. Using 1394 OHCI controller produced by the other vendors such as Texas Instruments may work. Or adding another node on the bus. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-30ALSA: firewire-digi00x: add support for asynchronous messagingTakashi Sakamoto5-3/+107
Digi 002/003 family uses asynchronous transaction for messaging. The address to transmit this message is stored on a certain register. This commit allocates a range of address on OHCI 1394 host controller to handle the messaging. As long as I know, the purpose of this message seems to notify lost of synchronization. While, the meaning of content of the message is not clear. Actual examples of this messaging: * When clock source is set as internal: - 0x00007051 - 0x00007052 - 0x00007054 - 0x00007057 - 0x00007058 * When clock source is set as somewhat external: - 0x00009000 - 0x00009010 - 0x00009020 - 0x00009021 - 0x00009022 The lost often occurs when using internal clock source. In this case, users hear sounds with quite short gap every several minutes. In fact, the lost is recovered temporarily. When using with external clock source, the lost seems not to occur. The mechanism is not clear yet. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-30ALSA: firewire-digi00x: add hwdep interfaceTakashi Sakamoto7-7/+270
This commit adds hwdep interface so as the other sound drivers for units on IEEE 1394 bus have. This interface is designed for mixer/control applications. By using this interface, an 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>
2015-09-30ALSA: firewire-digi00x: add PCM functionalityTakashi Sakamoto4-1/+370
This commit adds PCM functionality to transmit/receive PCM samples. Any PCM substreams are jointed because incoming/outgoing AMDTP streams are bound. When one of PCM substream is running or external clock source is selected, current sampling rate is used. Else, the sampling rate is changed as an userspace application requests. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-30ALSA: firewire-digi00x: add proc node to show clock statusTakashi Sakamoto4-1/+111
This commit adds proc node to show current clock status for debugging. As long as testing Digi 002 rack, registers can show local clock rate, local clock source. When external clock input such as S/PDIF is connected, the registers show the detection and external clock rate. Additionally, the registers show the mode of optical digital input interface. Although, a tester with Digi 003 rack reports this makes no sense. Further investigation is required for Digi 003 series. Besides, in Digi 002 rack, the S/PDIF format must be IEC 60958-4, so-called professional. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-30ALSA: firewire-digi00x: add stream functionalityTakashi Sakamoto4-2/+461
This commit adds a functionality to manage streaming. The streaming is not controlled by CMP in IEC 61883-6. It's controlled by IEEE 1394 write transaction to certain addresses. Several clock sources are available, while there're no differences about packet transmission. The value of SYT field in transmitted packets is always zero. Thus, streams in both direction don't build synchronization. And the device always requires received packets to transmit packets. This driver keeps to transfer outgoing stream even if they're not required. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-30ALSA: firewire-digi00x: add data block processing layerTakashi Sakamoto3-1/+345
Digi 002/003 family uses its own format for data blocks. The format is quite similar to AM824 in IEC 61883-6, while there're some differences: * The Valid Bit Length (VBL) code is always 0x40 in Multi-bit Linear Audio (MBLA) data channel. * The first data channel includes MIDI messages, against IEC 61883-6 recommendation. * The Counter field is always zero in MIDI conformant data channel. * Sequence multiplexing in IEC 61883-6 is not applied to the MIDI conformant data channel. * PCM samples are scrambled in received AMDTP packets. We call the way as Double-Oh-Three (DOT). The algorithm was discovered by Robin Gareus and Damien Zammit in 2012. This commit adds data processing layer to satisfy these differences. There's a quirk about transmission mode for received packets. When this driver applies non-blocking mode to outgoing packets with isochronous channel 2 or more, after 15 to 20 seconds since playbacking, any PCM samples causes noisy sound on the device. With isochronous channel 0 or 1, this doesn't occur. As long as I investigated, this quirk is not observed when applying blocking mode to the received packets. This driver applies blocking mode to outgoing packets, while non-blocking mode to incoming packgets. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-30ALSA: firewire-digi00x: add skeleton for Digi 002/003 familyTakashi Sakamoto5-0/+187
This commit adds a new driver for Digidesign 002/003 family. This commit just creates/removes card instance according to bus event. More functions will be added in following commits. Digidesign 002/003 family consists of: * Agere FW802B for IEEE 1394 PHY layer * PDI 1394L40 for IEEE 1394 LINK layer and IEC 61883 interface * ALTERA ACEX EP1K50 for IEC 61883 layer and DSP controller * ADSP-21065L for signal processing [minor cleanup using skip_spaces() by tiwai] Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: process_rx_data_blocks() can be statickbuild test robot1-4/+4
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29Merge branch 'topic/firewire-update' into for-nextTakashi Iwai23-483/+730
2015-09-29ALSA: firewire-lib: complete AM824 data block processing layerTakashi Sakamoto4-350/+401
This commit moves the codes related to data block processing from packet streaming layer to AM824 layer. Each driver initializes amdtp stream structure for AM824 data block by calling amdtp_am824_init(). Then, a memory block is allocated for AM824 specific structure. This memory block is released by calling amdtp_stream_destroy(). When setting streaming parameters, it calls amdtp_am824_set_parameters(). When starting packet streaming, it calls amdtp_stream_start(). When stopping packet streaming, it calls amdtp_stream_stop(). Signed-off-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 Sakamoto9-28/+28
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 Sakamoto6-18/+17
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 MIDI trigger helper function to AM824 layerTakashi Sakamoto7-46/+50
In IEC 61883-6, MIDI messages are transferred in MIDI conformant data channel. Essentially, packet streaming layer is not responsible for MIDI functionality. This commit moves MIDI trigger helper function from the layer to AM824 layer. The rest of codes related to MIDI functionality will be moved in later commits. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: add helper functions to set positions of data channelsTakashi Sakamoto4-4/+40
In IEC 61883-6, several types of data are available in AM824 format. The data is transferred in each data channel. The position of data channel in data block differs depending on model. Current implementation has an array to map the index of data channel in an data block to the position of actual data channel. The implementation allows each driver to access the mapping directly. In later commit, the mapping is in specific structure pushed into an opaque pointer. Helper functions are required. This commit adds the helper functions for this purpose. In IEC 61883-6, AM824 format supports many data types, while this specification easily causes over-engineering. Current AM824 implementation is allowed to handle two types of data, Multi Bit Linear Audio data (=PCM samples) and MIDI conformant data (=MIDI messages). 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 Sakamoto7-9/+29
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-09-29ALSA: firewire-lib: rename parameter setting function for AM824 with FDF fieldTakashi Sakamoto8-33/+62
The value of FDF field in CIP header is protocol-dependent. Thus, it's better to allow data block processing layer to decide the value in any timing. In AM824 data format, the value of FDF field in CIP header indicates N-flag and Nominal Sampling Frequency Code (sfc). The N-flag is for switching 'Clock-based rate control mode' and 'Command-based rate control mode'. In our implementation, 'Clock-based rate control mode' is just supported. Therefore, When sampling transfer frequency is decided, then the FDF can be set. This commit replaces 'amdtp_stream_set_parameters' with 'amdtp_am824_set_parameters' to set the FDF. This is the same timing to decide the ration between the number of data blocks and the number of PCM frames. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: add data block processing layer for AM824 formatTakashi Sakamoto13-16/+52
This commit adds data block processing layer for AM824 format. The new layer initializes streaming layer with its value for fmt field. Currently, most implementation of data block processing still remains streaming layer. In later commits, these codes will be moved to the layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: rename 'amdtp' to 'amdtp-stream' to prepare for functional separationTakashi Sakamoto8-9/+9
In later commit, data block processing layer will be newly added. This layer will be named as 'amdtp-am824'. This commit renames current amdtp file to amdtp-stream, to distinguish it from the new layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: add support arbitrary value for fmt/fdf fields in CIP headerTakashi Sakamoto2-8/+25
Some vendor specific protocol uses its own value for fmt/fdf fields in CIP header. This commit support to set arbitrary values for the fields. In IEC 61883-6, NO-DATA code is defined for FDF field. A packet with this code includes no data even if it includes some data blocks. This commit still leaves a condition to handle this special packet. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: add helper functions as interfaces between packet streaming layer and data block processing layerTakashi Sakamoto1-27/+55
ALSA PCM framework uses PCM buffer with a concept of 'period' to synchronize userspace operations to hardware for nearly-realtime processing. Each driver implements snd_pcm_period_elapsed() to tell across of the period boundary to ALSA PCM middleware. To call the function, some drivers utilize hardware interrupt handlers, the others count handled PCM frames. Drivers for sound units on IEEE 1394 bus are the latter. They use two buffers; PCM buffer and DMA buffer for IEEE 1394 isochronous packet. PCM frames are copied between these two buffers and 'amdtp_stream' structure counts the handled PCM frames. Then, snd_pcm_period_elapsed() is called if required. Essentially, packet streaming layer should not be responsible for PCM frame processing. The PCM frame processing should be handled in each data block processing layer as a result of handling data blocks. Although, PCM frame counting is a common work for all of protocols which ALSA firewire stack is going to support. This commit adds two new helper functions as interfaces between packet streaming layer to data block processing layer. In future, each data block processing layer implements these functions. The packet streaming layer calls data block processing layer per packet by calling the functions. The data block processing layer processes data blocks and PCM frames, and returns the number of processed PCM frames. Then the packet streaming layer calculates handled PCM frames and calls snd_pcm_period_elapsed(). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: add a member of frame_multiplier instead of double_pcm_framesTakashi Sakamoto2-11/+14
In future commit, interface between data block processing layer and packet stream processing layer is defined. These two layers communicate the number of data blocks and the number of PCM frames. The data block processing layer has a responsibility for calculating the number of PCM frames. Therefore, 'dual wire' of Dice quirk should be handled in data block processing layer. This commit adds a member of 'frame_multiplier'. This member represents the ratio of the number of PCM frames against the number of data blocks. Usually, the value of this member is 1, while it's 2 in Dice's 'dual wire'. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: add an argument for Dice's dual wire modeTakashi Sakamoto6-12/+17
In IEC 61883-6, one data block represents one event. In ALSA, the event is one PCM frame. Therefore, when processing one data block, current implementation counts one PCM frame. On the other hand, Dice platform has a quirk called as 'dual wire' at higher sampling rate. In detail, see comment of commit 6eb6c81eee2a ("ALSA: dice: Split stream functionality into a file"). Currently, to handle this quirk, AMDTP stream structure has a 'double_pcm_frames' member. When this is enabled, two PCM frames are counted. Each driver set this flag by accessing the structure member directly. In future commit, some members related to AM824 data block will be moved to specific structure, to separate packet streaming layer and data block processing layer. The access will be limited by opaque pointer. For this reason, this commit adds an argument into amdtp_stream_set_parameter() to set the flag. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: return error code when amdtp_stream_set_parameters() detects errorTakashi Sakamoto6-22/+37
Currently, amdtp_stream_set_parameters() returns no error even if wrong arguments are given. This is not good for streaming layer because drivers can continue processing ignoring capability of streaming layer. This commit changes this function to return error code. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-29ALSA: firewire-lib: arrange structure for AMDTP streamTakashi Sakamoto1-27/+31
In later commit, some members related to AM824 data format will be moved from AMDTP stream structure to data block structure. This commit is a preparation for it. Additionally, current layout of AMDTP stream structure is a bit mess by several extensions. This commit also arranges the layout. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-09-24ALSA: oxfw: add Mackie Onyx Satellite quirk to inform wrong value in 'dbs' field in tx CIP headerTakashi Sakamoto3-1/+34
Mackie Onyx Satellite has two usage; standalone and with base station. These two modes has different stream formats. In standalone mode, rx data block includes 2 Multi Bit Linear Audio (MBLA) data channels and tx data block includes 2. With base station, they're 6 and 2. Although, with base station, the actual tx packet include wrong value in 'dbs' field in its CIP header. This quirk causes packet streaming layer to detect packet discontinuity and to stop PCM substream. This is a response of 'single' subfunction 'extended stream format information' command in AV/C Stream Format Information Specification 1.1. It means that a data block in tx packets includes 2 MBLA data channels. $ ./firewire-request /dev/fw1 fcp 0x01ffbfc001000000ffffffff response: 000: 0c ff bf c0 01 00 00 00 ff 00 90 40 03 02 01 02 response: 010: 06 Current OXFW driver parses the response and detects stream formats correctly. $ cat /proc/asound/card1/firewire/formation ... Output Stream from device: Rate PCM MIDI * 48000 2 0 44100 2 0 88200 2 0 96000 2 0 On the other hand, in actual tx CIP, the 'dbs' field has 6. But the number of quadlets in CIP payload is not multiple of 6. Seeing the subtraction of two successive payload quadlets, it should be multiple of 2. payload CIP CIP quadlets header0 header1 24 00060052 9002ffff 24 0006005e 9002ffff 26 0006006a 9002ffff 24 00060077 9002ffff 24 00060083 9002ffff 26 0006008f 9002ffff 24 0006009c 9002ffff 24 000600a8 9002ffff 26 000600b4 9002ffff 24 000600c1 9002ffff This commit adds support for this quirk to OXFW driver, by using CIP_WRONG_DBS flag. When this flag is set, packet streaming layer uses the value of its 'data_block_quadlets' member instead of the value in CIP header. This value is already set by OXFW driver and no discontinuity is detected. 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 Sakamoto4-16/+57
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-08-11Merge branch 'for-linus' into for-nextTakashi Iwai5-8/+23
2015-08-07ALSA: firewire: use kmemdup rather than duplicating its implementationAndrzej Hajda1-6/+3
The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-05ALSA: fireworks/firewire-lib: add support for recent firmware quirkTakashi Sakamoto5-2/+23
Fireworks uses TSB43CB43(IceLynx-Micro) as its IEC 61883-1/6 interface. This chip includes ARM7 core, and loads and runs program. The firmware is stored in on-board memory and loaded every powering-on from it. Echo Audio ships several versions of firmwares for each model. These firmwares have each quirk and the quirk changes a sequence of packets. As long as I investigated, AudioFire2/AudioFire4/AudioFirePre8 have a quirk to transfer a first packet with 0x02 in its dbc field. This causes ALSA Fireworks driver to detect discontinuity. In this case, firmware version 5.7.0, 5.7.3 and 5.8.0 are used. Payload CIP CIP quadlets header1 header2 02 00050002 90ffffff <- 42 0005000a 90013000 42 00050012 90014400 42 0005001a 90015800 02 0005001a 90ffffff 42 00050022 90019000 42 0005002a 9001a400 42 00050032 9001b800 02 00050032 90ffffff 42 0005003a 9001d000 42 00050042 9001e400 42 0005004a 9001f800 02 0005004a 90ffffff (AudioFire2 with firmware version 5.7.) $ dmesg snd-fireworks fw1.0: Detect discontinuity of CIP: 00 02 These models, AudioFire8 (since Jul 2009 ) and Gibson Robot Interface Pack series uses the same ARM binary as their firmware. Thus, this quirk may be observed among them. This commit adds a new member for AMDTP structure. This member represents the value of dbc field in a first AMDTP packet. Drivers can set it with a preferred value according to model's quirk. Tested-by: Johannes Oertei <johannes.oertel@uni-due.de> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-05Revert "ALSA: fireworks: add support for AudioFire2 quirk"Takashi Sakamoto3-6/+0
This reverts commit 9c6893e0be38b6ca9a56a854226e51dee0a16a5a. The fix is superseded by the next commit as a better implementation for supporting AudioFire2/AudioFire4/AudioFirePre8 quirks. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-27ALSA: fireworks: add support for AudioFire2 quirkTakashi Sakamoto3-0/+6
Fireworks uses TSB43CB43(IceLynx-Micro) as its IEC 61883-1/6 interface. This chip includes ARM7 core, and loads and runs program. The firmware is stored in on-board memory and loaded every powering-on. Echo Audio ships several versions of firmwares for each model. These firmwares have each quirk and the quirk changes a sequence of packets. AudioFire2 has a quirk to transfer a first packet with non-zero in its dbc field. This causes ALSA Fireworks driver to detect discontinuity. As long as I investigated, firmware 5.7, 5.7.6 and 5.8 have this quirk. This commit adds a support for the quirk to handle AudioFire2 packets. For safe, CIP_SKIP_INIT_DBC_CHECK is applied to all versions of AudioFire2's firmwares. 02 00050002 90ffffff <- 42 0005000a 90013000 42 00050012 90014400 42 0005001a 90015800 02 0005001a 90ffffff 42 00050022 90019000 42 0005002a 9001a400 42 00050032 9001b800 02 00050032 90ffffff 42 0005003a 9001d000 42 00050042 9001e400 42 0005004a 9001f800 02 0005004a 90ffffff Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: add support for Behringer FCA 610/1616Takashi Sakamoto2-2/+5
They're based on DM1500 (ArchWave produced), and BeBoB version 3 is installed. $ cat /proc/asound/FCA610/firewire/firmware Manufacturer: bridgeCo Protocol Ver: 3 Build Ver: 0 GUID: 0x001564000002AD73 Model ID: 0x03 Model Rev: 0 Firmware Date: 20121102 Firmware Time: 153431 Firmware ID: 0x610 Firmware Ver: 8348 Base Addr: 0x400C0080 Max Size: 1422624 Loader Date: 20121015 Loader Time: 104710 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: keep duplex streams always to keep internal multiplexer properlyTakashi Sakamoto4-27/+16
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: loosen up severity of checking continuity for BeBoB v3 quirkTakashi Sakamoto1-0/+11
PrismSound Orpheus, Behringer UFX1604 and FCA610 work with BeBoB v3, and they're confirmed to transmit discontinuous packets in the beginning of streaming. payload CIP headers 8 0x00070000 0x9002FFFF 8 0x00070000 0x9002FFFF 8 0x00070000 0x9002FFFF 8 0x00070008 0x9002FFFF <- 8 0x00070008 0x9002FFFF 8 0x00070008 0x9002FFFF 8 0x00070008 0x9002FFFF 8 0x00070008 0x9002FFFF 8 0x00070008 0x9002FFFF 232 0x00070000 0x9002E798 <- 232 0x00070008 0x9002FB99 232 0x00070010 0x90021398 8 0x00070018 0x9002FFFF (This sample was got with Behringer FCA610 and FFADO library.) This commit sets CIP_EMPTY_HAS_WRONG_DBC and CIP_SKIP_DBC_ZERO_CHECK to ignore these discontinuities. 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: expand timeout for DM1500 quirkTakashi Sakamoto1-1/+1
Behringer FCA610 and UFX1604 is confirmed to require more time till transmitting packets after establishing connections. This seems to be a quirk of DM1500 ASIC which ArchWave produced. For this quirk, this commit extends the time to wait up to 2 seconds. As a result, in worst cases, below userspace functions require 2 seconds to return. - snd_pcm_prepare() - snd_pcm_hw_params() - snd_pcm_recover() 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 'version' member for BeBoB protocol versionTakashi Sakamoto2-0/+11
BeBoB installed devices have BeBoB register area. This area stores basic information about its firmware. A register has its protocol version. This commit adds 'version' member and store the device's protocol version to handle v3 quirks in following commits. 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 Sakamoto2-7/+18
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: obsolete string literal expression for clock sourceTakashi Sakamoto5-27/+6
The old string literals were completely replaced by new normalized representation. This commit obsoletes it. 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 Sakamoto4-31/+33
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>
2015-06-15ALSA: bebob: preparation for replacing string literals by normalized representation for model-dependent structuresTakashi Sakamoto4-12/+72
Previous commit adds a enumerator as a normalized representation of clock source, while model-dependent structures still use string literals for this purpose. This commit is a preparation for replacement. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: apply new enumerator to normalize the type of clock sourceTakashi Sakamoto1-0/+6
Previous commit allows this driver to detect several types of clock source, while there's no normalized expression for it. This commit adds a new enumerator for this purpose. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-06-15ALSA: bebob: improve signal mode detection for clock sourceTakashi Sakamoto2-9/+72
With BeBoB version 3, current ALSA BeBoB driver detects the type of current clock signal source wrongly. This is due to a lack of proper implementation to parse the information. This commit renews the parser. As a result, this driver detects SYT-Match clock signal, thus it can start streams with two modes; SYT-Match mode and the others. SYT-Match mode will be supported in future commits. There's a constrain about detected internal/external clock source. When detecting external clock source, this driver allows userspace applications to use current sampling rate only. This is due to consider abour synchronization to external clock sources such as S/PDIF, ADAT or word-clock. According to several information from some devices, I guesss that the internal clock of most devices synchronize to IEEE 1394 cycle start packet. In this case, by a usual way, it's detect as 'Sync type of output Music Sub-Unit' connected to 'Sync type of PCR output Unit (oPCR)', and this driver judges it as internal clock. Therefore, userspace applications is allowed to request arbitrary supported sampling rates. On the other hand, several devices based on BeBoB version 3 have additional internal clock. In this case, by a usual way, it's detect as 'Sync/Additional type of External input Unit'. Unfortunately, there's no way to distinguish this sync type from the other external clock sources such as word-clock. In this case, this driver handles it as external and userspace applications is forced to use current sampling rate. I note that when the source of clock is detected as 'Isochronous stream type of input PCR[0]', it's under 'SYT-Match' mode. In this mode, the synchronization clock is generated according to SYT-series in received packets. In this case, this driver generates the series by myself. I experienced this mode often make the device silent suddenly during playbacking. This means that the mode is easy to lost synchronization. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-27ALSA: firewire-lib: fix buffer-over-run when detecting packet discontinuityTakashi Sakamoto1-16/+16
When detecting packet discontinuity, handle_in_packet() returns minus value and this value is assigned to unsigned int variable, then the variable has huge value. As a result, the variable causes buffer-over-run in handle_out_packet(). This brings invalid page request and system hangup. This commit fixes the bug to add a new argument into handle_in_packet() and the number of handled data blocks is assignd to it. The function return value is just used to check error. I also considered to change the type of local variable to 'int' in in_stream_callback(). This idea is based on type-conversion in C standard, while it may cause future problems when adding more works. Thus, I dropped this idea. Fixes: 6fc6b9ce41c6('ALSA: firewire-lib: pass the number of data blocks in incoming packets to outgoing packets') Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-24ALSA: bebob: add Digidesign Mbox 2 Pro supportTakashi Sakamoto2-0/+4
This device is based on DM1000E, and BeBoB version 1 firmware is installed. $ cat /proc/asound/cards 0 [Pro ]: BeBoB - Mbox 2 Pro DIGIDESIGN Mbox 2 Pro (id:1, rev:1), GUID 00a07e0100a90000 at fw1.0, S400 $ cat /proc/asound/Pro/firewire/firmware Manufacturer: bridgeCo Protocol Ver: 1 Build Ver: 0 GUID: 0x00A07E0100A90000 Model ID: 0x01 Model Rev: 1 Firmware Date: 20071031 Firmware Time: 034402 Firmware ID: 0xA9 Firmware Ver: 16777215 Base Addr: 0x20080000 Max Size: 1572864 Loader Date: 20051207 Loader Time: 205554 With this patch, ALSA BeBoB driver can start packet streaming to/from this model, while as a default, internal multiplexer of this model is not initialized and generates no sound even if the driver transfers any packets with PCM samples. To hear any sounds from this model, userspace applications should be developed to set parameters to the internal multiplexer. You can see raw information in FFADO website: http://subversion.ffado.org/wiki/AvcModels/DigiDesignMboxPro2 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-05-24ALSA: firewire-lib: use protocol error when detecting wrong value in CIP headerTakashi Sakamoto1-1/+1
When detecting zero in 'dbs' field of CIP header, this packet streaming should be aborted because of avoiding division-by-zero. This is an error in an aspect of IEC 61883-1, thus protocol error. This commit use EPROTO instead of EIO. Actually, the returned value is not used for userspace and this commit has no effect. 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-05-24ALSA: firewire-lib: use dev_err() when detecting incoming streaming errorTakashi Sakamoto1-4/+4
When detecting invalid value in 'dbs' field of CIP header or packet discontinuity, current implementation reports the status by err_info(). In most cases this state is caused by model-specific issue due to vendor's customization and should be reported to developers. This commit use dev_err() instead of dev_info() for this purpose. In the cases, packet streaming is aborted, thus no message floading occurs. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>