aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/amdtp.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-05-26ALSA: bebob/firewire-lib: Add a quirk of wrong dbc in empty packet for M-Audio special Firewire seriesTakashi Sakamoto1-0/+3
M-Audio Firewire 1814 has a quirk, ProjectMix I/O also has. They transmit empty packet with wrong value of dbc incremented by 8 at high sampling rate. According to IEC 61883-1, this value should be the same as the one in previous packet. This commit adds a flag named as CIP_EMPTY_HAS_WRONG_DBC. With flag, the value of dbc in empty packet is overwittern by an expected value. This is an example of this quirk: CIP Header 0 CIP Header 1 Payload size 010D0000 9004F759 210 010D0010 90040B59 210 010D0020 90042359 210 01020028 9004FFFF 2 <- 010D0030 90043759 210 010D0040 90044B59 210 010D0050 90046359 210 01020058 9004FFFF 2 <- 010D0060 90047759 210 010D0070 90048B59 210 010D0080 9004A359 210 01020088 9004FFFF 2 <- 010D0090 9004B759 210 010D00A0 9004CB59 210 010D00B0 9004E359 210 010200B8 9004FFFF 2 <- 010D00C0 9004F759 210 010D00D0 90040B59 210 010D00E0 90042359 210 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: bebob/firewire-lib: Add a quirk for discontinuity at bus resetTakashi Sakamoto1-0/+3
Normal BeBoB firmware has a quirk. When receiving bus reset, it transmits packets with discontinuous value in dbc field. This causes two situation, one is to abort streaming by firewire-lib as a result of detecting the discontinuity. Another is to call driver's .update() because of bus reset. These two is generated independently. (The former depends on isochronous stream and the latter depends on IEEE1394 bus driver.) When BeBoB driver works with XRUN-recoverable applications, this situation looks like stream_start_duplex() call followed by stream_update_duplex() call because applications will call snd_pcm_prepare() immediately at XRUN. To update connections and streams at first, this commit use completion. When queueing error occurs, stream_start_duplex() is forced to wait maximum 1000msec. During this, when .update() is called, the completion is waken and stream_start_duplex() is processed without breaking connections. At bus reset, stream_start_duplex() shouldn't break/establish connections and stream_update_duplex() should update connections because a caller of fw_iso_resources_allocate() is responsible for calling fw_iso_resources_update() on bus reset. This commit also adds a flag, which has an effect to skip checking continuity for first packet. This flag is useful for BeBoB quirk to start handling packets during streaming. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: fireworks/firewire-lib: Add a quirk of data blocks for MIDI in out-streamTakashi Sakamoto1-0/+3
Fireworks has a quirk to ignore MIDI messages in data blocks more than 8. This commit adds a flag for this quirk and codes to skip 8 or more data blocks to transfer MIDI messages. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: fireworks/firewire-lib: Add a quirk to reset data block counter at bus resetTakashi Sakamoto1-0/+3
Fireworks has a quirk to reset data block counter at bus reset. This commit adds a flag of CIP_SKIP_DBC_ZERO_CHECK. This flag has an effect to skip checking dbc continuity when dbc is zero. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: fireworks/firewire-lib: Add a quirk for fixed interval of reported dbcTakashi Sakamoto1-0/+3
Fireworks firmware version 5.5 reports fix interval for dbc in each packet. For example, AudioFire4: CIP0 CIP1 Payload 00070000 900484FF 72 00070008 9004A8FF 72 00070008 90FFFFFF 02 00070010 9004D0FF 72 00070018 9004C4FF 72 00070020 9004E8FF 72 00070020 90FFFFFF 02 00070028 900410FE 72 The interval of each dbc should be 16 except for empty packet but it's still 8. This commit adds a flag for this quirk and codes to refer to a fixed value. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: fireworks/firewire-lib: Add a quirk for wrong dbs in tx packetsTakashi Sakamoto1-0/+3
One of Fireworks firmware, named as 'AudioFire9', seems to transmit packets with wrong value of dbs. It's always 0x11 but actual size of data block is different. This commit adds a flag for this quirk and some codes to calculate correct size. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: fireworks/firewire-lib: Add a quirk for the meaning of dbcTakashi Sakamoto1-0/+3
Fireworks has a quirk for the value of dbc field in transmitted packets. For Fireworks, dbc means the end of events in current packet. This is out of specification. For example, AudioFire4: CIP0 CIP1 Payload 01070092 90FFFFFF 02 0107009A 9001E17B 3A <- 010700A2 9001F6E5 3A 010700A2 90FFFFFF 02 010700AA 9001104F 3A <- 010700B2 900125B9 3A 010700BA 90013B23 3A 010700BA 90FFFFFF 02 010700C2 9001548E 3A <- 010700CA 900169F8 3A 010700CA 90FFFFFF 02 010700D2 90018362 3A <- 010700DA 900198CC 3A According to IEC 61883-1/6, a packet following to empty packet has the same value for its dbc. But for Fireworks, it's incremented and empty packet has the same value as previous packet in dbc field. This commit adds a flag for Fireworks and some codes to checking dbc continuity. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: fireworks/firewire-lib: Add a quirk for empty packet with TAG0Takashi Sakamoto1-0/+2
Fireworks has a quirk to transmit empty packets with TAG0. This commit adds handling this quirk for full duplex stream synchronization. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: firewire-lib: Add some AV/C general commandsTakashi Sakamoto1-0/+1
This commit adds three commands, which may be used by some firewire device drivers. These commands are defined in 'AV/C Digital Interface Command Set General Specification Version 4.2 (2004006, 1394TA)'. 1. PLUG INFO command (clause 10.1) 2. INPUT PLUG SIGNAL FORMAT command (clause 10.10) 3. OUTPUT PLUG SIGNAL FORMAT command (clause 10.11) By the command 1, the drivers can get the number of plugs for AV/C unit or subunit. By the command 2 and 3, the drivers can get/set sampling frequency. The 'firewire-speakers' already uses INPUT PLUG SIGNAL FORMAT command to set sampling rate. So this commit also affects the driver. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: firewire-lib/dice/speakers: Add common PCM constraints for AMDTP streamsTakashi Sakamoto1-0/+3
This commit adds common PCM constraints according to current firewire-lib implementation. 1.Maximum width for each sample is limited by 24. AM824 in IEC 61883-6 can deliver 24bit data. 2. Minimum time for period is 5msec. Apply the old value. For shorter latency, further works are needed. 3. In blocking mode, frames per period/buffer is aligned to 32. Each packet can include some frames depending on its sampling rate. In blocking mode, the number equals to SYT_INTERVAL. Currently firewire-lib can schedule snd_pcm_period_elapsed() for each packet. So, for accurate PCM interrupt, the number of frames per period/buffer should be aligned to SYT_INTERVAL. Currently firewire-lib is lack of better rules to achieve this. So LCM of each value of SYT_INTERVALs (=32) is applied. This can be improved for further work. [Fixed the compile error due to the missing "&" by tiwai] Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: dice/firewire-lib: Keep dualwire mode but obsolete CIP_HI_DUALWIRETakashi Sakamoto1-7/+1
In previous commit, AMDTP functionality in firewire-lib supports mapping for PCM data channels. With this mapping, firewire-lib can obsolete a flag, CIP_HI_DUALWIRE, but Dice driver still keeps dual wire mode. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: firewire-lib: Add support for channel mappingTakashi Sakamoto1-0/+8
Some devices arrange the position of PCM/MIDI data channel in AMDTP packet. This commit allows drivers to set channel mapping. To be simple, the mapping table is an array with fixed length. Then the number of channels for PCM is restricted by 64 channels. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: firewire-lib: Add support for duplex streams synchronization in blocking modeTakashi Sakamoto1-3/+42
Generally, the devices can synchronize to handle 'presentation timestamp' in CIP packets. This commit adds functionality to pick up this timestamp from in-packets transmitted by the device, then use it for out packets. In current implementation, this module generated the timestamp by itself. This is 'SYT Match' mode. Then drivers with this module acts as synchronization master. This commit allows this module to act as synchronization slave. This commit restricts this mechanism is only available in blocking mode because handling the timestamp in non-blocking mode is more complicated than in blocking mode. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: firewire-lib: Add support for MIDI capture/playbackTakashi Sakamoto1-0/+43
For capturing/playbacking MIDI messages, this commit adds one MIDI conformant data channel. This data channel has multiplexed 8 MIDI data streams. So this data channel can transfer messages from/to 8 MIDI ports. And this commit allows to set PCM format even if AMDTP streams already start. I suppose the case that PCM substreams are going to be joined into AMDTP streams when AMDTP streams are already started for MIDI substreams. Each driver must count how many PCM/MIDI substreams use AMDTP streams to stop AMDTP streams. There are differences between specifications about MIDI conformant data. About the multiplexing, IEC 61883-6:2002, itself, has no information. It describes labels and bytes for MIDI messages and refers to MMA/AMEI RP-027 for 'successfull implementation'. MMA/AMEI RP-027 describes 8 MPX-MIDI data streams for one MIDI conformant data channel. IEC 61883-6:2005 adds 'sequence multiplexing' and apply this way and describe incompatibility between 2002 and 2005. So this commit applies IEC 61883-6:2005. When we find some devices compliant to IEC 61883-6:2002, then this difference should be handles as device quirk in additional work. About the number of bytes in an MIDI conformant data, IEC 61883-6:2002 describe 0,1,2,3 bytes. MMA/AMEI RP-027 describes 'MIDI1.0-1x-SPEED', 'MIDI1.0-2x-SPEED', 'MIDI1.0-3x-SPEED' modes and the maximum bytes for each mode corresponds to 1, 2, 3 bytes. The 'MIDI1.0-2x/3x-SPEED' modes are accompanied with 'negotiation procedure' and 'encapsulation details' but there is no specifications for them. So this commit implements 'MIDI1.0-1x-SPEED' mode for playback, but allows to pick up 1-3 bytes for capturing. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: firewire-lib: Add support for AMDTP in-stream and PCM captureTakashi Sakamoto1-0/+2
For capturing PCM, this commit adds the functionality to handle in-stream. This is also applied for dual-wire mode. Currently, capturing 32bit samples are supported. When the sequence of in-packet has discontinuity of dbc, in-stream isn't handled and amdtp_streaming_error() returns true. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: firewire-lib: Add 'direction' member to 'amdtp_stream' structureTakashi Sakamoto1-0/+7
This patch adds 'direction' member to amdtp_stream structure to indicate its direction. This patch also adds 'direction' argument to amdtp_stream_init() function to determine its direction. The amdtp_stream_init() function is exported and used by firewire-speakers and dice so this patch also affects them. This patch just add them. Actual implementation will be done by followed patches. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: firewire-lib: Rename functions, structure, member for AMDTPTakashi Sakamoto1-29/+35
This patch renames some functions, a structure and its member to reuse them in both AMDTP in/out stream. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-19ALSA: firewire-lib: include sound/asound.h to refer to snd_pcm_format_tTakashi Sakamoto1-0/+1
'snd_pcm_format_t' is used by amdtp_out_stream_set_pcm_format(). Currently, when just including amdtp.h, compiler cannot find this type because this type is defined in uapi/sound/asound.h and this header is not included by amdtp.h. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-10-20ALSA: dice: make amdtp_rates[] constClemens Ladisch1-1/+1
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20ALSA: dice: support dual-wire stream format at 192 kHzClemens Ladisch1-28/+13
Change the AMDTP streaming code to handle the non-standard stream format that DICE devices use at sample rates greater than 96 kHz. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20ALSA: firewire: introduce amdtp_out_stream_running()Clemens Ladisch1-0/+6
Introduce the helper function amdtp_out_stream_running(). This makes many checks in amdtp.c clearer and frees the device drivers from having to track this with a separate variable. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-20ALSA: dice, firewire-lib: add blocking modeClemens Ladisch1-1/+6
Allow AMDTP output streams to use blocking mode. Use it for DICE devices, because the old DICE-II chip will in some cases not be able to lock to non-blocking streams (erratum E7). Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-06-25ALSA: snd-firewire-lib: remove unused header inclusionTakashi Sakamoto1-1/+0
spinlock is not used in amdtp.h. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-14ALSA: firewire-lib: optimize packet flushingClemens Ladisch1-0/+1
Trying to flush completed packets is pointless when the pointer callback was called from the packet completion callback; avoid it. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-14ALSA: firewire-lib: flush completed packets when reading PCM positionClemens Ladisch1-12/+1
By flushing all completed but not yet reported packets before reading the PCM hardware position, the granularity of the pointer is improved from the interrupt interval to the packet size. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2012-05-14ALSA: firewire-lib: taskletize the snd_pcm_period_elapsed() callClemens Ladisch1-12/+3
The following patch might introduce this call chain: PCM .pointer callback + fw_iso_context_flush_completions + packet callback + snd_pcm_period_elapsed + PCM .pointer callback Recursive calls to the pointer callback are not possible due to the PCM group locking, so avoid this by moving the period notification into a separate tasklet. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-15ALSA: firewire-lib, firewire-speakers: handle packet queueing errorsClemens Ladisch1-1/+13
Add an AMDTP stream error state that occurs when we fail to queue another packet. In this case, the stream is stopped, and the error can be reported when the application tries to restart the PCM stream. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2011-03-15ALSA: add LaCie FireWire Speakers/Griffin FireWave Surround driverClemens Ladisch1-0/+157
Add a driver for two playback-only FireWire devices based on the OXFW970 chip. v2: better AMDTP API abstraction; fix fw_unit leak; small fixes v3: cache the iPCR value v4: FireWave constraints; fix fw_device reference counting; fix PCR caching; small changes and fixes v5: volume/mute support; fix crashing due to pcm stop races v6: fix build; one-channel volume for LaCie v7: use signed values to make volume (range checks) work; fix function block IDs for volume/mute; always use channel 0 for LaCie volume Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Tested-by: Jay Fenlason <fenlason@redhat.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>