summaryrefslogtreecommitdiff
path: root/sound/firewire/motu
AgeCommit message (Collapse)AuthorFilesLines
2024-01-29ALSA: firewire-motu: add support for MOTU 896 mk3 FireWire and HybridTakashi Sakamoto3-0/+12
Mark of the Unicorn released 896 mk3 FireWire in 2008 as part of the third generation of its FireWire series. In 2011, 896 mk3 hybrid was released to support USB protocol. It supports sampling transfer frequency up to 192.0 kHz. The packet format differs depending on both of current sampling transfer frequency and the type of signal in optical interfaces. The model supports transmission of PCM frames as well as MIDI messages. The 896 mk3 FireWire consists of below ICs: * Texas Instruments TSB41AB2 * Xilinx Spartan-3A FPGA, XC3S500E * Texas Instruments TMS320C6722 * Microchip (Atmel) AT91SAM SAM7S256 It supports sampling transfer frequency up to 192.0 kHz. The packet format differs depending on both of current sampling transfer frequency and the type of signal in two pairs of optical interfaces. The model supports transmission of PCM frames, while has no port for MIDi messages. The model supports command mechanism to configure internal DSP. Hardware meter information is available in the first 2 chunks of each data block of tx packet. This commit adds support for it. The 896 mk3 FireWire is just tested, but the 896 mk3 Hybrid is not yet. $ config-rom-pretty-printer < motu-896mk3fw.img ROM header and bus information block ----------------------------------------------------------------- 1024 04100ce1 bus_info_length 4, crc_length 16, crc 3297 1028 31333934 bus_name "1394" 1032 20ff7000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256) 1036 0001f200 company_id 0001f2 | 1040 00093add device_id 0000604893 | EUI-64 0547556791237341 root directory ----------------------------------------------------------------- 1044 0004ef04 directory_length 4, crc 61188 1048 030001f2 vendor 1052 0c0083c0 node capabilities: per IEEE 1394 1056 d1000002 --> unit directory at 1064 1060 8d000005 --> eui-64 leaf at 1080 unit directory at 1064 ----------------------------------------------------------------- 1064 0003998d directory_length 3, crc 39309 1068 120001f2 specifier id 1072 13000017 version 1076 17101800 model eui-64 leaf at 1080 ----------------------------------------------------------------- 1080 0002cc82 leaf_length 2, crc 52354 1084 0001f200 company_id 0001f2 | 1088 00093add device_id 0000604893 | EUI-64 0547556791237341 $ config-rom-pretty-printer < motu-896mk3hybrid.img ROM header and bus information block ----------------------------------------------------------------- 1024 04103cbe bus_info_length 4, crc_length 16, crc 15550 1028 31333934 bus_name "1394" 1032 20ff7000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256) 1036 0001f200 company_id 0001f2 | 1040 000ae601 device_id 0000714241 | EUI-64 0547556791346689 root directory ----------------------------------------------------------------- 1044 0004ef04 directory_length 4, crc 61188 1048 030001f2 vendor 1052 0c0083c0 node capabilities: per IEEE 1394 1056 d1000002 --> unit directory at 1064 1060 8d000005 --> eui-64 leaf at 1080 unit directory at 1064 ----------------------------------------------------------------- 1064 000394ac directory_length 3, crc 38060 1068 120001f2 specifier id 1072 13000037 version 1076 17102800 model eui-64 leaf at 1080 ----------------------------------------------------------------- 1080 0002cf69 leaf_length 2, crc 53097 1084 0001f200 company_id 0001f2 | 1088 000ae601 device_id 0000714241 | EUI-64 0547556791346689 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20240129022711.254383-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-15ALSA: firewire: Fix -Wformat-truncation warning for MIDI stream namesTakashi Iwai1-2/+2
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-12ALSA: firewire: use 'GPL' string for module license contributed by Takashi ↵Takashi Sakamoto1-1/+1
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-16Merge branch 'topic/apple-gmux' into for-nextTakashi Iwai1-0/+4
Pull vga_switcheroo fix for Macs Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-31ALSA: firewire-motu: fix unreleased lock warning in hwdep deviceTakashi Sakamoto1-0/+4
Smatch static analysis tool detects that acquired lock is not released in hwdep device when condition branch is passed due to no event. It is unlikely to occur, while fulfilling is preferable for better coding. Reported-by: Dan Carpenter <error27@gmail.com> Fixes: 634ec0b2906e ("ALSA: firewire-motu: notify event for parameter change in register DSP model") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20230130141540.102854-1-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 Sakamoto1-12/+4
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 Sakamoto1-1/+1
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 Sakamoto4-34/+44
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 Iwai1-2/+2
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 JAILLET1-3/+0
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-11-08ALSA: firewire-motu: add support for MOTU Track 16Takashi Sakamoto3-3/+16
Mark of the Unicorn designed Track 16 2011 as one of models in third generation of its FireWire series. The model is already discontinued. It consists of below ICs: * Texas Instruments TSB41AB1 * Microchip (SMSC) USB3300 * Xilinx Spartan-3A FPGA, XC3S700A * Texas Instruments TMS320C6722 * Microchip (Atmel) AT91SAM SAM7S512 It supports sampling transfer frequency up to 192.0 kHz. The packet format differs depending on both of current sampling transfer frequency and the type of signal in optical interfaces. The model supports transmission of PCM frames as well as MIDI messages. The model supports command mechanism to configure internal DSP. Hardware meter information is available in the first 2 chunks of each data block of tx packet. This commit adds support for it. $ cd linux-firewire-tools/src $ python crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 04107d95 bus_info_length 4, crc_length 16, crc 32149 404 31333934 bus_name "1394" 408 20ff7000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256) 40c 0001f200 company_id 0001f2 | 410 000a83c4 device_id 00000a83c4 | EUI-64 0001f200000a83c4 root directory ----------------------------------------------------------------- 414 0004ef04 directory_length 4, crc 61188 418 030001f2 vendor 41c 0c0083c0 node capabilities per IEEE 1394 420 d1000002 --> unit directory at 428 424 8d000005 --> eui-64 leaf at 438 unit directory at 428 ----------------------------------------------------------------- 428 00035b04 directory_length 3, crc 23300 42c 120001f2 specifier id 430 13000039 version 434 17102800 model eui-64 leaf at 438 ----------------------------------------------------------------- 438 0002b25f leaf_length 2, crc 45663 43c 0001f200 company_id 0001f2 | 440 000a83c4 device_id 00000a83c4 | EUI-64 0001f200000a83c4 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211107110644.23511-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-11-04ALSA: firewire-motu: add support for MOTU Traveler mk3Takashi Sakamoto3-3/+21
Mark of the Unicorn (MOTU) shipped Traveler mk3 as one of models in third generation of its FireWire series, and discontinued it already. The model consists of below ICs: * Texas Instruments TSB41AB2 * Phillips Semiconductors PDI1394L40 * Altera cyclone EP1C3 * Texas Instruments TMS320VC5402 It supports sampling transfer frequency up to 192.0 kHz. The packet format differs depending on both of current sampling transfer frequency and whether to enable ADAT channels in rx/tx packets. The model supports transmission of PCM frames as well as MIDI messages. The model supports command mechanism to configure internal DSP. Hardware meter information is available in the first 2 chunks of each data block of tx packet. This commit adds support for it. $ cd linux-firewire-tools/src $ python crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 0410af0a bus_info_length 4, crc_length 16, crc 44810 404 31333934 bus_name "1394" 408 20ff7000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256) 40c 0001f200 company_id 0001f2 | 410 00090911 device_id 0000090911 | EUI-64 0001f20000090911 root directory ----------------------------------------------------------------- 414 0004ef04 directory_length 4, crc 61188 418 030001f2 vendor 41c 0c0083c0 node capabilities per IEEE 1394 420 d1000002 --> unit directory at 428 424 8d000005 --> eui-64 leaf at 438 unit directory at 428 ----------------------------------------------------------------- 428 00031733 directory_length 3, crc 5939 42c 120001f2 specifier id 430 1300001b version 434 17102800 model eui-64 leaf at 438 ----------------------------------------------------------------- 438 00028484 leaf_length 2, crc 33924 43c 0001f200 company_id 0001f2 | 440 00090911 device_id 0000090911 | EUI-64 0001f20000090911 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211104110627.94469-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-29ALSA: firewire-motu: remove TODO for interaction with userspace about ↵Takashi Sakamoto1-2/+0
control message Now UAPI of ALSA firewire stack got enough functions to interact with userspace for protocol of MOTU FireWire series. Let's remove the relevant TODO. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211029012847.11839-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-28ALSA: firewire-motu: export meter information to userspace as float valueTakashi Sakamoto1-2/+5
In command DSP models, one meter information consists of 4 bytes for IEEE 764 floating point (binary32). In previous patch, it is exported to userspace as 32 bit storage since the storage is also handled in ALSA firewire-motu driver as well in kernel space in which floating point arithmetic is not preferable. On the other hand, ALSA firewire-motu driver doesn't perform floating point calculation. The driver just gather meter information from isochronous packets and fill structure fields for userspace. In 'header' target of Kbuild, UAPI headers are processed before installed. In this timing, #ifdef macro with __KERNEL__ is removed. This mechanism is useful in the case so that the 32 bit storage can be accessible as u32 type in kernel space and float type in user space. We can see the same usage in ''struct acct_v3' in 'include/uapi/linux/acct.h'. This commit is for the above idea. Additionally, due to message protocol, meter information is filled with 0xffffffff in the end of period but 0xffffffff is invalid as binary32. To avoid confusion in userspace application, the last two elements are left without any assignment. Suggested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211027125529.54295-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-28ALSA: firewire-motu: refine parser for meter information in register DSP modelsTakashi Sakamoto1-5/+9
After further investigation, I realize that the total number of elements in array is not enough to store all of related messages from device. This commit refines meter array and message parser. In terms of channel identifier, register DSP models are classified to two categories: 1. the target of output is selectable 828mk2, 896hd, and Traveler are in the category. They transfer messages with channel identifier between 0x00 and 0x13 for input meters, therefore 20 elements are needed to store. On the other hand, they transfer messages with channel identifier for one pair of output meters. The selection is done by asynchronous write transaction to offset 0x'ffff'f000'0b2c. The table for relationship between written value and available identifiers is below: ============= =============== written value identifier pair ============= =============== 0x00000b00 0x80/0x81 0x00000b01 0x82/0x83 ... ... 0x00000b0b 0x96/0x97 ... ... 0x00000b10 0xa0/0xa1 ... ... 0x00000b3f 0xfe/0xff ... ... greater 0xfe/0xff ============= =============== Actually in the above three models, 0x96/0x97 pair is the maximum. Thus the number of available output meter is 24. 2. all of output is available 8 pre, Ultralite, Audio Express, and 4 pre are in the category. They transfer messages for output meters without any selection. The table for available identifier for each direction is below: ============== ========= ========== model input output ============== ========= ========== 8 pre 0x00-0x0f 0x82-0x8d Ultralite 0x00-0x09 0x82-0x8f Audio Express 0x00-0x09 0x80-0x8d 4 pre 0x00-0x09 0x80-0x8d ============== ========= ========== Some of available identifiers might not be used for actual output meters. Anyway, 24 plus 24 elements accommodate the input/output meters. I note that isochronous packet from V3HD/V4HD deliver no message. Notification by asynchronous transaction to registered address seems to be used for the purpose as well as for change of mixer parameter. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211027125529.54295-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-28ALSA: firewire-motu: fix null pointer dereference when polling hwdep ↵Takashi Sakamoto1-5/+11
character device ALSA firewire-motu driver recently got support for event notification via ALSA HwDep interface for register DSP models. However, when polling ALSA HwDep cdev, the driver can cause null pointer dereference for the other models due to accessing to unallocated memory or uninitialized memory. This commit fixes the bug by check the type of model before accessing to the memory. Reported-by: kernel test robot <lkp@intel.com> Suggested-by: Takashi Iwai <tiwai@suse.de> Fixes: 634ec0b2906e ("ALSA: firewire-motu: notify event for parameter change in register DSP model") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211027125529.54295-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15ALSA: firewire-motu: notify event for parameter change in register DSP modelTakashi Sakamoto3-9/+78
This commit copies queued event for change of register DSP into userspace when application operates ALSA hwdep character device. The notification occurs only when packet streaming is running. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211015080826.34847-12-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15ALSA: firewire-motu: queue event for parameter change in register DSP modelTakashi Sakamoto3-14/+82
This commit is a preparation to notify parameter change of register DSP to userspace application. A simple queue is added to store encoded data for the change as long as ALSA hwdep character device is opened by application. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211015080826.34847-11-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15ALSA: firewire-motu: add ioctl command to read cached parameters in register ↵Takashi Sakamoto3-1/+34
DSP model This patch adds new ioctl command for userspace applications to read cached parameters of register DSP. The structured data includes model-dependent parameters. Userspace application should be carefully programmed so that what parameter is common and specific. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211015080826.34847-10-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15ALSA: firewire-motu: parse messages for input parameters in register DSP modelTakashi Sakamoto1-2/+41
This commit parses message and cache current parameters of input function, available for MOTU Ultralite, 4 pre, and Audio Express. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211015080826.34847-9-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15ALSA: firewire-motu: parse messages for line input parameters in register ↵Takashi Sakamoto1-0/+6
DSP model This commit parses message and cache current parameters of line input function, available for MOTU 828 mk2 and Traveler. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211015080826.34847-8-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15ALSA: firewire-motu: parse messages for output parameters in register DSP modelTakashi Sakamoto1-1/+10
This commit parses message and cache current parameters of output function, commonly available for all of register DSP model. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211015080826.34847-7-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15ALSA: firewire-motu: parse messages for mixer output parameters in register ↵Takashi Sakamoto1-0/+20
DSP model This commit parses message and cache current parameters of mixer output function, commonly available for all of register DSP model Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211015080826.34847-6-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15ALSA: firewire-motu: parse messages for mixer source parameters in ↵Takashi Sakamoto1-0/+64
register-DSP model In register DSP models, current parameters of DSP are always reported by messages in isochronous packet. When user operates hardware component such as rotary knob, corresponding message is changed. This commit parses the message and cache current parameters of mixer source function, commonly available for all of register DSP models. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211015080826.34847-5-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15ALSA: firewire-motu: add ioctl command to read cached hardware meterTakashi Sakamoto4-0/+84
This patch adds new ioctl commands for userspace applications to read cached image about hardware meters in register DSP and command DSP models. The content of image differs depending on models. Model-specific parser should be implemented in userspace. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211015080826.34847-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15ALSA: firewire-motu: add message parser for meter information in command DSP ↵Takashi Sakamoto7-5/+186
model Some of MOTU models allows software to configure their DSP parameters by command included in asynchronous transaction. The models multiplex messages for hardware meters into isochronous packet as well as PCM frames. For convenience, I call them as 'command DSP' model. This patch adds message parser for them to gather hardware meter information. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211015080826.34847-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15ALSA: firewire-motu: add message parser to gather meter information in ↵Takashi Sakamoto8-7/+184
register DSP model Some of MOTU models allows software to configure their DSP parameters by accessing to their registers. The models multiplex messages for status of DSP into isochronous packet as well as PCM frames. The message includes information of hardware metering, MIDI message, current parameters of DSP. For my convenience, I call them as 'register DSP' model. This patch adds message parser for them to gather hardware meter information. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20211015080826.34847-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-09-21ALSA: firewire-motu: fix truncated bytes in message tracepointsTakashi Sakamoto1-3/+4
In MOTU protocol v2/v3, first two data chunks across 2nd and 3rd data channels includes message bytes from device. The total size of message is 48 bits per data block. The 'data_block_message' tracepoints event produced by ALSA firewire-motu driver exposes the sequence of messages to userspace in 64 bit storage, however lower 32 bits are actually available since current implementation truncates 16 bits in upper of the message as a result of bit shift operation within 32 bit storage. This commit fixes the bug by perform the bit shift in 64 bit storage. Fixes: c6b0b9e65f09 ("ALSA: firewire-motu: add tracepoints for messages for unique protocol") Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210920110734.27161-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-08-23ALSA: firewire-motu: add support for MOTU 896HDTakashi Sakamoto3-4/+20
Mark of the Unicorn (MOTU) shipped 896HD 2003 as one of models in second generation of its FireWire series, and already discontinued it. The model consists of below ICs: * Texas Instruments TSB41AB2 * Phillips Semiconductors PDI1394L40 * Altera cyclone EP1C3 * Texas Instruments TMS320VC5402 It supports sampling transmission frequency up to 192.0 kHz. The packet format differs depending on both of sampling transfer frequency and enabling ADAT channels. The model doesn't support MIDI message transmission. This commit adds support for it. $ python3 crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 04101b66 bus_info_length 4, crc_length 16, crc 7014 404 31333934 bus_name "1394" 408 20001000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 1 (4) 40c 0001f200 company_id 0001f2 | 410 0001dbce device_id 000001dbce | EUI-64 0001f2000001dbce root directory ----------------------------------------------------------------- 414 0004c65c directory_length 4, crc 50780 418 030001f2 vendor 41c 0c0083c0 node capabilities per IEEE 1394 420 8d000006 --> eui-64 leaf at 438 424 d1000001 --> unit directory at 428 unit directory at 428 ----------------------------------------------------------------- 428 0003dcc1 directory_length 3, crc 56513 42c 120001f2 specifier id 430 13000005 version 434 17102800 model eui-64 leaf at 438 ----------------------------------------------------------------- 438 000264f2 leaf_length 2, crc 25842 43c 0001f200 company_id 0001f2 | 440 0001dbce device_id 000001dbce | EUI-64 0001f2000001dbce Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210823085741.33864-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-23ALSA: firewire-motu: fix register handling for 896Takashi Sakamoto1-10/+23
After further investigation, I find out some mistakes for 896 about its register. This commit fixes it. Fixes: b431f16f1685 ("ALSA: firewire-motu: add support for MOTU 896") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210623075941.72562-10-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-23ALSA: firewire-motu: fix register handling for 828Takashi Sakamoto1-18/+35
After further investigation, I find out some mistakes for 828 about its register. This commit fixes it. Fixes: d13d6b284d8b ("ALSA: firewire-motu: add support for MOTU 828") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210623075941.72562-9-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-23ALSA: firewire-motu: use macro instead of magic number for clock source in ↵Takashi Sakamoto1-7/+13
v3 protocol This commit adds a series of macro for source of sampling clock in version 3 protocol. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210623075941.72562-8-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-23ALSA: firewire-motu: code refactoring for source detection of sampling clock ↵Takashi Sakamoto1-47/+12
in v3 protocol Current implementation of driver has two similar helper functions for source detection of sampling clock. This commit merges them as a code refactoring. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210623075941.72562-7-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-23ALSA: firewire-motu: code refactoring for packet format detection in v2 protocolTakashi Sakamoto1-59/+20
Current implementation of driver has several similar helper functions for packet format detection in protocol version 2. This commit merges them as code refactoring. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210623075941.72562-6-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-23ALSA: firewire-motu: use macro instead of magic number for clock source in ↵Takashi Sakamoto1-7/+14
v2 protocol This commit adds a series of macro for source of sampling clock in version 2 protocol. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210623075941.72562-5-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-23ALSA: firewire-motu: add support for AES/EBU clock source in v2 protocolTakashi Sakamoto1-0/+3
Although MOTU Traveler supports AES/EBU source for sampling clock, current implementation of driver doesn't code it. This commit adds support for AES/EBU source in protocol version 2. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210623075941.72562-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-23ALSA: firewire-motu: code refactoring for detection of clock source in v2 ↵Takashi Sakamoto1-47/+21
protocol Current implementation of driver has two similar helper functions for source detection of sampling clock. This commit merges them as a code refactoring. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210623075941.72562-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-23ALSA: firewire-motu: fix detection for S/PDIF source on optical interface in ↵Takashi Sakamoto1-7/+6
v2 protocol The devices in protocol version 2 has a register with flag for IEC 60958 signal detection as source of sampling clock without discrimination between coaxial and optical interfaces. On the other hand, current implementation of driver manage to interpret type of signal on optical interface instead. This commit fixes the detection of optical/coaxial interface for S/PDIF signal. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210623075941.72562-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-18ALSA: firewire-motu: fix rx packet format at higher rate for MOTU 828 mk3 HybridTakashi Sakamoto3-6/+16
I assumed that the combination of packet formats for MOTU 828 mk3 Hybrid is the same as MOTU 828 mk3 FireWire. However at higher sampling rate, it is different. MOTU 828 mk3 Hybrid has additional 4 dummy data chunks for rx packet. This commit fixes the issue to which I address at a commit f2ac3b839540 ("ALSA: firewire-motu: sequence replay for source packet header"). Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210618040713.114611-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-17ALSA: firewire-motu: fix stream format for MOTU 8pre FireWireTakashi Sakamoto1-2/+3
My previous refactoring for ALSA firewire-motu driver brought regression to handle MOTU 8pre FireWire. The packet format is not operated correctly. Cc: <stable@vger.kernel.org> Fixes: dfbaa4dc11eb ("ALSA: firewire-motu: add model-specific table of chunk count") Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210614083133.39753-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-17ALSA: firewire-motu: add support for MOTU 896Takashi Sakamoto3-0/+217
MOTU 896 is a second model in MOTU FireWire series, produced in 2001. This model consists of three chips: * Texas Instruments TSB41AB2 (Physical layer for IEEE 1394 bus) * Philips Semiconductors PDI 1394L21BE (Link layer for IEEE 1394 bus and packet processing layer) * QuickLogic QuickRAM QL4016 (Data block processing layer and digital signal processing) This commit adds a support for the model, with its unique protocol as version 1. The features of this protocol are: * no MIDI support. * Rx packets have no data chunks for control and status messages. * Tx packets have 2 bytes for control and status messages in the end of each data block. * The most of settings are represented in bit flag in one quadlet address (0x'ffff'f000'0b14). * It's selectable to use signal on optical interface, however the device has no register specific to it. The state has effect just to whether to exclude differed data chunks. * The internal multiplexer is not configured by software. Just after powering on, the device has a quirk to fail handling transaction. I recommend users to connect the device enough after powering on. $ python3 crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 04102814 bus_info_length 4, crc_length 16, crc 10260 404 31333934 bus_name "1394" 408 20001000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 1 (4) 40c 0001f200 company_id 0001f2 | 410 0000d645 device_id 000000d645 | EUI-64 0001f2000000d645 root directory ----------------------------------------------------------------- 414 0004c65c directory_length 4, crc 50780 418 030001f2 vendor 41c 0c0083c0 node capabilities per IEEE 1394 420 8d000006 --> eui-64 leaf at 438 424 d1000001 --> unit directory at 428 unit directory at 428 ----------------------------------------------------------------- 428 0003ab34 directory_length 3, crc 43828 42c 120001f2 specifier id 430 13000002 version 434 17102801 model eui-64 leaf at 438 ----------------------------------------------------------------- 438 0002057d leaf_length 2, crc 1405 43c 0001f200 company_id 0001f2 | 440 0000d645 device_id 000000d645 | EUI-64 0001f2000000d645 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210616082847.124688-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-17ALSA: firewire-motu: add support for MOTU 828Takashi Sakamoto4-1/+251
MOTU 828 is a first model in MOTU FireWire series, produced in 2001. This model consists of three chips: * Texas Instruments TSB41AB1 (Physical layer for IEEE 1394 bus) * Philips Semiconductors 1394L21BE (Link layer for IEEE 1394 bus and packet processing layer) * QuickLogic QuickRAM QL4016 (Data block processing layer and digital signal processing) This commit adds a support for this model, with its unique protocol as version 1. The features of this protocol are: * no MIDI support. * Rx packets have no data chunks for control and status messages. * Tx packets have 2 data chunks for control and status messages in the end of each data block. The chunks consist of data block counter (4 byte) and message (2 byte). * All of settings are represented in bit flag in one quadlet address (0x'ffff'f000'0b00). * When optical interface is configured as S/PDIF, signals of the interface is multiplexed for packets, instead of signals of coaxial interface. * The internal multiplexer is not configured by software. I note that the device has a quirk to mute output voluntarily during receiving batch of packets in the beginning of packet streaming. The operation to unmute should be done by software enough after the device shifts the state, however it's not deterministic. Furthermore, just after switching rate of sampling clock, the device keeps the state longer. This patch manages to sleep 100 msec before unmute operation, but it may fail to release the mute in the case that the rate is changed. As a workaround, users can restart packet streaming at the same rate, or write to specific register from userspace. $ python3 crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 04105c54 bus_info_length 4, crc_length 16, crc 23636 404 31333934 bus_name "1394" 408 20001000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 1 (4) 40c 0001f200 company_id 0001f2 | 410 00005015 device_id 0000005015 | EUI-64 0001f20000005015 root directory ----------------------------------------------------------------- 414 0004c65c directory_length 4, crc 50780 418 030001f2 vendor 41c 0c0083c0 node capabilities per IEEE 1394 420 8d000006 --> eui-64 leaf at 438 424 d1000001 --> unit directory at 428 unit directory at 428 ----------------------------------------------------------------- 428 00035052 directory_length 3, crc 20562 42c 120001f2 specifier id 430 13000001 version 434 17101800 model eui-64 leaf at 438 ----------------------------------------------------------------- 438 0002eeb6 leaf_length 2, crc 61110 43c 0001f200 company_id 0001f2 | 440 00005015 device_id 0000005015 | EUI-64 0001f20000005015 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210616082847.124688-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-07ALSA: firewire-motu: cease from delayed card registrationTakashi Sakamoto2-62/+25
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-8-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-06ALSA: firewire-motu: add support for hybrid model of MOTU Ultralite mk3Takashi Sakamoto1-0/+1
This commit adds support for the hybrid model of MOTU Ultralite mk3 with alpha connector, which is already discontinued. The hardware specification of the model is the same as the one of FireWire-only model. $ cd linux-firewire-utils $ python3 src/crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 04101573 bus_info_length 4, crc_length 16, crc 5491 404 31333934 bus_name "1394" 408 20ff7000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256) 40c 0001f200 company_id 0001f2 | 410 000a059c device_id 00000a059c | EUI-64 0001f200000a059c root directory ----------------------------------------------------------------- 414 0004ef04 directory_length 4, crc 61188 418 030001f2 vendor 41c 0c0083c0 node capabilities per IEEE 1394 420 d1000002 --> unit directory at 428 424 8d000005 --> eui-64 leaf at 438 unit directory at 428 ----------------------------------------------------------------- 428 0003f00b directory_length 3, crc 61451 42c 120001f2 specifier id 430 13000030 version 434 17103800 model eui-64 leaf at 438 ----------------------------------------------------------------- 438 0002d89c leaf_length 2, crc 55452 43c 0001f200 company_id 0001f2 | 440 000a059c device_id 00000a059c | EUI-64 0001f200000a059c Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210606043409.40019-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-04ALSA: firewire-motu: fix error return code in snd_motu_stream_reserve_duplex()Yang Yingliang1-1/+1
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: e50dfac81f73 ("ALSA: firewire-motu: cache event ticks in source packet header per data block") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210603143203.582017-1-yangyingliang@huawei.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-02ALSA: firewire-motu: sequence replay for source packet headerTakashi Sakamoto3-74/+26
This commit takes ALSA firewire-motu driver to perform sequence replay for media clock recovery. Unlike the other types of device, the devices in MOTU FireWire series require two levels of sequence replay; the sequence of the number of data blocks per packet and the sequence of source packet header per data block. The former is already cached by ALSA IEC 61883-1/6 packet streaming engine and ready to be replayed. The latter is also cached by ALSA firewire-motu driver itself with a previous patch. This commit takes the driver to replay both of them from the caches. The sequence replay is tested with below models: * 828 mkII * Traveler * UltraLite * 828 mk3 FireWire * 828 mk3 Hybrid (except for high sampling transfer frequency * UltraLite mk3 FireWire * 4pre * AudioExpress Unfortunately, below models still don't generate better sound, requires more work: * 8pre * 828 mk3 Hybrid at high sampling transfer frequency As long as I know, MOTU protocol version 1 requires extra care of the format of data block, thus below models are not supported yet in this time: * 828 * 896 Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210602013406.26442-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-02ALSA: firewire-motu: cache event ticks in source packet header per data blockTakashi Sakamoto3-3/+70
The devices in MOTU FireWire series put source packet header (SPH) into each data block of tx packet for presentation time of event. The format of timestamp is compliant to IEC 61883-1, with cycle and offset fields without sec field of 32 bit cycle time. This commit takes ALSA firewire-motu driver to cache the presentation time as offset from cycle in which the packet is transferred. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210602013406.26442-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-02ALSA: firewire-motu: use macro for magic numbers relevant to IEC 61883-1Takashi Sakamoto1-14/+26
ALSA firewire-motu driver has some magic numbers from IEC 61883-1 to operates source packet header (SPH). This commit replaces them with macros. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20210602013406.26442-2-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 Sakamoto1-1/+1
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 Sakamoto1-1/+1
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>