From patchwork Thu Sep 21 21:48:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 143180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5325708vqi; Thu, 21 Sep 2023 21:57:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1hjRDtgBfoqWM4XOrCR+gX+A2Tbk98Aef/nGyNWW/HB+w0dYGrq0TW9rCRXeshhb9x74S X-Received: by 2002:a54:4806:0:b0:3a4:3b56:72b2 with SMTP id j6-20020a544806000000b003a43b5672b2mr7461796oij.8.1695358672568; Thu, 21 Sep 2023 21:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695358672; cv=none; d=google.com; s=arc-20160816; b=hl78SrGat9iGX32DTwzJRtPig7tZFmA9GAPb5jy/oyds96mQCqCL7cXYt5DsJQct3Y X7DH3dOZ4dXE+p6UsTzIHmQTx0sW3jFhFClvSONHpbCFv0gLevIkizBNt7PxZbOxgJ3n lkYipyuyCx+k+NEEN0u1Srb6F4oRA6Jp/ylqxtnPoe21PbDHOBPzVtKZNEX5OcgOOHoT U3ssOT8rXaHpoTIpC8CUDKoRnTMhhITmMFKs8IPM7G85K3kNnjU3EoMvZk7oL6JzhqWJ hvNQc2mHA0efS0iBIesCmMWpbu9wu0AMztZmYsy96ZHo33nocx82htT2QNCOj0N5AZCo QXrg== 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=ob93bqxahOMEufwrgeaLvvgzI4mtSXSHT7C0WZfYQpA=; fh=MhCCCRx4c0AeUz43uLzZOKA4YzcBN2mk3tAWrRRVvW4=; b=v6kNyzsqHoWDVxjQEFTYHXtghW7YJEpiNe8p3SvuMp4KFmwg/QVU8IhQZME+9wkbhb g7R9EL1jS9T8+q73nIfVpWcTP4FJ61OdR2RzLibGjt6B9a+NCTdabALI0tP3BGnMfKlX iWLNPLBflkw3uYG8uSifGGHmFIBPnIJ7q18s+rwCbrENs+cwr1/ol3tmQS8JyVG1kSIi MbMj8cJvYYfcYbly331h92WRxyEbzDT+cQsjh21ctgtyl9qLQEDix2Mt++kCWWTsUy5h yAdLucW8U9ZM9sIO/u5yobTnMIZLROUxiN8nxribPS/8FT93slHDZSbgz+SsSZeLw6zu PP4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Xa6ou7MK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id y129-20020a62ce87000000b0068fea8a6169si2804196pfg.404.2023.09.21.21.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 21:57:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Xa6ou7MK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 5F1E380530D5; Thu, 21 Sep 2023 14:55:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233090AbjIUVyf (ORCPT + 29 others); Thu, 21 Sep 2023 17:54:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232833AbjIUVxZ (ORCPT ); Thu, 21 Sep 2023 17:53:25 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 077EF3C14; Thu, 21 Sep 2023 14:49:55 -0700 (PDT) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38LKotbk002000; Thu, 21 Sep 2023 21:49:11 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=ob93bqxahOMEufwrgeaLvvgzI4mtSXSHT7C0WZfYQpA=; b=Xa6ou7MKTGHcdYtdm5dsnM1IVPg1XLveL9BMOwSF2CWYU1Fn8ILjaIOBzzeQrj1g97oW WBp3hYD9i4IjJcYNXdzF5Wdk+r/TMlGuWmbxVr/2crinKDl4yvq6LJZRBABh60FuV8/D AOS6CyWf4o7vhO0FAzgJDYvubbIhJavoJ6zRQ41ctJsBwRBaNjpa8JMX5uS9nCNu1M6r Wi4aVGjxeP4riRuGVtgfy9g6kJQxS6uv+187PyAqZdLAvkIzhU/uRibFK/qB+W16UZXe RivI/qxgz+49yretWPP5p+ubHF2/BuRSC6paJU+JHzVIOT2x3qeFbxhCCcfKu3DQ8c/N cQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t8u0s0bsf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Sep 2023 21:49:11 +0000 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 38LLmx3T009024 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Sep 2023 21:48:59 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; Thu, 21 Sep 2023 14:48:59 -0700 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , Wesley Cheng Subject: [PATCH v7 21/33] ASoC: qcom: qdsp6: Ensure PCM format is supported by USB audio device Date: Thu, 21 Sep 2023 14:48:31 -0700 Message-ID: <20230921214843.18450-22-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230921214843.18450-1-quic_wcheng@quicinc.com> References: <20230921214843.18450-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: o10g6KvmgfuCCOMtyICd9ILCX4OK17H3 X-Proofpoint-ORIG-GUID: o10g6KvmgfuCCOMtyICd9ILCX4OK17H3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-21_19,2023-09-21_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 phishscore=0 suspectscore=0 adultscore=0 mlxlogscore=988 spamscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309210189 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Thu, 21 Sep 2023 14:55:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777712415693338125 X-GMAIL-MSGID: 1777712415693338125 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 dd664ad41668..329a7d4a3c01 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 = {