From patchwork Fri Feb 16 03:59:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wesley Cheng X-Patchwork-Id: 201896 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp287660dyb; Thu, 15 Feb 2024 20:14:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVnNr8k553aSH7VXFYnyw7o7oku4CXTedlBUFPZPJK/PuEWCKPR4sJekamj4TWi/v0HdO1TYZOqO8XmaMm8L8fXyYOmHg== X-Google-Smtp-Source: AGHT+IH2EOpEFnxBz3tbuca1rY+lBSi8BNHKrbMBtgtw5isxUv5DwFNJlVJohawqRVcRwmaToLZT X-Received: by 2002:a05:620a:1182:b0:785:3749:7cba with SMTP id b2-20020a05620a118200b0078537497cbamr4444624qkk.65.1708056855461; Thu, 15 Feb 2024 20:14:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708056855; cv=pass; d=google.com; s=arc-20160816; b=HJ3giXzojcvQkksZG9LlyDbMC0utb3pFo+RHKLWWm+6MUDxzS8wKyCKePgQkuKDEZK tPOX9sNNFb7Ma32LWrgQq2NuuKTNBgi58vaBGrMpRi/BJO5RJ8evG7Q7e3tnqukOb+fH 7ZhEdvxStuB8Erz2w+X9jGQrAIf8VdaGXPTttkrf3+nbfHnhef5hRnZa+FjBnICdtlan KXOV0WKMQC2zAZE7X2+65CWx+q2P1VqGpDC7xkA4uKXTrdpTsS+H3gdqMSJMrzCkp5++ x5/rh6cjA4HMxJ6xAC/B98P3Krv3K43IUAEWZL287a6vRDbof3Li+u9R8eVf8p/zZTIJ TyIA== 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=oLnn+66EtwDPUcYCf35t1CWt9sha3OSbLBeKHwa2G8w=; fh=VKrp0Y7I/+wT36BfKZ6oI/4N9BIwFCn9zerObkOrgGw=; b=x8sixK5W3uIlzeOtVbG8XnEonVti5QQ8V8uNaX6quYrEM2Zd5CV1jabUphM97zafhc hPw/NXenjw2AnaWU7HUwrAePTnftpyp1JcdPH4RRnjmLV92wKDdLlPPZOL8XKMO5mPEu Ar74yw+gYyCrq9i4OHlgCXwDlxpNBYJ/I17nQhFD/OYjt17E4Hzaob3b1Q5oU6Cn0WaS yc809z3h9+H2PFS3EEN7kl9c2/0YQY+s1L008crLBUEIsS4x12Bit0heQqOgJX8RXWRl C0s6urwGGC5amnumFeYAP/nf8Si8uaubjsFkEvE0ldxn8w7uNfPfDKOiw1kxLnG3CBf+ Hq5w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=BXnT4RMN; 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-68027-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68027-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. [147.75.199.223]) by mx.google.com with ESMTPS id wa6-20020a05620a4d0600b00783f9efc9f3si3153191qkn.319.2024.02.15.20.14.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 20:14:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68027-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=BXnT4RMN; 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-68027-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68027-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 3493F1C22627 for ; Fri, 16 Feb 2024 04:14:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 404E154745; Fri, 16 Feb 2024 04:00:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="BXnT4RMN" 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 08F841CAAC; Fri, 16 Feb 2024 04:00:03 +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=1708056006; cv=none; b=Tfaz95qu6ui7Dbn0q0QdXf1h2rvzGWsTSiSMFJSNVxnC6I5e4e9Bcng3/hjEuKy2F0vvT7zPATwebhNQVYg5b61jmLaHNQXGzdCONV+VtFzTi6SmI8vmh7C5ycwjxzy812TvJi9fa+4S/VnMPwHiDvyJgn88uq/gBXGT+qPgGew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708056006; c=relaxed/simple; bh=xdOkzCgg9LhiJrn/IOI09DYF8Zlmqa0SrtbvI/ey4hQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gvoT6N4Qnuu1iEWF94sQRzrgtMef5YMhVIW64tfGeZZuDWMXU/ama2E2vvm6UsXawqQVu0zBwT+UWwc6dzzScm/OTIC/A3GXbaiL+SuWhZzX/vEWAhGoDyLZpwFmfGXDVPOqjOdAcpmks5npfkhfgXPq1YC7V9ed2UaAvuJVpwY= 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=BXnT4RMN; 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 (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41G3sNWK030335; Fri, 16 Feb 2024 03:59: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=oLnn+66EtwDPUcYCf35t 1CWt9sha3OSbLBeKHwa2G8w=; b=BXnT4RMNtQvS1vmOmAHAhPj5wi/+CB3pk5o2 qYZFLAagQn6pU9Bhm+KX8jBq1A8fPRdUcOPtxLlVsbGUvgOTN0pK1NLRcV+2B4JF KWoqLTCmrGphr57a+ZwaEpr7gKDHv2HtKaLhdtzUjnbi95sv0o3w7QQztgBs1set EMCGYY9Khzud9/Mf9iLx4JzeuGpubfocDCA2gJECXNFkOM/jbrG+WpzaOEEK67m/ FVxtBr5BhoVgeFlw3c8KEGsyQjqsh7tcWaouDirqt3/CR6O5WLKiqKFjkPz+zcog zodiS23Mj7v6h5tpkIpt1nPVtRoBzoxTvbGGGLqW2iLDB0ZMTw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w9qbc14hv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Feb 2024 03:59:47 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41G3xkV8014745 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Feb 2024 03:59: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; Thu, 15 Feb 2024 19:59:46 -0800 From: Wesley Cheng To: , , , , , , , , , , , , , , CC: , , , , , , , Wesley Cheng Subject: [PATCH v16 49/50] ASoC: qcom: Populate SoC components string Date: Thu, 15 Feb 2024 19:59:22 -0800 Message-ID: <20240216035923.23392-50-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240216035923.23392-1-quic_wcheng@quicinc.com> References: <20240216035923.23392-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-GUID: jMjTa4m1eaIAZJPLoFSxEg803nbzXJz4 X-Proofpoint-ORIG-GUID: jMjTa4m1eaIAZJPLoFSxEg803nbzXJz4 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-16_03,2024-02-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 spamscore=0 adultscore=0 impostorscore=0 suspectscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxscore=0 priorityscore=1501 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402160031 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791027425037703913 X-GMAIL-MSGID: 1791027425037703913 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. Change-Id: I454631f8ddbceb7db6a65c7e5ab57bd918a2c88a 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__ */