Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: firewire-lib: handle quirk to calculate payload quadlets as data block counter

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>

authored by

Takashi Sakamoto and committed by
Takashi Iwai
4a486439 25ab2b2f

+12 -4
+8 -4
sound/firewire/amdtp-stream.c
··· 773 773 } else { 774 774 unsigned int dbc_interval; 775 775 776 - if (*data_blocks > 0 && s->ctx_data.tx.dbc_interval > 0) 777 - dbc_interval = s->ctx_data.tx.dbc_interval; 778 - else 779 - dbc_interval = *data_blocks; 776 + if (!(s->flags & CIP_DBC_IS_PAYLOAD_QUADLETS)) { 777 + if (*data_blocks > 0 && s->ctx_data.tx.dbc_interval > 0) 778 + dbc_interval = s->ctx_data.tx.dbc_interval; 779 + else 780 + dbc_interval = *data_blocks; 781 + } else { 782 + dbc_interval = payload_length / sizeof(__be32); 783 + } 780 784 781 785 lost = dbc != ((*data_block_counter + dbc_interval) & 0xff); 782 786 }
+4
sound/firewire/amdtp-stream.h
··· 37 37 * the value of current SYT_INTERVAL; e.g. initial value is not zero. 38 38 * @CIP_UNAWARE_SYT: For outgoing packet, the value in SYT field of CIP is 0xffff. 39 39 * For incoming packet, the value in SYT field of CIP is not handled. 40 + * @CIP_DBC_IS_PAYLOAD_QUADLETS: Available for incoming packet, and only effective with 41 + * CIP_DBC_IS_END_EVENT flag. The value of dbc field is the number of accumulated quadlets 42 + * in CIP payload, instead of the number of accumulated data blocks. 40 43 */ 41 44 enum cip_flags { 42 45 CIP_NONBLOCKING = 0x00, ··· 54 51 CIP_NO_HEADER = 0x100, 55 52 CIP_UNALIGHED_DBC = 0x200, 56 53 CIP_UNAWARE_SYT = 0x400, 54 + CIP_DBC_IS_PAYLOAD_QUADLETS = 0x800, 57 55 }; 58 56 59 57 /**