From patchwork Wed Feb 28 01:35:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 207588 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3078221dyb; Tue, 27 Feb 2024 17:44:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXu+2kVhnLgMm8fTts1ax/FvsTRLnoXDqeOHww9drnWCotUAz0WJYjiq9tFDTk6D757WLZAvJVJebUWsnKz4ydTmbz6nA== X-Google-Smtp-Source: AGHT+IFCP9gEY8eUD19nqToHavJcF93DtFvkIbvB0RVNWp8584/VzwE+b/5v+Io5gbMuLjd4JpEb X-Received: by 2002:a17:90a:300a:b0:298:bce9:47b4 with SMTP id g10-20020a17090a300a00b00298bce947b4mr9627775pjb.48.1709084678067; Tue, 27 Feb 2024 17:44:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709084678; cv=pass; d=google.com; s=arc-20160816; b=GTAK5xYYVh1tGqpR0DoGTdFnQGYzAjjWcx/ighTTmQqV3j/ljEtyI65tfzY2xwR6r0 YTAgYzx7sNbxItR8uc6zraftmEVw4zQDUW54E+JT46OZyaU7B5FQVX3Abh7jpiiZGmkz A6QPCsor+YbNTg3x0YtDJEoUYyF8Y/eXgYraGrQ9qx97oUkno57mDm2yQNKwXvjOUmqE OUE1agMeV41StOJYU8Pd4b4tgGOrp63dLMkjL7rt9VfYj0o+SdgVCNCjbBb5t6j8nPK5 5xbRvEgCGgB7eDoXgzIV5XsycXrzUIK4hdUCd2/rykbkOp7OQu1vrxaw3HlT5pbj5S+R BatA== 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=VKrp0Y7I/+wT36BfKZ6oI/4N9BIwFCn9zerObkOrgGw=; b=FNizaxGVkOnWRoCZnDKmf4S/7AhES0q0nZHeFWIYDzjKSaV/OENo9ffPLyiqy7wavu Yv4ai2NRpzFxN+aZviQb4BYGfrtYDg7tQfFWj5IQrrCPDca0ufaGv47V13Ip741GmdOQ 1xaGWq4GJZcgZs8ptttPHWct2LOMxdLity85D0+bKMWlxSyLmLn9jbzKWJzuKgoq/dgI iZWlzrx9eIsm0BCXS1ThdPl06es1+tXRLXWm9AWJIS2vOZsn7IQ5juoiT4zZCx7KoxEG QkvLmAsinsx7mYHL0Gyii092EkeO0BrHZfoK17H5qOm1WRH52xr8kfQMaRjhK3i6salc Huqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="BIa59Cm/"; 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-84346-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84346-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bk15-20020a17090b080f00b0029a6f31b103si358281pjb.153.2024.02.27.17.44.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 17:44:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84346-ouuuleilei=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=@quicinc.com header.s=qcppdkim1 header.b="BIa59Cm/"; 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-84346-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84346-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D2C27282E49 for ; Wed, 28 Feb 2024 01:44:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6348C433A8; Wed, 28 Feb 2024 01:37:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="BIa59Cm/" 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 AAC9B442C; Wed, 28 Feb 2024 01:36:52 +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=1709084214; cv=none; b=UxIKlcJlmUOOIqoockelHMIMRBDYaF6mVrW8tpAsZsRadtyGCosW6H5DHXkapBAFFyoPYv9j7UO/KCD5PogRi4Noo9cwO5P+NJlba0bCOk5H2VX6eD1Gb/zlh1HF7LSN9QIC9j1pGPW6RQcQS/nKSFXJdP7tF7mAUnAEr0DRn6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709084214; c=relaxed/simple; bh=vTcLhZf2R8paXkJQUxSXklktGwb+rhfT7p4hKA16e8Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d4IphoGkWjsylN11mhEK9TjKe20/BfE2dPr5rMH5Dp95fnMXsVVjMTPYg5UcqJuubZcg/O/dCZFpmS5ldktoUiN6afDyy0bQdxms1FQoZv5emaAtAuyvXg3eszy9Iy1uNRrp0r9zMmQx0/y1qY6vof6MNxEa+JretyyMf2NEbXI= 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=BIa59Cm/; 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.17.1.24/8.17.1.24) with ESMTP id 41S0nUSa012927; Wed, 28 Feb 2024 01:36:34 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=BIa59Cm/MRexRswgVEmPB5vCcnSkyRb3w1Vs fjfytVnQdXgxpH6pYS381OYw+ujQj2+p6hphE2CAiNTxjSVpM6ATQq6cPYDURak5 mKvtammRrLZznpFycl89uiuQ8BaZ24WU2j8JflZekGngSs3qXSCrojNzX72SSdmY Pi2rYzk2nlqwt6jxa+3qt5+OwAN/qcyn3Tacl2Tk1lR4Ayl2exWVkScgFBqhMl/m UaOeiVjMfRsKMNjt/8XshEtHZeRcLKE3JkPkg4NS0lWq+bp7bwvjlVqbq42NG1Ob h9aBkIZPYeRGU4w+O19mJ2GkcNpHosD0raDZVvAGciUZk92FDA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3whkd5h2kp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Feb 2024 01:36:34 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41S1aXmZ001639 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Feb 2024 01:36:33 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.1118.40; Tue, 27 Feb 2024 17:36:33 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v18 16/41] ALSA: usb-audio: Save UAC sample size information Date: Tue, 27 Feb 2024 17:35:54 -0800 Message-ID: <20240228013619.29758-17-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240228013619.29758-1-quic_wcheng@quicinc.com> References: <20240228013619.29758-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 X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) 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-GUID: qtc0VPD75YhlUqfwRobR3D_jwpfapXxi X-Proofpoint-ORIG-GUID: qtc0VPD75YhlUqfwRobR3D_jwpfapXxi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-27_11,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 bulkscore=0 spamscore=0 adultscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402280011 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792105175150356500 X-GMAIL-MSGID: 1792105175150356500 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))) {