Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1411946lqd; Thu, 25 Apr 2024 15:05:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXW0t1gWq+L8Z9zw28wYPtMPzEU5e6SKR7wdrmOblfbcbfDR+gKRrCCVLzV8CNAUgIzHay3mO7frX7kkrnN8VcFS0wcKXy2Hgfy0vdC7w== X-Google-Smtp-Source: AGHT+IHsTLI4J+Q0MxBPtgTZGCjG+3dzmDLOtCThrdnbatyT1XgpA1K6vnoPeWiahGNWHpOb9Nby X-Received: by 2002:a05:6359:65c1:b0:17e:6a4c:e96d with SMTP id ym1-20020a05635965c100b0017e6a4ce96dmr978515rwb.30.1714082728727; Thu, 25 Apr 2024 15:05:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714082728; cv=pass; d=google.com; s=arc-20160816; b=AGFeLsn2kteW5ndw9UNuhU8/S6DzyAGkfKbMwO3vYHR2hOVYxNugd+Hyt0/z+JSy30 c/OlsE9/3U9opP48vcbbT6FYUNgI/IMXRjPJOW0o3CMhFPTEGRyhr9ENvtQpnNyHPCUO yqdRClnnPRXuJuLHArf/gCV5Nl6qbtWZHC2lmt7l9GCfxZOnnBjTSO8QdeCEolgXQ53r kc2syOn1abNaZYEtsjnw815o0W5lkFF4naiUNZJFJxahOaXaaj9HDIWmP+eWl2S9UOma CVwGV7aQgjZ+iHq0iCmf1CbyBFhTzdnDaAsWrkntKOJHxEnuh3CoH3nU64gdb7JY8iQ1 XQWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uyF8k4GY10EkPruZFkeC0IFOj0f++wkbH8Kw38rv/5Y=; fh=usWEz1eJjYCle08WABmDyuqCrJGq9m48/LVlmybnzRs=; b=ZAE0Zsr/nlfO+Z05fIARIKvR+G34RTcZ+3NnwXgbt4IKOP/GGp+WsrfqUfSNe527Rj +jrh3J9yagaB14no+xw/iuBB+9hZpbIg63j7jChHl4ddqmwpwnKrad9oNYHtLUtkTIR3 gaqe8Tnloze2ON2xHmD9wCfK3d7/5oEzquaa7hMLQVIDHSSorrG+q505e9CsTolzS2vV abl6vU3CjT9lIvBqxk+4EL26wAaX2PgrpL3bJ1V7vWwFl4CL9QAOa7hj3Kpc/6y4UQ9k QVpoDP6Y/uAdueJpaoTp5r9MFR9mDhskx+OTEmldFE/2SACtxx+ptLSdtZZqiLBSj9X0 2nzg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=OINZf3W7; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-159272-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159272-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id l10-20020a0561023f4a00b004705dcf4dd2si3518588vsv.703.2024.04.25.15.05.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 15:05:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159272-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=OINZf3W7; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-159272-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159272-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com 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 498311C24A44 for ; Thu, 25 Apr 2024 22:03:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E80C1BF6F1; Thu, 25 Apr 2024 21:52:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="OINZf3W7" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 678D4180A73; Thu, 25 Apr 2024 21:52:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714081942; cv=none; b=gDtLmWCEHC/Ila9kcDUg23hdc3JhPe5yI/FQzL5DjEUJYNqrQrEeDAL5zBro8XrMcDGMBBTm+jy91djXacFm81mjtzKvR4x1MY7qeWn7IDL8kXlWmIsb+L98r4c2K+py1QIp96OiTP2rbvZWqnoqdorsxVC7MW1C4zIr7QF6krI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714081942; c=relaxed/simple; bh=vTcLhZf2R8paXkJQUxSXklktGwb+rhfT7p4hKA16e8Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kJp9g9xp8PKztPnXv2dd2k08cFTQdTWQjZhLyrtrPvySKiAuE6+7prau3hNMsLrP8AOWiB9xX2uk8Ebzr8I6DlVoB2pm8gSHI8rSy64tiph2oMcx3PkxUOdzg5GHZAOK9l6V+HHl6w0x8OYlsCBgTi/Ygnu51U+Wt+gIsQIYT44= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=OINZf3W7; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43PJ0rCc000429; Thu, 25 Apr 2024 21:51:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=qcppdkim1; bh=uyF8k4GY10EkPruZFkeC 0IFOj0f++wkbH8Kw38rv/5Y=; b=OINZf3W74eR5ykr8Jt3sFDXsYqeUY+1nTvvU EROEC4ih26LoueN8cydIxvQU65r3XCnm3n6sJd1Ox76gwCwA2CWsASK7uqsHkk7/ sU0jbKMDukWgDURK/YoK4bz8lLxI10nnlnZKwOm1YwiBZk5OeVc7olc9lP0rmM1b I+qnUD7SxsSO08++DMcXHB1b6e1btTxUYnIbS5/NpdXE0fVXAB4LhBVBQ5pVEcQD 5Z7RSTfi0rC9UETwpFDkiNvaQ/gRsKbtqmrRiEN7jqRETNNM6uvUoYBou54pWHAJ RH7fe41muOaLhOexchLGwUAT2iMsveD7RMit8iX6g7HdV53h7g== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xqenhksmq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 21:51:42 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43PLpfBr015459 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Apr 2024 21:51:41 GMT Received: from hu-wcheng-lv.qualcomm.com (10.49.16.6) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 25 Apr 2024 14:51:40 -0700 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v20 16/41] ALSA: usb-audio: Save UAC sample size information Date: Thu, 25 Apr 2024 14:51:00 -0700 Message-ID: <20240425215125.29761-17-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240425215125.29761-1-quic_wcheng@quicinc.com> References: <20240425215125.29761-1-quic_wcheng@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: IeCJ_r9XyAMx2qWS6CbZN1-5YUEHSr_R X-Proofpoint-GUID: IeCJ_r9XyAMx2qWS6CbZN1-5YUEHSr_R X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-25_21,2024-04-25_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 phishscore=0 spamscore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404250157 Within the UAC descriptor, there is information describing the size of a sample (bSubframeSize/bSubslotSize) and the number of relevant bits (bBitResolution). Currently, fmt_bits carries only the bit resolution, however, some offloading entities may also require the overall size of the sample. Save this information in a separate parameter, as depending on the UAC format type, the sample size can not easily be decoded from other exisiting parameters. Signed-off-by: Wesley Cheng --- sound/usb/card.h | 1 + sound/usb/format.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sound/usb/card.h b/sound/usb/card.h index 2884912adc96..02e4ea898db5 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -15,6 +15,7 @@ struct audioformat { unsigned int channels; /* # channels */ unsigned int fmt_type; /* USB audio format type (1-3) */ unsigned int fmt_bits; /* number of significant bits */ + unsigned int fmt_sz; /* overall audio sub frame/slot size */ unsigned int frame_size; /* samples per frame for non-audio */ unsigned char iface; /* interface number */ unsigned char altsetting; /* corresponding alternate setting */ diff --git a/sound/usb/format.c b/sound/usb/format.c index 3b45d0ee7693..5fde543536a8 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -80,6 +80,7 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, } fp->fmt_bits = sample_width; + fp->fmt_sz = sample_bytes; if ((pcm_formats == 0) && (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) {