Message ID | 20240208231406.27397-34-quic_wcheng@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-58861-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp518454dyd; Thu, 8 Feb 2024 15:36:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8ONg9OA5QkuUH83o+a0wF6VO3fNI3/VbZALGayktPVa2TkwTcPXlvGpp5Uc5oEAGCslEA X-Received: by 2002:a17:90a:dc0b:b0:296:452a:9662 with SMTP id i11-20020a17090adc0b00b00296452a9662mr296075pjv.2.1707435363073; Thu, 08 Feb 2024 15:36:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707435363; cv=pass; d=google.com; s=arc-20160816; b=YSrrIpAnWM+DcakeuXVDU1lIZE/mnPOjdlgggLsCargIJYXDZtEFIQWml7IMIHMw4D Ov5pQmT1fH16/M4IKiATw40ZpRK/VfvSARwuo5eJXQ8s3/s1izSCwG8czMM1hkNdhv8u KtPv6qHVwA1uCsYhh82ueSl5/3qDpIU5UT99Y+bO49pg92JzLGfgMUOoh4mJUuFi++wY Pjc0yZgRyHL4kipFIpzi6VeWtHaMysoixr75YCw1ViKxneFPVvonmloQo5LvcoJBLG/B BUwBvda+OOzZQ+kWziJZVmOpgPMMe0xMO6MzIQNncbLQK0lFfP1fNEh4JzeAtqrn6TrC vSdg== 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=ykcyhuwEhB5FE+rNrTlrUbhFOhgtshSgIcmuOKFpL3A=; fh=p4lLYBaNk/6gvJJs0tDclVwwBckFgKnxbBSqC3am3pI=; b=tU3res9R+e8EG8y3LmqFQadzwX12ith+/2A5XDrVxNQV9qEIAmBT0Xg1vQNdCxcVZe gRCyobjP14BsPxYMDUXPZ2PAuw9c403p7v7RmbdPHdzPD+PKJF0NbN8ZxFaEOX/issdZ WZDVTYjdKgUe/mVnLUzlnYN+e8zbuqzYIEAU/b1z9HoO3TbCbWX1tsHKN7qsgwrt4Bf8 3Qtas+Yz5QRzJbGP0HZl/r1ty6pfukdWjm58HIivhftnAPlgVQdmRYXm5MWdTx4m5o1l 3pg9iLgc3o75zXaeD+/c5WSyoOql+VJl/bdLZ7kN1368qXhw2nW6M7dQdy99UU8Ns0um Ym4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IOwvJH3u; 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-58861-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58861-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=2; AJvYcCW1YaEnV43ErYSqnBcUCqRbN55GttQOhNij33RHU3RKJ3rP6zcx8qQU/jtJ+fzRgOrTsTTneXA9vW909yT4Sk1Bsx/Dow== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w21-20020a17090a8a1500b0029707f6025asi405997pjn.15.2024.02.08.15.36.02 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 15:36:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58861-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IOwvJH3u; 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-58861-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58861-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 D73FF2819CF for <ouuuleilei@gmail.com>; Thu, 8 Feb 2024 23:36:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A89EE67C7B; Thu, 8 Feb 2024 23:15:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="IOwvJH3u" 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 878105CDCC; Thu, 8 Feb 2024 23:14:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707434098; cv=none; b=F3s393CxFT9AHYK2RqLeccHehDFZ2omdKQ4y45dX33svEjxFkeJHtofhcdUbcjTSNLD5mURJFnotoMLp5CFy7magLTYFRbRu45nrpkHBQz53GluOKRe6Vn9iwwaw2YfELVWiQGf96A7KQl679TX7imTiK51WyfAR3dKtlc4uT+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707434098; c=relaxed/simple; bh=Qq33CwXLVxI1jn/NLnJhzo53fs/1RVWlAKACEKQ/XQ8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qnBdutqMf0Y2WB5Tm0N8my4L/DagSxMZ9NU7ZjsedfIadK1OqKFeZx4owyFXQF1Pfwx4JkGRJOb0Eq+8V34UK1gz/RjvdjbilNDGFBaATnIVL6P1b6EteqNeHu0BmR1fxP9Y8cEt/wgfcp2+JW32q0bjW/c6SIUHtUPnu5Ekh7w= 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=IOwvJH3u; arc=none smtp.client-ip=205.220.180.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 (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 418NEJIL030158; Thu, 8 Feb 2024 23:14:26 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=ykcyhuwEhB5FE+rNrTlr UbhFOhgtshSgIcmuOKFpL3A=; b=IOwvJH3un0g+fMwj6Ae/0ngGA+FDlctjGY/7 GaQCpCNAysOE81xJI4Gk+D/X6h8k6tsnfR4Hkt+5sCvREngUwtEGHkP0b9UD3JvP uGnQYK3OBbmLqVc1YYmh6iwDXXg0wZVIWUIkgE6cT95r9X/IZjN/rhSfpQ+9V5fl 559MZqaN//IpNc0mUMapxGdjoSO5STsthv8RHjqIAdzi7XYp65vRBgboc5Q2AQFM +P1yMeWENDRPXn6b+Zwbv5m5V8lyFDIS0c0xTDcb/iAneEOJc0qWTiXJ/+RfZh7x fP3Au+CRDpPpQUifJsGrga616oJikOkjaWR6EseYcj1FKieMTQ== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w4hhkbajb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Feb 2024 23:14:26 +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 418NEPFf005609 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 8 Feb 2024 23:14:25 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, 8 Feb 2024 15:14:24 -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>, <lgirdwood@gmail.com>, <andersson@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <gregkh@linuxfoundation.org>, <Thinh.Nguyen@synopsys.com>, <broonie@kernel.org>, <bgoswami@quicinc.com>, <tiwai@suse.com>, <robh+dt@kernel.org>, <konrad.dybcio@linaro.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 v14 33/53] ASoC: usb: Add PCM format check API for USB backend Date: Thu, 8 Feb 2024 15:13:46 -0800 Message-ID: <20240208231406.27397-34-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240208231406.27397-1-quic_wcheng@quicinc.com> References: <20240208231406.27397-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: CTVCLWGaqzy-bGHnA3UkE_crcdQJWCZP X-Proofpoint-GUID: CTVCLWGaqzy-bGHnA3UkE_crcdQJWCZP 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-08_11,2024-02-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxlogscore=999 spamscore=0 adultscore=0 phishscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402080131 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790375743518137008 X-GMAIL-MSGID: 1790375743518137008 |
Series |
Introduce QC USB SND audio offloading support
|
|
Commit Message
Wesley Cheng
Feb. 8, 2024, 11:13 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 a1e0363bd760..e3556c397b39 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