Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2975804rdh; Wed, 27 Sep 2023 20:58:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAZGTMyMmIitWVi06a3pokglWopMBH82EfcnX85c9ZIkD57XCi1T4Emwz/wZi4JuXBrk2u X-Received: by 2002:a05:6358:9490:b0:142:fb84:92e6 with SMTP id i16-20020a056358949000b00142fb8492e6mr63707rwb.9.1695873487026; Wed, 27 Sep 2023 20:58:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695873486; cv=none; d=google.com; s=arc-20160816; b=hhiRVK5KneiCzF2G/lFzbV1MVaCRu4Zb5G3cukUtMQbWjyyL7xmCaGByB3v/v13Isv kbdHcWDjrZSSgO8GqDE7rvGM0vlLRKsLIVbJ3/FmGWDDlqJmxqy7UluqeHPCDcUd3OE0 GMLUDK1o59Wf5P/0qMabQhelY5ma1h3tU7NNssIk0Sx42gZFcCOup+XArjJEWwTXWh0a dzYaVIX+9jVjgCY28h8ZPAKYn/8xozj94NF3RCdaEMGCBiu1HIrYBkNUV1JijOdQk/lS fauaVEviWEd76JbVWOrtdF8Ue4lA2IaPuShmgCki0PkUqSA2Fj2DYFt6yqxv8fOM1Zb+ 2rHg== 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=90q9NOxzqefCLLb/rXZtD8+r2D3ym/pWfk2IUKZ2P14=; fh=2+uJqJbra/oRf09LKOWWXp4vapmNADgeD3EK1qrWXyA=; b=TpBflWYZNEh/VzpkHM1+MB9z7/2Ei8LgsJ3MifgUqtDJadlWQWjVwJxTC8JDF9VsE6 qdU49f6Q5S4GOOwuVmvwZKUXRmK/dOB36yyiUVqrt6aCtbJXThfwBWYgL5xD10ZC9hdA dbKAcmAM6fvoaE84TOW3PcrJGaMw1VPNWvTz9wYN8fF2l0XHTNu2Fe/fkrPKyijtvlNp GcO7Bk8ItAg62aPF0TKI6Ic5y4V2Lg1l6d6Jiszq+17n4xdP+UmgIIB9pmHcb9GskNM/ 53SAstsTGMacbniO15HNSz3zVx2dFh8+8RHB+rOIV9bihamgfqxQUajl2yikPG9aXVdZ u3cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=p2XOg6Yc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id n13-20020a65488d000000b0055e607f1e99si17069480pgs.882.2023.09.27.20.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 20:58:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=p2XOg6Yc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id ED3718051143; Wed, 27 Sep 2023 13:11:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229796AbjI0ULJ (ORCPT + 99 others); Wed, 27 Sep 2023 16:11:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbjI0ULI (ORCPT ); Wed, 27 Sep 2023 16:11:08 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1498ECC; Wed, 27 Sep 2023 13:11:06 -0700 (PDT) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38RJwqTa021844; Wed, 27 Sep 2023 20:10:42 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=90q9NOxzqefCLLb/rXZtD8+r2D3ym/pWfk2IUKZ2P14=; b=p2XOg6YcZGZGLpHOOt7i4Uo+22v250jwhaoPSt6xZpfZecBiXmB5+2pVpi9xwsdUV9Ue ImSn8bX2NDyelCp289GDLFnxMO+B4XUQzmV7cg3tGQV5Xz7bZvAwOAiO3Oiszf4GIgzt RyuLvcBLQQ8e4atLfGeOLthwQd1VcGxCh6Itk73mjTh7nrqtIiKqFRwL2n4CqmNeDTf1 lquhW1BN4dOS95+Sc+VKeWTdUGPnHAnRCW6DtQGnEXWWveZXAwk0NWjZrcX/KqlA7rt3 j4061mbSJmPp4CJDuNi0VeSR8YeBMUkMF10rx32/qxatSwoapIAo3L0HK1zOpLigjzHc pg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tcda7sy83-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Sep 2023 20:10:42 +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 38RKAfkE031384 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Sep 2023 20:10:41 GMT Received: from [10.110.25.80] (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.36; Wed, 27 Sep 2023 13:10:40 -0700 Message-ID: <191e6429-bb47-625b-a074-fa67ee052f03@quicinc.com> Date: Wed, 27 Sep 2023 13:10:40 -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 v7 29/33] ASoC: qcom: qdsp6: Add SND kcontrol for fetching offload status Content-Language: en-US To: Mark Brown CC: , , , , , , , , , , , , , , , , , , References: <20230921214843.18450-1-quic_wcheng@quicinc.com> <20230921214843.18450-30-quic_wcheng@quicinc.com> From: Wesley Cheng In-Reply-To: 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-ORIG-GUID: blIC-0fzkR4GdcVTYsm5N-g6sY1MOCnu X-Proofpoint-GUID: blIC-0fzkR4GdcVTYsm5N-g6sY1MOCnu 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-27_12,2023-09-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 bulkscore=0 mlxlogscore=783 priorityscore=1501 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309270171 X-Spam-Status: No, score=-2.3 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 agentk.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 (agentk.vger.email [0.0.0.0]); Wed, 27 Sep 2023 13:11:21 -0700 (PDT) Hi Mark, On 9/27/2023 8:02 AM, Mark Brown wrote: > On Thu, Sep 21, 2023 at 02:48:39PM -0700, Wesley Cheng wrote: > >> Add a kcontrol to the platform sound card to fetch the current offload >> status. This can allow for userspace to ensure/check which USB SND >> resources are actually busy versus having to attempt opening the USB SND >> devices, which will result in an error if offloading is active. > >> +static int q6usb_prepare(struct snd_pcm_substream *substream, >> + struct snd_soc_dai *dai) >> +{ >> + struct q6usb_port_data *data = dev_get_drvdata(dai->dev); >> + >> + mutex_lock(&data->mutex); >> + data->status[data->sel_card_idx].running = true; >> + mutex_unlock(&data->mutex); > > These updates of running should really have a snd_ctl_notify() so that > UIs can know to update when the value changes while they're open. > Sure, me review some of the APIs again and add the notify call where necessary. >> +static int q6usb_mixer_get_offload_status(struct snd_kcontrol *kcontrol, >> + struct snd_ctl_elem_value *ucontrol) >> +{ > >> + running = q6usb_find_running(data); >> + if (running < 0) { >> + card_idx = -1; >> + pcm_idx = -1; >> + } else { >> + card_idx = running; >> + pcm_idx = data->status[running].pcm_index; >> + } >> + >> + ucontrol->value.integer.value[0] = card_idx; >> + ucontrol->value.integer.value[1] = pcm_idx; > > This feels a bit messy but I'm not sure what we'd do that's better so > unless someone else has better ideas let's go with this. Possibly we > should standardise this as a new control type for joining cards up so at > least if there's further needs for this we can use the same solution? I'm all ears for any suggestions from other users :). I think its a bit difficult to tell since this is the first iteration of adding this feature. Pierre gave me some great feedback from the userspace/application level, and tried my best to accommodate for those requirements since it would be the main entity interacting with these controls. Thanks Wesley Cheng