From patchwork Fri Dec 15 21:49:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 179560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9598645dys; Fri, 15 Dec 2023 13:53:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRB0ySguqhWkQaEum0gtuiJkprPTNfYYZ4Hi1HkKxR1phSuTaj3weHw8VpxUTo2GXRvnUx X-Received: by 2002:a17:906:d009:b0:a19:65da:f18b with SMTP id z9-20020a170906d00900b00a1965daf18bmr5566234ejy.38.1702677195044; Fri, 15 Dec 2023 13:53:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702677195; cv=none; d=google.com; s=arc-20160816; b=nTPg1RLOBHDyHCL+5sZb3Vb9TJnIGUIxiyBzfbB7G+HkMVA9T2QVpERA2hehsOQmC+ JejrF9Hh4uJyIPJdxc68L7VEWYieGBmJLzGsMpPcLh+s59AIbMqZldi75xxSc9CBWmb+ cUc4h1H0zf8c6OddE9Qa5DMUhltwPkfxND1fzmSwCpZnDuGFDyiMDLgB9ZLf+vWYFVhi Ap0TPy5F1bJJ1QVXmNbZsYLlhqElU0PGmZvy/aa7lLCBghSo9rL3UWMHguPynBA54eCZ VlZcJALyYbUeUmrDJHoABUijqAm4bqNvjSsmHGZxiM0CN86laWMCJmPBI1o33vubfSJc pwgg== ARC-Message-Signature: i=1; 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=QAId/huwU+vLycR1v5ldlqmYb6477nfIMJClVSaqa9U=; fh=0KzismZj+xI0Z//ZGdqKIH/FO9LtSZM7Yj4P0VtrCz0=; b=sw4QAbON8QVOaoo6X75AsFKV4pHMhlS0vTdqmlyDwdL8oY0/FG5iyHBzxkin0tz39Z g+7DPLM2DjqAHaRJAirv0lcBpAjZqN2NxJ4WPDyBayzmPDSOyp7Noqv/4/LK+G46m24x OzeVDGd4MZSiaWYdFVm+BY0sjKUvvPpNQl+Yo5r+qz5XOou75NC+NF3QyV8c9FA3royO 5XJCwwGA2CKxMpHdRkV2GPpatC7xYA7GYZ61X4GrA8soxgqkj5nzLL6wGyl8T11yOo5M a7qIjYvsomfKG9ftNyY0QogT2XaREG+r5RuXQ+wfqV0fm3K5OU4NwIeH9E4py10jY0aa yABA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Y3URZvQz; spf=pass (google.com: domain of linux-kernel+bounces-1685-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1685-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w7-20020a1709061f0700b00a1fb302b5dcsi4385767ejj.682.2023.12.15.13.53.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 13:53:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1685-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Y3URZvQz; spf=pass (google.com: domain of linux-kernel+bounces-1685-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1685-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A6B401F2232F for ; Fri, 15 Dec 2023 21:53:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C1C3697BE; Fri, 15 Dec 2023 21:50:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Y3URZvQz" X-Original-To: linux-kernel@vger.kernel.org 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 983D44879B; Fri, 15 Dec 2023 21:50:26 +0000 (UTC) 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 (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BFIq9YR002008; Fri, 15 Dec 2023 21:50:10 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=QAId/huwU+vLycR1v5ld lqmYb6477nfIMJClVSaqa9U=; b=Y3URZvQzravokDc3h7Xrr938woieD94kmd2L ERhyU2AkiHNIvSo3/XF6D+Ub7OBiwqf/zla/uAcmHS4TQufIqDCZv/D2djqrG3L2 OYaoG4ZdGl2WSErDhOULyed4uMri19E08YXwe/wljvXRZYfVctt58DIJM3r6I1Cn OjpVCoQi29ILeLtP3VI1AWpo4lVW6jV94sRgd0ILyonHFJxct1rqzw1EnXjsryIP xTttJaJ8JexARI4yLP7t/x97CW3F5GSJC2xm3C8SGA1kqfZ4vmqi0O+NBcihEjdF xaYucKPFyTjFTpvZwJLXIsgdySu1URpW7Mx54TWKtLWy7Ibs9A== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v0up20gj4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 21:50:10 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BFLo9kq000834 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 21:50:09 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; Fri, 15 Dec 2023 13:50:09 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v10 13/41] ALSA: usb-audio: Save UAC sample size information Date: Fri, 15 Dec 2023 13:49:27 -0800 Message-ID: <20231215214955.12110-14-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231215214955.12110-1-quic_wcheng@quicinc.com> References: <20231215214955.12110-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: nalasex01c.na.qualcomm.com (10.47.97.35) 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: p2ZCiqZlsKnPOkqG80Lin15NejEoSlM0 X-Proofpoint-ORIG-GUID: p2ZCiqZlsKnPOkqG80Lin15NejEoSlM0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 mlxlogscore=936 impostorscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312150152 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785386442502498241 X-GMAIL-MSGID: 1785386442502498241 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 ab5fed9f55b6..1721e4f360fb 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))) {