Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp20511lqz; Fri, 29 Mar 2024 07:22:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWP+vNQjdgxk14gHwHV9wc8Q/y27IdBhpflF6ypWXK+R2fpl/Fa6pfrEEzb710lIeUTtMiMTVjtbvMALPA5AvrL6DZNuGpR/gH6lBHAZQ== X-Google-Smtp-Source: AGHT+IEp9HbDtAxkHFvulJ0cQAWhc41TXkkdnU221gLYTa3Qpxtc/5VeRHoPfJDgFhhEZmU/2zS5 X-Received: by 2002:a17:902:c406:b0:1de:eac5:9294 with SMTP id k6-20020a170902c40600b001deeac59294mr2843496plk.13.1711722169671; Fri, 29 Mar 2024 07:22:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711722169; cv=pass; d=google.com; s=arc-20160816; b=bqyhNYVyyXQQC8k84MKiQKLFEBnaHPX1jFJzpIMFxQyhxbtOj1iGp95M/x9k7q/UVL OuXxOPgoKuUZH+0eCvqPNVu/Xzz8cJD+9nMP47Z3PVbtMiuoJG93BaUic4TjtyWoFh8l hZeuK61KgmhDKtvGGNsVyH8fhZIPe3rDw5ZTc3hn65nogR9Y+7fZRq83QvvuC/397fyH HXpxAjFJzilX/8FM6lZPtKc4q9CAPcol8JZVorQ76d5rTvJlnemES4LLbOAGeyZEO5jH Nq+Dx2Bde/6puYOo/OjaxJbOF5WFmGDW3bwJyuB14BypqcPoa/mmdCG/2DwFfg1NY7h0 Hckw== 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=Xe/QdWdTBob8yG3gFUrKgO952B7zc4CuBmjPYTZmjhE=; fh=E3ztVfWv0rTncYnEe2rUBjG37Lev1J+XId5zrNqIN3A=; b=UBc3l4proeDqJiHBVy/jkcXxNY8rcn9hzlyzzI8faOif72+DGk5Od1shLsUDWHSLao zM8sSX0eTWIDAFVSksSVr9P1ZjNLFkp/ojusPtVTGhwRFMog+dajQOE1gu7fP8memkdz /+xHuW+oawQUiTr89nls1tjsJYALmjACuCfRSlZPPPfitItzAb+A/KtGeOt0JUuh4RF8 X7mEc01ishryzfava8X8+4hdM/YNpP0FKA1QDMW2/6MoFdbJYcjsSLecVSglgM3DJ2B/ UX1nYVG2UEqdiKV6ayHcvJoMA4wn3eqnzSMFRCamT70sZjBhGixeLsjLJgSipa8locFw ktbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u05kSsP3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124904-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124904-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q7-20020a170902eb8700b001e223b898e1si2789143plg.215.2024.03.29.07.22.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 07:22:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124904-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u05kSsP3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124904-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124904-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 387D7283944 for ; Fri, 29 Mar 2024 14:22:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C532827BBB3; Fri, 29 Mar 2024 12:46:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="u05kSsP3" 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 E864127BBA1; Fri, 29 Mar 2024 12:46:42 +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=1711716403; cv=none; b=YEQ0gTzMBO+OAkkiF2wcdLwnp6az1xxG9bc00oFoV5HkL9FHXC2vf2k1DkF9hBaC5eWhOS7zwGB/b3WTrXSkGpgcieB50ZarAvmgesa601fvoMUrbw97LvaJSrc4PWJRGeOOKDgF6NJnPErOQxW6uxuerbnkc2yzZ+QYiFWqu3E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716403; c=relaxed/simple; bh=24ZfbhX4pI7+/FQ2TTtmh8cVzbSFP7TYidogpYLdsoI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aNRYk8KQiztZSBGTNAwaCohUlQrNZMCYFOHjW/nm4dT+4Xx3PE7Rnn0AK9FJ6AJ36d2fHg+QoDP1vLCOZGX699fVESPnOtUqc8LVAVC0rQ6P/Duu33915fKlHBIpvun/s6vkpgofz7F94jRxw43ehgUvrUd7Ovtxar5QCsarVHE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u05kSsP3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 898B5C433C7; Fri, 29 Mar 2024 12:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711716402; bh=24ZfbhX4pI7+/FQ2TTtmh8cVzbSFP7TYidogpYLdsoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u05kSsP3XMmwAi1gOWmybowXYvNJ79q/0IOKGS6W97PHtwqx6BE+fLZ2P0kKeX4pR 6C2tJC4jLuB496GBRnUtENZKaPS8aYQzkd24ecWqn8n0cQb46050z6AfrbufwMZ6LB 1pNbcbgyrmeEiC1iPlyMjjJL6bA4pNulIE1GyjwB7LvJr9o6N+OvWTQipTfCtRJpGj 1DtD+JmoxnMa15dFbs+xILH+B5IZ8GSdj5LAPhGZveUuxV5M2DwDvQG5dOs0g12Xdb cEK7OQTJnWgMpUrMl1LkTRRAsULIEqYD388mx7xUEy2YM84lqOKURJEPBlH2Q6D/X3 9AyoEX13qCpTg== 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.1 20/52] ALSA: firewire-lib: handle quirk to calculate payload quadlets as data block counter Date: Fri, 29 Mar 2024 08:45:14 -0400 Message-ID: <20240329124605.3091273-20-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329124605.3091273-1-sashal@kernel.org> References: <20240329124605.3091273-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.1.83 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 f8b644cb9157a..8753125683692 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -771,10 +771,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 1f957c946c956..cf9ab347277f2 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