From patchwork Wed Dec 20 22:45:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 181856 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp61902dyi; Wed, 20 Dec 2023 15:05:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4nUt4PIQcaZNhvPLqqPP/l6hCxP5orGWTBDxufjrgKv5LvC72MvPANL4uW/VdnkyVtDCU X-Received: by 2002:a05:6808:1598:b0:3ae:156f:d319 with SMTP id t24-20020a056808159800b003ae156fd319mr15510876oiw.45.1703113519663; Wed, 20 Dec 2023 15:05:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703113519; cv=none; d=google.com; s=arc-20160816; b=YErm/3ce1ivs8kOR7Y8hvuNcwg+H69RFfLBqFsTgx88srS6I/jr49qIw+xBPzqZWkp Vd1TlBwdt63EHV2r5AJCeONYc4DJCuqI44MrrRg2I4lUE3Ith/1PtPuGD0SeCF+STM7P GrlAMT+piKr1qU5UAKqhJdM64I+0ILn67qRwsP8G9QJfq9Wyhh/Jb/Hd9xnvyfOC38B8 hvdVjTSwDETyMqTJU7zsfqfI8uEUJa1AzlYkbfeNgYca7BpO2Mjce/nb0SlL2iuynkll 5ajC7MHVtsWtL2NrlBN2xKPvEnEVfbmeI1XPNRtzrNsAkpWJ3MYgeBBDrNZRS+ly3cQ/ vSsw== 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=T4MnaiGoCF1Pdim7xes1uAp3HJcJjxoBC3AQ91+u6btSje6vWcx4A/nL71XWxckONJ BFzx99pNXfnfx9gpBAaT5iKC4ohRVE+8FoF7cBm8AVDBbJbKY3Bgo8qnaqm+4FvcUJdm YFm6xO0xVnB2+lyydU6N/bVft0Nz07snnc//gt5eMrq8OeGErbZPBNEYonb7r25I/i9U MAM41MCI5SngKXBBRjMo7jpbcQUuyFuJOtpNjDOqpq9FR2Xbx1tZk6DXAfg4eD49bDnf UjXhVRREddk2k92yzg0MQsDS2hKzcwoT16rGDTDfoOHwJ/Mj2nZaOZJJIK52kZON9M/l fbPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=AUqcoZqZ; spf=pass (google.com: domain of linux-kernel+bounces-7585-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7585-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id i3-20020a67e2c3000000b0046698c48822si118702vsm.433.2023.12.20.15.05.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 15:05:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7585-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=AUqcoZqZ; spf=pass (google.com: domain of linux-kernel+bounces-7585-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7585-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 53B511C20906 for ; Wed, 20 Dec 2023 23:05:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A9AF670990; Wed, 20 Dec 2023 22:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="AUqcoZqZ" X-Original-To: linux-kernel@vger.kernel.org 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 BACD854729; Wed, 20 Dec 2023 22:46:23 +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 (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BKMW4PA032308; Wed, 20 Dec 2023 22:46:07 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=AUqcoZqZqaE/GSJAhkJEfiqDqtEA9WVMMwzI aZRt3VARTKW9X03SDeMspZt4yjFJCEN6Czo5KmUwFYvRbzObAK/GMoM+hKg78o8j wvngYJ6+1asToWKZonFbukSh1iC3ZeBMjbbZ3FZet5BjYD32nhg5wMWMP4K1rXMw VdwViMDlmW6qAI4P2IjtSqbByWHfSGqTWoMH3seSydi+gTTUfuN7stsxdMqe7fVt jk/UYv+bH/1TSRuHrY8dojrC9Mzu8YvBL7gdvT6+6+c2IMRldNRjRP/yrdZZQG8f mwWrEUqF5+AcngfQAdGf1+rsYmPvJnUERL0mS6TfMOo9DiRaBg== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v3v33a5q7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 22:46:07 +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 3BKMk6Kr032044 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 22:46:06 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; Wed, 20 Dec 2023 14:46:05 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v11 40/41] ASoC: qcom: Populate SoC components string Date: Wed, 20 Dec 2023 14:45:43 -0800 Message-ID: <20231220224544.18031-41-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231220224544.18031-1-quic_wcheng@quicinc.com> References: <20231220224544.18031-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: nalasex01a.na.qualcomm.com (10.47.209.196) 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: m3vdB9E4mjJWCyS9dcRXT4MyPH_7fbba X-Proofpoint-GUID: m3vdB9E4mjJWCyS9dcRXT4MyPH_7fbba 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_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 adultscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312200162 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785843961993998114 X-GMAIL-MSGID: 1785843961993998114 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; }