int amdtp_motu_init(struct amdtp_stream *s, struct fw_unit *unit,
enum amdtp_stream_direction dir,
- const struct snd_motu_protocol *const protocol)
+ const struct snd_motu_spec *spec)
{
amdtp_stream_process_ctx_payloads_t process_ctx_payloads;
int fmt = CIP_FMT_MOTU;
* Units of version 3 transmits packets with invalid CIP header
* against IEC 61883-1.
*/
- if (protocol == &snd_motu_protocol_v3) {
+ if (spec->protocol_version == SND_MOTU_PROTOCOL_V3) {
flags |= CIP_WRONG_DBS |
CIP_SKIP_DBC_ZERO_CHECK |
CIP_HEADER_WITHOUT_EOH;
fmt = CIP_FMT_MOTU_TX_V3;
}
- if (protocol == &snd_motu_protocol_v2) {
+ if (spec == &snd_motu_spec_8pre ||
+ spec == &snd_motu_spec_ultralite) {
// 8pre has some quirks.
flags |= CIP_WRONG_DBS |
CIP_SKIP_DBC_ZERO_CHECK;
return 0;
}
-const struct snd_motu_protocol snd_motu_protocol_v2 = {
+static const struct snd_motu_protocol snd_motu_protocol_v2 = {
.get_clock_rate = v2_get_clock_rate,
.set_clock_rate = v2_set_clock_rate,
.get_clock_source = v2_get_clock_source,
const struct snd_motu_spec snd_motu_spec_828mk2 = {
.name = "828mk2",
+ .protocol_version = SND_MOTU_PROTOCOL_V2,
.protocol = &snd_motu_protocol_v2,
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
SND_MOTU_SPEC_TX_MICINST_CHUNK |
const struct snd_motu_spec snd_motu_spec_traveler = {
.name = "Traveler",
.protocol = &snd_motu_protocol_v2,
+ .protocol_version = SND_MOTU_PROTOCOL_V2,
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
SND_MOTU_SPEC_SUPPORT_CLOCK_X4 |
SND_MOTU_SPEC_TX_RETURN_CHUNK |
const struct snd_motu_spec snd_motu_spec_ultralite = {
.name = "UltraLite",
+ .protocol_version = SND_MOTU_PROTOCOL_V2,
.protocol = &snd_motu_protocol_v2,
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
SND_MOTU_SPEC_TX_MICINST_CHUNK | // padding.
const struct snd_motu_spec snd_motu_spec_8pre = {
.name = "8pre",
+ .protocol_version = SND_MOTU_PROTOCOL_V2,
.protocol = &snd_motu_protocol_v2,
// In tx, use coax chunks for mix-return 1/2. In rx, use coax chunks for
// dummy 1/2.
return 0;
}
-const struct snd_motu_protocol snd_motu_protocol_v3 = {
+static const struct snd_motu_protocol snd_motu_protocol_v3 = {
.get_clock_rate = v3_get_clock_rate,
.set_clock_rate = v3_set_clock_rate,
.get_clock_source = v3_get_clock_source,
const struct snd_motu_spec snd_motu_spec_828mk3 = {
.name = "828mk3",
+ .protocol_version = SND_MOTU_PROTOCOL_V3,
.protocol = &snd_motu_protocol_v3,
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
SND_MOTU_SPEC_SUPPORT_CLOCK_X4 |
const struct snd_motu_spec snd_motu_spec_audio_express = {
.name = "AudioExpress",
+ .protocol_version = SND_MOTU_PROTOCOL_V3,
.protocol = &snd_motu_protocol_v3,
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
SND_MOTU_SPEC_TX_MICINST_CHUNK |
const struct snd_motu_spec snd_motu_spec_4pre = {
.name = "4pre",
+ .protocol_version = SND_MOTU_PROTOCOL_V3,
.protocol = &snd_motu_protocol_v3,
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
SND_MOTU_SPEC_TX_MICINST_CHUNK |
if (err < 0)
return err;
- err = amdtp_motu_init(s, motu->unit, dir, motu->spec->protocol);
+ err = amdtp_motu_init(s, motu->unit, dir, motu->spec);
if (err < 0)
fw_iso_resources_destroy(resources);
SND_MOTU_CLOCK_SOURCE_UNKNOWN,
};
+enum snd_motu_protocol_version {
+ SND_MOTU_PROTOCOL_V2,
+ SND_MOTU_PROTOCOL_V3,
+};
+
struct snd_motu_protocol {
int (*get_clock_rate)(struct snd_motu *motu, unsigned int *rate);
int (*set_clock_rate)(struct snd_motu *motu, unsigned int rate);
struct snd_motu_spec {
const char *const name;
+ enum snd_motu_protocol_version protocol_version;
enum snd_motu_spec_flags flags;
unsigned char analog_in_ports;
const struct snd_motu_protocol *const protocol;
};
-extern const struct snd_motu_protocol snd_motu_protocol_v2;
-extern const struct snd_motu_protocol snd_motu_protocol_v3;
-
extern const struct snd_motu_spec snd_motu_spec_828mk2;
extern const struct snd_motu_spec snd_motu_spec_traveler;
extern const struct snd_motu_spec snd_motu_spec_ultralite;
int amdtp_motu_init(struct amdtp_stream *s, struct fw_unit *unit,
enum amdtp_stream_direction dir,
- const struct snd_motu_protocol *const protocol);
+ const struct snd_motu_spec *spec);
int amdtp_motu_set_parameters(struct amdtp_stream *s, unsigned int rate,
unsigned int midi_ports,
struct snd_motu_packet_format *formats);