@@ -165,8 +165,6 @@ static void calculate_fixed_part(struct snd_motu_packet_format *formats,
165
165
{
166
166
unsigned char pcm_chunks [3 ] = {0 , 0 , 0 };
167
167
168
- formats -> msg_chunks = 2 ;
169
-
170
168
pcm_chunks [0 ] = analog_ports ;
171
169
pcm_chunks [1 ] = analog_ports ;
172
170
if (flags & SND_MOTU_SPEC_SUPPORT_CLOCK_X4 )
@@ -278,12 +276,63 @@ static void calculate_differed_part(struct snd_motu_packet_format *formats,
278
276
}
279
277
}
280
278
279
+ static int detect_packet_formats_828mk3 (struct snd_motu * motu , u32 data )
280
+ {
281
+ if (data & V3_ENABLE_OPT_IN_IFACE_A ) {
282
+ if (data & V3_NO_ADAT_OPT_IN_IFACE_A ) {
283
+ motu -> tx_packet_formats .pcm_chunks [0 ] += 4 ;
284
+ motu -> tx_packet_formats .pcm_chunks [1 ] += 4 ;
285
+ } else {
286
+ motu -> tx_packet_formats .pcm_chunks [0 ] += 8 ;
287
+ motu -> tx_packet_formats .pcm_chunks [1 ] += 4 ;
288
+ }
289
+ }
290
+
291
+ if (data & V3_ENABLE_OPT_IN_IFACE_B ) {
292
+ if (data & V3_NO_ADAT_OPT_IN_IFACE_B ) {
293
+ motu -> tx_packet_formats .pcm_chunks [0 ] += 4 ;
294
+ motu -> tx_packet_formats .pcm_chunks [1 ] += 4 ;
295
+ } else {
296
+ motu -> tx_packet_formats .pcm_chunks [0 ] += 8 ;
297
+ motu -> tx_packet_formats .pcm_chunks [1 ] += 4 ;
298
+ }
299
+ }
300
+
301
+ if (data & V3_ENABLE_OPT_OUT_IFACE_A ) {
302
+ if (data & V3_NO_ADAT_OPT_OUT_IFACE_A ) {
303
+ motu -> rx_packet_formats .pcm_chunks [0 ] += 4 ;
304
+ motu -> rx_packet_formats .pcm_chunks [1 ] += 4 ;
305
+ } else {
306
+ motu -> rx_packet_formats .pcm_chunks [0 ] += 8 ;
307
+ motu -> rx_packet_formats .pcm_chunks [1 ] += 4 ;
308
+ }
309
+ }
310
+
311
+ if (data & V3_ENABLE_OPT_OUT_IFACE_B ) {
312
+ if (data & V3_NO_ADAT_OPT_OUT_IFACE_B ) {
313
+ motu -> rx_packet_formats .pcm_chunks [0 ] += 4 ;
314
+ motu -> rx_packet_formats .pcm_chunks [1 ] += 4 ;
315
+ } else {
316
+ motu -> rx_packet_formats .pcm_chunks [0 ] += 8 ;
317
+ motu -> rx_packet_formats .pcm_chunks [1 ] += 4 ;
318
+ }
319
+ }
320
+
321
+ return 0 ;
322
+ }
323
+
281
324
int snd_motu_protocol_v3_cache_packet_formats (struct snd_motu * motu )
282
325
{
283
326
__be32 reg ;
284
327
u32 data ;
285
328
int err ;
286
329
330
+ motu -> tx_packet_formats .pcm_byte_offset = 10 ;
331
+ motu -> rx_packet_formats .pcm_byte_offset = 10 ;
332
+
333
+ motu -> tx_packet_formats .msg_chunks = 2 ;
334
+ motu -> rx_packet_formats .msg_chunks = 2 ;
335
+
287
336
err = snd_motu_transaction_read (motu , V3_OPT_IFACE_MODE_OFFSET , & reg ,
288
337
sizeof (reg ));
289
338
if (err < 0 )
@@ -304,10 +353,17 @@ int snd_motu_protocol_v3_cache_packet_formats(struct snd_motu *motu)
304
353
V3_ENABLE_OPT_OUT_IFACE_A , V3_NO_ADAT_OPT_OUT_IFACE_A ,
305
354
V3_ENABLE_OPT_OUT_IFACE_B , V3_NO_ADAT_OPT_OUT_IFACE_B );
306
355
307
- motu -> tx_packet_formats .pcm_byte_offset = 10 ;
308
- motu -> rx_packet_formats .pcm_byte_offset = 10 ;
356
+ memcpy (motu -> tx_packet_formats .pcm_chunks ,
357
+ motu -> spec -> tx_fixed_pcm_chunks ,
358
+ sizeof (motu -> tx_packet_formats .pcm_chunks ));
359
+ memcpy (motu -> rx_packet_formats .pcm_chunks ,
360
+ motu -> spec -> rx_fixed_pcm_chunks ,
361
+ sizeof (motu -> rx_packet_formats .pcm_chunks ));
309
362
310
- return 0 ;
363
+ if (motu -> spec == & snd_motu_spec_828mk3 )
364
+ return detect_packet_formats_828mk3 (motu , data );
365
+ else
366
+ return 0 ;
311
367
}
312
368
313
369
0 commit comments