Commit graph

31 commits

Author SHA1 Message Date
Takashi Sakamoto
bea36afa10 ALSA: firewire-motu: add message parser to gather meter information in 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-10-15 17:52:05 +02:00
Takashi Sakamoto
23c671be97 ALSA: firewire-motu: add support for MOTU 896HD
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-08-23 10:58:40 +02:00
Takashi Sakamoto
53ed8cf625 ALSA: firewire-motu: code refactoring for packet format detection in v2 protocol
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-23 10:17:26 +02:00
Takashi Sakamoto
184aa6b7e1 ALSA: firewire-motu: use macro instead of magic number for clock source in 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-23 10:17:25 +02:00
Takashi Sakamoto
683d36690f ALSA: firewire-motu: add support for AES/EBU clock source in v2 protocol
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-23 10:17:25 +02:00
Takashi Sakamoto
25eb438920 ALSA: firewire-motu: code refactoring for detection of clock source in v2 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-23 10:17:24 +02:00
Takashi Sakamoto
fa4db23233 ALSA: firewire-motu: fix detection for S/PDIF source on optical interface in 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-23 10:17:23 +02:00
Takashi Sakamoto
fc36ef80ca ALSA: firewire-motu: fix stream format for MOTU 8pre FireWire
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: dfbaa4dc11 ("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-17 12:06:00 +02:00
Takashi Sakamoto
506ad56a59 ALSA: firewire-motu: refactoring protocol v2 for fetching mode switch
This commit splits the method to switch fetching mode for protocol
version 2 so that model-dependent operations are explicitly defined.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200519111641.123211-15-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-22 16:52:19 +02:00
Takashi Sakamoto
2b8f050e4e ALSA: firewire-motu: refactoring protocol v2 for clock source getter
This commit splits the method to get clock source for protocol
version 2 so that model-dependent operations are explicitly defined.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200519111641.123211-13-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-22 16:52:18 +02:00
Takashi Sakamoto
739bdbaec7 ALSA: firewire-motu: remove obsoleted codes
The way to decide CIP payload size by calculation with any flag is now
obsoleted. This commit removes the codes.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200519111641.123211-12-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-22 16:52:17 +02:00
Takashi Sakamoto
0090c1c5f3 ALSA: firewire-motu: add alternative functions to detect packet format for protocol v3
This commit adds alternative functions to detect packet format so that
each function corresponds to each model.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200519111641.123211-9-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-22 16:52:15 +02:00
Takashi Sakamoto
28c8d3c91a ALSA: firewire-motu: add alternative functions to detect packet format for protocol v2
This commit adds alternative functions to detect packet format so that
each function corresponds to each model.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200519111641.123211-8-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-22 16:52:14 +02:00
Takashi Sakamoto
dfbaa4dc11 ALSA: firewire-motu: add model-specific table of chunk count
In MOTU protocol, data block consists of SPH and 24-bit chunks
aligned to quadlet. The number of chunks per data block is specific
to model. For models with optical interface, the number differs
depending on I/O settings for the interface (ADAT, TOSLINK).

Currently the number is calculated from flags in model-specific
data. However this is weak in the case that the model has quirks.
Actually, for quirks of some models, flags are used against their
original meanings.

This commit adds model-specific table of chunk count. For future
integration, this table is based on the calculation.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200519111641.123211-7-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-22 16:52:14 +02:00
Takashi Sakamoto
562f0c6700 ALSA: firewire-motu: drop protocol structure
Now protocol structure becomes useless. This commit drops it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200519111641.123211-6-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-22 16:52:13 +02:00
Takashi Sakamoto
ff222b7e45 ALSA: firewire-motu: add wrapper functions for protocol-dependent operations
This commit adds helper functions which wraps function call for each
protocol.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200519111641.123211-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-22 16:52:12 +02:00
Takashi Sakamoto
61d79c70c9 ALSA: firewire-motu: localize protocol data
This commit adds enumerations of protocol version to localize protocol
data.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200519111641.123211-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-22 16:52:11 +02:00
Takashi Sakamoto
0a7c7b47e4 ALSA: firewire-motu: move spec data to v2 protocol file
The most of members in spec data is used in each protocol file. It's
better to capsulate the data to the file.

This commit moves the data to the file for protocol version 2.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200519111641.123211-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-22 16:52:09 +02:00
Takashi Sakamoto
bd10737282 ALSA: firewire-motu: code refactoring to handle model specific switch for protocol v2
In MOTU FireWire series, devices which support protocol version 2 have
several types of hardware design to process audio data frames for isoc
packet. Roughly devices are categorized into three groups:
 - 828mkII
 - Traveler/896HD
 - UltraLite/8pre FireWire

Some bit flags in register addressed by 0x'ffff'f000'0b14
includes device-specific effects.

This commit cleanups implementation of protocol v2 in this point.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191030080644.1704-6-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-30 10:57:56 +01:00
Takashi Sakamoto
4b2079f80a ALSA: firewire-motu: minor code refactoring for protocol version 2
This commit adds some helper functions to parse register value for
source of sampling clock and nominal sampling transmission frequency.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191030080644.1704-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-30 10:57:56 +01:00
Takashi Sakamoto
3f58f004bf ALSA: firewire-motu: detect SPH source of sampling clock
In MOTU FireWire series, devices have a mode to generate sampling clock
from a sequence of source packet header (SPH) included in each data block
of received packet. This mode is used for several purposes such as mode
for SMPTE time code, sync to the other sound cards and so on.

This commit adds support for the SPH mode.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191030080644.1704-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-30 10:57:54 +01:00
Takashi Sakamoto
2644df63c7 ALSA: firewire-motu: fix wrong spelling for macro
Just replace 'SEPARETED' with 'SEPARATED' for macro.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191030080644.1704-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-10-30 10:57:52 +01:00
Thomas Gleixner
da607e1969 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 345
Based on 1 normalized pattern(s):

  licensed under the terms of the gnu general public license version 2

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 88 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190530000437.521539229@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05 17:37:08 +02:00
Takashi Sakamoto
35033d8cb7 ALSA: firewire-motu: add support MOTU 8pre FireWire
This commit adds support for MOTU 8pre FireWire, which was shipped 2007
and nowadays already discontinued. Userspace applications can transmit
and receive PCM frames and MIDI messages for this model via ALSA PCM
interface and RawMidi/Sequencer interfaces.

Like the other models of MOTU FireWire series, this model has many
quirks in its CIP.

At first, data channels for two pairs of optical interfaces. At lower
sampling transmission frequency, i.e. 44.1 and 48.0 kHz, one pair is
available for ADAT data, thus 8 data chunks are transferred by CIP.
At middle sampling transmission frequency, i.e.  88.2 and 96.0 kHz,
two pairs are available to keep 8 chunks for ADAT data, thus CIP
still includes 8 data chunks.

Apart from data chunks for optical interface, CIP includes fixed number
of data chunks. In tx stream, two chunks for status message, eight
chunks for samples from analog 1-8 input, two chunks for mix-return.
In rx stream, two chunks for control message, two chunks for main 1-2
output, two chunks for phone 1-2 output, two chunks for dummy 1-2.

CIP header in tx stream includes quirks for its dbs and dbc fields.
The value of dbs field is fixed to 0x13, against its actual size.
The value of dbc field is firstly updated to 0x07 from zero, then
it's incremented continuously according to actual number of data h
blocks.

Finally, the model has own bits to disable frame fetch.

This commit uses several options to absorb the above quirks.

$ python2 crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  0410b57d  bus_info_length 4, crc_length 16, crc 46461
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  00083dfb  device_id 0000083dfb  | EUI-64 0001f20000083dfb

               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  0003991c  directory_length 3, crc 39196
42c  120001f2  specifier id
430  1300000f  version
434  17103800  model

               eui-64 leaf at 438
               -----------------------------------------------------------------
438  00022681  leaf_length 2, crc 9857
43c  0001f200  company_id 0001f2     |
440  00083dfb  device_id 0000083dfb  | EUI-64 0001f20000083dfb

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-03-18 14:50:16 +01:00
Takashi Sakamoto
6c5e1ac0e1 ALSA: firewire-motu: add support for Motu Traveler
This commit adds support for MOTU Traveler, launched in 2005, discontinued
quite before. As a result, transmission of PCM frame and MIDI messages is
available via ALSA PCM and RawMIDI/Sequencer interfaces.

This model supports sampling transmission frequency up to 192.0 kHz, and
AES/EBU on XLR interface and ADAT on optical interface. Unlike
Motu 828MkII, Windows driver can switch fetching mode for DSP, like
mute/unmute feature.

Although this commit enables high sampling transmission frequency, actual
sound from this model is not good. As long as I tested, it's silence at
176.4 kHz, and it includes hissing noise at 192.0 kHz. In my opinion, as I
reported at 3526ce7f9ba7 ('ALSA: firewire-motu: add MOTU specific protocol
layer'), timestamping on source packet header (SPH) may not still be good
for this model as well.

$ python2 crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  04106505  bus_info_length 4, crc_length 16, crc 25861
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  0001f32f  device_id 000001f32f  | EUI-64 0001f2000001f32f

               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  00035955  directory_length 3, crc 22869
42c  120001f2  specifier id
430  13000009  version
434  17107800  model

               eui-64 leaf at 438
               -----------------------------------------------------------------
438  000206b2  leaf_length 2, crc 1714
43c  0001f200  company_id 0001f2     |
440  0001f32f  device_id 000001f32f  | EUI-64 0001f2000001f32f

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-06-19 20:44:54 +02:00
Takashi Sakamoto
191ef57683 ALSA: firewire-motu: cancel chunk alignment for protocol version 2
For MOTU protocol version 2, this driver arranges the number of data
chunks to align chunks to quadlet data channel. However, MOTU Traveler
has padding bytes in the end of data block at high clock mode.

This commit removes the arrangement. Fortunately, at low and middle clock
mode, supported model for v2 protocol (828mkII) gets no influence from this
change because all of combination for data chunks are just aligned to
quadlet data channel.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-06-19 20:44:52 +02:00
Takashi Sakamoto
06ac0b6f8f ALSA: firewire-motu: add a flag for AES/EBU on XLR interface
MOTU Traveler supports AES/EBU on XLR interface and data block of rx/tx
packet includes two chunk for the interface. This commit adds a flag
for this purpose.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-06-19 20:44:50 +02:00
Takashi Sakamoto
81720c6d49 ALSA: firewire-motu: add a flag for chunks for main 1/2 out
This driver explicitly assumes that all of supported models have main data
chunk separated from chunk for analog ports. However, MOTU Traveler doesn't
support the separated main data chunk.

This commit adds a flag for the separated main data chunk.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-06-19 20:44:47 +02:00
Takashi Sakamoto
6c1549c4cc ALSA: firewire-motu: suppless consumption for unused element of array in stack
In MOTU firewire protocol, data block consists of 24 bit data chunks except
for one quadlet for source packet header (SPH). The number of data chunk in
a data block is different between three clock modes; low, middle and high.
When unit supports ADAT on optical interface, the data block includes some
chunks for ADAT channels. These ADAT chunks are unavailable at high mode.

This driver has local functions to calculate the number of ADAT chunks. But
They uses stack for three clock modes. This is useless for higher mode.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-06-19 20:44:45 +02:00
Takashi Sakamoto
8b460c76bd ALSA: firewire-motu: add specification flag for position of flag for MIDI messages
In protocols of MOTU FireWire series, when transferring MIDI messages,
transmitter set existence flag to one byte on first several quadlets. The
position differs depending on protocols and models, however two cases are
confirmed; in 5th byte and 8th byte from MSB side.

This commit adds a series of specification flag to describe them. When
the existence flag is in the 5th byte, SND_MOTU_SPEC_[R|T]X_MIDI_2ND_Q is
used. Else, another set of the flag is used. Here, '_Q' means quadlet.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-08-21 12:24:00 +02:00
Takashi Sakamoto
949613e366 ALSA: firewire-motu: add support for MOTU 828mk2 as a model with protocol version 2
MOTU 828mk2 is one of second generation in MOTU FireWire series, produced in
2003. This model consists of four chips:
 * TI TSB41AB2 (Physical layer for IEEE 1394 bus)
 * PDI 1394L40BE (Link layer for IEEE 1394 bus and packet processing layer)
 * ALTERA ACEX 1K EP1K30 Series FPGA (Data block processing layer)
 * TI TMS320VC5402 (Digital signal processing)

This commit adds a support for this model, with its unique protocol as
version 2. The features of this protocol are:

 * Support data chunks for status and control messages for both
   directions.
 * Support a pair of MIDI input/output.
 * Support a data chunk for mic/instrument independent of analog line in.
 * Support a data chunk for playback return.
 * Support independent data chunks for S/PDIF of both optical/coaxial
   interfaces.
 * Support independent data chunks for each of main out and phone out.

Status of clock is configured by write transactions to 0x'ffff'f000'0b14.
Modes of optical interfaces are configured by write transactions to
0x'ffff'f000'0c04.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-03-28 12:34:08 +02:00