From patchwork Sat Sep 16 00:10:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 140982 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1519370vqi; Sat, 16 Sep 2023 00:03:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLOp/F3tw+7ReWGef8Ow+1ZgLa9YBvdIZ/OXvbUzJU+kE7TjuuaektS2qvReMiNLc2d3s5 X-Received: by 2002:a05:6a20:394b:b0:138:2fb8:6b42 with SMTP id r11-20020a056a20394b00b001382fb86b42mr4763630pzg.14.1694847791160; Sat, 16 Sep 2023 00:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694847791; cv=none; d=google.com; s=arc-20160816; b=YOKo8FHf7IuTJFBBvC9tYf81GdKXamuQN9FPW7S/VQlTxNFvhIMs/9bBHcyjs6Lt8N XsIzoEKF/lrJRHi1vsP8LJzGfute4baXCSKSYzmbYSFcVX0hZERPBhvgIrinyRFk7Tsp ecaf8EpDXsSOSazIY0O6nBOGwZstJdbrbKpA4LnBAeHb7wfMTekv7sFw3KLmi/ApRHvu JTTsV+6KJ751hzUvHmOd9JjYG/10af0VxHFa48apNqRLwUAzOjqTZ8sZUJUp6LDtg1QO N2h/JwSUTEAqr1r3ltW1f8svV2wTW3HrcWyPVMd3hQ6oguXtK1yEcF4YR12zos74fyKy R3/A== 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=n5lsHSOuhOpCEIHfc2UBND64vYtpFQLLlOZE/NYUxRo=; fh=MhCCCRx4c0AeUz43uLzZOKA4YzcBN2mk3tAWrRRVvW4=; b=B6HN4rh265GA5snIkIQKxbUwWbPlSj4ZpFwEfKNcdNXT+kBBebHRTqqt4YLRiiVlD+ mZTYjtYJQb2cVvf4Xg3yqYlXOjWBPY9rIBhzjdTJWxA35Pb60EMeq/g1DHzqT1mz0uLn 1rCg7Tm8k6h96lQPRm4tuGJD00khXCDF498wb5v+HDcqgqn+Uu5p2KNXbqv6kh9jzdA8 k7zoDyfbcnRnbAobFrkms1WIcd8pm2DWyWddfqXjTUr2YhTzZ/6+DbiQIfW+9VJt+yox nqZKmzztW8TEgZZ7H0HLNEVMPk72t9NlAQnPeH9sZsNsFxwKSfatznvKI8WlLiaM7OL5 r9Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=JFP79C39; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id i4-20020a639d04000000b005740ab95917si4392978pgd.45.2023.09.16.00.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 00:03:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=JFP79C39; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id BD3D48286E92; Fri, 15 Sep 2023 17:15:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238350AbjIPAMX (ORCPT + 28 others); Fri, 15 Sep 2023 20:12:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238199AbjIPALP (ORCPT ); Fri, 15 Sep 2023 20:11:15 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F9CF98; Fri, 15 Sep 2023 17:11:10 -0700 (PDT) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38FNgMqs001777; Sat, 16 Sep 2023 00:10:44 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=n5lsHSOuhOpCEIHfc2UBND64vYtpFQLLlOZE/NYUxRo=; b=JFP79C395r4m4b9WlbsCjjPhS3JYRvExslNgb7ynadAmJ3G2FWrnno94hgEIiSMgTp12 hNawOwlikVFtrB3Eczgw3CRBHqRC+LTWPSIfcrxd3rkRCwds7q9a0y71t0w9HvwZbjah sQGOQ+HvfWoHboDoqtIUP2NllsGwRkmg8VOkvTbhg2QhwT/vp71b0PzUhRvSwIMoNg4V w9zQU2F4lsctVcDe5Gehbj8R5gTwds9l3qmescDGdcnOH8LosoqTzMPu9vOirlUEyU30 7f3EVE0xWdfBjXMyp/e9WcP/DBBj10eZHklwaV3y1dkItZZaEpjXAhrSaFSMUahSJ/OQ 4w== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t4g2xjhmr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 16 Sep 2023 00:10:44 +0000 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 38G0AhZG027134 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 16 Sep 2023 00:10:43 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.36; Fri, 15 Sep 2023 17:10:42 -0700 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , Wesley Cheng Subject: [PATCH v6 21/33] ASoC: qcom: qdsp6: Ensure PCM format is supported by USB audio device Date: Fri, 15 Sep 2023 17:10:14 -0700 Message-ID: <20230916001026.315-22-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230916001026.315-1-quic_wcheng@quicinc.com> References: <20230916001026.315-1-quic_wcheng@quicinc.com> MIME-Version: 1.0 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: k08PAAZime_vlhHrb3UOO8R116JcLrqD X-Proofpoint-ORIG-GUID: k08PAAZime_vlhHrb3UOO8R116JcLrqD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-15_20,2023-09-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 phishscore=0 impostorscore=0 adultscore=0 mlxlogscore=989 bulkscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309160000 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 15 Sep 2023 17:15:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777176717889866268 X-GMAIL-MSGID: 1777176717889866268 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 --- sound/soc/qcom/qdsp6/q6usb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/q6usb.c b/sound/soc/qcom/qdsp6/q6usb.c index f0e3e87ba1f0..0467d8a533fb 100644 --- a/sound/soc/qcom/qdsp6/q6usb.c +++ b/sound/soc/qcom/qdsp6/q6usb.c @@ -44,7 +44,10 @@ 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; + + return snd_soc_usb_find_format(data->active_idx, params, direction); } static const struct snd_soc_dai_ops q6usb_ops = {