ALSA: firewire-lib: handle quirk to calculate payload quadlets as data block counter
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 18 Feb 2024 07:41:27 +0000 (16:41 +0900)
committerTakashi Iwai <tiwai@suse.de>
Mon, 19 Feb 2024 08:24:35 +0000 (09:24 +0100)
Miglia Harmony Audio (OXFW970) has a quirk to put the number of
accumulated quadlets in CIP payload into the dbc field of CIP header.

This commit handles the quirk in the packet processing layer.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20240218074128.95210-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/amdtp-stream.c
sound/firewire/amdtp-stream.h

index a13c0b408aadfcc6d2f1f588cdd96a733961bf2a..9d5a025d2e967083947ae5da321b1c2e4923ee70 100644 (file)
@@ -773,10 +773,14 @@ static int check_cip_header(struct amdtp_stream *s, const __be32 *buf,
        } else {
                unsigned int dbc_interval;
 
-               if (*data_blocks > 0 && s->ctx_data.tx.dbc_interval > 0)
-                       dbc_interval = s->ctx_data.tx.dbc_interval;
-               else
-                       dbc_interval = *data_blocks;
+               if (!(s->flags & CIP_DBC_IS_PAYLOAD_QUADLETS)) {
+                       if (*data_blocks > 0 && s->ctx_data.tx.dbc_interval > 0)
+                               dbc_interval = s->ctx_data.tx.dbc_interval;
+                       else
+                               dbc_interval = *data_blocks;
+               } else {
+                       dbc_interval = payload_length / sizeof(__be32);
+               }
 
                lost = dbc != ((*data_block_counter + dbc_interval) & 0xff);
        }
index b7ff44751ab93b625a154057535b532a65b46706..a1ed2e80f91a7cc07fecf55288a20a240d0900da 100644 (file)
@@ -37,6 +37,9 @@
  *     the value of current SYT_INTERVAL; e.g. initial value is not zero.
  * @CIP_UNAWARE_SYT: For outgoing packet, the value in SYT field of CIP is 0xffff.
  *     For incoming packet, the value in SYT field of CIP is not handled.
+ * @CIP_DBC_IS_PAYLOAD_QUADLETS: Available for incoming packet, and only effective with
+ *     CIP_DBC_IS_END_EVENT flag. The value of dbc field is the number of accumulated quadlets
+ *     in CIP payload, instead of the number of accumulated data blocks.
  */
 enum cip_flags {
        CIP_NONBLOCKING         = 0x00,
@@ -51,6 +54,7 @@ enum cip_flags {
        CIP_NO_HEADER           = 0x100,
        CIP_UNALIGHED_DBC       = 0x200,
        CIP_UNAWARE_SYT         = 0x400,
+       CIP_DBC_IS_PAYLOAD_QUADLETS = 0x800,
 };
 
 /**