@@ -164,7 +164,7 @@ int snd_motu_protocol_v2_switch_fetching_mode(struct snd_motu *motu,
164
164
if (enable )
165
165
data |= V2_CLOCK_FETCH_ENABLE ;
166
166
167
- if (motu -> spec -> flags & SND_MOTU_SPEC_SUPPORT_CLOCK_X4 ) {
167
+ if (motu -> spec == & snd_motu_spec_traveler ) {
168
168
// Expected for Traveler and 896HD, which implements Altera
169
169
// Cyclone EP1C3.
170
170
data |= V2_CLOCK_MODEL_SPECIFIC ;
@@ -193,8 +193,6 @@ static void calculate_fixed_part(struct snd_motu_packet_format *formats,
193
193
{
194
194
unsigned char pcm_chunks [3 ] = {0 , 0 , 0 };
195
195
196
- formats -> msg_chunks = 2 ;
197
-
198
196
pcm_chunks [0 ] = analog_ports ;
199
197
pcm_chunks [1 ] = analog_ports ;
200
198
if (flags & SND_MOTU_SPEC_SUPPORT_CLOCK_X4 )
@@ -268,12 +266,69 @@ static void calculate_differed_part(struct snd_motu_packet_format *formats,
268
266
formats -> differed_part_pcm_chunks [1 ] = pcm_chunks [1 ];
269
267
}
270
268
269
+ static int detect_packet_formats_828mk2 (struct snd_motu * motu , u32 data )
270
+ {
271
+ if (((data & V2_OPT_IN_IFACE_MASK ) >> V2_OPT_IN_IFACE_SHIFT ) ==
272
+ V2_OPT_IFACE_MODE_ADAT ) {
273
+ motu -> tx_packet_formats .pcm_chunks [0 ] += 8 ;
274
+ motu -> tx_packet_formats .pcm_chunks [1 ] += 4 ;
275
+ }
276
+
277
+ if (((data & V2_OPT_OUT_IFACE_MASK ) >> V2_OPT_OUT_IFACE_SHIFT ) ==
278
+ V2_OPT_IFACE_MODE_ADAT ) {
279
+ motu -> rx_packet_formats .pcm_chunks [0 ] += 8 ;
280
+ motu -> rx_packet_formats .pcm_chunks [1 ] += 4 ;
281
+ }
282
+
283
+ return 0 ;
284
+ }
285
+
286
+ static int detect_packet_formats_traveler (struct snd_motu * motu , u32 data )
287
+ {
288
+ if (((data & V2_OPT_IN_IFACE_MASK ) >> V2_OPT_IN_IFACE_SHIFT ) ==
289
+ V2_OPT_IFACE_MODE_ADAT ) {
290
+ motu -> tx_packet_formats .pcm_chunks [0 ] += 8 ;
291
+ motu -> tx_packet_formats .pcm_chunks [1 ] += 4 ;
292
+ }
293
+
294
+ if (((data & V2_OPT_OUT_IFACE_MASK ) >> V2_OPT_OUT_IFACE_SHIFT ) ==
295
+ V2_OPT_IFACE_MODE_ADAT ) {
296
+ motu -> rx_packet_formats .pcm_chunks [0 ] += 8 ;
297
+ motu -> rx_packet_formats .pcm_chunks [1 ] += 4 ;
298
+ }
299
+
300
+ return 0 ;
301
+ }
302
+
303
+ static int detect_packet_formats_8pre (struct snd_motu * motu , u32 data )
304
+ {
305
+ if (((data & V2_OPT_IN_IFACE_MASK ) >> V2_OPT_IN_IFACE_SHIFT ) ==
306
+ V2_OPT_IFACE_MODE_ADAT ) {
307
+ motu -> tx_packet_formats .pcm_chunks [0 ] += 8 ;
308
+ motu -> tx_packet_formats .pcm_chunks [1 ] += 8 ;
309
+ }
310
+
311
+ if (((data & V2_OPT_OUT_IFACE_MASK ) >> V2_OPT_OUT_IFACE_SHIFT ) ==
312
+ V2_OPT_IFACE_MODE_ADAT ) {
313
+ motu -> rx_packet_formats .pcm_chunks [0 ] += 8 ;
314
+ motu -> rx_packet_formats .pcm_chunks [1 ] += 8 ;
315
+ }
316
+
317
+ return 0 ;
318
+ }
319
+
271
320
int snd_motu_protocol_v2_cache_packet_formats (struct snd_motu * motu )
272
321
{
273
322
__be32 reg ;
274
323
u32 data ;
275
324
int err ;
276
325
326
+ motu -> tx_packet_formats .pcm_byte_offset = 10 ;
327
+ motu -> rx_packet_formats .pcm_byte_offset = 10 ;
328
+
329
+ motu -> tx_packet_formats .msg_chunks = 2 ;
330
+ motu -> rx_packet_formats .msg_chunks = 2 ;
331
+
277
332
err = snd_motu_transaction_read (motu , V2_IN_OUT_CONF_OFFSET , & reg ,
278
333
sizeof (reg ));
279
334
if (err < 0 )
@@ -290,10 +345,15 @@ int snd_motu_protocol_v2_cache_packet_formats(struct snd_motu *motu)
290
345
calculate_differed_part (& motu -> rx_packet_formats , motu -> spec -> flags ,
291
346
data , V2_OPT_OUT_IFACE_MASK , V2_OPT_OUT_IFACE_SHIFT );
292
347
293
- motu -> tx_packet_formats .pcm_byte_offset = 10 ;
294
- motu -> rx_packet_formats .pcm_byte_offset = 10 ;
295
348
296
- return 0 ;
349
+ if (motu -> spec == & snd_motu_spec_828mk2 )
350
+ return detect_packet_formats_828mk2 (motu , data );
351
+ else if (motu -> spec == & snd_motu_spec_traveler )
352
+ return detect_packet_formats_traveler (motu , data );
353
+ else if (motu -> spec == & snd_motu_spec_8pre )
354
+ return detect_packet_formats_8pre (motu , data );
355
+ else
356
+ return 0 ;
297
357
}
298
358
299
359
const struct snd_motu_spec snd_motu_spec_828mk2 = {
0 commit comments