Message ID | 20240102214549.22498-22-quic_wcheng@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-14887-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4702364dyb; Tue, 2 Jan 2024 13:58:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGECjWsJcAVeKODb4QJ5wjg/HDd7Jp/QrD55OXSv8fUlToOYn+bI8aUFf2JOFaenqsydrx2 X-Received: by 2002:a05:6402:b13:b0:556:a311:2b2b with SMTP id bm19-20020a0564020b1300b00556a3112b2bmr685887edb.68.1704232683793; Tue, 02 Jan 2024 13:58:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704232683; cv=none; d=google.com; s=arc-20160816; b=TOuChflG5xei9K2lz+9IpOFtNKgAi1q5CRzlDj5nILkBrNxtcG1IgBqv2Twi/izBQX vcYqxGK3qeY8pKTZyu0pQKRoPF19EF0yuKLUfZ3yWybXxyohj8J9eXg9YbU4e7ineLKB QrK3u8RFED4SFNTJKQvb+DAp7j+Ip1pfa6riswh3vXGE3d4N3cIGzh90m1mOVCKsYJ/1 kqB/YukI3vMvr7E6O9Dh+xKVIoCGVcq0iPzHWgg+JdbBJhen16wPbjbnmUOG5A225XCk VhNbb+om6nxL+4wex0N5RnpJcIyUCNSuvl/HwjWGUK8N7IDEOjTOoXTY/5cf1dwXPaGc cl/Q== 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=As/LdtUmbbB5siySloFf0kGunSrAkzqtvS8hEof3Hjw=; fh=0KzismZj+xI0Z//ZGdqKIH/FO9LtSZM7Yj4P0VtrCz0=; b=nD2EvF6CKd8ThYRUIQ+an5PXtlNeM3AU5kkCFnlZqHcAToTkUMXCxdOliR4moybBtO pmIjq65Qh+vX9IDBxL339fKMYX6wmR1VyBvJwHRVLV5et37RURRpscn6GC0lzbiE2gFE DFq05wT4Q5nq/adXP7iEKFuI1AWBZcqPVwf5lkldqSNFxEB9rQnUDIU6cyDc8ULKQ300 1rqpoFKQBF3JLdNxBZgOsgTvEAxrJop+EaMl7xsdCEIkfR3ZXXjrtF9QrMbuFTa4IhGp 00E2RWgC3BUsSy7C24beqhKnqM5nhRj3XNPK8HQIFPMYFDFs8UnTu39qqB4UWg7A+KNd fQig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=cMFWgU1r; spf=pass (google.com: domain of linux-kernel+bounces-14887-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14887-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. [147.75.80.249]) by mx.google.com with ESMTPS id l26-20020a50d6da000000b005540261f0ccsi11417829edj.691.2024.01.02.13.58.03 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 13:58:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14887-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=cMFWgU1r; spf=pass (google.com: domain of linux-kernel+bounces-14887-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14887-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 652901F23735 for <ouuuleilei@gmail.com>; Tue, 2 Jan 2024 21:58:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 587FB20B0B; Tue, 2 Jan 2024 21:47:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="cMFWgU1r" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 605AF1CF8F; Tue, 2 Jan 2024 21:46:56 +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 (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 402JU40E007927; Tue, 2 Jan 2024 21:46:25 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=As/LdtUmbbB5siySloFf 0kGunSrAkzqtvS8hEof3Hjw=; b=cMFWgU1rsNPFzg0pKPg9uIjD5vCqXMjy/VAU 2k4vvokrCIy8iDdslxGq3vZOZTnLBLSfQhuQ8BgPuN6gU1KFJm93Gr6Jnz7eVA2X mGl+aqYQtP8Ckj16fu5FOELTCxjJ0FGaLMrT33++fAEZb0EFNSvffcoYd9IG4XtT HZ+W2SBYk4rg5Liabjd4162dg8W20C7iY7HGMrYg2sb/OoEGgGIDWIzTGFhqScxd 0KR9obSfbZ/Ndwvh9Ay/vsUnZuiBrd50l1qF92g2qF08EVwuzrkb8Fo/NppkJpLR o+EuhbLkm52WQe6VsB87CEIY2TkTi2lMxOW0hLOWMJJCZMHjnA== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vbsyk2yb0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Jan 2024 21:46:25 +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 402LkOPA003251 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 2 Jan 2024 21:46:24 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, 2 Jan 2024 13:46:23 -0800 From: Wesley Cheng <quic_wcheng@quicinc.com> To: <srinivas.kandagatla@linaro.org>, <mathias.nyman@intel.com>, <perex@perex.cz>, <conor+dt@kernel.org>, <corbet@lwn.net>, <gregkh@linuxfoundation.org>, <lgirdwood@gmail.com>, <andersson@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <konrad.dybcio@linaro.org>, <Thinh.Nguyen@synopsys.com>, <broonie@kernel.org>, <bgoswami@quicinc.com>, <tiwai@suse.com>, <robh+dt@kernel.org>, <agross@kernel.org> CC: <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-sound@vger.kernel.org>, <linux-usb@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>, <linux-doc@vger.kernel.org>, <alsa-devel@alsa-project.org>, Wesley Cheng <quic_wcheng@quicinc.com> Subject: [PATCH v12 21/41] ASoC: usb: Add PCM format check API for USB backend Date: Tue, 2 Jan 2024 13:45:29 -0800 Message-ID: <20240102214549.22498-22-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240102214549.22498-1-quic_wcheng@quicinc.com> References: <20240102214549.22498-1-quic_wcheng@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain 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-ORIG-GUID: KnPDFzMt07AOILiz33GmyoyJysan74Ex X-Proofpoint-GUID: KnPDFzMt07AOILiz33GmyoyJysan74Ex 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 adultscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 clxscore=1015 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401020161 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787017490716186124 X-GMAIL-MSGID: 1787017490716186124 |
Series |
Introduce QC USB SND audio offloading support
|
|
Commit Message
Wesley Cheng
Jan. 2, 2024, 9:45 p.m. UTC
Introduce a helper to check if a particular PCM format is supported by the
USB audio device connected. If the USB audio device does not have an
audio profile which can support the requested format, then notify the USB
backend.
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
---
include/sound/soc-usb.h | 2 ++
sound/soc/soc-usb.c | 25 +++++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/include/sound/soc-usb.h b/include/sound/soc-usb.h index c0c6b5abacdf..d9fc83180c56 100644 --- a/include/sound/soc-usb.h +++ b/include/sound/soc-usb.h @@ -38,6 +38,8 @@ struct snd_soc_usb { }; const char *snd_soc_usb_get_components_tag(bool playback); +int snd_soc_usb_find_format(int card_idx, struct snd_pcm_hw_params *params, + int direction); int snd_soc_usb_connect(struct device *usbdev, struct snd_soc_usb_device *sdev); int snd_soc_usb_disconnect(struct device *usbdev, struct snd_soc_usb_device *sdev); diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c index 5b127141f0a1..cad8e1d798e4 100644 --- a/sound/soc/soc-usb.c +++ b/sound/soc/soc-usb.c @@ -80,6 +80,31 @@ void *snd_soc_usb_find_priv_data(struct device *dev) } EXPORT_SYMBOL_GPL(snd_soc_usb_find_priv_data); +/** + * snd_soc_usb_find_format() - Check if audio format is supported + * @card_idx: USB sound chip array index + * @params: PCM parameters + * @direction: capture or playback + * + * Ensure that a requested audio profile from the ASoC side is able to be + * supported by the USB device. + * + * Return 0 on success, negative on error. + * + */ +int snd_soc_usb_find_format(int card_idx, struct snd_pcm_hw_params *params, + int direction) +{ + struct snd_usb_stream *as; + + as = snd_usb_find_suppported_substream(card_idx, params, direction); + if (!as) + return -EOPNOTSUPP; + + return 0; +} +EXPORT_SYMBOL_GPL(snd_soc_usb_find_format); + /** * snd_soc_usb_allocate_port() - allocate a SOC USB device * @component: USB DPCM backend DAI component