ALSA: fireface: add support for Fireface 400
Fireface 400 is a second model of RME Fireface series, released in 2006.
This commit adds support for this model.
This model supports 8 analog channels, 2 S/PDIF channels and 8 ADAT
channels in both of tx/rx packet. The number of ADAT channels differs
depending on each mode of sampling transmission frequency.
$ python2 linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom
ROM header and bus information block
-----------------------------------------------------------------
400 04107768 bus_info_length 4, crc_length 16, crc 30568 (should be 61311)
404 31333934 bus_name "1394"
408 20009002 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 9 (1024)
40c 000a3501 company_id 000a35 |
410 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
root directory
-----------------------------------------------------------------
414 000485ec directory_length 4, crc 34284
418 03000a35 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 000314c4 directory_length 3, crc 5316
42c 12000a35 specifier id
430 13000002 version
434 17101800 model
eui-64 leaf at 438
-----------------------------------------------------------------
438 000261a8 leaf_length 2, crc 25000
43c 000a3501 company_id 000a35 |
440 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-03-31 13:06:12 +00:00
|
|
|
/*
|
|
|
|
* ff-protocol-ff400.c - a part of driver for RME Fireface series
|
|
|
|
*
|
|
|
|
* Copyright (c) 2015-2017 Takashi Sakamoto
|
|
|
|
*
|
|
|
|
* Licensed under the terms of the GNU General Public License, version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include "ff.h"
|
|
|
|
|
|
|
|
#define FF400_STF 0x000080100500ull
|
|
|
|
#define FF400_RX_PACKET_FORMAT 0x000080100504ull
|
|
|
|
#define FF400_ISOC_COMM_START 0x000080100508ull
|
|
|
|
#define FF400_TX_PACKET_FORMAT 0x00008010050cull
|
|
|
|
#define FF400_ISOC_COMM_STOP 0x000080100510ull
|
|
|
|
|
2018-12-16 08:32:31 +00:00
|
|
|
/*
|
|
|
|
* Fireface 400 manages isochronous channel number in 3 bit field. Therefore,
|
|
|
|
* we can allocate between 0 and 7 channel.
|
|
|
|
*/
|
|
|
|
static int keep_resources(struct snd_ff *ff, unsigned int rate)
|
ALSA: fireface: add support for Fireface 400
Fireface 400 is a second model of RME Fireface series, released in 2006.
This commit adds support for this model.
This model supports 8 analog channels, 2 S/PDIF channels and 8 ADAT
channels in both of tx/rx packet. The number of ADAT channels differs
depending on each mode of sampling transmission frequency.
$ python2 linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom
ROM header and bus information block
-----------------------------------------------------------------
400 04107768 bus_info_length 4, crc_length 16, crc 30568 (should be 61311)
404 31333934 bus_name "1394"
408 20009002 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 9 (1024)
40c 000a3501 company_id 000a35 |
410 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
root directory
-----------------------------------------------------------------
414 000485ec directory_length 4, crc 34284
418 03000a35 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 000314c4 directory_length 3, crc 5316
42c 12000a35 specifier id
430 13000002 version
434 17101800 model
eui-64 leaf at 438
-----------------------------------------------------------------
438 000261a8 leaf_length 2, crc 25000
43c 000a3501 company_id 000a35 |
440 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-03-31 13:06:12 +00:00
|
|
|
{
|
2018-12-16 08:32:31 +00:00
|
|
|
enum snd_ff_stream_mode mode;
|
|
|
|
int i;
|
|
|
|
int err;
|
ALSA: fireface: add support for Fireface 400
Fireface 400 is a second model of RME Fireface series, released in 2006.
This commit adds support for this model.
This model supports 8 analog channels, 2 S/PDIF channels and 8 ADAT
channels in both of tx/rx packet. The number of ADAT channels differs
depending on each mode of sampling transmission frequency.
$ python2 linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom
ROM header and bus information block
-----------------------------------------------------------------
400 04107768 bus_info_length 4, crc_length 16, crc 30568 (should be 61311)
404 31333934 bus_name "1394"
408 20009002 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 9 (1024)
40c 000a3501 company_id 000a35 |
410 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
root directory
-----------------------------------------------------------------
414 000485ec directory_length 4, crc 34284
418 03000a35 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 000314c4 directory_length 3, crc 5316
42c 12000a35 specifier id
430 13000002 version
434 17101800 model
eui-64 leaf at 438
-----------------------------------------------------------------
438 000261a8 leaf_length 2, crc 25000
43c 000a3501 company_id 000a35 |
440 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-03-31 13:06:12 +00:00
|
|
|
|
2018-12-16 08:32:31 +00:00
|
|
|
// Check whether the given value is supported or not.
|
ALSA: fireface: add support for Fireface 400
Fireface 400 is a second model of RME Fireface series, released in 2006.
This commit adds support for this model.
This model supports 8 analog channels, 2 S/PDIF channels and 8 ADAT
channels in both of tx/rx packet. The number of ADAT channels differs
depending on each mode of sampling transmission frequency.
$ python2 linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom
ROM header and bus information block
-----------------------------------------------------------------
400 04107768 bus_info_length 4, crc_length 16, crc 30568 (should be 61311)
404 31333934 bus_name "1394"
408 20009002 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 9 (1024)
40c 000a3501 company_id 000a35 |
410 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
root directory
-----------------------------------------------------------------
414 000485ec directory_length 4, crc 34284
418 03000a35 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 000314c4 directory_length 3, crc 5316
42c 12000a35 specifier id
430 13000002 version
434 17101800 model
eui-64 leaf at 438
-----------------------------------------------------------------
438 000261a8 leaf_length 2, crc 25000
43c 000a3501 company_id 000a35 |
440 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-03-31 13:06:12 +00:00
|
|
|
for (i = 0; i < CIP_SFC_COUNT; i++) {
|
|
|
|
if (amdtp_rate_table[i] == rate)
|
|
|
|
break;
|
|
|
|
}
|
2018-12-16 08:32:31 +00:00
|
|
|
if (i >= CIP_SFC_COUNT)
|
ALSA: fireface: add support for Fireface 400
Fireface 400 is a second model of RME Fireface series, released in 2006.
This commit adds support for this model.
This model supports 8 analog channels, 2 S/PDIF channels and 8 ADAT
channels in both of tx/rx packet. The number of ADAT channels differs
depending on each mode of sampling transmission frequency.
$ python2 linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom
ROM header and bus information block
-----------------------------------------------------------------
400 04107768 bus_info_length 4, crc_length 16, crc 30568 (should be 61311)
404 31333934 bus_name "1394"
408 20009002 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 9 (1024)
40c 000a3501 company_id 000a35 |
410 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
root directory
-----------------------------------------------------------------
414 000485ec directory_length 4, crc 34284
418 03000a35 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 000314c4 directory_length 3, crc 5316
42c 12000a35 specifier id
430 13000002 version
434 17101800 model
eui-64 leaf at 438
-----------------------------------------------------------------
438 000261a8 leaf_length 2, crc 25000
43c 000a3501 company_id 000a35 |
440 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-03-31 13:06:12 +00:00
|
|
|
return -EINVAL;
|
|
|
|
|
2018-12-16 08:32:31 +00:00
|
|
|
err = snd_ff_stream_get_multiplier_mode(i, &mode);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
/* Keep resources for in-stream. */
|
|
|
|
ff->tx_resources.channels_mask = 0x00000000000000ffuLL;
|
|
|
|
err = fw_iso_resources_allocate(&ff->tx_resources,
|
|
|
|
amdtp_stream_get_max_payload(&ff->tx_stream),
|
|
|
|
fw_parent_device(ff->unit)->max_speed);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
/* Keep resources for out-stream. */
|
|
|
|
err = amdtp_ff_set_parameters(&ff->rx_stream, rate,
|
|
|
|
ff->spec->pcm_playback_channels[mode]);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
ff->rx_resources.channels_mask = 0x00000000000000ffuLL;
|
|
|
|
err = fw_iso_resources_allocate(&ff->rx_resources,
|
|
|
|
amdtp_stream_get_max_payload(&ff->rx_stream),
|
|
|
|
fw_parent_device(ff->unit)->max_speed);
|
|
|
|
if (err < 0)
|
|
|
|
fw_iso_resources_free(&ff->tx_resources);
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ff400_begin_session(struct snd_ff *ff, unsigned int rate)
|
|
|
|
{
|
|
|
|
__le32 reg;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
err = keep_resources(ff, rate);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
ALSA: fireface: add support for Fireface 400
Fireface 400 is a second model of RME Fireface series, released in 2006.
This commit adds support for this model.
This model supports 8 analog channels, 2 S/PDIF channels and 8 ADAT
channels in both of tx/rx packet. The number of ADAT channels differs
depending on each mode of sampling transmission frequency.
$ python2 linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom
ROM header and bus information block
-----------------------------------------------------------------
400 04107768 bus_info_length 4, crc_length 16, crc 30568 (should be 61311)
404 31333934 bus_name "1394"
408 20009002 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 9 (1024)
40c 000a3501 company_id 000a35 |
410 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
root directory
-----------------------------------------------------------------
414 000485ec directory_length 4, crc 34284
418 03000a35 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 000314c4 directory_length 3, crc 5316
42c 12000a35 specifier id
430 13000002 version
434 17101800 model
eui-64 leaf at 438
-----------------------------------------------------------------
438 000261a8 leaf_length 2, crc 25000
43c 000a3501 company_id 000a35 |
440 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-03-31 13:06:12 +00:00
|
|
|
/* Set the number of data blocks transferred in a second. */
|
|
|
|
reg = cpu_to_le32(rate);
|
|
|
|
err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST,
|
|
|
|
FF400_STF, ®, sizeof(reg), 0);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
msleep(100);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set isochronous channel and the number of quadlets of received
|
|
|
|
* packets.
|
|
|
|
*/
|
|
|
|
reg = cpu_to_le32(((ff->rx_stream.data_block_quadlets << 3) << 8) |
|
|
|
|
ff->rx_resources.channel);
|
|
|
|
err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST,
|
|
|
|
FF400_RX_PACKET_FORMAT, ®, sizeof(reg), 0);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set isochronous channel and the number of quadlets of transmitted
|
|
|
|
* packet.
|
|
|
|
*/
|
|
|
|
/* TODO: investigate the purpose of this 0x80. */
|
|
|
|
reg = cpu_to_le32((0x80 << 24) |
|
|
|
|
(ff->tx_resources.channel << 5) |
|
|
|
|
(ff->tx_stream.data_block_quadlets));
|
|
|
|
err = snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST,
|
|
|
|
FF400_TX_PACKET_FORMAT, ®, sizeof(reg), 0);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
/* Allow to transmit packets. */
|
|
|
|
reg = cpu_to_le32(0x00000001);
|
|
|
|
return snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST,
|
|
|
|
FF400_ISOC_COMM_START, ®, sizeof(reg), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ff400_finish_session(struct snd_ff *ff)
|
|
|
|
{
|
|
|
|
__le32 reg;
|
|
|
|
|
|
|
|
reg = cpu_to_le32(0x80000000);
|
|
|
|
snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST,
|
|
|
|
FF400_ISOC_COMM_STOP, ®, sizeof(reg), 0);
|
|
|
|
}
|
|
|
|
|
2018-12-11 10:17:34 +00:00
|
|
|
static void ff400_handle_midi_msg(struct snd_ff *ff, __le32 *buf, size_t length)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < length / 4; i++) {
|
|
|
|
u32 quad = le32_to_cpu(buf[i]);
|
|
|
|
u8 byte;
|
|
|
|
unsigned int index;
|
|
|
|
struct snd_rawmidi_substream *substream;
|
|
|
|
|
|
|
|
/* Message in first port. */
|
|
|
|
/*
|
|
|
|
* This value may represent the index of this unit when the same
|
|
|
|
* units are on the same IEEE 1394 bus. This driver doesn't use
|
|
|
|
* it.
|
|
|
|
*/
|
|
|
|
index = (quad >> 8) & 0xff;
|
|
|
|
if (index > 0) {
|
|
|
|
substream = READ_ONCE(ff->tx_midi_substreams[0]);
|
|
|
|
if (substream != NULL) {
|
|
|
|
byte = quad & 0xff;
|
|
|
|
snd_rawmidi_receive(substream, &byte, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Message in second port. */
|
|
|
|
index = (quad >> 24) & 0xff;
|
|
|
|
if (index > 0) {
|
|
|
|
substream = READ_ONCE(ff->tx_midi_substreams[1]);
|
|
|
|
if (substream != NULL) {
|
|
|
|
byte = (quad >> 16) & 0xff;
|
|
|
|
snd_rawmidi_receive(substream, &byte, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-22 13:58:15 +00:00
|
|
|
const struct snd_ff_protocol snd_ff_protocol_ff400 = {
|
2018-12-11 10:17:34 +00:00
|
|
|
.handle_midi_msg = ff400_handle_midi_msg,
|
ALSA: fireface: add support for Fireface 400
Fireface 400 is a second model of RME Fireface series, released in 2006.
This commit adds support for this model.
This model supports 8 analog channels, 2 S/PDIF channels and 8 ADAT
channels in both of tx/rx packet. The number of ADAT channels differs
depending on each mode of sampling transmission frequency.
$ python2 linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom
ROM header and bus information block
-----------------------------------------------------------------
400 04107768 bus_info_length 4, crc_length 16, crc 30568 (should be 61311)
404 31333934 bus_name "1394"
408 20009002 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 9 (1024)
40c 000a3501 company_id 000a35 |
410 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
root directory
-----------------------------------------------------------------
414 000485ec directory_length 4, crc 34284
418 03000a35 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 000314c4 directory_length 3, crc 5316
42c 12000a35 specifier id
430 13000002 version
434 17101800 model
eui-64 leaf at 438
-----------------------------------------------------------------
438 000261a8 leaf_length 2, crc 25000
43c 000a3501 company_id 000a35 |
440 1bd0862a device_id 011bd0862a | EUI-64 000a35011bd0862a
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-03-31 13:06:12 +00:00
|
|
|
.begin_session = ff400_begin_session,
|
|
|
|
.finish_session = ff400_finish_session,
|
|
|
|
};
|