From patchwork Thu Sep 21 21:48:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 143320 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5448822vqi; Fri, 22 Sep 2023 03:06:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFkwXh7PejASMHKZXsSw//fmFXIlBsRkBuHgTVJ6JheXeysOIBT8/vvgncjLe+NJnq32HCN X-Received: by 2002:a05:6a00:cd4:b0:68f:f741:57a1 with SMTP id b20-20020a056a000cd400b0068ff74157a1mr9237541pfv.7.1695377186297; Fri, 22 Sep 2023 03:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695377186; cv=none; d=google.com; s=arc-20160816; b=xZZghYN7MpEvvUYahu79/p/Ep9szemKwdpocsHVIggxODr/xYtTEmheb/clNzNtW5s /dMbF3G8Iej5WEzo6YU3zyziysP1pIWndDtcYGCXRiSwyQzrdL0YOjjMu6ej9YCHShuE 7n4eVY/qrY4D0MJNDUEaSd+4pM55EFDKNWbm0YtBIDg3Jp71vGUvUJZ5FAF34g9l6q+O pN1kUAzH72r8/Pzw3XnlDyBBH5vdD2D8efWbVcFxSurumW8oP/JLyr9MBWPbEMxEUgDd daaaJ4/kNVOKmYFnaQzZwLeLbx7Zi9cYGKTeAN2dyYQ7E1uPQrO7GsuFZ1xqoE126J1c cKow== 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=e0W9a3ggrYIVw0XCJb6rDIkBiGQl97APIxzQ9iCtvxI=; fh=MhCCCRx4c0AeUz43uLzZOKA4YzcBN2mk3tAWrRRVvW4=; b=srpzgfCHaks+gKYE6xILyMWoA4LfJvTo7Ww6Amz7sZTDAqNR3lM0Pyk4/+Z+Ei+QpJ uieO5YVx6qxBd42qVaDnZiqoenyW1BRzrhPOeBq6m3WfKS+HVtJ9iiwO3bIcoNTIWRs/ EvU6f/IxPfT9+0L5HPhI8BnlW7BvVg9Y7OQvxMGfq4b6zMAP10ddApWcTTA3ETkBuew2 QAcGlV4OcduLQJ1LeJB6h3n5uQVer87PfShZNfmF+m2FcxOpLSa1p/p3dTyb4TZ5BId1 DkA3rWOnf54Qfsh7hYpZ03ZDajXyF5VZrWvgidQNQpa0wJheclvCf0Bo0b+TbGkUkTXK tp0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=XsOfqRh7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id g4-20020a056a001a0400b00690fb3c5cecsi3762284pfv.16.2023.09.22.03.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 03:06:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=XsOfqRh7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 389AF8325E97; Thu, 21 Sep 2023 14:54:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233057AbjIUVyM (ORCPT + 29 others); Thu, 21 Sep 2023 17:54:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230479AbjIUVxY (ORCPT ); Thu, 21 Sep 2023 17:53:24 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 313DA448F; Thu, 21 Sep 2023 14:49:43 -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 38LLXlub007813; Thu, 21 Sep 2023 21:49:21 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=e0W9a3ggrYIVw0XCJb6rDIkBiGQl97APIxzQ9iCtvxI=; b=XsOfqRh7hp/NDl08znqXS5nAowH8L4meC3n3b/zuMqljGYP7BkLlSB8xCe94SnbNMmVc OIn20ClDQM0pOLsBDtzXFsKUstPVN3chYTWmlbLs0cch+oiIl7in5ovByRDRfiodnTMa hO841Sy7AbHuPNXTcR3h63kgqRlMeg+CaTdQmtC9y5qRY2F8FXRs5o+PqBYi07v2ClDN HL0DoEqCxj6eB9gCdnLVoWMivIC6ab4Y9qqzS5TGpyUfA019gc1EIEpnpbL0RR3+tpb7 1BCTeYytXdb6WOzCfM8ObFN6xmLZXnaKCWUt50IIQbYmYIkRFDZyYoLUTOh+W1SF6YYS 3g== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t8txg8cb2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Sep 2023 21:49:21 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38LLn2Dp000321 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Sep 2023 21:49:02 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:49:02 -0700 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , Wesley Cheng Subject: [PATCH v7 31/33] ALSA: usb-audio: qcom: Use card and PCM index from QMI request Date: Thu, 21 Sep 2023 14:48:41 -0700 Message-ID: <20230921214843.18450-32-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-ORIG-GUID: CFPlal0ZwMRLzkXaGQQtPeD65UxO0UVs X-Proofpoint-GUID: CFPlal0ZwMRLzkXaGQQtPeD65UxO0UVs 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 clxscore=1015 priorityscore=1501 bulkscore=0 spamscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 impostorscore=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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 21 Sep 2023 14:54:20 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777731828073483354 X-GMAIL-MSGID: 1777731828073483354 Utilize the card and PCM index coming from the USB QMI stream request. This field follows what is set by the ASoC USB backend, and could potentially carry information about a specific device selected through the ASoC USB backend. The backend also has information about the last USB sound device plugged in, so it can choose to select the last device plugged in, accordingly. Signed-off-by: Wesley Cheng --- sound/usb/qcom/qc_audio_offload.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sound/usb/qcom/qc_audio_offload.c b/sound/usb/qcom/qc_audio_offload.c index 2dffe7e99e01..e482e62d5f37 100644 --- a/sound/usb/qcom/qc_audio_offload.c +++ b/sound/usb/qcom/qc_audio_offload.c @@ -109,8 +109,6 @@ struct uaudio_qmi_dev { bool er_mapped; /* reference count to number of possible consumers */ atomic_t qdev_in_use; - /* idx to last udev card number plugged in */ - unsigned int last_card_num; }; struct uaudio_dev { @@ -987,7 +985,7 @@ static int prepare_qmi_response(struct snd_usb_substream *subs, assoc = iface->intf_assoc; pcm_dev_num = (req_msg->usb_token & QMI_STREAM_REQ_DEV_NUM_MASK) >> 8; xfer_buf_len = req_msg->xfer_buff_size; - card_num = uaudio_qdev->last_card_num; + card_num = (req_msg->usb_token & QMI_STREAM_REQ_CARD_NUM_MASK) >> 16; alts = &iface->altsetting[subs->cur_audiofmt->altset_idx]; altsd = get_iface_desc(alts); @@ -1388,8 +1386,7 @@ static void handle_uaudio_stream_req(struct qmi_handle *handle, direction = (req_msg->usb_token & QMI_STREAM_REQ_DIRECTION); pcm_dev_num = (req_msg->usb_token & QMI_STREAM_REQ_DEV_NUM_MASK) >> 8; - pcm_card_num = req_msg->enable ? uaudio_qdev->last_card_num : - ffs(uaudio_qdev->card_slot) - 1; + pcm_card_num = (req_msg->usb_token & QMI_STREAM_REQ_CARD_NUM_MASK) >> 16; if (pcm_card_num >= SNDRV_CARDS) { ret = -EINVAL; goto response; @@ -1598,7 +1595,6 @@ static void qc_usb_audio_offload_probe(struct snd_usb_audio *chip) sdev->num_capture = usb_qmi_get_pcm_num(chip, 1); uadev[chip->card->number].sdev = sdev; - uaudio_qdev->last_card_num = chip->card->number; snd_soc_usb_connect(usb_get_usb_backend(udev), sdev); mutex_unlock(&chip->mutex);