From patchwork Tue Feb 13 00:54:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 200181 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp278213dyb; Mon, 12 Feb 2024 17:58:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVMBpSLl56FmyPHHLsD8YYRgkDoXEnuW3sBKQSV38xQEBWwEkuoriEpaqEuZI82QqoCCGV/hmdZ7Sm/pLAp6Ub6Putxcw== X-Google-Smtp-Source: AGHT+IGkySZQpt+VTSdZhgvb4TRusT2hLUocJQ4v+Ai5ERkT7qB6e99twFYoGWAe+G+xwhZ48H3C X-Received: by 2002:a17:903:32d1:b0:1d9:6cb4:3330 with SMTP id i17-20020a17090332d100b001d96cb43330mr11163894plr.12.1707789504814; Mon, 12 Feb 2024 17:58:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707789504; cv=pass; d=google.com; s=arc-20160816; b=m76Di3Wv9oDTMzb8GvSZlE1rEGyXiIVDfDFjCRe1kzrM5zbN3jFs9ruPi33X8w1Hf+ mQLohu2l491gcvh0qj6vWzaU5/22PYnWdKGQzU22D50O7cDNz7bAbaOhJneBCinkcOnv ESTOMBYZr5Vj12uEVsLmPHq7s8SOD6FTaZ1IniXcQi+AHv9gUWdfnGHr5kyfx9QNr8bL tmENvt12aEslwThT46ES/l4t8xdIKLHGSISN3W8H9lAXQyCjUNSZPew95wbapsQJ06UJ eoURbXvkALeolvMDSDhl7xbuOpl61ECj3Qfn7BfJeulxFOnHvc+FvNwcd0sia3Sfdual SOVw== 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=DYlDaoMzMP8hhWYbnbuVllKnwKPUMw5nutuR92LPe2U=; fh=YWjpg2PSm3rYmyVgp8IrmEhOOR9EU37w8Blb9IU0x0g=; b=lLznT+MTAjeOkGHfe5daz4JWNICVAbfueayyJCeBBpchsUmgi9FDsLJ7k4k4UB7nZz O7Bgc/sB5yemL62md6CW/p0KCscioodJZodw0SJo7HNfxy7WWYVd0p5LPdY0Ua+EYHw9 7J2U7HBqRxzWBC1L9a1sfXd20jE9B/P47GUmu0cEJ7Cmot1AhJ3n4fFfyFW04wvWrfQO cBdZMFqhS29RSm//iNjyDhIXE7+oYm2FOhwHlBfRJr/7et4LzbJkVhNnhE3dztqp5ATk ItxV3CMGthC3n5N4bs7aVQC8zfUhANY0RbsbjrsLZhMSvf2TUgVwa68Teyvx3hmtV8v7 cSfQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ghJ+1ivm; 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-62819-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62819-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=2; AJvYcCXoWXRH2miCEwtK6okJUBiVy54lDxPozrCH9SrBYaZmFAJGp4X64iN1W27MykEPLJeIqgFff3Ka/1qV7YKYMXt9+2vjUA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id jc5-20020a17090325c500b001d9055b6a4bsi1125662plb.418.2024.02.12.17.58.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 17:58:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62819-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=ghJ+1ivm; 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-62819-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62819-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 6F91DB2304B for ; Tue, 13 Feb 2024 01:36:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01F156310B; Tue, 13 Feb 2024 00:55:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="ghJ+1ivm" 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 BC6455914A; Tue, 13 Feb 2024 00:55:07 +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=1707785710; cv=none; b=dIbFcsr54D/DacyM734l32P5OsFehKBu+Z/hzm+yq3WFruHi/d72JQGb/RBzwfc5kDLxaRh00H7hTCKv4nAN98Eo8KjYj8hYtYl0fTbKCM7yav46YaO182eFLJ9v5dYXkvYdw6/pkqPO9W8qc3TXHiG9GP0vLK8lLhEq54/a7xI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707785710; c=relaxed/simple; bh=3t+oyyObCLNtDcTqp0pGT8TPY42C27S0xw+SlfeDuZ0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AOD+EMmd/nKflQ8MmfA/874RogceWcQlPSE7DF7eRXDgr6fZd5C0OUvUu310ROJAmOnPpE0XCAUnmXxOQ9VkH0faa4J6eKqBBCri9zOH/uAHyExg4pWu/eM6dfBRmvz08/TpJGliCXgvqtzWpSE6a4xrU0TBi40Z0wcrg1HUSvs= 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=ghJ+1ivm; 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 (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41D0GkKG012215; Tue, 13 Feb 2024 00:54: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=DYlDaoMzMP8hhWYbnbuV llKnwKPUMw5nutuR92LPe2U=; b=ghJ+1ivmyKilxYdOrWhdXlgFU7cV0lOqVxJb nEexJ/xK1jDCZH7/hqG7Sr1OE5WWI3U4QkJwi9iaWKgZkPZNP0R1LS94MGA9n1yr iWhAjonJZtH4U15XaEL9lv9DcP+I0QgK9nISbUYd9PzHmHKIm18nqM7MFQUpW2dh tH5NEB5dgywHezGymGEGmYSYQjed2riOgXo6u4UOpf6YYTzk4N+JmnsfKLuIrlRn 4EpvKexovlL1uZxzI0SdqY03X8P6mjakGJrfwjTN8+JFXZ4ybPyhrZKJ3YzZLiQp ZBANDOy+Tyv51qZjhzFGACzKAqHzSPdij052ORAfMJ20Bw67jw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w7q2y0vvw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Feb 2024 00:54:44 +0000 (GMT) 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 41D0sh5t031143 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Feb 2024 00:54: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.40; Mon, 12 Feb 2024 16:54:42 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v15 37/50] ALSA: usb-audio: qcom: Populate PCM and USB chip information Date: Mon, 12 Feb 2024 16:54:09 -0800 Message-ID: <20240213005422.3121-38-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240213005422.3121-1-quic_wcheng@quicinc.com> References: <20240213005422.3121-1-quic_wcheng@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) 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: bRV22WulYu8SOK51ErEE8ljXwscoxNiH X-Proofpoint-ORIG-GUID: bRV22WulYu8SOK51ErEE8ljXwscoxNiH 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-12_20,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 clxscore=1015 adultscore=0 mlxscore=0 impostorscore=0 mlxlogscore=678 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402130005 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790747087992318524 X-GMAIL-MSGID: 1790747087992318524 Currently, only the index to the USB SND card array is passed to the USB backend. Pass through more information, specifically the USB SND card number and the number of PCM devices available. This allows for the DPCM backend to determine what USB resources are available during situations, such as USB audio offloading. Signed-off-by: Wesley Cheng --- sound/usb/qcom/qc_audio_offload.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sound/usb/qcom/qc_audio_offload.c b/sound/usb/qcom/qc_audio_offload.c index 31c0cf5916a0..17cee0cf2ff5 100644 --- a/sound/usb/qcom/qc_audio_offload.c +++ b/sound/usb/qcom/qc_audio_offload.c @@ -172,6 +172,21 @@ enum usb_qmi_audio_format { USB_QMI_PCM_FORMAT_U32_BE, }; +static int usb_qmi_get_pcm_num(struct snd_usb_audio *chip, int direction) +{ + struct snd_usb_substream *subs = NULL; + struct snd_usb_stream *as; + int count = 0; + + list_for_each_entry(as, &chip->pcm_list, list) { + subs = &as->substream[direction]; + if (subs->ep_num) + count++; + } + + return count; +} + static enum usb_qmi_audio_device_speed_enum_v01 get_speed_info(enum usb_device_speed udev_speed) { @@ -1626,6 +1641,8 @@ static void qc_usb_audio_offload_probe(struct snd_usb_audio *chip) sdev->card_idx = chip->card->number; sdev->chip_idx = chip->index; + sdev->num_playback = usb_qmi_get_pcm_num(chip, 0); + sdev->num_capture = usb_qmi_get_pcm_num(chip, 1); uadev[chip->card->number].sdev = sdev; uaudio_qdev->last_card_num = chip->card->number;