From patchwork Fri Feb 16 03:58:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 201899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp288104dyb; Thu, 15 Feb 2024 20:15:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVl3CVErDbX6Cnc74aq4cGkVrxF62f5PKx7gQWAxCW7XJ9cYb0LWU8p18aculOai1GnQfbErWsEP13vWxIa6k3COgJh2g== X-Google-Smtp-Source: AGHT+IFuspuzHWeg/f0DLdd1Z4uLXJpgt8c7rNjqye9Ql8ciS1ubC7Culcvb/38RNF/vJLUXcZRT X-Received: by 2002:a05:6214:b65:b0:68c:c0e8:736d with SMTP id ey5-20020a0562140b6500b0068cc0e8736dmr5188631qvb.61.1708056942679; Thu, 15 Feb 2024 20:15:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708056942; cv=pass; d=google.com; s=arc-20160816; b=dZKVPnwUBBZOA25OOdtX0BeRQnOPBZjOhV6AxvoE14W6xGaLPf0zvLvEGwGl4V27mR vGnmH36UJ2y3P/X50MAEBubTLew7VuxY+4RsGiAnu3EvrK7fc0rBhSIJSAJKIcUkcUb6 Qj6HpEO9F5wQ6t6Kx/jtkAurInXKQbST6HwMdCh1qhuhWSjwfwQYt0C6z3HnHpgXTQ6C wrQgZNDJ3+53kkaA3LlkjCmDIUCo8A+utcUGfgcKqca5NLz6+qMaB3URc9D8WAJoBxPT 9AN65tXVGHrbe1HYijjX/sKAkxscfCCQn2sQFfGBdGuyteAO/Q0KllkXaCjPUktYwW1k kJLg== 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=CeT4BK6vUpCBs6RiFBUeQLZ9geud4b5c5mxaSI60Qe0=; fh=VKrp0Y7I/+wT36BfKZ6oI/4N9BIwFCn9zerObkOrgGw=; b=Ylmks083JBFrVsH7GCB6kqnx/F99Y70oLcoJ9VB4XX+xuKYGwWu4SkhmjdY9IS2fIT 5vIBt4fdapHJ0ljA/xGGaNCODDP/70vc7vVVZkvhuz7VVXU5e/J6GB1RqlmQKhZnTVUy kA/swI463QNKwzMy9iaYlOFr3jedFVEPUVvqSXgyHnGCeb/tCsZ5z/R+5ZjGl+Kf/LC2 fOQZwdW8emw5zk1QtYcLtA81cgjW9UQawLEtQZNUXOVw0DLIDZBKRHTyJhk/zA7/Imb+ P9I7kVi84BzkYCm5af1/lC2BasWjHAuJD0Ajsu2WeUjgx0RxBYWLe2IqmKGxBvjVinqo F2Tg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UztNSdtZ; 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-68033-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68033-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id pt1-20020a056214048100b0068cc2054432si3116408qvb.495.2024.02.15.20.15.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 20:15:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68033-ouuuleilei=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=@quicinc.com header.s=qcppdkim1 header.b=UztNSdtZ; 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-68033-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68033-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0DC521C22537 for ; Fri, 16 Feb 2024 04:15:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 630E659B40; Fri, 16 Feb 2024 04:00:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="UztNSdtZ" 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 0954C200D5; Fri, 16 Feb 2024 04:00:05 +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=1708056008; cv=none; b=Xg8aLSWzePdNaGPTK8K4Y/FfDP4cF9kxvvMaoYyi7msC8NaFcucbDTgRlmej9Y1/VfyytWtQzDcb7TJdGzsRhj+mUk5FWkiTWX/v7R9w5mfVjCwDKXP+htxeu23NmTBIYWQ2AdnBwMEsI5+Z8MzWtDmnFHIfP3033rpk0Ra7QIg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708056008; c=relaxed/simple; bh=jfK7NpUqnMHbZVnS3RbmQAEeB4R0WNaT5lwn4mCIjdY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jYVMaGjqBpygly1CUS6Kt9+OCoMhI5dH9ZeWIcOllptCjZnU5K3jD/P63e1zp/8qiJYKioaM72SWlNt5khXGJzAMANrc4YGZxuYx025VGIC/iwrZdGPZqniBXLLPncNWfo6ynj+4UWX+Gtq7Z3Incx8EXW63pia46TMeLx3Kt4o= 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=UztNSdtZ; 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 (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41G3TYRq003573; Fri, 16 Feb 2024 03:59:41 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=CeT4BK6vUpCBs6RiFBUe QLZ9geud4b5c5mxaSI60Qe0=; b=UztNSdtZ8OH5iO5HjhNK3tUffoif9DuwQtRu ciUHKccz/rhdtwt4kOFeAiF6ROOqoZd9M6AbBoNULIkNLsfGxLSJknn1WgVNR3w+ Q4qgClZSPt7oDPyt7Sh0EaKaaUwXz3epqCvFbqN68bceYyrMIElzQO3EyDoygYL7 PKEnxELEDQ6WAsREPi2lh6f4Dg5ZrFfsTUVLEyaePTXWZc5Ra25X2n0f1XDg72pO 0mgWx5UIocDp55A0IMpNgbdvP9ECniYj3EP4UR2J/qEdQHugh/EnbGz3jSR9Qgu7 2jMkmUXLR4YKjEQE2zFuVpBMSiDMBwq7LTLfnOZyPa+g72kQqA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w9gv7jce5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Feb 2024 03:59:40 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41G3xdB5024929 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Feb 2024 03:59:39 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; Thu, 15 Feb 2024 19:59:39 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v16 25/50] ALSA: usb-audio: Save UAC sample size information Date: Thu, 15 Feb 2024 19:58:58 -0800 Message-ID: <20240216035923.23392-26-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240216035923.23392-1-quic_wcheng@quicinc.com> References: <20240216035923.23392-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: 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-GUID: giAec8g2EX6XGxxoV8ePXLoSUhCDzMhR X-Proofpoint-ORIG-GUID: giAec8g2EX6XGxxoV8ePXLoSUhCDzMhR 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-16_03,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 adultscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 suspectscore=0 mlxscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402160031 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791027517107653829 X-GMAIL-MSGID: 1791027517107653829 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. Change-Id: If439ffb86e48819b9bef5894f9cc5350f6053f04 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))) {