summaryrefslogtreecommitdiff
path: root/sound/firewire
AgeCommit message (Collapse)AuthorFilesLines
2014-05-26ALSA: firewire-lib: Add support for deferred transactionTakashi Sakamoto1-7/+28
Some devices based on BeBoB use this type of AV/C transaction. 'Deferred Transaction' is defined in 'AV/C Digital Interface Command Set General Specification' and is used by targets to make a response deferred during processing it. If a target may not be able to complete a command within 100msec since receiving the command, then the target shall return INTERIM response, to which final response will follow later. CONTROL/NOTIFY commands are allowed for deferred transaction. In the specification, devices allow to send INTERIM response just one time. But this commit allows to handle several INTERIM response with two reasons. One reason is to simplify codes, and another reason is to prepare for devices which is out of specification. There is an issue. In the specification, the interval between INTERIM response and final response is 'Unspecified interval'. The specification depends on each subunit specification for this interval. But we promise to finish this function for caller. In this reason, I use FCP_TIMEOUT_MS for this interval. Currently it's 125msec. When we find devices which needs more time for this interval, then let us add some codes to apply more interval for 'Unspecified interval'. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: firewire-lib: Add a new function to check others' connectionTakashi Sakamoto2-0/+19
Plug Control Registers have two fields related to the number of established connections, one is 'Broadcast connection counter' and another is 'Point-to-point connection counter'. The driver can know there are established connections or not to check these fields. This commit is for considering about JACK/FFADO streaming. Currently, when JACK/FFADO starts its streaming to the device, cmp_connection_establish() is failed expectedly. This seems to be enough but there are some devices which needs to change sampling frequency before trying to establish connections. For such devices, this functionality is needed. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: firewire-lib: Add handling output connection by CMPTakashi Sakamoto1-9/+90
This patch adds some macros, codes with condition of direction and new functions to handle output connection. Once cmp_connection_init() is executed with its direction, CMP input and output connection can be handled by the same way. 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 'cmp_connection' structureTakashi Sakamoto3-1/+9
This patch adds 'direction' member to 'cmp_connection' structure to indicate the direction of connection. This patch also adds 'direction' argument to cmp_connection_init() function to determine the direction. The cmp_connection_init() function is exported and used in snd-firewire-speakers so this patch also affect it. 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 macros, variables and functions for CMPTakashi Sakamoto2-48/+49
Referring to IEC 61883-1, oMPR and iMPR, oPCR and iPCR have some fields with the same role in the same position. This patch renames some macros, variables and function arguments with "i" in its prefix to reuse them between oMPR and iMPR, oPCR and iPCR. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-05-26ALSA: firewire-lib: Restrict calling flush_context_completion() when context ↵Takashi Sakamoto1-1/+1
exists Currently, drivers can bring XRUN state for PCM substreams when error to queue packets or detecting discontinuity of packet. The application may try to recover this state by calling snd_pcm_prepare(). Depending on each driver, .prepare() includes restart streaming. Then there is a state that PCM substreams are running but isochronous contexts are stopped. In this case, when .pointer() is called, it refers to error pointer. This commit is for a prevention of this bug. 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 Sakamoto4-23/+61
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 Sakamoto3-158/+34
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 Sakamoto2-47/+79
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 ↵Takashi Sakamoto2-10/+110
blocking mode 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: Give syt value as parameter to handle_out_packet()Takashi Sakamoto1-12/+12
For duplex streams with synchronization, drivers should pick up 'presentation timestamp' from in-packets and use the timestamp for out-packets. This commit is preparation for this. 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 Sakamoto2-8/+88
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 Sakamoto2-17/+214
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: Split some codes into functions to reuse for both streamsTakashi Sakamoto1-73/+81
Some codes can be reused to handle in-stream. This commit adds new functions. This commit also renames some functions to keep naming consistency. 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 Sakamoto4-3/+13
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: Add macros instead of fixed value for AMDTPTakashi Sakamoto1-7/+23
This patch adds some macros instead of fixed value for AMDTP according to IEC 61883-1/6. These macros will also be used 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 Sakamoto4-152/+158
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>
2014-02-14ALSA: firewire: Convert to snd_card_new() with a device pointerTakashi Iwai4-8/+8
Also remove superfluous snd_card_set_dev() calls. Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-29ALSA: dice: fix array limits in dice_proc_read()Dan Carpenter1-2/+2
The array limits are supposed to be in units of u32 instead of in bytes. The current code has a potential array overflow. Fixes: c614475b0ea9 ('ALSA: dice: add a proc file to show device information') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2013-11-26Merge branch 'fix/firewire' into for-linusTakashi Iwai1-9/+6
2013-11-22Merge tag 'sound-fix2-3.13-rc1' of ↵Linus Torvalds1-0/+1
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound Pull second set of sound fixes from Takashi Iwai: "A collection of small fixes in HD-audio quirks and runtime PM, ASoC rcar, abs8500 and other codecs. Most of commits are for stable kernels, too" * tag 'sound-fix2-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda - Set current_headset_type to ALC_HEADSET_TYPE_ENUM (janitorial) ALSA: hda - Provide missing pin configs for VAIO with ALC260 ALSA: hda - Add headset quirk for Dell Inspiron 3135 ALSA: hda - Fix the headphone jack detection on Sony VAIO TX ALSA: hda - Fix missing bass speaker on ASUS N550 ALSA: hda - Fix unbalanced runtime PM notification at resume ASoC: arizona: Set FLL to free-run before disabling ALSA: hda - A casual Dell Headset quirk ASoC: rcar: fixup dma_async_issue_pending() timing ASoC: rcar: off by one in rsnd_scu_set_route() ASoC: wm5110: Add post SYSCLK register patch for rev D chip ASoC: ab8500: Revert to using custom I/O functions ALSA: hda - Also enable mute/micmute LED control for "Lenovo dock" fixup ALSA: firewire-lib: include sound/asound.h to refer to snd_pcm_format_t ALSA: hda - Select FW_LOADER from CONFIG_SND_HDA_CODEC_CA0132_DSP ALSA: hda - Enable mute/mic-mute LEDs for more Thinkpads with Realtek codec ASoC: rcar: fixup mod access before checking
2013-11-22ALSA: firewire-lib: fix wrong value for FDF field as an empty packetTakashi Sakamoto1-9/+6
This commit fix out of specification about the value of FDF field in out packet with 'no data'. This affects blocking mode. According to IEC 61883-6, there is two way to generate AMDTP packets include no data in blocking mode. Way 1. an empty packet defined in IEC 61883-1 - Size of packet is 2 quadlets. - The value of FDF is sfc. - The packet includes only CIP headers Way 2. a special non-empty packet defined in IEC 61883-6 - Size of packet is following to blocking mode - The value of FDF is 0xff. This value is 'NO-DATA'. This means 'The receiver' must ignore all the data in a CIP with this FDF code'. - The packet includes dummy data. But current implementation is a combination of them. - Size of packet is 2 (way 1) - FDF = 0xff (way 2) This causes BeBoB chipset cannot sound. This patch applies Way 1. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Cc: Acked-by: Clemens Ladisch <clemens@ladisch.de> 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-11-15tree-wide: use reinit_completion instead of INIT_COMPLETIONWolfram Sang1-1/+1
Use this new function to make code more comprehensible, since we are reinitialzing the completion, not initializing. [akpm@linux-foundation.org: linux-next resyncs] Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13) Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-10-22Merge branch 'dice-driver-playback-only' of ↵Takashi Iwai13-150/+2137
git://git.alsa-project.org/alsa-kprivate into for-next
2013-10-21ALSA: dice: restrict the driver to playback-only devicesClemens Ladisch2-4/+15
At the moment, this driver supports only playback, while FFADO supports (only) full-duplex devices. So, prevent conflicts by not claiming devices that would be better handled by FFADO. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: fix detection of Weiss devicesClemens Ladisch1-5/+12
While most DICE devices keep TCAT's default category ID of 0x04, Weiss devices identify themselves with 0x00. Reported-by: Rolf Anderegg <rolf.anderegg@weiss.ch> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: dice_proc_read: remove wrong typecastClemens Ladisch1-2/+1
Remove a wrong typecast that resulted from a copy-and-paste error. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: document quadlet alignmentClemens Ladisch1-3/+3
Doing accesses without quadlet alignment is a bad idea because the firmware's byte-swapping would garble the data; clarify this in the documentation. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: add a proc file to show device informationClemens Ladisch1-0/+246
For easier debugging, add a proc file to show the device's capabilities and current status. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: check clock change timeoutClemens Ladisch1-2/+3
Output a warning if the wait for the clock change notification times out. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: dynamic sample rate selectionClemens Ladisch1-35/+102
Instead of relying of some control panel application to configure some fixed sample rate, allow applications to set it automatically. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: get rate-dependent parametersClemens Ladisch1-2/+90
In preparation for sample rate selection support, read the stream parameters that might change when running at different sample rates. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: allow notifications during initializationClemens Ladisch1-11/+11
Reorganize the initialization order so that the driver can receive notifications earlier. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: get clock capabilitiesClemens Ladisch1-2/+21
In preparation for sample rate selection support, ensure that the driver knows about the device's clock capabilities. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: make amdtp_rates[] constClemens Ladisch2-2/+2
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: fix lockingStefan Richter1-4/+4
Avoid a lock inversion between dice->mutex and pcm->open_mutex. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: remove superfluous fieldClemens Ladisch1-3/+1
The pcm field was not actually used. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: remove 10s period length limitClemens Ladisch1-1/+1
Since commit f2b3614cefb6 (Don't check DMA time-out too shortly), we need no longer to restrict the period length to less than 10 s. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: avoid superflous write at bus resetClemens Ladisch1-0/+5
When a bus reset happens, the enable register is automatically cleared, so we do not need to clear it manually when stopping the stream. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: firewire: extend snd_fw_transaction()Clemens Ladisch8-206/+137
Add a flag to snd_fw_transaction() to allow it to abort when a bus reset happens. This removes most of the duplicated error handling loops that were required around calls to the low-level fw_run_transaction(). Also add a flag to suppress error messages; errors are expected when we attempt to clean up after the device was unplugged. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: optimize reading of consecutive registersClemens Ladisch1-16/+11
Instead of reading two consecutive register with two quadlet requests, use one block read request. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: support dual-wire stream format at 192 kHzClemens Ladisch4-67/+164
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-21ALSA: dice: fix device detection for other vendorsClemens Ladisch1-18/+84
DICE devices do not have a unique specifier ID in their unit directory (it's always the same as the device vendor's ID), so rely on just the version ID for driver loading, and use a heuristic in the probe callback to detect actual DICE devices. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: reorganize interface definitionsClemens Ladisch2-207/+373
Move the DICE interface symbols into a separate header file, and add more documentation. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: firewire: introduce amdtp_out_stream_running()Clemens Ladisch4-23/+18
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-21ALSA: dice: clear device lock when closing hwdep deviceClemens Ladisch1-0/+13
Ensure that misbehaving or aborted userspace programs do not accidentally keep the lock. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: implement hwdep deviceClemens Ladisch1-22/+203
Implement the hwdep locking and notification mechanisms. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice: fix hang when unplugging a running deviceClemens Ladisch1-2/+5
When aborting a PCM stream, the xrun is signaled only if the stream is running. When disconnecting a PCM stream, calling snd_card_disconnect() too early would change the stream into a non-running state and thus prevent the xrun from being noticed by user space. To prevent this, move the snd_card_disconnect() call after the xrun. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
2013-10-21ALSA: dice, firewire-lib: add blocking modeClemens Ladisch3-27/+36
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>