summaryrefslogtreecommitdiff
path: root/sound/firewire/fireface
AgeCommit message (Collapse)Author
2023-09-15ALSA: firewire: Fix -Wformat-truncation warning for MIDI stream namesTakashi Iwai
The compile warnings at filling MIDI stream name strings are all false-positive; the number of streams can't go so high. For suppressing the warning, replace snprintf() with scnprintf(). As stated in the above, truncation doesn't matter. Link: https://lore.kernel.org/r/20230915082802.28684-12-tiwai@suse.de Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-28ALSA: fireface: make read-only const array for model names staticTakashi Sakamoto
It is preferable not to populate the constant array for constant strings on the stack. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20230627235406.289970-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-12ALSA: firewire: use 'GPL' string for module license contributed by Takashi ↵Takashi Sakamoto
Sakamoto In MODULE_LICENSE macro, "GPL" string obsoletes "GPL v2" string by a commit bf7fbeeae6db ("module: Cure the MODULE_LICENSE "GPL" vs. "GPL v2" bogosity"). This commit uses the preferable expression. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20230611144445.221529-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-02-04ALSA: fireface: add field for the number of messages copied to user spaceTakashi Sakamoto
Current structure includes no field to express the number of messages copied to user space, thus user space application needs to information out of the structure to parse the content of structure. This commit adds a field to express the number of messages copied to user space since It is more preferable to use self-contained structure. Kees Cook proposed an idea of annotation for bound of flexible arrays in his future improvement for flexible-length array in kernel. The additional field for message count is suitable to the idea as well. Reference: https://people.kernel.org/kees/bounded-flexible-arrays-in-c Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20230202133708.163936-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-18ALSA: fireface: fix locking bug in ff400_copy_msg_to_user()Dan Carpenter
The ff400_copy_msg_to_user() function drops the spin lock to call copy_to_user(). However, if the copy_to_user() fails, then it must take the lock again before returning. Failure to take the lock leads to a double unlock in the caller, hwdep_read(). Fixes: acdebd8b4c0c ("ALSA: fireface: implement message parser for Fireface 400") Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/Y8at+W/7OGvEBY8O@kili Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-13ALSA: fireface: implement message parser for Fireface 400Takashi Sakamoto
This commit implements message parser for Fireface 400 to pass data of knob control to user space. The parser has FIFO which can store maximum 32 events without no overrun detection since it doesn't matter to lose the event. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20230112120954.500692-7-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-13ALSA: fireface: add local framework to message parserTakashi Sakamoto
This commit adds local framework to message parser. This is preparation for future work to pass event of knob control for Fireface 400 to user space. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20230112120954.500692-6-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-13ALSA: fireface: add helper function to parse MIDI messages transmitted by ↵Takashi Sakamoto
Fireface 400 This is minor code refactoring to add helper function to parse MIDI message bytes in quadlet message. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20230112120954.500692-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-13ALSA: fireface: pick up time stamp for request subaction of asynchronous ↵Takashi Sakamoto
transaction The time stamp of isochronous cycle at which asynchronous transaction is sent is perhaps useful somehow. A commit b2405aa948b9 ("firewire: add kernel API to access packet structure in request structure for AR context") adds kernel API to retrieve the time stamp in inner structure of request subaction. This commit changes local framework to handle message delivered by the asynchronous transaction so that time stamp is picked up by the kernel API. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20230112120954.500692-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-13ALSA: fireface: rename callback functionsTakashi Sakamoto
It's cleared that Fireface 400 transmits quadlet message for two purposes at least; received MIDI messages and notification of knob control operation. Nevertheless current implementation uses callback function name just for MIDI messages. This commit renames the callback functions. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20230112120954.500692-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-12ALSA: firewire-lib: obsolete return value from context payload processing layerTakashi Sakamoto
This commit obsoletes return value from the context payload processing layer since the multiplier between the data block count and PCM frame count was moved to the packet streaming processing layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20230110134933.322794-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-12ALSA: firewire-lib: move parameter for pcm frame multiplier from context ↵Takashi Sakamoto
payload processing layer The current implementation delegates the task to calculate the number of processed PCM frames into the context payload processing layer. It looks good as long as frame calculation is done for a single purpose. Nevertheless, another purpose, the computation of extra delay for the runtime of PCM substream, requires frame calculation, too. This commit refactors the current implementation so that the packet stream processing layer is responsible for the calculation of PCM frame, too. The member is moved to stream structure for multiplier between data block count and PCM frame count. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20230110134933.322794-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-09ALSA: firewire-lib: use circular linked list for context payload processing ↵Takashi Sakamoto
layer The list of packet descriptor is passed to context payload processing layer so that each driver can copy PCM frames, MIDI messages, and device specific data between packet payload buffer and intermediate buffer for user space application. The list of packet descriptor was replaced by circular linked list in a previous commit. This commit uses circular linked in context payload processing layer as well. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20230109021738.75543-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-09-27ALSA: firewire: Replace runtime->status->state reference to runtime->stateTakashi Iwai
The recent change in ALSA core allows drivers to get the current PCM state directly from runtime object. Replace the calls accordingly. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20220926135558.26580-5-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-09-27ALSA: firewire: Remove some left-over license text in sound/firewireChristophe JAILLET
There is already a SPDX-License-Identifier tag, so the corresponding license text can be removed. While at it, be more consistent and: - add a missing .c (ff-protocol-latter) - remove an empty line (motu-protocol-v1) Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/2bfe76c7eeb0f5205a1427e280bf8d9da0354a62.1664110649.git.christophe.jaillet@wanadoo.fr Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-07ALSA: fireface: cease from delayed card registrationTakashi Sakamoto
The delayed registration of sound card instance brings less benefit than complication of kobject management. This commit ceases from it. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210607081250.13397-9-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-01ALSA: fireface: perform sequence replay for media clock recoveryTakashi Sakamoto
This commit takes ALSA fireface driver to perform sequence replay for media clock recovery. The protocol specific to RME Fireface series is not compliant to IEC 61883-1/6 since it has no CIP header, therefore presentation time is not used for media clock recovery. The sequence of the number of data blocks per packet is important. I note that the device skips an isochronous cycle corresponding to an empty packet or a NODATA packet in blocking transmission method of IEC 61883-1/6. For sequence replay, the cycle is handled as receiving an empty packet. Furthermore, it doesn't start packet transmission till receiving any packet. The sequence replay is tested with below models: * Fireface 400 * Fireface 800 * Fireface 802 I note that it is better to initialize Fireface 400 in advance by initialization transaction implemented in snd-fireface-ctl-service of snd-firewire-ctl-services project. You can see whether initialized or not by HOST LED on the device. Unless, the device often stops packet transmission even if session starts. I guess the sequence replay also works well with below models: * Fireface UFX * Fireface UCX Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210531025103.17880-7-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-28ALSA: firewire-lib: transfer rx packets on-the-fly when replayingTakashi Sakamoto
Models in below series start transmission of packet after receiving the sequence of packets: * Digidesign Digi00x family * RME Fireface series Additionally, models in Tascam FireWire series start multiplexing PCM frames into packets enough after receiving packets. It's required to transfer packets on-the-fly for the above models according to nominal sampling transfer frequency before starting sequence replay. This commit allows drivers to decide whether the engine transfers packet on-the-fly or not. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210527122611.173711-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-28ALSA: firewire-lib: add replay target to cache sequence of packetTakashi Sakamoto
In design of audio and music unit in IEEE 1394 bus, feedback of effective sampling transfer frequency (STF) is delivered by packets transferred from device. The devices supported by ALSA firewire stack are categorized to three groups regarding to it. * Group 1: * Echo Audio Fireworks board module * Oxford Semiconductor OXFW971 ASIC * Digidesign Digi00x family * Tascam FireWire series * RME Fireface series * Group 2: * BridgeCo. DM1000/DM1100/DM1500 ASICs for BeBoB solution * TC Applied Technologies DICE ASICs * Group 3: * Mark of the Unicord FireWire series In group 1, the effective STF is determined by the sequence of the number of events per packet. In group 2, the sequence of presentation timestamp expressed in syt field of CIP header is interpreted as well. In group 3, the presentation timestamp is expressed in source packet header (SPH) of each data block. I note that some models doesn't take care of effective STF with large internal buffer. It's reasonable to name it as group 0: * Group 0 * Oxford Semiconductor OXFW970 ASIC The effective STF is known to be slightly different from nominal STF for all of devices, and to be different between the devices. Furthermore, the effective STF is known to be shifted for long-period transmission. This makes it hard for software to satisfy the effective STF when processing packets to the device. The effective STF is deterministic as a result of analyzing the batch of packet transferred from the device. For the analysis, caching the sequence of parameter in the packet is required. This commit adds an option so that AMDTP domain structure takes AMDTP stream structure to cache the sequence of parameters in packet transferred from the device. The parameters are offset ticks of syt field against the cycle to receive the packet and the number of data blocks per packet. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210527122611.173711-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-20ALSA: firewire-lib: change waking up timing to process packetsTakashi Sakamoto
When starting AMDTP domain, tasks in process context yields running CPU till all of isochronous context get callback, with an assumption that it's OK to process content of packet. However several isochronous cycles are skipped to transfer rx packets, or the content of rx packets are dropped, to manage the timing to start processing the packets. This commit changes the timing for tasks in process context to wake up when processing content of packet is actually ready. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210520040154.80450-9-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-02-08ALSA: fireface: fix to parse sync status register of latter protocolTakashi Sakamoto
Fireface UCX, UFX, and FF802 are categorized for latter protocol of the series. Current support for FF802 (and UFX) includes failure to parse sync status register and results in EIO. Further investigation figures out that the content of register differs depending on models. This commit adds tables specific to FF802 and UFX to fix it. Fixes: 062bb452b078b ("ALSA: fireface: add support for RME FireFace 802") Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210207154736.229551-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-01-25ALSA: fireface: remove unnecessary condition in hwdep_read()Dan Carpenter
Smatch complains that "count" is not clamped when "ff->dev_lock_changed" and it leads to an information leak. Fortunately, that's not actually possible and the condition can be deleted. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/YA6n6I8EcNAO5ZFs@mwanda Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-01-18Merge branch 'for-linus' into for-nextTakashi Iwai
Back-merge of 5.11 devel branch for more works on USB-audio. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-01-12ALSA: fireface: Fix integer overflow in transmit_midi_msg()Geert Uytterhoeven
As snd_ff.rx_bytes[] is unsigned int, and NSEC_PER_SEC is 1000000000L, the second multiplication in ff->rx_bytes[port] * 8 * NSEC_PER_SEC / 31250 always overflows on 32-bit platforms, truncating the result. Fix this by precalculating "NSEC_PER_SEC / 31250", which is an integer constant. Note that this assumes ff->rx_bytes[port] <= 16777. Fixes: 19174295788de77d ("ALSA: fireface: add transaction support") Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20210111130251.361335-2-geert+renesas@glider.be Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-01-08ALSA: Convert strlcpy to strscpy when return value is unusedJoe Perches
strlcpy is deprecated. see: Documentation/process/deprecated.rst Change the calls that do not use the strlcpy return value to the preferred strscpy. Done with cocci script: @@ expression e1, e2, e3; @@ - strlcpy( + strscpy( e1, e2, e3); This cocci script leaves the instances where the return value is used unchanged. After this patch, sound/ has 3 uses of strlcpy() that need to be manually inspected for conversion and changed one day. $ git grep -w strlcpy sound/ sound/usb/card.c: len = strlcpy(card->longname, s, sizeof(card->longname)); sound/usb/mixer.c: return strlcpy(buf, p->name, buflen); sound/usb/mixer.c: return strlcpy(buf, p->names[index], buflen); Miscellenea: o Remove trailing whitespace in conversion of sound/core/hwdep.c Link: https://lore.kernel.org/lkml/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/22b393d1790bb268769d0bab7bacf0866dcb0c14.camel@perches.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-10ALSA: fireface: add support for RME Fireface UFX (untested)Takashi Sakamoto
Fireface UFX was shipped by RME GmbH in 2010, and now discontinued. Although this model has some enhanced feature which Fireface 802 doesn't have (e.g. on-board USB mass storage device class, configuration interface with color display), the functionality relevant to packet communication on IEEE 1394 bus seems to be the same as Fireface 802 (e.g. available number of channels for PCM frame in each sampling transfer frequency). With the assumption, this commit adds support for Fireface UFX. In ALSA fireface driver, these two models are handled as the same one. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20200510074301.116224-7-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-10ALSA: fireface: add support for RME FireFace 802Takashi Sakamoto
Fireface 802 was shipped by RME GmbH in 2014. This model supports later protocol for management of isochronous communication and synchronization of sampling transmission frequency. This model consists of below ICs: * TI TSB41AB2 * Xilinx Spartan-6 FPGA XC6SLX16 * TI TMS320 C6747 * SMSC USB3250 Especially, this model just supports IEEE 1394a, against its name which evokes Fireface 800. This commit adds support for Fireface 802 (tested). Userspace applications can transfer PCM frames and MIDI messages via ALSA PCM/Rawmidi interface. I note that 4 channels for ADAt1 and ADAT2 are disabled at higher sampling transfer frequency since isochronous resources reservation fails due to bandwidth limitation of IEEE 1394a. The value read from LATTER_SYNC_STATUS register is slightly different from the one of Fireface UCX. The higher 4 bits and lower 4 bits are swapped within the same byte. Without any assist of userspace application, transmitted MIDI messages from the device are not going to be processed. For detail, please refer to my comment in code of latter protocol. $ python crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 0404ffff bus_info_length 4, crc_length 4, crc 65535 (should be 26805) 404 31333934 bus_name "1394" 408 20008000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 8 (512) 40c 000a3504 company_id 000a35 | 410 38077423 device_id 0438077423 | EUI-64 000a350438077423 root directory ----------------------------------------------------------------- 414 0005ffff directory_length 5, crc 65535 (should be 9514) 418 0c0083c0 node capabilities per IEEE 1394 41c 03000a35 vendor 420 8100000b --> descriptor leaf at 44c 424 8d000007 --> eui-64 leaf at 440 428 d1000001 --> unit directory at 42c unit directory at 42c ----------------------------------------------------------------- 42c 0004ffff directory_length 4, crc 65535 (should be 45134) 430 12000a35 specifier id 434 13000005 version 438 17101800 model 43c 81000008 --> descriptor leaf at 45c eui-64 leaf at 440 ----------------------------------------------------------------- 440 0002ffff leaf_length 2, crc 65535 (should be 60131) 444 000a3504 company_id 000a35 | 448 38077423 device_id 0438077423 | EUI-64 000a350438077423 descriptor leaf at 44c ----------------------------------------------------------------- 44c 0003ffff leaf_length 3, crc 65535 (should be 469) 450 00000000 textual descriptor 454 00000000 minimal ASCII 458 524d4521 "RME!" descriptor leaf at 45c ----------------------------------------------------------------- 45c 0005ffff leaf_length 5, crc 65535 (should be 10561) 460 00000000 textual descriptor 464 00000000 minimal ASCII 468 46697265 "Fire" 46c 66616365 "face" 470 20383032 " 802" Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20200510074301.116224-6-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-10ALSA: fireface: code refactoring to decide name of sound cardTakashi Sakamoto
This commit uses enumeration constants as index of table for the list of name of sound card. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20200510074301.116224-5-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-10ALSA: fireface: code refactoring to add enumeration constants for model ↵Takashi Sakamoto
identification In RME fireface series, version field of unit directory in configuration ROM is used to distinguish each model. The value of field is known and it's better to use enumeration constants for code representation. This commit adds enumeration constants for model identification. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20200510074301.116224-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-10ALSA: fireface: start IR context immediatelyTakashi Sakamoto
In the latter models of RME Fireface series, device start to transfer packets several dozens of milliseconds. On the other hand, ALSA fireface driver starts IR context 2 milliseconds after the start. This results in loss to handle incoming packets on the context. This commit changes to start IR context immediately instead of postponement. For Fireface 800, this affects nothing because the device transfer packets 100 milliseconds or so after the start and this is within wait timeout. Cc: <stable@vger.kernel.org> Fixes: acfedcbe1ce4 ("ALSA: firewire-lib: postpone to start IR context") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20200510074301.116224-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-10ALSA: fireface: fix configuration error for nominal sampling transfer frequencyTakashi Sakamoto
128000 and 192000 are congruence modulo 32000, thus it's wrong to distinguish them as multiple of 32000 and 48000 by modulo 32000 at first. Additionally, used condition statement to detect quadruple speed can cause missing bit flag. Furthermore, counter to ensure the configuration is wrong and it causes false positive. This commit fixes the above three bugs. Cc: <stable@vger.kernel.org> Fixes: 60aec494b389 ("ALSA: fireface: support allocate_resources operation in latter protocol") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20200510074301.116224-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-03-06ALSA: firewire: use KBUILD_MODNAME for struct driver.name instead of stringTakashi Sakamoto
KBUILD_MODNAME is available to name kernel modules according to its object name. This commit uses the macro instead of string for name field of struct driver since drivers in ALSA firewire stack have the same name of each object name. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20200306135229.11659-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-11ALSA: firewire: Drop superfluous ioctl PCM opsTakashi Iwai
All the PCM ioctl ops of ALSA FireWire drivers do nothing but calling the default handler. Now PCM core accepts NULL as the default ioctl ops(*), so let's drop altogether. (*) commit fc033cbf6fb7 ("ALSA: pcm: Allow NULL ioctl ops") Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191210061145.24641-6-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-11ALSA: firewire: Use managed buffer allocationTakashi Iwai
Clean up the drivers with the new managed buffer allocation API. The superfluous snd_pcm_lib_malloc_pages() and snd_pcm_lib_free_pages() calls are dropped. Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191209192422.23902-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-09ALSA: fireface: fix return value in error path of isochronous resources ↵Takashi Sakamoto
reservation Even if isochronous resources reservation fails, error code doesn't return in pcm.hw_params callback. Cc: <stable@vger.kernel.org> #5.3+ Fixes: 55162d2bb0e8 ("ALSA: fireface: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191209151655.GA8090@workstation Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-06ALSA: firewire: Convert to the common vmalloc memallocTakashi Iwai
The recent change (*) in the ALSA memalloc core allows us to drop the special vmalloc-specific allocation and page handling. This patch coverts to the common code. (*) 1fe7f397cfe2: ALSA: memalloc: Add vmalloc buffer allocation support 7e8edae39fd1: ALSA: pcm: Handle special page mapping in the default mmap handler Link: https://lore.kernel.org/r/20191105151856.10785-11-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-19ALSA: firewire-lib: postpone to start IR contextTakashi Sakamoto
Some devices have a quirk to postpone transmission of isoc packet for several dozen or hundred isoc cycles since configured to transmit. Furthermore, some devices have a quirk to transmit isoc packet with discontinued data of its header. In 1394 OHCI specification, software allows to start isoc context with certain isoc cycle. Linux firewire subsystem has kernel API to use it as well. This commit uses the functionality of 1394 OHCI controller to handle the quirks. At present, this feature is convenient to ALSA bebob and fireface driver. As a result, some devices can be safely handled, as long as I know: - MAudio FireWire solo - MAudio ProFire Lightbridge - MAudio FireWire 410 - Roland FA-66 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191018061911.24909-7-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-19ALSA: firewire-lib: replace ack callback to flush isoc contexts in AMDTP domainTakashi Sakamoto
An isoc context for AMDTP stream is flushed to queue packet by a call of pcm.ack. This commit extends this for AMDTP domain. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191018061911.24909-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-19ALSA: firewire-lib: replace pointer callback to flush isoc contexts in AMDTP ↵Takashi Sakamoto
domain An isoc context for AMDTP stream is flushed to queue packet by a call of pcm.pointer. This commit extends this for AMDTP domain. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191018061911.24909-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-18ALSA: fireface: share PCM buffer size for both directionTakashi Sakamoto
This commit allows ALSA fireface driver to share PCM buffer size for both capture and playback PCM substream. When AMDTP domain starts for one of the PCM substream, buffer size of the PCM substream is stores to AMDTP domain structure. Some AMDTP streams have already run with the buffer size when another PCM substream starts, therefore the PCM substream has a constraint to its buffer size. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191017155424.885-10-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-18ALSA: firewire-lib: use variable size of queue for isoc packets instead of ↵Takashi Sakamoto
fixed size The number of packets in packet buffer has been fixed number (=48) since first commit of ALSA IEC 61883-1/6 packet streaming engine. This commit allows the engine to use variable number of packets in the buffer. The size is calculated by a parameter in AMDTP domain structure surely to store the number of events in the packets of buffer. Although the value of parameter is expected to come from 'period size' parameter of PCM substream, at present 48 is still used. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191017155424.885-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-17ALSA: fireface: use the same size of period for PCM substreams in AMDTP streamsTakashi Sakamoto
In current implementation, when opening a PCM substream, it's needed to check whether the opposite PCM substream runs. This is to assign effectual constraints (e.g. sampling rate) to opened PCM substream. The number of PCM substreams on AMDTP streams in domain is recorded in own structure. Usage of this count is an alternative of the above check. This is better because the count is incremented in pcm.hw_params earlier than pcm.trigger. This commit replaces the check with the substream count and the value for the size of PCM period. Unlike the other drivers in ALSA firewire stack, no MIDI substream is multiplexed into AMDTP stream. I note that Fireface AMDTP protocol has a quirk that tx stream includes blank isochronous cycle. The packet for blank cycle is equivalent to empty or NODATA packet in IEC 61883-6, thus the protocol is similar to blocking transmission method of IEC 61883-6. On the other hand, rx stream adopts non-blocking transmission method. Although the difference of transmission method between tx/rx streams precisely brings different timing for a certain amount of events due to their different calculation for data blocks per packet, it's possible to approximate enough amount of events mostly has the same timing. Actually current ALSA IEC 61883-1/6 engine uses large amount of data blocks for each hardware IRQ (=16 packets). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191007110532.30270-18-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-17ALSA: fireface: register the size of PCM period to AMDTP domainTakashi Sakamoto
This commit is a preparation to share the size of PCM period between PCM substreams on AMDTP streams in the same domain. At this time, the size of PCM period in PCM substream which starts AMDTP streams in the same domain is recorded. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191007110532.30270-10-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05ALSA: fireface: support AMDTP domainTakashi Sakamoto
This commit adds AMDTP domain support for ALSA fireface driver. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-05ALSA: fireface: code refactoring for initialization/destruction of AMDTP streamTakashi Sakamoto
This commit is a preparation to support AMDTP domain. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-07-22ALSA: firewire-lib: process payload of isoc context according to packet ↵Takashi Sakamoto
descriptors This commit changes each of data block processing layer so that it receives list of packet descriptor. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-07-22ALSA: fireface: code refactoring for FF data block processing layerTakashi Sakamoto
This is code refactoring for FF data block processing layer so that it can receive list of packet descriptor. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-07-22ALSA: firewire-lib: pass packet descriptor to data block processing layerTakashi Sakamoto
This commit changes signature of callback function to call data block processing layer with packet descriptor. At present, the layer is called per packet. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-07-22ALSA: firewire-lib: pass no syt information to data block processing layerTakashi Sakamoto
In a previous commit, the variable passed from packet streaming layer for syt variable is useless. This commit obsoletes it. In my future work, the syt information is passed to data block processing layer by another way. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-07-22ALSA: firewire-lib: pass data block counter to data block processing layerTakashi Sakamoto
This is a preparation for future commit that 'struct amdtp_stream.data_block_count' does not represent the value of data block count for current data block. However, data block count is required for calculation of sequence index in sequence-multiplied data channel. Some of data block processing layer require it; e.g. for AM824 data block. This commit passes data block count to the processing layer. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>