Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1654894rwb; Wed, 26 Jul 2023 16:34:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlFz86hfiKGiO9CgYZ104CRJgg52tnIrM6r7i6Bu0VB9x1e21gq6ODy8dan7pa5mWt5SI+KY X-Received: by 2002:a05:6a20:3d8b:b0:10c:7c72:bdf9 with SMTP id s11-20020a056a203d8b00b0010c7c72bdf9mr3524277pzi.29.1690414458304; Wed, 26 Jul 2023 16:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690414458; cv=none; d=google.com; s=arc-20160816; b=HDQUZqYucSm4XCbo1RkI1yiMnTgoIwCatCRZ41gXm5kltehfB2arTQlpA0NZ4zHelJ VzU2yLg0T5tkVpbCJkS6SahUJjcgm0qQRor34p+NcCRslGsMovJifXFYp9IASAOokm7M UtmGwP3NjLbDdFUQfZ2NIiadqn/fsQm84F8pNcnXwnGY5CrwJVoCGea/lrt+0VipGbue Un2jtqvpPAIZE3IuH3jbh13kvNuBnrWJ2wvckI4wSuaJ1ox5rBvtxx0+S2G74FgqTf5+ /9dSAjAIU2zGq52VfNLmdkxC5lkimklrpou6l9l8SPbcm0cCnZp7XkbITUxTcGjb520Z bKZQ== 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=hst80EK+5jLT39EI5q3/zwn9B9Ep+cXarB3YmbOzyXc=; fh=WqsIC/GRGEc8JUoa1K4F4H4BcLy68pBnbNgOxc1yDes=; b=JZwlPwaacoB6r8J87/eeMfprHKysNYi0qVB0t7y2ck778FdQCS9TAA6GbI2fImjZ43 Z2OciYlfZgazdkzf//8NFtXcBOcGs7AwBqy7UdsQavMJ8uD/kNs7R9gpp+5/lc0rKwQs opCR3Q/JQQpuNAnQQiFPlG3FwQJ9IlMro1c1qaBiplNEBbHqu/33ZRgMfgDaq1VcRN04 i5WPenVhMj382B0Vssp6Sb9YkFLQQ/IRkIcsEsYSiqpDIpu8mjxR0nGhd8L3SAJTn42l QxOjI00rdAGTqah53F8NhSiGLmzALcp1fV7JSC2vaQBVC05vtKkLxIb6ny0XRqQtZAvt R1Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=k+D9BFUC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s34-20020a632162000000b00563dc234457si90026pgm.377.2023.07.26.16.34.05; Wed, 26 Jul 2023 16:34:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=k+D9BFUC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230191AbjGZXHY (ORCPT + 99 others); Wed, 26 Jul 2023 19:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbjGZXHX (ORCPT ); Wed, 26 Jul 2023 19:07:23 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E12271737; Wed, 26 Jul 2023 16:07:18 -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 36QN1hxG022941; Wed, 26 Jul 2023 23:06:44 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=hst80EK+5jLT39EI5q3/zwn9B9Ep+cXarB3YmbOzyXc=; b=k+D9BFUC0fJBW78f71nfk0im2alc0BGH1qMBS4AYsZnYbJloNpoqDNB9xDoR+QBuGCmy y3h7ItHHHOurVFQnRhiGXo3yCkpI/vjB6yWNMrO3k+IJ+OzxHs7GzA2jyeg5va8SwJsg EazS5Yaj0LfyuVpRU82PCm0q/XB/ExbaVVx+WQgPuH99DR50k7HtrQup43hoKUTxEDJb uWyfFCg5bz3S6nfwTkmj2jHD4je+AWd/bm8cfH88ScAh0bv3AnlTkw09ndIwTx251Si3 Amnh0dqAC7dwY+9crEGIa0DQE4swWFSl3IqJIpaVFLOHLCM4YUExeiiG1rNJSHRqfZ5Z ug== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s3afyr785-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jul 2023 23:06:44 +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 36QN6hoF031629 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jul 2023 23:06:43 GMT Received: from [10.110.23.161] (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.30; Wed, 26 Jul 2023 16:06:42 -0700 Message-ID: Date: Wed, 26 Jul 2023 16:06:41 -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 v4 27/32] sound: soc: qdsp6: Add SND kcontrol to select offload device Content-Language: en-US To: Pierre-Louis Bossart , , , , , , , , , , , , , , , , CC: , , , , , , , , , References: <20230725023416.11205-1-quic_wcheng@quicinc.com> <20230725023416.11205-28-quic_wcheng@quicinc.com> <82568c9d-05b8-54dc-47e9-05c74a9260be@linux.intel.com> From: Wesley Cheng In-Reply-To: <82568c9d-05b8-54dc-47e9-05c74a9260be@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: nasanex01a.na.qualcomm.com (10.52.223.231) 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: zHrkparVg1APzQLo3hBS0lfjhvKXkqdF X-Proofpoint-ORIG-GUID: zHrkparVg1APzQLo3hBS0lfjhvKXkqdF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-26_08,2023-07-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 bulkscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307260207 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,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 Hi Pierre, On 7/25/2023 2:16 AM, Pierre-Louis Bossart wrote: > > > On 7/25/23 04:34, Wesley Cheng wrote: >> Expose a kcontrol on the platform sound card, which will allow for >> userspace to determine which USB card number and PCM device to offload. >> This allows for userspace to potentially tag an alternate path for a >> specific USB SND card and PCM device. Previously, control was absent, and >> the offload path would be enabled on the last USB SND device which was >> connected. This logic will continue to be applicable if no mixer input is >> received for specific device selection. >> >> An example to configure the offload device using tinymix: >> tinymix -D 0 set 'Q6USB offload SND device select' 1 0 >> >> The above will set the Q6AFE device token to choose offload on card#1 and >> pcm#0. Device selection is made possible by setting the Q6AFE device >> token. The audio DSP utilizes this parameter, and will pass this field >> back to the USB offload driver within the QMI stream requests. > > I must be missing something... If you have a card 0 which exposes a > control to change what the card1 does, then it means you have a card0 > with a PCM device what can potentially be used concurrently with the > card1 exposing an offload device. > > Is there any sort of mutual exclusion to make sure the same USB endpoint > is not used twice? > > One would hope that when a device is opened the matching non-offloaded > one (or ones in the case of implicit feedback) is disabled or marked as > used? > > I would guess in your Android setup you have control on such behavior at > the HAL level, but in the more generic Linux use I don't see what > would orchestrate the use of two devices, and at the kernel level what > would prevent it. > Still going through the comments and trying to address the suggestions in the code, so will reply pack to those as I make the needed changes. As for the above question, the following change was made with the intention to prevent the above scenario. https://lore.kernel.org/linux-usb/20230725023416.11205-23-quic_wcheng@quicinc.com/ Thanks Wesley Cheng