Message ID | 20231220224544.18031-36-quic_wcheng@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-7581-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp61707dyi; Wed, 20 Dec 2023 15:04:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+ikhdBzZGZBwnM166LHe7DfmZCuc6RHx7cPXMN3kEsO5Kx4z00p0IHrLCGeGcKjvKTx1Y X-Received: by 2002:a05:620a:4482:b0:77f:16da:d42 with SMTP id x2-20020a05620a448200b0077f16da0d42mr28319793qkp.28.1703113499716; Wed, 20 Dec 2023 15:04:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703113499; cv=none; d=google.com; s=arc-20160816; b=0AY/cjBySCZQOzs/Q2hrXPYn0Yd7xtacvOL9kBd1KyZhH3j6d1souhy7Iir2c2t+bL kbIdwywz8p4zmum5nomzoqcDUnru2hVaP2FXI/IYV6zrdl+mBvgJ7rBoB0IHpEDa3F8x ZDb1eox2NG/2/El+KOpI/7ylwZvO1WpPTHzfZ86cHHDbCcghAj1x+pWT4TuhZY8xbJRO Yb+SmRsUz9aY3LUHdrij2na86o1CGfrux/A4HeMJ6ugp0UgzgKx0gg5Zy8g0lMKDTtHX Mrx43oe+UG6CXJDdymtPG/Qt6tWKuKhSPXb3qK3I3nY7A4g01BIMcdgXOorLsZRYQmAG qkpQ== 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=l/SogG1mwYpfrMkIwODI+k6bupo64StismUhwsMTISY=; fh=0KzismZj+xI0Z//ZGdqKIH/FO9LtSZM7Yj4P0VtrCz0=; b=UvB9VgwPO81MweqfCU1+kUUP2PtAuN2PFMY/UJ549/DWl7QEdFOukeBqXE+Yp/QnOU 3S9FCTuMTo6FsUtsWal5HnfngWc4xMMuEqArD98T/nf4U55Z8uw3EGk6j4kvX4t2Kk+q 1c+9j3pdZWXoCgfaQgXZuuFBRJUV67n7pAmpOOX4Dc+WoxILm1aAadbs0iZKtO6kBJXr jp8+kgb4LOo3Pn7xknxxgWad74pNDrwK+9rfon7CFJhhr567VmaSAGaK4mOc3NKpttLw lRYgV+1RRXOg+psUDgrQw+fAtq4IU3PMlofcuD7fqqL+UmnwRn0TjDtUeC+1V0u/66JQ JRTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=W69cGewM; spf=pass (google.com: domain of linux-kernel+bounces-7581-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7581-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 z19-20020ae9c113000000b00781143dde0esi758863qki.172.2023.12.20.15.04.59 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 15:04:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7581-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=W69cGewM; spf=pass (google.com: domain of linux-kernel+bounces-7581-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7581-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 8293A1C20643 for <ouuuleilei@gmail.com>; Wed, 20 Dec 2023 23:04:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 461CE6FCF7; 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="W69cGewM" 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 A8B4C52F90; Wed, 20 Dec 2023 22:46:22 +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 (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BKMNZdX026151; Wed, 20 Dec 2023 22:46:05 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=l/SogG1mwYpfrMkIwODI +k6bupo64StismUhwsMTISY=; b=W69cGewM2Vr3sMBl49ISrokNGlb8WoBqokZj fYFUwaO/P9Hk2MyfgBxZMYuMXSIwAd6vn5p9etjoFP6TaUdGojgbCZW0FkA3L2TN QXGP0k3UQjV8soyj1wN03usmMpz4EQbGvQmLtl+iCcjBbo83iARBd5LjMGLn5p3S XO1U06nPosqMWu+dVKSO6zb3RmOmjWBlOPdvRkRIVrhBOwQBgKVy6BOximdUHlwL GHDNg3qxD/fffIl4Kh3HuF6j0AVG4G4PbmYANOz/1y+oCsXHI4pu4FgJ303f8Y78 bglcC0+xrwy3KaHP9hPwZcaGKBhuOTDnL3b51Q50urw8sb12fw== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v3tmm2d5n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 22:46:05 +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 3BKMk48o008445 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Dec 2023 22:46:04 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:04 -0800 From: Wesley Cheng <quic_wcheng@quicinc.com> To: <srinivas.kandagatla@linaro.org>, <mathias.nyman@intel.com>, <perex@perex.cz>, <conor+dt@kernel.org>, <corbet@lwn.net>, <gregkh@linuxfoundation.org>, <lgirdwood@gmail.com>, <andersson@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <konrad.dybcio@linaro.org>, <Thinh.Nguyen@synopsys.com>, <broonie@kernel.org>, <bgoswami@quicinc.com>, <tiwai@suse.com>, <robh+dt@kernel.org>, <agross@kernel.org> CC: <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-sound@vger.kernel.org>, <linux-usb@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>, <linux-doc@vger.kernel.org>, <alsa-devel@alsa-project.org>, Wesley Cheng <quic_wcheng@quicinc.com> Subject: [PATCH v11 35/41] ASoC: usb: Fetch ASoC sound card information Date: Wed, 20 Dec 2023 14:45:38 -0800 Message-ID: <20231220224544.18031-36-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: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain 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: zbW7OBVW4PU8bgy_khwncWFImxsh0BU2 X-Proofpoint-ORIG-GUID: zbW7OBVW4PU8bgy_khwncWFImxsh0BU2 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 lowpriorityscore=0 spamscore=0 impostorscore=0 mlxscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 adultscore=0 malwarescore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312200163 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785843941315235124 X-GMAIL-MSGID: 1785843941315235124 |
Series |
Introduce QC USB SND audio offloading support
|
|
Commit Message
Wesley Cheng
Dec. 20, 2023, 10:45 p.m. UTC
For USB sound to expose mixer controls to fetch information about the ASoC
sound card, add an API that returns the platform sound card number that is
registered with SOC USB. Knowing this allows for applications to further
query about the offload status.
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
---
include/sound/soc-usb.h | 1 +
sound/soc/soc-usb.c | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/include/sound/soc-usb.h b/include/sound/soc-usb.h index 6bbd4339e8c5..77c19fc591ea 100644 --- a/include/sound/soc-usb.h +++ b/include/sound/soc-usb.h @@ -73,6 +73,7 @@ int snd_soc_usb_find_format(int card_idx, struct snd_pcm_hw_params *params, int snd_soc_usb_connect(struct device *usbdev, struct snd_soc_usb_device *sdev); int snd_soc_usb_disconnect(struct device *usbdev, struct snd_soc_usb_device *sdev); void *snd_soc_usb_find_priv_data(struct device *dev); +int snd_soc_usb_device_offload_available(struct device *dev); int snd_soc_usb_prepare_session(struct snd_soc_usb *usb, int card_idx, int pcm_idx); int snd_soc_usb_shutdown_session(struct snd_soc_usb *usb, int session_id); diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c index 7d202b0a2680..b272945dcab0 100644 --- a/sound/soc/soc-usb.c +++ b/sound/soc/soc-usb.c @@ -340,6 +340,32 @@ int snd_soc_usb_find_format(int card_idx, struct snd_pcm_hw_params *params, } EXPORT_SYMBOL_GPL(snd_soc_usb_find_format); +/** + * snd_soc_usb_device_offload_available() - Fetch BE DAI link sound card + * @dev: the device to find in SOC USB + * + * Finds the component linked to a specific SOC USB instance, and returns + * the sound card number for the platform card supporting offloading. + * + */ +int snd_soc_usb_device_offload_available(struct device *dev) +{ + struct snd_soc_usb *ctx; + struct device_node *node; + + node = snd_soc_find_phandle(dev); + if (IS_ERR(node)) + return -ENODEV; + + ctx = snd_soc_find_usb_ctx(node); + of_node_put(node); + if (!ctx) + return -ENODEV; + + return ctx->component->card->snd_card->number; +} +EXPORT_SYMBOL_GPL(snd_soc_usb_device_offload_available); + /** * snd_soc_usb_allocate_port() - allocate a SOC USB device * @component: USB DPCM backend DAI component