Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2296055rbb; Tue, 27 Feb 2024 18:20:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXHybcVNmiUouboFxmL+piTmoirYM5jD8uEE3XHDip0h7XTM0iS30lMnH+Is8f27eY7SUq5lUX+Oyn8N2rGHsSjZUDxqfBwxiNcxB9uBQ== X-Google-Smtp-Source: AGHT+IHdxYiH7zWXTRN6PIS75hu2GWnwoqem6Z2G5fhuvazTlOBp1GQninMjbq2Q297eEJw7xRDM X-Received: by 2002:a17:902:cf0d:b0:1dc:affd:6510 with SMTP id i13-20020a170902cf0d00b001dcaffd6510mr6906676plg.49.1709086849498; Tue, 27 Feb 2024 18:20:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709086849; cv=pass; d=google.com; s=arc-20160816; b=wqvGU3dhez7arfmvEFvPEVRmBM6losCRVLXS+WvCpPMbMh8mBOmVuCmuy1Tp/3sfbe rQD209ciuzp1fiOExh8dIoNlR2GRNU5EuIGbWF9RVuj952SYYftI41va/6LXTK1BCkXq m5q/xkTi9suhhLqf8DfY51p4XGkuAy/U7nzGePiHZsE33p7F7IC2d7nre6/CsXmbn2zJ aqgLlMOYdKIMwsXfK7agvcc7RFdVSRCITqDRr9clH2qu56rmixnl1nLA0+B2XyFZL+mg 44OhEg8G7S9OPvMjmmqXU7QyraKqxjF+AqAOhJl7Jk5mxZEzyp31s7SlT2ds2ZZJhO5N FvAw== 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=5uoGJwSD9C2YGZyRc+IK0V5FTPw3VvdAlOyGPREG8wI=; fh=VKrp0Y7I/+wT36BfKZ6oI/4N9BIwFCn9zerObkOrgGw=; b=oijupXTIiqldpXk0dPLQmIFs3NuaHwkT95BhBfdrXmNMOdSzpwfIRLnvqLO+x5Wv6r WlYQKyn0zuLdmtr/eM7RNBc2ampU1IQpW/3BboOKv2se6GVeOH734WgIKk6V/jbyJ7/J BelcfdfZhABNx15gVABggYEMvfVoC1xtJMGt6uGwlgf0tLs9B279+DK3gj0cIA+HHOji nCi1pAVMCP+VCc+xsVxXPtIBsb11J7NYmZeMNgAGp/k4tvJOCZkKX+7tVAOHUG6UYtDA zVVDg6uQPiGeZHH2Lce7QtTXZQiQpxNwT3hlB5jBmtQrRb340yzMPADIbMZOwFdMkSSF +g/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=cnzfGLRV; 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-84371-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84371-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id u7-20020a170902e80700b001dcc8ea624dsi507885plg.69.2024.02.27.18.20.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 18:20:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84371-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=cnzfGLRV; 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-84371-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84371-linux.lists.archive=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 1F87EB2865D for ; Wed, 28 Feb 2024 01:47:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3680C53E3E; Wed, 28 Feb 2024 01:37:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="cnzfGLRV" 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 AB6363308A; Wed, 28 Feb 2024 01:37:00 +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=1709084222; cv=none; b=us2gdoiNFJTAAQC0zOXjq1AQGqBfmca2D1dgSm6wPR5Dhy7ziRtsz5KYchWTRbDtfP/lDVQDPoyyWqRUao92w88AYQ6MGsgMlCPL+5ITWzAHvxzt0jUVahmZb4Be9Q2h3eR2qa7SbkLj9t47w6FhkkB8re0n2PfCbBi62Jds4Ok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709084222; c=relaxed/simple; bh=+5mctwiPbGJWIC8A878mTRFjfB1bsvH1gd7x5+K/epQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gLkYf7lFIigaXp2aDGWkahwVKIuyblDFxbx1ioUYeT2OXHrR5a5Ak+VudqOHftH4BrQJsq0Ri1f7CLGtz2fzsZnfLBUvgvrXy7gUdM2itIxCvV4EeXM5LlIkySsbpQkPeNeOwyK0BvoOcK137zydKAy2/3Ty2j5vi5euuSTQXh0= 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=cnzfGLRV; 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 (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41S0f7Xr014622; Wed, 28 Feb 2024 01:36:41 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=5uoGJwSD9C2YGZyRc+IK 0V5FTPw3VvdAlOyGPREG8wI=; b=cnzfGLRVVWzgCUR3N70QA2swMqNwQudpE4FY xa5cjHskHVa97jpQRIesE/djZUUnCU2N6qiEXkc7Oo7hZy7IkXIRXwgQVOHA2WXX Xrz8187C2527jlifGbJJz190SZ2BZYffS9H6DiajEkH4n/7gAHKnY2UWjMZaQP1l 3kzpGJ1+/+BZjy3WDDZBLzUMxDGoJky9aWFqibjAiySlccsttsqgfi/Htf1Fr1Lk /YZRsqNT8JR6iMMIeLeD4/qbbzkINd3mNP+KjTw0wHtD2wEyRDdQS6iW/B6JUbGY yorets/6QszUnluriRMwxCBJTlizUqn2T09yrIQ3bZWZ9+IHYg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wh8aujrat-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Feb 2024 01:36:41 +0000 (GMT) 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 41S1aeut005376 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Feb 2024 01:36:40 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; Tue, 27 Feb 2024 17:36:40 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v18 40/41] ASoC: qcom: Populate SoC components string Date: Tue, 27 Feb 2024 17:36:18 -0800 Message-ID: <20240228013619.29758-41-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240228013619.29758-1-quic_wcheng@quicinc.com> References: <20240228013619.29758-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 Content-Type: text/plain 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-ORIG-GUID: ndc-ZV6cCnNDS-NB3J9iS40hts7D2fzG X-Proofpoint-GUID: ndc-ZV6cCnNDS-NB3J9iS40hts7D2fzG 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-27_11,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402280011 For userspace to know about certain capabilities of the current platform card, add tags to the components string that it can use to enable support for that audio path. In case of USB offloading, the "usboffldplybk: 1" tag is added to the string. Signed-off-by: Wesley Cheng --- sound/soc/qcom/sm8250.c | 3 +++ sound/soc/qcom/usb_offload_utils.c | 22 ++++++++++++++++++++++ sound/soc/qcom/usb_offload_utils.h | 6 ++++++ 3 files changed, 31 insertions(+) diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c index a4e87dfb1b93..5e3007e2e061 100644 --- a/sound/soc/qcom/sm8250.c +++ b/sound/soc/qcom/sm8250.c @@ -39,6 +39,9 @@ static int sm8250_snd_init(struct snd_soc_pcm_runtime *rtd) &data->usb_offload_jack_setup); else ret = qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup); + + qcom_snd_add_components_string(rtd); + return ret; } diff --git a/sound/soc/qcom/usb_offload_utils.c b/sound/soc/qcom/usb_offload_utils.c index 0be05c1f87a9..8b137e1593e5 100644 --- a/sound/soc/qcom/usb_offload_utils.c +++ b/sound/soc/qcom/usb_offload_utils.c @@ -26,4 +26,26 @@ int qcom_snd_usb_offload_jack_setup(struct snd_soc_pcm_runtime *rtd, return 0; } EXPORT_SYMBOL_GPL(qcom_snd_usb_offload_jack_setup); + +int qcom_snd_add_components_string(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); + struct snd_soc_card *card = rtd->card; + const char *prev = card->components; + + switch (cpu_dai->id) { + case USB_RX: + card->components = devm_kasprintf(card->dev, GFP_KERNEL, "%s %s", + card->components, + snd_soc_usb_get_components_tag(true)); + default: + break; + } + + if (prev && prev != card->components) + devm_kfree(card->dev, prev); + + return 0; +} +EXPORT_SYMBOL_GPL(qcom_snd_add_components_string); MODULE_LICENSE("GPL"); diff --git a/sound/soc/qcom/usb_offload_utils.h b/sound/soc/qcom/usb_offload_utils.h index 283e81f57f43..03780a12a326 100644 --- a/sound/soc/qcom/usb_offload_utils.h +++ b/sound/soc/qcom/usb_offload_utils.h @@ -10,11 +10,17 @@ #if IS_ENABLED(CONFIG_SND_SOC_QCOM_OFFLOAD_UTILS) int qcom_snd_usb_offload_jack_setup(struct snd_soc_pcm_runtime *rtd, struct snd_soc_jack *jack, bool *jack_setup); +int qcom_snd_add_components_string(struct snd_soc_pcm_runtime *rtd); #else static inline int qcom_snd_usb_offload_jack_setup(struct snd_soc_pcm_runtime *rtd, struct snd_soc_jack *jack, bool *jack_setup) { return -ENODEV; } + +static inline int qcom_snd_add_components_string(struct snd_soc_pcm_runtime *rtd) +{ + return -ENODEV; +} #endif /* IS_ENABLED(CONFIG_SND_SOC_QCOM_OFFLOAD_UTILS) */ #endif /* __QCOM_SND_USB_OFFLOAD_UTILS_H__ */