From patchwork Tue Feb 13 00:54:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 200153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp272608dyb; Mon, 12 Feb 2024 17:40:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUZUWmKbYLa7h3auyTNaS5prha3YM/4iVlhDSUCt/vS/iWFRuYbXwystbbDlj1mckhh5L6f2eJylyR95a1B2yXAupiI1g== X-Google-Smtp-Source: AGHT+IFFjzpunlhrycnbBvwvviHEpWtVP3ISZxF88HNj0tCVcIx2Sk9U7eXRwXltP8bBOK8ypS2s X-Received: by 2002:a17:902:e9cd:b0:1db:28c4:b757 with SMTP id 13-20020a170902e9cd00b001db28c4b757mr2072676plk.0.1707788431541; Mon, 12 Feb 2024 17:40:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707788431; cv=pass; d=google.com; s=arc-20160816; b=JSfBpKmIyb3S8oXoAmtGuuw4A6mARHPoNL9bEJFvcglAfYahwIMeZwHtwQ0jcDBpz4 Jh2DINDIsnxoNhlGm39B/D6fKnlyaZYMdDenjR39a5BrPujAnCV9y6vni9cXkPbBzNP6 tbd3VRqbwp5louktRn5U9i19LyEHJ3k6rrcClkk/PIxdza0m/q5mFbFb8RLoB0gmQ6xO 8IHPoauZjXVtC+MyFebwwFvGhneL7HpSmlOSoB+axOPeFbRf2j+xeLc0FRjPtPQuuFuj Rg3XyGJlVAM+bOoZ9IMcbDhPu3UvfaH/ddDnhnlJJGcFYpvWcK7/n2jvTyGUMW3NhQQG uQhA== 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=5vmvA/j8Eq+r73ofFDYJ664BV9DDh9rA330ASd5d/Rg=; fh=+SXZwO3PU8vIcfMDhSLxwzXYFGQn+TqcqtFHNOFTI+E=; b=NppAQshrUZL7midz1TSFgH2OiwSaWJ8zMz/UsL2RHS9MfALzH73gji92nxA3N/qdXJ J9W56zDBQM1H12K7L/uH8QeI78kQ3P3oNulhr4fXsIdI45H0t0TMe5NzDYGyRkVUdYgW mZApKxyYwGY+fr//mKzSfnxc3W/ll4J4NkuL2zgwBSPfl9uUhVkRjKPvcSTzZJF+tfBz myUGRfN5KMsScgkABxIOqvTxLhonJNRUgTZSIlUhRSSedzS83a0hXVckTBoC3aXxSDfJ FaSrqRxhuB81is3dt0JblKYqQ2hWBnlFJ43e+dI6vOAuas8F9g+7mMjjiXyH0byRh+to 3jtQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Eatj4Zz1; 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-62822-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62822-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=2; AJvYcCWpTX4iymeVefnPgCRRn9ifXdm0tkeWn75YBthFVXWEGAOccHUyrCpOQn+6FrTOpg3Up+UvnsWIy+wJ+Qr3MqmCQyy8/Q== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j10-20020a170902da8a00b001d70b8d77b9si1110398plx.307.2024.02.12.17.40.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 17:40:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62822-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Eatj4Zz1; 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-62822-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62822-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B4C99288274 for ; Tue, 13 Feb 2024 01:36:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1AFEA633FB; Tue, 13 Feb 2024 00:55:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Eatj4Zz1" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 B42F75812B; Tue, 13 Feb 2024 00:55:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707785711; cv=none; b=JYEaHsk34wjnHaU4BOaJ2WOcn1mtI1BFZAQgO5Hpyzy9XT/Zje0RsdgBQW9IAiJHMFko3Wc6MM6t3e39lExKYpRzUpKCcbsUroTLmNOPaYllubstM6FUOdTa+lSE4g3n3NTVJoFJtakNG+FFTwJTWJ8tVjTuYtpnLpcEqbrlNhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707785711; c=relaxed/simple; bh=UemOCUX9OC/jB7lWASuqhcBieye2GhhUA69QsoWo44I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n1IWbR68tQvdz6ZL/OombzI2GxVnpRT6hrb3bzxObIZ1+JRR2aTbLYUwmSz4mcf2WL/tVkd90dU7hlbMxCNwyfV/pKsGPYieo4BQIxrtzCHPsvHl1Y1Xw8fSmXSHrIN1w0dNmdy5Zvt1YyhvRZ7tamFWb5qlszF/fsOfsdUopnA= 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=Eatj4Zz1; arc=none smtp.client-ip=205.220.180.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 (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41CM4vHR027931; Tue, 13 Feb 2024 00:54:47 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=5vmvA/j8Eq+r73ofFDYJ 664BV9DDh9rA330ASd5d/Rg=; b=Eatj4Zz1Q7LGKyxDIK0BGj6l2aT38s+NN16X WzTDNRVi5t70YfnmKD8PF+6xdlSAzjCzLSEKxtbOoLwlxMHdOo4y+vMzRRAN+9La 5oKF8ZdAlUX2r45uscTDKyTW3jXKxsN8EdVbj7qTW/P2Lzib1hedaeF4BbPIdMlt ipbmd3TfZht5la/oqcpjErmI1wYFAMVSKmforsJzl4dIPYqD5QruA+qsliwP+mnx 6dcZmamBsQ7nbioxN7uLVkCbYtU1Uy0jhe9VA8PdxtDc608d25sRz9x+hZThcSW5 3vXd4Jof+MCJtxA6yW4xcbJKFd+OY6P6LjF+guI9PZR8F0cwag== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w7s390kbv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Feb 2024 00:54:47 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41D0sk40031192 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Feb 2024 00:54:46 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; Mon, 12 Feb 2024 16:54:46 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v15 49/50] ASoC: qcom: Populate SoC components string Date: Mon, 12 Feb 2024 16:54:21 -0800 Message-ID: <20240213005422.3121-50-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240213005422.3121-1-quic_wcheng@quicinc.com> References: <20240213005422.3121-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: 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: BFLnIyaRpDc6P0gP1YcYMyGBNoBQkQ1W X-Proofpoint-GUID: BFLnIyaRpDc6P0gP1YcYMyGBNoBQkQ1W 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-12_20,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 mlxscore=0 suspectscore=0 spamscore=0 bulkscore=0 phishscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402130005 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790745962243065476 X-GMAIL-MSGID: 1790745962243065476 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 c81a52f64ef8..bd83ac3f2638 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"); 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 52136897cc92..2a5384dd5988 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; }