From patchwork Fri Dec 15 21:49:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 179577 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9602888dys; Fri, 15 Dec 2023 14:02:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IEy/aDzQSdUOQ5IcIlUHUHHFFNYjW31mVmt88akY+L5HdwxsNIeaQsNix37TcdxxUWe0X5E X-Received: by 2002:a05:6512:b0d:b0:50c:bd0:870f with SMTP id w13-20020a0565120b0d00b0050c0bd0870fmr7399792lfu.73.1702677743222; Fri, 15 Dec 2023 14:02:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702677743; cv=none; d=google.com; s=arc-20160816; b=LWH70P94ybQjUEg9YZilp7uU/rm+J9qBB8E2hAOrXX0YS2IR3LS4DEbUSERNLtOQK8 NYdbGM389iZTF46Cg8/6y+gyGmKPvlvX/5HbtsalIUVCfhs/qtIp2sfRHzZq2/gapy+S wVALLUZDZXpOOa+WwPAox1ZunuTQ72NyvF4g5/LPKQ/7tUwZTIgjKjBTifngHu65w6AS ys49YMlartB0Mjlkyqvl3PotQYWEtRKTgYScNR0Qp+IePehwtl//N4K9w/Hj7Fk7fzkr iLfIi+q78RRdiMY+vhoAyn9q1p4OSio4dsijqjT1k5Y+QMul173XgsWCLNIify0hgpYb NuWg== ARC-Message-Signature: i=1; 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=llHWIe5zbQO1tbGH7RoiDrsh+BfbJOEpduoXXgWTYB0=; fh=0KzismZj+xI0Z//ZGdqKIH/FO9LtSZM7Yj4P0VtrCz0=; b=TZlzAHz/+8fGbueMFLHDi/RSE4upPXJADztKMu8nRSXCIYGPxp/bKybBp2lyuB9b8R aURi0pMfLzXTimc1HrqJvJc8S33rFZ+LEep165ayhxptOr8Elnv42Xg/vvs3vLq7vyXd edH0r9n2DK7jhbXZQVt/dBnIudnmDCEBymkSsL1uKWkoOlph7NSIE7BgKMSLUnNWX79h Cg3++SDIkTAMcmnPOJP+cWjDh9c7QmCB+cIXphfQWmFt+yDcjlQMmMDXybxE/GYRJIqc 2AWYAVxKPT7UM8XuGaW0Qn7T4Q/FuABztZ10Y8xKh2x1xDszbLpPjU+U3tBaVRZRDcnG XtXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IVQqP+2o; spf=pass (google.com: domain of linux-kernel+bounces-1705-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1705-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z25-20020a50cd19000000b005520f2d43bcsi2921501edi.99.2023.12.15.14.02.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 14:02:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1705-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IVQqP+2o; spf=pass (google.com: domain of linux-kernel+bounces-1705-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1705-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 am.mirrors.kernel.org (Postfix) with ESMTPS id CDE841F21A1C for ; Fri, 15 Dec 2023 22:02:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EEC4B83F5A; Fri, 15 Dec 2023 21:50:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="IVQqP+2o" X-Original-To: linux-kernel@vger.kernel.org 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 E4A2369796; Fri, 15 Dec 2023 21:50:30 +0000 (UTC) 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 (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BFICYsJ021003; Fri, 15 Dec 2023 21:50:19 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=llHWIe5zbQO1tbGH7Roi Drsh+BfbJOEpduoXXgWTYB0=; b=IVQqP+2opkuMqT6iS4AUumNs2XiRFtBEF7qM 9DLnn6Ay1JMPRcMiSm1T9fh/xjQEqwCTdkobGmfy+G8VBZ3UGdHHarzn3iAGDXtK EVO5acRGpQ3T33yt+p+2goxsJavEzf7szvSSlhZQkHbcX4udOSSvUiLMVW++IHuz nMt8koRArACqXFSJdE8yqCD2GDDYn36hfTQ4ABLOiaKjRxLK3k+0qJAv8v5Lr6Eu ea77eRMeL4A9BSfKL4v5pSkQ5OOpiEndTOxGjFwDhGF0QY7aUawYcZRCaln7oxOu QM8hvFHtOQ/xYWJz+JK4n/wcY72e/aHriQ7iLjzqxvo7T+8zhw== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v0k90sw80-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 21:50:18 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BFLoIhF018058 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 21:50:18 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; Fri, 15 Dec 2023 13:50:17 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v10 40/41] ASoC: qcom: Populate SoC components string Date: Fri, 15 Dec 2023 13:49:54 -0800 Message-ID: <20231215214955.12110-41-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231215214955.12110-1-quic_wcheng@quicinc.com> References: <20231215214955.12110-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: nalasex01c.na.qualcomm.com (10.47.97.35) 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: nZjq_ilJU4Bhnufksz_uyBPArk19Dm89 X-Proofpoint-GUID: nZjq_ilJU4Bhnufksz_uyBPArk19Dm89 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 mlxlogscore=999 adultscore=0 suspectscore=0 bulkscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312150152 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785387017476455534 X-GMAIL-MSGID: 1785387017476455534 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/common.c | 22 ++++++++++++++++++++++ sound/soc/qcom/common.h | 1 + sound/soc/qcom/sm8250.c | 3 +++ 3 files changed, 26 insertions(+) diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c index 2645436b08c4..4a4e4c14e625 100644 --- a/sound/soc/qcom/common.c +++ b/sound/soc/qcom/common.c @@ -258,4 +258,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 v2"); diff --git a/sound/soc/qcom/common.h b/sound/soc/qcom/common.h index fca3046c8674..8546723e0aa8 100644 --- a/sound/soc/qcom/common.h +++ b/sound/soc/qcom/common.h @@ -11,4 +11,5 @@ int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd, struct snd_soc_jack *jack, bool *jack_setup); 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); #endif diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c index c33a7c5fb8ad..d1c4f34d04f5 100644 --- a/sound/soc/qcom/sm8250.c +++ b/sound/soc/qcom/sm8250.c @@ -38,6 +38,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; }