Commit Graph

1100 Commits

Author SHA1 Message Date
Takashi Iwai fdd51b3e73 ALSA: firewire: Use *-y instead of *-objs in Makefile
*-objs suffix is reserved rather for (user-space) host programs while
usually *-y suffix is used for kernel drivers (although *-objs works
for that purpose for now).

Let's correct the old usages of *-objs in Makefiles.

Cc: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20240507135513.14919-8-tiwai@suse.de
2024-05-08 18:18:03 +02:00
Gustavo A. R. Silva 1d717123bb ALSA: firewire-lib: Avoid -Wflex-array-member-not-at-end warning
Use the `DEFINE_FLEX()` helper for an on-stack definition of a
flexible structure where the size of the flexible-array member
is known at compile-time, and refactor the rest of the code,
accordingly.

So, with these changes, fix the following warning:
sound/firewire/amdtp-stream.c:1184:46: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Link: https://github.com/KSPP/linux/issues/202
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Message-ID: <ZgIsBqoMb7p3fMDr@neat>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-03-26 12:16:50 +01:00
Takashi Iwai 3fdecc7d9a Merge branch 'for-linus' into for-next
Pull 6.8-rc devel branch.  The trivial merge conflict got resolved.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-02-21 11:17:06 +01:00
Takashi Sakamoto 77ce96543b ALSA: firewire-lib: fix to check cycle continuity
The local helper function to compare the given pair of cycle count
evaluates them. If the left value is less than the right value, the
function returns negative value.

If the safe cycle is less than the current cycle, it is the case of
cycle lost. However, it is not currently handled properly.

This commit fixes the bug.

Cc: <stable@vger.kernel.org>
Fixes: 705794c53b ("ALSA: firewire-lib: check cycle continuity")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20240218033026.72577-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-02-19 09:25:52 +01:00
Takashi Sakamoto 5259293240 ALSA: oxfw: add support for Miglia Harmony Audio
Miglia Technology ships Harmony Audio 2004. It uses Oxford Semiconductor
OXFW970 for communication function in IEEE 1394 bus. This commit adds
support for the model.

In my opinion, the firmware of ASIC is really the initial stage, since
it has the following quirks.

* It skips several isochronous cycles to transmit isochronous packets
  when receiving any asynchronous transaction.
* The value of dbc field in the transmitted packet is the number of
  accumulated quadlets in CIP payload, instead of the accumulated data
  blocks. Furthermore, the value includes the quadlets of CIP payload in
  the packet.
* It neither supports AV/C Stream Format Information command nor AV/C
  Extended Stream Format Information command.
* The vendor and model information in root directory of configuration
  ROM includes some mistakes.

Additionally, when operating at 96.0 kHz, it often skips much isochronous
cycles to transmit the isochronous packets. The issue is detected as cycle
discontinuity and ALSA PCM application receives -EIO at any operation for
PCM substream. I have never found any workaround yet.

$ config-rom-pretty-printer < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
1024  04249e04  bus_info_length 4, crc_length 36, crc 40452
1028  31333934  bus_name "1394"
1032  20ff5003  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 5 (64)
1036  0030e002  company_id 0030e0     |
1040  00454647  device_id 8594474567  | EUI-64 13757098081207879

               root directory
               -----------------------------------------------------------------
1044  00062d69  directory_length 6, crc 11625
1048  030030e0  vendor
1052  8100000a  --> descriptor leaf at 1092
1056  1700f970  model
1060  81000011  --> descriptor leaf at 1128
1064  0c0083c0  node capabilities: per IEEE 1394
1068  d1000001  --> unit directory at 1072

               unit directory at 1072
               -----------------------------------------------------------------
1072  00046ff9  directory_length 4, crc 28665 (should be 43676)
1076  1200a02d  specifier id
1080  13010001  version
1084  1700f970  model
1088  8100000f  --> descriptor leaf at 1148

               descriptor leaf at 1092
               -----------------------------------------------------------------
1092  00085f8a  leaf_length 8, crc 24458
1096  00000000  textual descriptor
1100  00000000  minimal ASCII
1104  4d69676c  "Migl"
1108  69612054  "ia T"
1112  6563686e  "echn"
1116  6f6c6f67  "olog"
1120  79204c74  "y Lt"
1124  642e0000  "d."

               descriptor leaf at 1128
               -----------------------------------------------------------------
1128  00040514  leaf_length 4, crc 1300
1132  00000000  textual descriptor
1136  00000000  minimal ASCII
1140  4f584657  "OXFW"
1144  20393730  " 970"

               descriptor leaf at 1148
               -----------------------------------------------------------------
1148  0005a1dc  leaf_length 5, crc 41436
1152  00000000  textual descriptor
1156  00000000  minimal ASCII
1160  4861726d  "Harm"
1164  6f6e7941  "onyA"
1168  7564696f  "udio"

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20240218074128.95210-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-02-19 09:24:35 +01:00
Takashi Sakamoto 4a486439d2 ALSA: firewire-lib: handle quirk to calculate payload quadlets as data block counter
Miglia Harmony Audio (OXFW970) has a quirk to put the number of
accumulated quadlets in CIP payload into the dbc field of CIP header.

This commit handles the quirk in the packet processing layer.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20240218074128.95210-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-02-19 09:24:35 +01:00
Takashi Sakamoto 25ab2b2f6a ALSA: oxfw: support the case that AV/C Stream Format Information command is not available
Miglia Harmony Audio does neither support AV/C Stream Format Information
command nor AV/C Extended Stream Format Information command.

This commit adds a workaround for the case and uses the hard-coded formats.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20240218074128.95210-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-02-19 09:24:35 +01:00
Takashi Sakamoto 5c0a35b26f ALSA: oxfw: use const qualifier for immutable argument
In the helper function, the first argument is immutable, thus it is
preferable to use const qualifier.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20240218074128.95210-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-02-19 09:24:35 +01:00
Takashi Sakamoto 6d5a2dda9b ALSA: firewire-motu: add support for MOTU 896 mk3 FireWire and Hybrid
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>
2024-01-29 09:04:30 +01:00
Takashi Iwai ea77850e98 ALSA: firewire: Fix -Wformat-truncation warning for MIDI stream names
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-09-15 13:22:06 +02:00
Takashi Iwai 641e969114 ALSA: firewire: Fix -Wformat-truncation warning for longname string
The filling of card->longname can be gracefully truncated, as it's
only informative.  Use scnprintf() and suppress the superfluous
compile warning with -Wformat-truncation.

Link: https://lore.kernel.org/r/20230915082802.28684-11-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-09-15 13:21:50 +02:00
Takashi Sakamoto ff7a0b4016 ALSA: dice: add stream format parameters for Weiss devices
Hard-coded stream format parameters are added for Weiss Engineering
FireWire devices. When the device vendor and model match, the parameters
are copied into the stream format cache. This allows for setting all
supported sampling rates up to 192kHz, and consequently adjusting the
number of available I/O channels.

Signed-off-by: Rolf Anderegg <rolf.anderegg@weiss.ch>
Signed-off-by: Michele Perrone <michele.perrone@weiss.ch>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230809002631.750120-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-10 10:10:34 +02:00
Takashi Sakamoto a64db0b9df ALSA: fireface: make read-only const array for model names static
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-28 11:42:55 +02:00
Colin Ian King d17f0ce9a9 ALSA: oxfw: make read-only const array models static
Don't populate the const array on the stack, instead make it static.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230627113253.700065-1-colin.i.king@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-28 11:42:29 +02:00
Takashi Iwai a15b513756 Merge branch 'for-next' into for-linus
Pull the 6.5-devel branch for upstreaming.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-26 15:23:23 +02:00
Takashi Sakamoto 9b4469410c ALSA: firewire: use 'GPL' string for module license contributed by Clemens Ladisch
In MODULE_LICENSE macro, "GPL" string obsoletes "GPL v2" string by a
commit bf7fbeeae6 ("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-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-06-12 14:39:00 +02:00
Takashi Sakamoto 81c2943507 ALSA: firewire: use 'GPL' string for module license contributed by Takashi Sakamoto
In MODULE_LICENSE macro, "GPL" string obsoletes "GPL v2" string by a
commit bf7fbeeae6 ("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-06-12 14:38:58 +02:00
Dan Carpenter c0e72058d5 ALSA: firewire-digi00x: prevent potential use after free
This code was supposed to return an error code if init_stream()
failed, but it instead freed dg00x->rx_stream and returned success.
This potentially leads to a use after free.

Fixes: 9a08067ec3 ("ALSA: firewire-digi00x: support AMDTP domain")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/c224cbd5-d9e2-4cd4-9bcf-2138eb1d35c6@kili.mountain
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-05-12 10:18:05 +02:00
Xu Biang fb4a624f88 ALSA: firewire-tascam: add missing unwind goto in snd_tscm_stream_start_duplex()
Smatch Warns:
sound/firewire/tascam/tascam-stream.c:493 snd_tscm_stream_start_duplex()
warn: missing unwind goto?

The direct return will cause the stream list of "&tscm->domain" unemptied
and the session in "tscm" unfinished if amdtp_domain_start() returns with
an error.

Fix this by changing the direct return to a goto which will empty the
stream list of "&tscm->domain" and finish the session in "tscm".

The snd_tscm_stream_start_duplex() function is called in the prepare
callback of PCM. According to "ALSA Kernel API Documentation", the prepare
callback of PCM will be called many times at each setup. So, if the
"&d->streams" list is not emptied, when the prepare callback is called
next time, snd_tscm_stream_start_duplex() will receive -EBUSY from
amdtp_domain_add_stream() that tries to add an existing stream to the
domain. The error handling code after the "error" label will be executed
in this case, and the "&d->streams" list will be emptied. So not emptying
the "&d->streams" list will not cause an issue. But it is more efficient
and readable to empty it on the first error by changing the direct return
to a goto statement.

The session in "tscm" has been begun before amdtp_domain_start(), so it
needs to be finished when amdtp_domain_start() fails.

Fixes: c281d46a51 ("ALSA: firewire-tascam: support AMDTP domain")
Signed-off-by: Xu Biang <xubiang@hust.edu.cn>
Reviewed-by: Dan Carpenter <error27@gmail.com>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230406132801.105108-1-xubiang@hust.edu.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-06 16:45:03 +02:00
Takashi Iwai 5661706efa Merge branch 'topic/apple-gmux' into for-next
Pull vga_switcheroo fix for Macs

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-02-16 14:18:54 +01:00
Takashi Sakamoto 0d9eb7ed95 ALSA: fireface: add field for the number of messages copied to user space
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-02-04 09:35:17 +01:00
Takashi Sakamoto c7a806d9ce ALSA: firewire-motu: fix unreleased lock warning in hwdep device
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: 634ec0b290 ("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-31 09:34:04 +01:00
Takashi Sakamoto d8dc872046 ALSA: firewire-lib: fix uninitialized local variable
The function local variable, curr_cycle_time is declared without
initialization. When tracepoints event is not probed, it looks to be
used as is. This commit fixes it. Fortunately, the value of local variable
is not used unless the event is probed, thus this commit is for better
coding.

Reported-by: Dan Carpenter <error27@gmail.com>
Fixes: fef4e61b0b ("ALSA: firewire-lib: extend tracepoints event including CYCLE_TIME of 1394 OHCI")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230130141532.102838-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-31 09:32:10 +01:00
Dan Carpenter 81c254a65c ALSA: fireface: fix locking bug in ff400_copy_msg_to_user()
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: acdebd8b4c ("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-18 17:49:48 +01:00
Takashi Sakamoto acdebd8b4c ALSA: fireface: implement message parser for Fireface 400
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-13 09:56:39 +01:00
Takashi Sakamoto c31909fa06 ALSA: fireface: add local framework to message parser
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-13 09:56:37 +01:00
Takashi Sakamoto aed713bfae ALSA: fireface: add helper function to parse MIDI messages transmitted by 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-13 09:56:36 +01:00
Takashi Sakamoto 4bdcb8d28f ALSA: fireface: pick up time stamp for request subaction of asynchronous transaction
The time stamp of isochronous cycle at which asynchronous transaction is
sent is perhaps useful somehow. A commit b2405aa948 ("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-13 09:56:35 +01:00
Takashi Sakamoto 50c597c77c ALSA: fireface: rename callback functions
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-13 09:56:33 +01:00
Takashi Sakamoto af13842cad ALSA: firewire-lib: compute extra delay for runtime of PCM substream
All drivers in ALSA firewire stack have never reported extra delay for
the runtime of PCM substream. There is some reason, but the main reason
is that the meaning of extra delay differs depending on driver design,
especially for the packet-oriented driver.

Here I define the extra delay for the case of IEC 61883-1/6. It is the
number of PCM frames transferred or should be transferred between the
current isochronous cycle and the isochronous cycle to which the latest
isochronous packet arrived (in IR context) or is scheduled (in IT context).

A commit baa914cd81 ("firewire: add kernel API to access CYCLE_TIME
register") allow unit drivers to read CYCLE_TIME of 1394 OHCI controller.
It allows the drivers to compute the current isochronous cycle.

Additionally, a commit f011712887 ("ALSA: firewire-lib: keep history to
process isochronous packet") enables to save the history processing
packets. It allows the driver to estimate the total number of data blocks
in packets arriving shortly, or calculate the total number of data blocks
in scheduled packets.

Now it is ready. This commit implements the computation of the extra delay.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230110134933.322794-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-12 12:14:52 +01:00
Takashi Sakamoto 7fc693e474 ALSA: firewire-lib: obsolete return value from context payload processing layer
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-12 12:14:50 +01:00
Takashi Sakamoto a36183f69c ALSA: firewire-lib: move parameter for pcm frame multiplier from context 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-12 12:14:49 +01:00
Takashi Sakamoto fef4e61b0b ALSA: firewire-lib: extend tracepoints event including CYCLE_TIME of 1394 OHCI
A commit baa914cd81 ("firewire: add kernel API to access CYCLE_TIME
register") allow unit drivers to read CYCLE_TIME of 1394 OHCI controller.
The value expresses monotonic time with 42.195 Mhz resolution and wrapping
around every 128 seconds. The controller uses the time to govern
isochronous cycle.

This commit extends tracepoints event including the value so that event
parser can compute gap between current isochronous cycle and the latest
isochronous cycle in which packet is processed (in IR context) or scheduled
(in IT context). It loses backward compatibility to former format of the
tracepoints event.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230109213231.138223-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-10 09:34:47 +01:00
Takashi Sakamoto f011712887 ALSA: firewire-lib: keep history to process isochronous packet
The history to process isochronous packets is useful when computing gap
between current isochronous cycle and the latest isochronous cycle in
which packet is processed (in IR context) and scheduled (in IT context).

This commit stores the most recent packet descriptors to keep the history.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230109021738.75543-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-09 17:04:46 +01:00
Takashi Sakamoto 0cac60c776 ALSA: firewire-lib: use circular linked list for context payload processing 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>
2023-01-09 17:04:44 +01:00
Takashi Sakamoto cec371ff1a ALSA: firewire-lib: use circular linked list to enumerate packet descriptors
Current implementation uses list of packet descriptor as template to
schedule isochronous packet. The packet descriptors are operated by
position and size, while circular linked list is convenient to enumerate
the packet descriptors.

This commit utilizes circular linked list for the purpose.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230109021738.75543-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-09 17:04:43 +01:00
Takashi Sakamoto c38d8cff9c ALSA: firewire-lib: code refactoring for cache position in sequence replay
When sequence replay is enabled for media clock recovery, current
implementation refers to cache of sequence descriptors in tx packets, then
fulfil sequence descriptors for rx packets. The initialization for rx
packets is done before starting packet streaming, while it can be postponed
till the cache has enough entries for the replay.

This commit refactors for the purpose as well as minor code change for
renaming of structure member.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230107023214.29132-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-08 15:00:11 +01:00
Takashi Sakamoto cccddec49c ALSA: firewire-lib: code refactoring for cache position in tx packets
When sequence replay is enabled for media clock recovery, current
implementation caches sequence descriptors from packet descriptors in tx
packets. Helper function for the purpose do not necessarily have good
readability.

This commit refactors relevant functions by renaming structure members,
function name, and function local variables.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230107023214.29132-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-08 15:00:10 +01:00
Takashi Sakamoto f2bdee856f ALSA: firewire-lib: code refactoring for pool position in rx packets
When scheduling transmission of rx packets, current implementation
fulfils packet descriptors after pooling sequence descriptors. It is for
packet queueing. Besides the implementations do not necessarily have
good readability.

This commit refactors them by adding function local variables and
function arguments.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230107023214.29132-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-08 15:00:09 +01:00
Takashi Sakamoto 119c446a48 ALSA: firewire-lib: code refactoring for helper functions to pool sequence in rx packets
When scheduling transmission of rx packets, current implementation pools
sequence descriptors at first for media clock. Two methods are used for
the purpose depending on four cases, while the implementations do not
necessarily have good readability.

This commit refactors them by adding function pointers and functions
arguments.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20230107023214.29132-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-01-08 15:00:08 +01:00
Linus Torvalds 102f9d3d45 sound updates for 6.2-rc1
This looks like a relatively calm development cycle; there have been
 only few changes in ALSA and ASoC core sides while we get lots of
 device-specific fixes and updates as usual.  Most of commits are about
 ASoC, including Intel SOF/AVS and many device tree updates.
 
 Below are some highlights:
 
 Core:
 - Improvement in memalloc helper for fallback allocations
 - More cleanups of ASoC DAPM code
 
 ASoC:
 - Factoring out of mapping hw_params onto SoundWire configuration
 - The ever ongoing overhauls of the Intel DSP code continue, including
   support for loading libraries and probes with IPC4 on SOF.
 - Support for more sample formats on JZ4740
 - Lots of device tree conversions and fixups
 - Support for Allwinner D1, a range of AMD and Intel systems, Mediatek
   systems with multiple DMICs, Nuvoton NAU8318, NXP fsl_rpmsg and
   i.MX93, Qualcomm AudioReach Enable, MFC and SAL, RealTek RT1318 and
   Rockchip RK3588
 
 ALSA:
 - Addition of PCM kselftest; still minimalistic but can be extended
   in future
 - Fixes for corner-case XRUNs with USB-audio implicit feedback mode
 - Usual device-specific quirk updates for USB- and HD-audio
 - FireWire DICE updates
 
 Also, this PR also contains a few cross-tree updates:
 - Some OMAP board file updates for removal of relevant OMAP platforms
 - A new I2C API update for I2C probe API adaption
 - A DRM update for the further hdmi-codec updates
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAmOR6TEOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE9p4w/8CoC/jEVFoOFVeH4/ur3MSGv93iDlPlA9sg1B
 BMtUEsa+yUtlPjZfw/ZdnUvWGGkvSTIAA3Tyc+yrx+WYAJeoWsL6vpkjQcoKBFLV
 oOo/dLROqeK6kS3cir0Z5VzaTg29XNz7iwe2wMp2q0irjbVZVy0+TUa2bzNOAdbs
 Hupu5Vwx2lKINSKjWVbN+3g4LiMW+VyEavNZf7bZNxI5h/4p1oaOj/lJrsHCEX5y
 rj1+d4EJntaFHToPf+4YkrMjLji0Yj9qsIWeXWy0Q5aUCyNr4zA3LrSszyM5cYfC
 dBPPrFatvXt+N0SVTURX7VnKgYzLlG8TNwXPUJbfnTGzvXHzd5q08MHWm2ZyF2tf
 3wDR+Lrw97WLWvGKQjHpg1ZFWmqSTC6D+9ihGCNRq0pMW6EtmxHtkDxhD45WF1Wq
 UQJNYHWbpSQye+wwio1/JZCZ55x89utapaRXD9cTZCDoCBKOcaUsr71hNt56HL/3
 5dT6fx1pJwyaR+SPJg7DQlnPGnm4J8cJhwi+WuHME9IECjO10b9o5ThcxaNWY3W7
 ysVCk2jLJHOZTG4FDun5mEqyWEmnjrUAH9UZtCSQZdhYCk8E8C9B2trKUAh9nb/p
 bUCrNdoopY5SpUCadPT7HtDiNXNWYMnpd7ktUun2z7V0u8pZNnhNUVvOuzFc/gT1
 ypWJp+0=
 =QV3a
 -----END PGP SIGNATURE-----

Merge tag 'sound-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound updates from Takashi Iwai:
 "This looks like a relatively calm development cycle; there have been
  only few changes in ALSA and ASoC core sides while we get lots of
  device-specific fixes and updates as usual. Most of commits are about
  ASoC, including Intel SOF/AVS and many device tree updates.

  Below are some highlights:

  Core:
   - Improvement in memalloc helper for fallback allocations
   - More cleanups of ASoC DAPM code

  ASoC:
   - Factoring out of mapping hw_params onto SoundWire configuration
   - The ever ongoing overhauls of the Intel DSP code continue,
     including support for loading libraries and probes with IPC4 on
     SOF.
   - Support for more sample formats on JZ4740
   - Lots of device tree conversions and fixups
   - Support for Allwinner D1, a range of AMD and Intel systems,
     Mediatek systems with multiple DMICs, Nuvoton NAU8318, NXP
     fsl_rpmsg and i.MX93, Qualcomm AudioReach Enable, MFC and SAL,
     RealTek RT1318 and Rockchip RK3588

  ALSA:
   - Addition of PCM kselftest; still minimalistic but can be extended
     in future
   - Fixes for corner-case XRUNs with USB-audio implicit feedback mode
   - Usual device-specific quirk updates for USB- and HD-audio
   - FireWire DICE updates

  This also contains a few cross-tree updates:
   - Some OMAP board file updates for removal of relevant OMAP platforms
   - A new I2C API update for I2C probe API adaption
   - A DRM update for the further hdmi-codec updates"

* tag 'sound-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (417 commits)
  ALSA: mts64: fix possible null-ptr-defer in snd_mts64_interrupt
  ALSA: patch_realtek: Fix Dell Inspiron Plus 16
  ALSA: hda/cirrus: Add extra 10 ms delay to allow PLL settle and lock.
  ASoC: dt-bindings: Correct Alexandre Belloni email
  ASoC: dt-bindings: maxim,max98504: Convert to DT schema
  ASoC: dt-bindings: maxim,max98357a: Convert to DT schema
  ASoC: dt-bindings: Reference common DAI properties
  ASoC: dt-bindings: Extend name-prefix.yaml into common DAI properties
  ASoC: rt715: Make read-only arrays capture_reg_H and capture_reg_L static const
  ASoC: uniphier: aio-core: Make some read-only arrays static const
  ASoC: wcd938x: Make read-only array minCode_param static const
  ASoC: qcom: lpass-sc7280: Add maybe_unused tag for system PM ops
  ASoC : SOF: amd: Add support for IPC and DSP dumps
  ASoC: SOF: amd: Use poll function instead to read ACP_SHA_DSP_FW_QUALIFIER
  ALSA: usb-audio: Workaround for XRUN at prepare
  ALSA: pcm: Handle XRUN at trigger START
  ALSA: pcm: Set missing stop_operating flag at undoing trigger start
  drm: tda99x: Don't advertise non-existent capture support
  ASoC: hdmi-codec: Allow playback and capture to be disabled
  kselftest/alsa: Add more coverage of sample rates and channel counts
  ...
2022-12-13 11:27:26 -08:00
Takashi Sakamoto 4e9050e5f9 ALSA: dice: Remove left-over license text
Following a commit 1dd0dd0b1f ("ALSA: firewire: Remove some left-over
license text in sound/firewire"), this patch removes it added carelessly.

Fixes: 2133dc91d6 ("ALSA: dice: add support for Focusrite Saffire Pro 40 with TCD3070 ASIC")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20221201030100.31495-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-12-01 07:50:59 +01:00
Takashi Sakamoto 2133dc91d6 ALSA: dice: add support for Focusrite Saffire Pro 40 with TCD3070 ASIC
TC Applied Technologies (TCAT) produces TCD3070 as final DICE ASIC for
communication in IEEE 1394 bus for IEC 61883-1/6 protocol. As long as I
know, latter model of Focusrite Saffire Pro 40 is an application of the
ASIC and only in the market for consumers.

This patchset adds support for the device. The device has several
remarkable points.

1. No support for extended synchronization information section in TCAT
general protocol. The value of GLOBAL_EXTENDED_STATUS register is always
zero. Additionally, NOTIFY_EXT_STATUS message is never emitted.

2. No support for TCAT protocol extension. Hard coding is required for
format of CIP payload.

3. During several seconds after changing sampling rate, the block to
process PCM frames is under disfunction. When starting packet streaming
during the state, the block is never function till configuring different
sampling rate and several seconds.

This commit adds support for the device. The item 1 and 2 can be
adaptable, while item 3 is not. It's not preferable that user process
is forced to sleep during the disfunction in the call of ioctl(2) with
SNDRV_PCM_IOCTL_HW_PARAMS or SNDRV_PCM_IOCTL_PREPARE request. It's
inconvenient but let user configure preferable sampling rate in advance
of starting PCM substream.

The content of configuration ROM in the device I used is available at:
 * https://github.com/takaswie/am-config-roms/

I note that any mixer control operation is implemented by unique
transaction. The frame of request consists of 16 bytes header followed
by payload.

header (4 quadlets):
1st: the type of request, prefixed with 0x8000
2nd: counter at 2 bytes in MSB side, the length of data at 2 bytes in LSB
     side
3rd: parameter 0
4th: parameter 1

payload (variable length if need):
5th-: data according to parameters

The request frame is sent by block write request to 0x'ffff'e040'01c0.

The frame of response is similar to the frame of request, but it is
header only, thus fixed to 16 bytes. The response frame is sent to the
address which is registered by lock transaction to 0x'ffff'e040'0008.

If the operation results in batch of data, the 2nd quadlet of header
includes the length of data like request. The data is itself readable
by read block request to 0x'ffff'e040'0030, which includes both
header and payload for data, thus the length to read should be the
length of data plus 16 bytes for header

The actual value of request, parameter 0, parameter 1, and data is
unclear yet.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20221130143313.43880-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-11-30 16:16:38 +01:00
Takashi Sakamoto 9b84f0f74d ALSA: dice: fix regression for Lexicon I-ONIX FW810S
For Lexicon I-ONIX FW810S, the call of ioctl(2) with
SNDRV_PCM_IOCTL_HW_PARAMS can returns -ETIMEDOUT. This is a regression due
to the commit 41319eb56e ("ALSA: dice: wait just for
NOTIFY_CLOCK_ACCEPTED after GLOBAL_CLOCK_SELECT operation"). The device
does not emit NOTIFY_CLOCK_ACCEPTED notification when accepting
GLOBAL_CLOCK_SELECT operation with the same parameters as current ones.

This commit fixes the regression. When receiving no notification, return
-ETIMEDOUT as long as operating for any change.

Fixes: 41319eb56e ("ALSA: dice: wait just for NOTIFY_CLOCK_ACCEPTED after GLOBAL_CLOCK_SELECT operation")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20221130130604.29774-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-11-30 16:15:02 +01:00
Takashi Iwai 23cb0767f0 ALSA: firewire: Replace runtime->status->state reference to runtime->state
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-27 08:47:25 +02:00
Christophe JAILLET 1dd0dd0b1f ALSA: firewire: Remove some left-over license text in sound/firewire
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>
2022-09-27 08:42:18 +02:00
Takashi Sakamoto eb9d84b0ff ALSA: fireworks: fix wrong return count shorter than expected by 4 bytes
ALSA fireworks driver has a bug in its initial state to return count
shorter than expected by 4 bytes to userspace applications when handling
response frame for Echo Audio Fireworks transaction. It's due to missing
addition of the size for the type of event in ALSA firewire stack.

Fixes: 555e8a8f7f ("ALSA: fireworks: Add command/response functionality into hwdep interface")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20220424102428.21109-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-04-25 08:03:49 +02:00
Takashi Sakamoto bf0cd60b7e ALSA: firewire-lib: fix uninitialized flag for AV/C deferred transaction
AV/C deferred transaction was supported at a commit 00a7bb81c2 ("ALSA:
firewire-lib: Add support for deferred transaction") while 'deferrable'
flag can be uninitialized for non-control/notify AV/C transactions.
UBSAN reports it:

kernel: ================================================================================
kernel: UBSAN: invalid-load in /build/linux-aa0B4d/linux-5.15.0/sound/firewire/fcp.c:363:9
kernel: load of value 158 is not a valid value for type '_Bool'
kernel: CPU: 3 PID: 182227 Comm: irq/35-firewire Tainted: P           OE     5.15.0-18-generic #18-Ubuntu
kernel: Hardware name: Gigabyte Technology Co., Ltd. AX370-Gaming 5/AX370-Gaming 5, BIOS F42b 08/01/2019
kernel: Call Trace:
kernel:  <IRQ>
kernel:  show_stack+0x52/0x58
kernel:  dump_stack_lvl+0x4a/0x5f
kernel:  dump_stack+0x10/0x12
kernel:  ubsan_epilogue+0x9/0x45
kernel:  __ubsan_handle_load_invalid_value.cold+0x44/0x49
kernel:  fcp_response.part.0.cold+0x1a/0x2b [snd_firewire_lib]
kernel:  fcp_response+0x28/0x30 [snd_firewire_lib]
kernel:  fw_core_handle_request+0x230/0x3d0 [firewire_core]
kernel:  handle_ar_packet+0x1d9/0x200 [firewire_ohci]
kernel:  ? handle_ar_packet+0x1d9/0x200 [firewire_ohci]
kernel:  ? transmit_complete_callback+0x9f/0x120 [firewire_core]
kernel:  ar_context_tasklet+0xa8/0x2e0 [firewire_ohci]
kernel:  tasklet_action_common.constprop.0+0xea/0xf0
kernel:  tasklet_action+0x22/0x30
kernel:  __do_softirq+0xd9/0x2e3
kernel:  ? irq_finalize_oneshot.part.0+0xf0/0xf0
kernel:  do_softirq+0x75/0xa0
kernel:  </IRQ>
kernel:  <TASK>
kernel:  __local_bh_enable_ip+0x50/0x60
kernel:  irq_forced_thread_fn+0x7e/0x90
kernel:  irq_thread+0xba/0x190
kernel:  ? irq_thread_fn+0x60/0x60
kernel:  kthread+0x11e/0x140
kernel:  ? irq_thread_check_affinity+0xf0/0xf0
kernel:  ? set_kthread_struct+0x50/0x50
kernel:  ret_from_fork+0x22/0x30
kernel:  </TASK>
kernel: ================================================================================

This commit fixes the bug. The bug has no disadvantage for the non-
control/notify AV/C transactions since the flag has an effect for AV/C
response with INTERIM (0x0f) status which is not used for the transactions
in AV/C general specification.

Fixes: 00a7bb81c2 ("ALSA: firewire-lib: Add support for deferred transaction")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20220304125647.78430-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-04 17:23:21 +01:00
Takashi Sakamoto 0ca37273ee ALSA: fireworks: add support for Loud Onyx 1200f quirk
Loud Technologies shipped Onyx 1200f 2008 in its Mackie brand and
already discontinued. The model uses component of Fireworks board
module as its communication and DSP function.

The latest firmware (v4.6.0) has a quirk that tx packet includes wrong
value (0x1f) in its dbs field at middle and higher sampling transfer
frequency. It brings ALSA fireworks driver discontinuity of data block
counter.

This commit fixes it by assuming it as a quirk of firmware version
4.6.0.

$ cd linux-firewire-tools/src
$ python crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  0404b9ef  bus_info_length 4, crc_length 4, crc 47599
404  31333934  bus_name "1394"
408  e064a212  irmc 1, cmc 1, isc 1, bmc 0, pmc 0, cyc_clk_acc 100,
               max_rec 10 (2048), max_rom 2, gen 1, spd 2 (S400)
40c  000ff209  company_id 000ff2     |
410  62550ce0  device_id 0962550ce0  | EUI-64 000ff20962550ce0

               root directory
               -----------------------------------------------------------------
414  0008088e  directory_length 8, crc 2190
418  03000ff2  vendor
41c  8100000f  --> descriptor leaf at 458
420  1701200f  model
424  81000018  --> descriptor leaf at 484
428  0c008380  node capabilities
42c  8d000003  --> eui-64 leaf at 438
430  d1000005  --> unit directory at 444
434  08000ff2  (immediate value)

               eui-64 leaf at 438
               -----------------------------------------------------------------
438  000281ae  leaf_length 2, crc 33198
43c  000ff209  company_id 000ff2     |
440  62550ce0  device_id 0962550ce0  | EUI-64 000ff20962550ce0

               unit directory at 444
               -----------------------------------------------------------------
444  00045d94  directory_length 4, crc 23956
448  1200a02d  specifier id: 1394 TA
44c  13010000  version
450  1701200f  model
454  8100000c  --> descriptor leaf at 484

               descriptor leaf at 458
               -----------------------------------------------------------------
458  000a199d  leaf_length 10, crc 6557
45c  00000000  textual descriptor
460  00000000  minimal ASCII
464  4d61636b  "Mack"
468  69650000  "ie"
46c  00000000
470  00000000
474  00000000
478  00000000
47c  00000000
480  00000000

               descriptor leaf at 484
               -----------------------------------------------------------------
484  000a0964  leaf_length 10, crc 2404
488  00000000  textual descriptor
48c  00000000  minimal ASCII
490  4f6e7978  "Onyx"
494  20313230  " 120"
498  30460000  "0F"
49c  00000000
4a0  00000000
4a4  00000000
4a8  00000000
4ac  00000000

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211111103015.7498-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-11-11 14:02:02 +01:00
Takashi Sakamoto 411ac2982c ALSA: firewire-motu: add support for MOTU Track 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-08 13:49:27 +01:00