Skip to content

Commit 062bb45

Browse files
takaswietiwai
authored andcommitted
ALSA: fireface: add support for RME FireFace 802
Fireface 802 was shipped by RME GmbH in 2014. This model supports later protocol for management of isochronous communication and synchronization of sampling transmission frequency. This model consists of below ICs: * TI TSB41AB2 * Xilinx Spartan-6 FPGA XC6SLX16 * TI TMS320 C6747 * SMSC USB3250 Especially, this model just supports IEEE 1394a, against its name which evokes Fireface 800. This commit adds support for Fireface 802 (tested). Userspace applications can transfer PCM frames and MIDI messages via ALSA PCM/Rawmidi interface. I note that 4 channels for ADAt1 and ADAT2 are disabled at higher sampling transfer frequency since isochronous resources reservation fails due to bandwidth limitation of IEEE 1394a. The value read from LATTER_SYNC_STATUS register is slightly different from the one of Fireface UCX. The higher 4 bits and lower 4 bits are swapped within the same byte. Without any assist of userspace application, transmitted MIDI messages from the device are not going to be processed. For detail, please refer to my comment in code of latter protocol. $ python crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 0404ffff bus_info_length 4, crc_length 4, crc 65535 (should be 26805) 404 31333934 bus_name "1394" 408 20008000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 8 (512) 40c 000a3504 company_id 000a35 | 410 38077423 device_id 0438077423 | EUI-64 000a350438077423 root directory ----------------------------------------------------------------- 414 0005ffff directory_length 5, crc 65535 (should be 9514) 418 0c0083c0 node capabilities per IEEE 1394 41c 03000a35 vendor 420 8100000b --> descriptor leaf at 44c 424 8d000007 --> eui-64 leaf at 440 428 d1000001 --> unit directory at 42c unit directory at 42c ----------------------------------------------------------------- 42c 0004ffff directory_length 4, crc 65535 (should be 45134) 430 12000a35 specifier id 434 13000005 version 438 17101800 model 43c 81000008 --> descriptor leaf at 45c eui-64 leaf at 440 ----------------------------------------------------------------- 440 0002ffff leaf_length 2, crc 65535 (should be 60131) 444 000a3504 company_id 000a35 | 448 38077423 device_id 0438077423 | EUI-64 000a350438077423 descriptor leaf at 44c ----------------------------------------------------------------- 44c 0003ffff leaf_length 3, crc 65535 (should be 469) 450 00000000 textual descriptor 454 00000000 minimal ASCII 458 524d4521 "RME!" descriptor leaf at 45c ----------------------------------------------------------------- 45c 0005ffff leaf_length 5, crc 65535 (should be 10561) 460 00000000 textual descriptor 464 00000000 minimal ASCII 468 46697265 "Fire" 46c 66616365 "face" 470 20383032 " 802" Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20200510074301.116224-6-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 782222b commit 062bb45

4 files changed

Lines changed: 59 additions & 13 deletions

File tree

‎sound/firewire/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,5 +165,6 @@ config SND_FIREFACE
165165
* Fireface 400
166166
* Fireface 800
167167
* Fireface UCX
168+
* Fireface 802
168169

169170
endif # SND_FIREWIRE

‎sound/firewire/fireface/ff-protocol-latter.c‎

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
#define LATTER_SYNC_STATUS 0x0000801c0000ULL
1717

1818
static int parse_clock_bits(u32 data, unsigned int *rate,
19-
enum snd_ff_clock_src *src)
19+
enum snd_ff_clock_src *src,
20+
enum snd_ff_unit_version unit_version)
2021
{
2122
static const struct {
2223
unsigned int rate;
@@ -43,6 +44,11 @@ static int parse_clock_bits(u32 data, unsigned int *rate,
4344
};
4445
int i;
4546

47+
if (unit_version != SND_FF_UNIT_VERSION_UCX) {
48+
// e.g. 0x00fe0f20 but expected 0x00eff002.
49+
data = ((data & 0xf0f0f0f0) >> 4) | ((data & 0x0f0f0f0f) << 4);
50+
}
51+
4652
for (i = 0; i < ARRAY_SIZE(rate_entries); ++i) {
4753
rate_entry = rate_entries + i;
4854
if ((data & 0x0f000000) == rate_entry->flag) {
@@ -79,7 +85,7 @@ static int latter_get_clock(struct snd_ff *ff, unsigned int *rate,
7985
return err;
8086
data = le32_to_cpu(reg);
8187

82-
return parse_clock_bits(data, rate, src);
88+
return parse_clock_bits(data, rate, src, ff->unit_version);
8389
}
8490

8591
static int latter_switch_fetching_mode(struct snd_ff *ff, bool enable)
@@ -181,14 +187,30 @@ static int latter_begin_session(struct snd_ff *ff, unsigned int rate)
181187
__le32 reg;
182188
int err;
183189

184-
if (rate >= 32000 && rate <= 48000)
185-
flag = 0x92;
186-
else if (rate >= 64000 && rate <= 96000)
187-
flag = 0x8e;
188-
else if (rate >= 128000 && rate <= 192000)
189-
flag = 0x8c;
190-
else
191-
return -EINVAL;
190+
if (ff->unit_version == SND_FF_UNIT_VERSION_UCX) {
191+
// For Fireface UCX. Always use the maximum number of data
192+
// channels in data block of packet.
193+
if (rate >= 32000 && rate <= 48000)
194+
flag = 0x92;
195+
else if (rate >= 64000 && rate <= 96000)
196+
flag = 0x8e;
197+
else if (rate >= 128000 && rate <= 192000)
198+
flag = 0x8c;
199+
else
200+
return -EINVAL;
201+
} else {
202+
// For Fireface 802. Due to bandwidth limitation on
203+
// IEEE 1394a (400 Mbps), Analog 1-12 and AES are available
204+
// without any ADAT at quadruple speed.
205+
if (rate >= 32000 && rate <= 48000)
206+
flag = 0x9e;
207+
else if (rate >= 64000 && rate <= 96000)
208+
flag = 0x96;
209+
else if (rate >= 128000 && rate <= 192000)
210+
flag = 0x8e;
211+
else
212+
return -EINVAL;
213+
}
192214

193215
if (generation != fw_parent_device(ff->unit)->card->generation) {
194216
err = fw_iso_resources_update(&ff->tx_resources);
@@ -207,8 +229,6 @@ static int latter_begin_session(struct snd_ff *ff, unsigned int rate)
207229
if (err < 0)
208230
return err;
209231

210-
// Always use the maximum number of data channels in data block of
211-
// packet.
212232
reg = cpu_to_le32(flag);
213233
return snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST,
214234
LATTER_ISOC_START, &reg, sizeof(reg), 0);
@@ -263,7 +283,7 @@ static void latter_dump_status(struct snd_ff *ff, struct snd_info_buffer *buffer
263283
}
264284
}
265285

266-
err = parse_clock_bits(data, &rate, &src);
286+
err = parse_clock_bits(data, &rate, &src, ff->unit_version);
267287
if (err < 0)
268288
return;
269289
label = snd_ff_proc_get_clk_label(src);

‎sound/firewire/fireface/ff.c‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ static void name_card(struct snd_ff *ff)
2020
[SND_FF_UNIT_VERSION_FF800] = "Fireface800",
2121
[SND_FF_UNIT_VERSION_FF400] = "Fireface400",
2222
[SND_FF_UNIT_VERSION_UCX] = "FirefaceUCX",
23+
[SND_FF_UNIT_VERSION_802] = "Fireface802",
2324
};
2425
const char *name;
2526

@@ -186,6 +187,17 @@ static const struct snd_ff_spec spec_ucx = {
186187
.midi_rx_addrs = {0xffff00000030ull, 0xffff00000030ull},
187188
};
188189

190+
static const struct snd_ff_spec spec_802 = {
191+
.pcm_capture_channels = {30, 22, 14},
192+
.pcm_playback_channels = {30, 22, 14},
193+
.midi_in_ports = 1,
194+
.midi_out_ports = 1,
195+
.protocol = &snd_ff_protocol_latter,
196+
.midi_high_addr = 0xffff00000034ull,
197+
.midi_addr_range = 0x80,
198+
.midi_rx_addrs = {0xffff00000030ull, 0xffff00000030ull},
199+
};
200+
189201
static const struct ieee1394_device_id snd_ff_id_table[] = {
190202
/* Fireface 800 */
191203
{
@@ -223,6 +235,18 @@ static const struct ieee1394_device_id snd_ff_id_table[] = {
223235
.model_id = 0x101800,
224236
.driver_data = (kernel_ulong_t)&spec_ucx,
225237
},
238+
// Fireface 802.
239+
{
240+
.match_flags = IEEE1394_MATCH_VENDOR_ID |
241+
IEEE1394_MATCH_SPECIFIER_ID |
242+
IEEE1394_MATCH_VERSION |
243+
IEEE1394_MATCH_MODEL_ID,
244+
.vendor_id = OUI_RME,
245+
.specifier_id = OUI_RME,
246+
.version = SND_FF_UNIT_VERSION_802,
247+
.model_id = 0x101800,
248+
.driver_data = (kernel_ulong_t)&spec_802,
249+
},
226250
{}
227251
};
228252
MODULE_DEVICE_TABLE(ieee1394, snd_ff_id_table);

‎sound/firewire/fireface/ff.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ enum snd_ff_unit_version {
3838
SND_FF_UNIT_VERSION_FF800 = 0x000001,
3939
SND_FF_UNIT_VERSION_FF400 = 0x000002,
4040
SND_FF_UNIT_VERSION_UCX = 0x000004,
41+
SND_FF_UNIT_VERSION_802 = 0x000005,
4142
};
4243

4344
enum snd_ff_stream_mode {

0 commit comments

Comments
 (0)