Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1431342rdb; Fri, 16 Feb 2024 16:22:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUzxqH7T+SUWJfIwfXiqMzjB4qIV/baEof0KRZrDwwrxTr9yelsttONkzX1Km67hmlbLnkKPIj9Q9yTjHfycyhnq3EuFZrbmGbkXrm1fA== X-Google-Smtp-Source: AGHT+IHMr6URBp/H9YIF5YWWqi5C4/eMt+PiixVbGQrmawxeEoptxK/VZfJ0ZrlurZSYSFFGQJno X-Received: by 2002:a05:620a:c16:b0:785:53ba:4cf7 with SMTP id l22-20020a05620a0c1600b0078553ba4cf7mr6552372qki.13.1708129357987; Fri, 16 Feb 2024 16:22:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708129357; cv=pass; d=google.com; s=arc-20160816; b=u82T5KUU6BKGnCmPnkdp5Eah7AXyhqtVi7B5VnMhjV7UZD088a4YnYAK9TJ7YPF882 6kop4QVtU4qEmewOnMjIBsT64jAyad9Em0zx2HOVN1mGUJBdE6fB7HdxLI+gHUXKx5vV +kVea0LCCNOkINZgloNamoLhwh6+0MIhh+bbAXTK6CbmExJh3umFW55F2fdVeCReEqnJ nLXUFr6+baBSsZUVHXtA1GgrlIYMGuzWi2fyWrq7yTD+nRfktdF1ROFQgM2pqIBIrhsC NwM9XapRKD8UPPMuagbHIZ3jTX/x8Aa4tyHs6R+dY6/+ThMh6fJ+kEDLJl557IJwvK1b LUwA== 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=PMLeMpsS5hONYP2iSnXYL143hV7iy4lIFhVVbgCK+uoJ2bzduj0s+r+rJ29ztvDF3H F4i8aZv/Wnz8N6V8SGUA9rkg694mTDWYJbRARDwz8QeeT8QqgwbLAd9LHOohrOl/bgZm 1cZW+d8MvjPR/NSfSvSW7thsCGl1IybIybb3TIWPSYgpSTfa/gzTWf1pSRk7YdUA0aXX 5ToLI3OwLN7EBJk0bVQTsJCWP11ChpoCqsImOOtr7kiuQ9gg2OVNbNvjY5KGgVN/5a5O 58xLkY2hSbaBKWiDWDE8FFLvVf8e0ffiDavUS27B/ipUeus8wDcApYkGHBps5Nt+Abww LQyA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=jFwCQYLm; 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-69556-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69556-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 o9-20020a05620a22c900b00785c15906b4si1045319qki.61.2024.02.16.16.22.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 16:22:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69556-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=jFwCQYLm; 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-69556-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69556-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 5D7741C23A62 for ; Sat, 17 Feb 2024 00:21:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0C4B779DA8; Sat, 17 Feb 2024 00:11:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="jFwCQYLm" 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 AAEB84F8BE; Sat, 17 Feb 2024 00:10:59 +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=1708128663; cv=none; b=IpvCF9KpYCGJ0ftoYC97dIUHdnvHamozl6q8+FsDLdSCynILXQRWpK1ehhIPDzel7mZ5JntEWaowOMsW0JE6rcEzEdSZrhzUQRiYU2OQDgBoXSPCVsRNsTMXkEBPQCjA8jUCdjRfT2FIjX3dHqAV6jZuDOuiWKcgIriFqrIviYQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708128663; c=relaxed/simple; bh=vTcLhZf2R8paXkJQUxSXklktGwb+rhfT7p4hKA16e8Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EIjh6YJ86nl+S7hDY7xnDrqPuD0MYKgph8eMqb/QAUDwFdHknxBOs1BuMV9UF8rH03r6ypwZ/OWgG8iKbC6QBRYW/HVEggNMcBAKSNTdnH7uMUfWhV/cSsxbGHgwq9ldGnnxI4NVB0y+Uoa47AZpewuIP/sxDr1gKsPwcMBYbmI= 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=jFwCQYLm; 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 (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41GNJUV5026687; Sat, 17 Feb 2024 00:10:37 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=jFwCQYLm7crFHZ0OsKIVA7N4SnSy7OMDJgDO 8VLKDHp7OoE6mgZDy9biPNfeD1TsHZ0jSCYo/UgIw2E1wEjkVDKrNdf6ftcmcpEU JGJcEINiiIAnmsU+QLYIA4sCA5zaVT+35R2XKPUwah+E3R4kCrJeuu/jJ0wzby34 UxzlzIaFUEOrs9DlyTE71oBD3rxqKLAwfD2iKotH7e/qHwQJpuF8YAcpXsQAJyeu bX6l562APIVhhkeD4YAhAzGAphybAqxW8Ee5ObVK8Crr0D03DkRXUmSA5iVXp8+L eL2wG36wtuiYib4vsoJjUWJigw15lKCoCpiEQukcUKmzmLezSg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wa61nhek5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 17 Feb 2024 00:10:37 +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 41H0Aaqi017229 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 17 Feb 2024 00:10:36 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, 16 Feb 2024 16:10:36 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v17 25/51] ALSA: usb-audio: Save UAC sample size information Date: Fri, 16 Feb 2024 16:09:51 -0800 Message-ID: <20240217001017.29969-26-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240217001017.29969-1-quic_wcheng@quicinc.com> References: <20240217001017.29969-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-GUID: OsL1XriGFpiy-G6jcsc98GcYjA8J8Z7a X-Proofpoint-ORIG-GUID: OsL1XriGFpiy-G6jcsc98GcYjA8J8Z7a 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_23,2024-02-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 clxscore=1015 bulkscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 spamscore=0 suspectscore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402160189 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))) {