Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp52270rdb; Wed, 18 Oct 2023 18:01:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKiJGwEPnduD7fGMamlb/9uqQZetWGQf8CUJLlvsoAODagkZQ+8xO9GDTpcRrJ3TqSROwJ X-Received: by 2002:a05:6870:110f:b0:1d6:cbcd:80f8 with SMTP id 15-20020a056870110f00b001d6cbcd80f8mr853353oaf.54.1697677296918; Wed, 18 Oct 2023 18:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697677296; cv=none; d=google.com; s=arc-20160816; b=aZkGmHpYl5NgL8lqK4V8U//co6sBvHVaOl9Gvl7xzgo1EcmDmd2DCfdnajQIL4gRy6 Hl756AWc6u+h4Uo8/tw5U3aqfgU9QhsYlJ8tnlbdLvwW9/IEa89UrK5i02e6G41zB/6x 1Mu9O8kL4bbr5e+fpjde1pSkpydiB48mnPsFoy3Ru/OEU0OcRw1qep22xFpWrCb7Ijyj 2tAX6DjNZFKAHoP7YRPVqekVi090fAmQ1s7xVROA0h7sRBBj4FJZcr4hCHnZATUwGE+U snbV6AhvEP7Iy5NpZOUPcCuZizl/iD6MNiGzlhA8/z6yph04rQYr+mwKM1KhtWNfNwlG +2lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=cR1dwz0zXrLfTDcJcqzJYdtdZWzRK0fZ1IO29Q5Vzxw=; fh=9+IEscr4WmNbE41gibPc+AZ0nx0+/tccCXbA5gmgnS8=; b=TeEH6f8nUaZbvOhxH4LE28bTkkchMs/5oyIPWAMYCTvw3qzyHxiaJVOGKoEfw98qQz oNL/NDaaQrs0FII55/bKR5XSotgaUbfjIvKSi0HpFnjzLPSIF7JcsjtKtKpfOciPyewr wig9fZgaUQj5vwGbo90ZJ3xzH5qckZ/ZWY8yBK1AOtIYwmRO1iB631HvL5wkI2pz5j1p 2A8HOdgol08oV6LM64DmhuM6M0SSpGC1JQINFD+0UOxKykZk96XGmgxRloqOFjkOmCcA bVe1pV5xRM8yUqbGeJ5Vu6BvW+3avjev5bwAT/YaIbG+tAGMy44Di/zORX9dNTHEwyff dRdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UyKHNnGH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id bk13-20020a056a02028d00b005a9fde46fa1si3116547pgb.343.2023.10.18.18.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 18:01:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=UyKHNnGH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 4D498805F409; Wed, 18 Oct 2023 18:01:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231828AbjJSBBP (ORCPT + 99 others); Wed, 18 Oct 2023 21:01:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231204AbjJSBBN (ORCPT ); Wed, 18 Oct 2023 21:01:13 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EA47B8; Wed, 18 Oct 2023 18:01:10 -0700 (PDT) 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 39J0VwMb031097; Thu, 19 Oct 2023 01:00:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=cR1dwz0zXrLfTDcJcqzJYdtdZWzRK0fZ1IO29Q5Vzxw=; b=UyKHNnGHiU45oj+7DOr0fR6/vIuf0UMhACCTkf3dO2j2IXb0ARbdutVkQNfTEKmKy0D/ 2gH43Xubt53BjRxgqxrZx1Nd9ZpQnt9sP1bKRGNLVvGBbXlzFgiMPZlO4dQZasD6xyuj CH7dT6uGdcJKNj87tUDmOSGlXEZWgeQv3XqieGAN2kCxu+yk40OKR2yC6Hf3gtlDj6HW DGsLFH/PaCl2qvy3ha7eeO9a9Bj5SX3+XoJ4GeZsMKfLTxp1FwDtZp8lKj8kPDz6YAmU 9YcYF+tpkoPuunvMJwYnFequcNcKkrdE0m17pTI3HTSBQJIk7iE3D3p/opbeHzYCJXn8 3A== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ttg82sde0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Oct 2023 01:00:54 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 39J10rq6015142 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Oct 2023 01:00:53 GMT Received: from [10.110.123.255] (10.80.80.8) 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.39; Wed, 18 Oct 2023 18:00:52 -0700 Message-ID: <1620550b-bbd5-bca3-c95b-6a01d3aed7f7@quicinc.com> Date: Wed, 18 Oct 2023 18:00:52 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v9 28/34] ASoC: qcom: qdsp6: Add support to track available USB PCM devices Content-Language: en-US To: Pierre-Louis Bossart , , , , , , , , , , , , , , , CC: , , , , References: <20231017200109.11407-1-quic_wcheng@quicinc.com> <20231017200109.11407-29-quic_wcheng@quicinc.com> <7d596a0a-fb98-458a-bd74-d22f15c0f0d8@linux.intel.com> From: Wesley Cheng In-Reply-To: <7d596a0a-fb98-458a-bd74-d22f15c0f0d8@linux.intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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: _DIVjw2Tl3aBovN25ss1PqPWynBB9R_n X-Proofpoint-ORIG-GUID: _DIVjw2Tl3aBovN25ss1PqPWynBB9R_n X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-18_19,2023-10-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 adultscore=0 bulkscore=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310190005 X-Spam-Status: No, score=-4.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Wed, 18 Oct 2023 18:01:30 -0700 (PDT) Hi Pierre, On 10/17/2023 3:43 PM, Pierre-Louis Bossart wrote: > > > On 10/17/23 15:01, Wesley Cheng wrote: >> The USB backend should know about which sound resources are being shared >> between the ASoC and USB SND paths. This can be utilized to properly >> select and maintain the offloading devices. >> >> Signed-off-by: Wesley Cheng >> --- >> sound/soc/qcom/qdsp6/q6usb.c | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/sound/soc/qcom/qdsp6/q6usb.c b/sound/soc/qcom/qdsp6/q6usb.c >> index 329a7d4a3c01..d697cbe7f184 100644 >> --- a/sound/soc/qcom/qdsp6/q6usb.c >> +++ b/sound/soc/qcom/qdsp6/q6usb.c >> @@ -25,10 +25,18 @@ >> >> #define SID_MASK 0xF >> >> +struct q6usb_status { >> + unsigned int num_pcm; > > how would one know which ones are capture and which ones are playback? > > This really looks like a playback-only assumption, despite earlier > mentions of capture supported. > Yes, playback only, which is the reasoning for only having one parameter here. I will rename it though to be clearer. Thanks Wesley Cheng >> + unsigned int chip_index; >> + unsigned int pcm_index; >> +}; >> + >> struct q6usb_port_data { >> struct q6afe_usb_cfg usb_cfg; >> struct snd_soc_usb *usb; >> struct q6usb_offload priv; >> + unsigned long available_card_slot; >> + struct q6usb_status status[SNDRV_CARDS]; >> int active_idx; >> }; >> >> @@ -110,6 +118,14 @@ static int q6usb_alsa_connection_cb(struct snd_soc_usb *usb, >> if (connected) { >> /* We only track the latest USB headset plugged in */ >> data->active_idx = sdev->card_idx; >> + >> + set_bit(sdev->card_idx, &data->available_card_slot); >> + data->status[sdev->card_idx].num_pcm = sdev->num_playback; > > there you go... > >> + data->status[sdev->card_idx].chip_index = sdev->chip_idx; >> + } else { >> + clear_bit(sdev->card_idx, &data->available_card_slot); >> + data->status[sdev->card_idx].num_pcm = 0; >> + data->status[sdev->card_idx].chip_index = 0; >> } >> >> return 0;