Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp1077391lqh; Fri, 29 Mar 2024 06:42:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU3bhOYYiM3NSHhgQhpmmYcdricykboikYWBK2mYtMVQrF5FrBock2puLqvl3HsQQiK6VjDlIs3+42IYVe2XCqvn0MSKgF0qe5KdMnxdg== X-Google-Smtp-Source: AGHT+IFAcgL9Xyr4W2vdLDEMHYnsLhvPl6CPFu8lej/1U5m3MSgASg7S5efo73QQfnXAYQiHP79K X-Received: by 2002:a05:6214:7f0:b0:698:f698:bfd5 with SMTP id bp16-20020a05621407f000b00698f698bfd5mr255982qvb.44.1711719768991; Fri, 29 Mar 2024 06:42:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711719768; cv=pass; d=google.com; s=arc-20160816; b=ghRKBzdrgJDb1eHyvDD+646BHIcYhoZqZr5hiVEBc9MrcC659OdfwKRCsOFsOVlcws DWsVSzDOQWqWUbiIF6thMxbIUdeCKyHhe8dqxesLOz+RZkx+bnwR3Jxb++e3BijFVgSD zs8bKK+E4eVnvYkOa3MTNP9tt6QWGoXkMQp44jQqIfBFwsKrfkCubHm4uHTRBtbUX82e u06r42z/yBUvpB7r46N3kvSt+DRq2wcQ+WTKmB5Xv6Gcs6g4mqcvwRq6ACwZcb1FutgW brSwlpYpbsgSaXaeeJRdbKMrE6LGFqbdkpkzWHIiaauOKBUcilRsDh9DgzaZ7yC7zTUf HifA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=trdtvExX9NETR7UlxUSIzjB1SJeCGvewPyDU+b+8N+8=; fh=E3ztVfWv0rTncYnEe2rUBjG37Lev1J+XId5zrNqIN3A=; b=NmJUqre5d9uFayXKPhF9CWWBgO8dV3YFGcEeA8fdsmfdiqPcZMgRXS0Z/2lTf0MwvZ SLXXn611VHI0eXOHRqK9SeXjcjQAvGQ7vnH7AnzwCczHzfPLJ4Lis8kEzHauxLD14fH+ 9h41WcjAKXvdkyLDQlkj90mnZIGzt0kvqRsq0K9XSZuWsmBmFJYxVTzWxFPqDm90jbqF /Bd3qIRytxj2NV6Q0QK5RuLM8GJd0xVx6HOQahfSYo7agIQ7+YLxuRfotD3hfc8xiDiF alrfxyvMLSOiBZGkjxbUR1L8ytTC4TN7ZhCSRk1G+xSC5Uc1KBoKOY+BxZ+07yt8eCHf EJmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uab7+65h; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124754-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124754-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id p8-20020a05621415c800b00698f66f31f1si216167qvz.366.2024.03.29.06.42.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 06:42:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124754-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uab7+65h; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124754-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124754-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5A2DA1C226EF for ; Fri, 29 Mar 2024 13:42:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43BEA147C83; Fri, 29 Mar 2024 12:41:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uab7+65h" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6889E17E3BF; Fri, 29 Mar 2024 12:41:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716082; cv=none; b=K0ELT6IfDHiYBiGhI7gWIs6GCl6go+x2zhbfHA73151bel8WgXUJMaAZUStJb9dXygWdBrxktphodiKxQQQYkUvX5dgO11RZqyjIAMO9c3Gi7miPKxAtpwPxu1Mtx60xd5gVuOIMhIZa+/5bVVqyj7sLFUVytK/LBiDut3jlvkw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716082; c=relaxed/simple; bh=TNBHL7/cvZN2LXgjSXAmdR5FNyw6Z27zxWEH7K4CHH8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nMn6A/zlZ187mCgBkqjtq8TbxrqmspR+gTuo2iaG6EKAKS12vgoTzicEqBtlTsjP7mESLoTsHKqGLmSriLUgWSdW0zImNQ40zyozY8PnIx1ItJ7KqvKlo0t/pKtgMKCZyTq+iYu3vIzy79cQLZfooX9ppXpBOTWOpmTHk658Xn4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uab7+65h; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3349C43141; Fri, 29 Mar 2024 12:41:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711716082; bh=TNBHL7/cvZN2LXgjSXAmdR5FNyw6Z27zxWEH7K4CHH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uab7+65heWyiVpdhwLlrdLj8SaTVdsHOJ3Lsxwrrpv5ROKVtMUkOI1/T9A/85tFFn 2h0bpQ2YoHpYXhFRQFiZxWPJ58djjcyWCDGUfo+wQd9RI+qCErcWLkN9FVP2ZmfhUq DHdjU/hdWXjRWTaynjtxRbCoNDAViUpKQseLFaWpd/fAMkZNFz99HgePI4eZ8r/JEh T+QPuRRThR79Wvt8a209us6meoLt0DPvKhvN8RP43oux459kZPy8liLD8tZ88vQbdk 0F6Xd8aA27IgiBm82puAzfPcFOi0zVKpjShCWgZsae6bvbX2Pqj7kxxFXFLJbknurx /wdTbJWzf5v1A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Sakamoto , Takashi Iwai , Sasha Levin , clemens@ladisch.de, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org Subject: [PATCH AUTOSEL 6.8 45/98] ALSA: firewire-lib: handle quirk to calculate payload quadlets as data block counter Date: Fri, 29 Mar 2024 08:37:16 -0400 Message-ID: <20240329123919.3087149-45-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329123919.3087149-1-sashal@kernel.org> References: <20240329123919.3087149-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.2 Content-Transfer-Encoding: 8bit From: Takashi Sakamoto [ Upstream commit 4a486439d2ca85752c46711f373b6ddc107bb35d ] 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 Link: https://lore.kernel.org/r/20240218074128.95210-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/firewire/amdtp-stream.c | 12 ++++++++---- sound/firewire/amdtp-stream.h | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 7be17bca257f0..c9f153f85ae6b 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -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); } diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h index b7ff44751ab93..a1ed2e80f91a7 100644 --- a/sound/firewire/amdtp-stream.h +++ b/sound/firewire/amdtp-stream.h @@ -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, }; /** -- 2.43.0