[RFC,12/14] sound: soc: qcom: qusb6: Ensure PCM format is supported by USB audio device
Message ID | 20221223233200.26089-13-quic_wcheng@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6000:1b02:0:0:0:0 with SMTP id f2csp32135wrz; Fri, 23 Dec 2022 15:33:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXtfNjWyAsp7W2ou1JzWwis7C0508+0yRLMAwSeANRbUC54yjGAaTiyFYgiBPOvuJR/xWSfp X-Received: by 2002:aa7:c30b:0:b0:47b:a6e:6ba5 with SMTP id l11-20020aa7c30b000000b0047b0a6e6ba5mr9131467edq.12.1671838435515; Fri, 23 Dec 2022 15:33:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671838435; cv=none; d=google.com; s=arc-20160816; b=TPLdvaxzdHD30wIC13Xuag3xH4pMXd9Z8bUtWWD6UWc6Mv/aDZzcgflMhfc6zhZ/UK HxuO5utwSBk691Lg70BXTlOGy4192SwGzpw3kOg1ebmRMozOfHTx6RHHCyaGwZt1Y3rv 1q05sdda4srupB/su86suiOHPextZJkCa31gRBtz89B/gXSwL9vOfICqBu4dcTS4o7me fyd+N4A+mPOu8AxmCvE0/f70D01nrYFVXP6MdThJIzViH2SEpHOdYRA88hfeguPa1RG0 yWR5tblIseaQamhlJ63DFPgMP0meTTw9FHl7jMtmB/iLHaa2E6jpC1If4ijMpa08ifUc y/DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=qUCscePKihIFBMdxnTm5jSbbeyncpZ92egDlWPvRgW0=; b=QG12U+1eGrG5ZHDqaCtw7kXWXhLYxsfbwxV+ZRIAstfHDV8I2ldMjhnjC/O6OM/I45 cLXGrTZHJfMXXpMSR5+cZSSjREcZbKEjdJvDNgvRFBmWRXCT6/4/FBAmMiG+nAvI8Ps8 o7GSvLL7ZdTZSIQcCgsMjjl8Paafdpw6bxgGEGpUuA4A9aFSpFKmvFandtzJRvcyJB1N qtqGg/sZHH8/xsj21c3hAlKE757yMPlzwPCDBlxP56CYaVe+yMrlCsCKE54/FhqTFl0u rPNBgPVXg1NUJsUpTIb+IPxZopDcM6BQEzmEtotQwLDXtLTTic+amB684HbP1LLV8xmN IhWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ZkKhDvgW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a50ab0d000000b0046125ddf5easi3868132edc.185.2022.12.23.15.33.30; Fri, 23 Dec 2022 15:33:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ZkKhDvgW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231194AbiLWXdL (ORCPT <rfc822;pacteraone@gmail.com> + 99 others); Fri, 23 Dec 2022 18:33:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230157AbiLWXdJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 23 Dec 2022 18:33:09 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0C7410FCF; Fri, 23 Dec 2022 15:33:08 -0800 (PST) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BNNU9uV003339; Fri, 23 Dec 2022 23:32:48 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=qUCscePKihIFBMdxnTm5jSbbeyncpZ92egDlWPvRgW0=; b=ZkKhDvgWop6EVeKG3r16AkQu2rq/G3xyNaFMzP4+MohhsFJeKuhv48x6llbNz6sxCEmW AKWnvz2InpniLZqGYWEkOiU8LdzV5/g3eVCSjZzu7hSExP7PHQJfrYN2Ns6EaK30YPz3 nX7HKBCoSlfSXtgkntRcw2RVXzQLZu/pi9RCzn3UEhamlKsrkOBnof9xe/vAJx/sSNGb 7YLQIF3elihvpGRHSz304u91MdWtYVb2kRLeqD6NJYWD6smVHzlcV59EN7894B4t39m/ 2q9pKDJ2BzfdMatq42UT2fS3oZPSxfT8Yao2AzIgdzuwaAtYOvkhEjWaYjSA1LUnV6N6 3Q== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3mm3cjx2m5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Dec 2022 23:32:48 +0000 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 2BNNWl84001241 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Dec 2022 23:32:47 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.986.36; Fri, 23 Dec 2022 15:32:46 -0800 From: Wesley Cheng <quic_wcheng@quicinc.com> To: <srinivas.kandagatla@linaro.org>, <mathias.nyman@intel.com>, <perex@perex.cz>, <broonie@kernel.org>, <lgirdwood@gmail.com>, <andersson@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <gregkh@linuxfoundation.org>, <Thinh.Nguyen@synopsys.com>, <bgoswami@quicinc.com>, <tiwai@suse.com>, <robh+dt@kernel.org>, <agross@kernel.org> CC: <linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>, <alsa-devel@alsa-project.org>, <devicetree@vger.kernel.org>, <linux-usb@vger.kernel.org>, <quic_jackp@quicinc.com>, <quic_plai@quicinc.com>, Wesley Cheng <quic_wcheng@quicinc.com> Subject: [RFC PATCH 12/14] sound: soc: qcom: qusb6: Ensure PCM format is supported by USB audio device Date: Fri, 23 Dec 2022 15:31:58 -0800 Message-ID: <20221223233200.26089-13-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221223233200.26089-1-quic_wcheng@quicinc.com> References: <20221223233200.26089-1-quic_wcheng@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.49.16.6] 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: NpacJDGBM8v1OaWa7CaWQa7WYsAkJ64T X-Proofpoint-ORIG-GUID: NpacJDGBM8v1OaWa7CaWQa7WYsAkJ64T X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-23_08,2022-12-23_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=970 impostorscore=0 spamscore=0 phishscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212230197 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753049659281445660?= X-GMAIL-MSGID: =?utf-8?q?1753049659281445660?= |
Series |
Introduce QC USB SND audio offloading support
|
|
Commit Message
Wesley Cheng
Dec. 23, 2022, 11:31 p.m. UTC
Check for if the PCM format is supported during the hw_params callback. If
the profile is not supported then the userspace ALSA entity will receive an
error, and can take further action.
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
---
sound/soc/qcom/qdsp6/q6usb.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Comments
Hello! On 12/24/22 2:31 AM, Wesley Cheng wrote: > Check for if the PCM format is supported during the hw_params callback. If > the profile is not supported then the userspace ALSA entity will receive an > error, and can take further action. > > Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com> > --- > sound/soc/qcom/qdsp6/q6usb.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/qcom/qdsp6/q6usb.c b/sound/soc/qcom/qdsp6/q6usb.c > index a9da6dec6c6f..128e0974db4e 100644 > --- a/sound/soc/qcom/qdsp6/q6usb.c > +++ b/sound/soc/qcom/qdsp6/q6usb.c > @@ -42,7 +42,14 @@ static int q6usb_hw_params(struct snd_pcm_substream *substream, > struct snd_pcm_hw_params *params, > struct snd_soc_dai *dai) > { > - return 0; > + struct q6usb_port_data *data = dev_get_drvdata(dai->dev); > + int direction = substream->stream; > + int ret; You don't seem to need this variable, just use *return* snd_soc_usb_find_format(...). > + > + ret = snd_soc_usb_find_format(data->active_idx, params, direction); > + > + return ret; > + > } > static const struct snd_soc_dai_ops q6usb_ops = { > .hw_params = q6usb_hw_params, MBR, Sergey
Hi Sergey, On 12/24/2022 12:19 AM, Sergey Shtylyov wrote: > Hello! > > On 12/24/22 2:31 AM, Wesley Cheng wrote: > >> Check for if the PCM format is supported during the hw_params callback. If >> the profile is not supported then the userspace ALSA entity will receive an >> error, and can take further action. >> >> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com> >> --- >> sound/soc/qcom/qdsp6/q6usb.c | 9 ++++++++- >> 1 file changed, 8 insertions(+), 1 deletion(-) >> >> diff --git a/sound/soc/qcom/qdsp6/q6usb.c b/sound/soc/qcom/qdsp6/q6usb.c >> index a9da6dec6c6f..128e0974db4e 100644 >> --- a/sound/soc/qcom/qdsp6/q6usb.c >> +++ b/sound/soc/qcom/qdsp6/q6usb.c >> @@ -42,7 +42,14 @@ static int q6usb_hw_params(struct snd_pcm_substream *substream, >> struct snd_pcm_hw_params *params, >> struct snd_soc_dai *dai) >> { >> - return 0; >> + struct q6usb_port_data *data = dev_get_drvdata(dai->dev); >> + int direction = substream->stream; >> + int ret; > > You don't seem to need this variable, just use *return* > snd_soc_usb_find_format(...) > Thanks for catching this... Will fix it in the next submission I make. Happy holidays! Thanks Wesley Cheng
On Fri, Dec 23, 2022 at 03:31:58PM -0800, Wesley Cheng wrote: > Check for if the PCM format is supported during the hw_params callback. If > the profile is not supported then the userspace ALSA entity will receive an > error, and can take further action. Ideally we'd wire up constraints for this but that gets complicated with DPCM so it's probably disproportionate effort. Otherwise other than the subject lines not using ASoC on this and the previous change I don't have any issues that other people didn't raise, but then most of the complication is in the USB bits.
diff --git a/sound/soc/qcom/qdsp6/q6usb.c b/sound/soc/qcom/qdsp6/q6usb.c index a9da6dec6c6f..128e0974db4e 100644 --- a/sound/soc/qcom/qdsp6/q6usb.c +++ b/sound/soc/qcom/qdsp6/q6usb.c @@ -42,7 +42,14 @@ static int q6usb_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - return 0; + struct q6usb_port_data *data = dev_get_drvdata(dai->dev); + int direction = substream->stream; + int ret; + + ret = snd_soc_usb_find_format(data->active_idx, params, direction); + + return ret; + } static const struct snd_soc_dai_ops q6usb_ops = { .hw_params = q6usb_hw_params,