Message ID | 20240217001017.29969-31-quic_wcheng@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-69563-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp71703dyc; Fri, 16 Feb 2024 16:26:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWADCgC/H4rU9II726ChV7WqxDwwmYIQmCun2ulC85z2bqD5A8d42QNExqfBNvu/mpzLmay7fMeuJ/v4t1BmovdtmL8kg== X-Google-Smtp-Source: AGHT+IFjdx1Y50j9aa68PyBhAFr/+jYJVXd4MvdPYh1bxzssa4GBxCCvPxIKIPk4vLdAuYZZfFAt X-Received: by 2002:a17:906:a29a:b0:a3b:fd70:f9e6 with SMTP id i26-20020a170906a29a00b00a3bfd70f9e6mr4154474ejz.5.1708129559948; Fri, 16 Feb 2024 16:25:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708129559; cv=pass; d=google.com; s=arc-20160816; b=F7KlCA3mig0B2qyVUw61T9XgCKcMYcKcsl0InUljrCedYblK1vj4TaITsBdmMcvf84 b/7zDXoJHx3A7DQ1ZF/EUvyZ5MBWxDWcmJo4MY0oz3k/WuXH48M0P/ac6fvc8JQNYzMl qutFFuPvd60I21r9poCLpNpNWLUMqqI7UNJvXE5kpGCpMaO49J8s8zxpomXNKBSrG5Wp TcQrxtJB4pZ/xGhi696YxNkBEmouXna7duUMfHFfzH8FxUzJ921VCJBWzb1kiZOUaCWQ 33+GexrG0ZX6Zngbd13cmmmNx23u6JCU0yFMisDXdBLybO67hUecOY/K7bFYCISPyc+X Hu1w== 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=3bwLuYCMG73fmLRYggLzUSc2Pw8XejmjpquTCB1HSg4=; fh=VKrp0Y7I/+wT36BfKZ6oI/4N9BIwFCn9zerObkOrgGw=; b=qC2sHxVz2LqeogIfywR6fhtw/6vBVdgEtjk8VvCZ4LbV+yUCExlL389Xs3NPez01WT vovpzQYWoejGpKSZ8CKayNkd3sNhShvU7soVUXpYaOrsdM8srZ8tjqlIrys5MmGpZCdD 0xJkEJiVlKTEdD8ofVi+xqZO44HBeC0ScENI/+ekA9JuMERrXfJPHV9Zw3vzOjGJ0QqC /m0LedcS/ydHp0moIW2FkVmPMr33Qb5sr08jaPQzyiqUOBv0edud4fOOJzT3EzLt5xag nEHa1+KlK2kOINMffwE6mzVY5yl3VLXTWwSeHXFK7idKDB+oqok2rclk9GOYN1ztekHD b8Pg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="g5/SemVR"; 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-69563-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69563-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 gz2-20020a170906f2c200b00a3d0d26c72esi380046ejb.317.2024.02.16.16.25.59 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 16:25:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69563-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="g5/SemVR"; 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-69563-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69563-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 8E1201F221BC for <ouuuleilei@gmail.com>; Sat, 17 Feb 2024 00:25:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9741914A0B6; Sat, 17 Feb 2024 00:11:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="g5/SemVR" 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 A7C2350A6E; Sat, 17 Feb 2024 00:11:00 +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=1708128665; cv=none; b=oeGfBhTnXJ7M9KbhP4a/1sWNyyo3QP+1n25zqGUc8XjnNUxTFXOYiFIdMNRBV/EPbpjUqoqIx2IkQ+Ie5Lcbw3cfRzC/0HesMIqL7jYPYO1yqArOXtZuFAlZArdYRkKS2cWvLSr65I/WK6bAHfiZPozqocueJyoxOVBjCyRTbXg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708128665; c=relaxed/simple; bh=4lnx2mrepTwqsAVALf/CpfYu3ABkH0WHKcZbALGTiRA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=om8ScMcXKDGYK0dSSCW5ddvod63m29YuIhNPJjLJjmefDiAfeLT5885ukBnr8/IisZH15xoBl8O7tDLcH6AG05XlMeJoaaPNg1tuOkJdnygwagJxGy21FwUuJ0M2PrSgr33922aHS4v/Y/qPLi1Bqz5xSeQp3oOEHMGTuowb9ok= 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=g5/SemVR; 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 (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41GNrwXI002078; Sat, 17 Feb 2024 00:10:39 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=3bwLuYCMG73fmLRYggLz USc2Pw8XejmjpquTCB1HSg4=; b=g5/SemVRBqBRnch7kMzThbX9mKdNXa82dsww 3LQtD7fBpVq3GnA5NryCyLIWDOw7zihNcTfDSbmr6UuILwSsxKUI9+Qin9Q7vk+1 Xm+U8XqClTLn3dNtu0sowYBKooohsx1wzvypGUbLSe7XPB45Sd6pp1RLLxdfivyv W4CJ2I3Nh8usf/YagrxNxBRqZcngVI32E2ylcRFCZnZGVolsuTdMTnxVjX9SCukN K6qbsMCMM6xTCtflnVRx+vY6oS5JYUo+w8zNcoSXnzWX+4DJE+D6k8Qek5CGtJkq FJiBkvOxRwheS22CJITJbGn6d4yIcb8xejhIPGmv0NW0C2u7qg== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w9xv9j898-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 17 Feb 2024 00:10:38 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41H0AcNP012916 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 17 Feb 2024 00:10:38 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:37 -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 v17 30/51] ALSA: usb-audio: Check for support for requested audio format Date: Fri, 16 Feb 2024 16:09:56 -0800 Message-ID: <20240217001017.29969-31-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: <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: 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-ORIG-GUID: BJKS9E6do4_EsoM1hFpxXBQphzuXes6O X-Proofpoint-GUID: BJKS9E6do4_EsoM1hFpxXBQphzuXes6O 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 malwarescore=0 clxscore=1015 bulkscore=0 adultscore=0 mlxscore=0 priorityscore=1501 suspectscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402160189 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791103661424470338 X-GMAIL-MSGID: 1791103661424470338 |
Series |
Introduce QC USB SND audio offloading support
|
|
Commit Message
Wesley Cheng
Feb. 17, 2024, 12:09 a.m. UTC
Allow for checks on a specific USB audio device to see if a requested PCM
format is supported. This is needed for support when playback is
initiated by the ASoC USB backend path.
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
---
sound/usb/card.c | 31 +++++++++++++++++++++++++++++++
sound/usb/card.h | 11 +++++++++++
2 files changed, 42 insertions(+)
diff --git a/sound/usb/card.c b/sound/usb/card.c index 7dc8007ba839..1ad99a462038 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -155,6 +155,37 @@ int snd_usb_unregister_platform_ops(void) } EXPORT_SYMBOL_GPL(snd_usb_unregister_platform_ops); +/* + * Checks to see if requested audio profile, i.e sample rate, # of + * channels, etc... is supported by the substream associated to the + * USB audio device. + */ +struct snd_usb_stream *snd_usb_find_suppported_substream(int card_idx, + struct snd_pcm_hw_params *params, int direction) +{ + struct snd_usb_audio *chip; + struct snd_usb_substream *subs; + struct snd_usb_stream *as; + + /* + * Register mutex is held when populating and clearing usb_chip + * array. + */ + guard(mutex)(®ister_mutex); + chip = usb_chip[card_idx]; + + if (chip && enable[card_idx]) { + list_for_each_entry(as, &chip->pcm_list, list) { + subs = &as->substream[direction]; + if (snd_usb_find_substream_format(subs, params)) + return as; + } + } + + return NULL; +} +EXPORT_SYMBOL_GPL(snd_usb_find_suppported_substream); + /* * disconnect streams * called from usb_audio_disconnect() diff --git a/sound/usb/card.h b/sound/usb/card.h index 02e4ea898db5..a03d0b5e242b 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -217,4 +217,15 @@ struct snd_usb_platform_ops { int snd_usb_register_platform_ops(struct snd_usb_platform_ops *ops); int snd_usb_unregister_platform_ops(void); + +#if IS_ENABLED(CONFIG_SND_USB_AUDIO) +struct snd_usb_stream *snd_usb_find_suppported_substream(int card_idx, + struct snd_pcm_hw_params *params, int direction); +#else +static struct snd_usb_stream *snd_usb_find_suppported_substream(int card_idx, + struct snd_pcm_hw_params *params, int direction) +{ + return NULL; +} +#endif /* IS_ENABLED(CONFIG_SND_USB_AUDIO) */ #endif /* __USBAUDIO_CARD_H */