Message ID | 20240208231406.27397-46-quic_wcheng@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-58842-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp517549dyd; Thu, 8 Feb 2024 15:33:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHwY3UjhFyliIKtf3+ps3lXn/ZbXo2BSyB3/N7FudaGOSO4/Jcfy/3xq6CI59yo7z30HQjr X-Received: by 2002:a05:6358:6f9e:b0:178:b9a0:fe9f with SMTP id s30-20020a0563586f9e00b00178b9a0fe9fmr728760rwn.19.1707435224179; Thu, 08 Feb 2024 15:33:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707435224; cv=pass; d=google.com; s=arc-20160816; b=krqbYxC6ltPoEMS9AvWtVw8hU4V2BU0l8ASMLQnbwrD57I8W8WXWdh2PcRnBsapvFs vGGGt6zinhXAonpt4IsvE3AXF2j+3/kgRT9NbmAd/An0+fF9bI39lEKlKNQg6jVBM7ee 4R3bXC5tWAgiNx3sS3wm/AXRZiiBpjRwxqsCM6KWkZXttwXTpkaKM1fqWtF9K1BaGGl/ FHFcJ0g9kFX0C9uaAKAWw17oabO8Ftepc53WiI41SZhTvZSV5b3XyWLbSYMTwJSTMk79 qITdC/ZELioYayQJ+Tgd9wOxWOagHuS0TR4MytzzKh2PN82Hi0Ah451Sr/aeJ/AjH8lD Ethg== 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=EzS2gn4U4WnO6HUj0UC69z/Zo5B+U25eLv0bGKq0HUI=; fh=bcdD9+ev54RVSrR9qIPP+WzEFPNb1Z93cC9FkpbF5iE=; b=Zq7BiL6YTZVWMdwETGSFuAD6TH6FlfE9jZk8/wGRGmlO+tjYbum96fyVKetlocRoit vPNN7ylYOStue1wV3DlD8HFl/L+Cn1mXo4zZckgzkXDtGhySg1C95Iimb/WKF4j/M3AH rqWP1FP8mxfBTsFkvXJVhgS9DH/iKGeMSvxEiERLaaJE8oePujGjHyEHL1yySv6aQ/+z 8HX2aYRjs0JtEZpgQLP8kpeQh01au7eyCt5IJR9x4lgApxUNdRVNINHQSx6FADfn9FJ3 Nke381hucYkTUTP8bGXLPwDIf3OvfgG3Ar80skwvAQaKQ62X1t7L30cZrOyrV2hpW0K2 fj2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Vq7e9dh9; 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-58842-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58842-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=2; AJvYcCUYS+FVlAKIaMd437ntYgWemFquffCSPncRVr2lwSi/RrDMdZ0sLX60TMkukCoMCuuEi7/X5YPxTbLL+U6fNqH6jfLf0w== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l29-20020a63ba5d000000b005dbd5035ddasi587336pgu.275.2024.02.08.15.33.44 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 15:33:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58842-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Vq7e9dh9; 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-58842-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58842-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 E42D72811C4 for <ouuuleilei@gmail.com>; Thu, 8 Feb 2024 23:33:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CD19651B7; Thu, 8 Feb 2024 23:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="Vq7e9dh9" 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 AC3CB54FB0; Thu, 8 Feb 2024 23:14:47 +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=1707434090; cv=none; b=B4J6EOsuz8IsNQXZhXGi8kdgQfnMLqzDkmK+icctKUjmrEAUJ2btwjH0QSIciV1/0XHFk7py+MQk1sa1winjF6bX4wyaGnYV/rG5uBvHkXji7Jhgpk9rECds4sUkCJVCc6F50Xa+KOlr9M6ASLMTUb2vvyTB0SZabUoo8jtisrw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707434090; c=relaxed/simple; bh=kCI2wpxHS2B0a8rnreQMrTdOsnwA7+jL3ssXaF27uaU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FtzOi1Sl2uqAjGQP2QSu3f40uDj6gun2mSf09zue87GRTLm+ilMWeYtj698ITBDtAUZhM8OhaTBMlFfTMaCgVUD0bjjPYfUQnVhlYKDvUXwnpiPeqkaWmDc7NtoPO8mklXA6jlQusGkzsMcrcxMwH2ZWrnNYF/i5PKmU39ozPhQ= 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=Vq7e9dh9; 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 (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 418N0rmX025969; Thu, 8 Feb 2024 23:14:29 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=EzS2gn4U4WnO6HUj0UC6 9z/Zo5B+U25eLv0bGKq0HUI=; b=Vq7e9dh9cfW50sAun5tL/amCcCfQA7CdG8cW A2BXfcmuiaNRSuDfRPCFbYxqmZ3agMRJRzj7u7BJQnDoe50HdGBB5EhChj/oOwjh btUc/nrKUub5kIZyrbwITLJi23/9X3o1smJlB4QLoZ4ps4sViW9tMQxGRGGJxx7O 9mUb/Yy3AjQwdiFB2dmlYZSNkcsNL7OrAfp0mK9sCKItgjRLYnNlhjrsRdYKmztX TgWGc9TihAQAIC97mJTzOyUI/rGCbX7mKn4Y0e0IVJvC5/NysM8DkYQWaZ3tjvcN 9yS0F2hNwTsjPGtHtv4byRgiqr0PT8puwEK2CKNLIvuugG1HWg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w4m3ak1pj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Feb 2024 23:14:29 +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 418NEScr005639 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 8 Feb 2024 23:14:28 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, 8 Feb 2024 15:14:27 -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>, <lgirdwood@gmail.com>, <andersson@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <gregkh@linuxfoundation.org>, <Thinh.Nguyen@synopsys.com>, <broonie@kernel.org>, <bgoswami@quicinc.com>, <tiwai@suse.com>, <robh+dt@kernel.org>, <konrad.dybcio@linaro.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 v14 45/53] ASoC: usb: Create SOC USB SND jack kcontrol Date: Thu, 8 Feb 2024 15:13:58 -0800 Message-ID: <20240208231406.27397-46-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240208231406.27397-1-quic_wcheng@quicinc.com> References: <20240208231406.27397-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: 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: fnioLAMqjAzfQg0-pZ6w1c1JU1bR7suu X-Proofpoint-GUID: fnioLAMqjAzfQg0-pZ6w1c1JU1bR7suu 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-08_11,2024-02-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 mlxlogscore=725 adultscore=0 priorityscore=1501 malwarescore=0 spamscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402080131 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790375597959469588 X-GMAIL-MSGID: 1790375597959469588 |
Series |
Introduce QC USB SND audio offloading support
|
|
Commit Message
Wesley Cheng
Feb. 8, 2024, 11:13 p.m. UTC
Expose API for creation of a jack control for notifying of available
devices that are plugged in/discovered, and that support offloading. This
allows for control names to be standardized across implementations of USB
audio offloading.
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
---
include/sound/soc-usb.h | 4 ++++
sound/soc/soc-usb.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+)
Comments
On Fri, 09 Feb 2024 00:13:58 +0100, Wesley Cheng wrote: > > Expose API for creation of a jack control for notifying of available > devices that are plugged in/discovered, and that support offloading. This > allows for control names to be standardized across implementations of USB > audio offloading. > > Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com> Again, use a more intuitive control element name. thanks, Takashi
Hi Takashi, On 2/9/2024 3:02 AM, Takashi Iwai wrote: > On Fri, 09 Feb 2024 00:13:58 +0100, > Wesley Cheng wrote: >> >> Expose API for creation of a jack control for notifying of available >> devices that are plugged in/discovered, and that support offloading. This >> allows for control names to be standardized across implementations of USB >> audio offloading. >> >> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com> > > Again, use a more intuitive control element name. > Sorry, missed these. Will fix. Thanks Wesley Cheng
diff --git a/include/sound/soc-usb.h b/include/sound/soc-usb.h index c05d9b2f5c90..e07e83d86a11 100644 --- a/include/sound/soc-usb.h +++ b/include/sound/soc-usb.h @@ -6,6 +6,8 @@ #ifndef __LINUX_SND_SOC_USB_H #define __LINUX_SND_SOC_USB_H +#include <sound/soc.h> + enum snd_soc_usb_dai_state { SND_SOC_USB_IDLE, SND_SOC_USB_PREPARED, @@ -76,6 +78,8 @@ int snd_soc_usb_prepare_session(struct snd_soc_usb *usb, int card_idx, int pcm_i int snd_soc_usb_shutdown_session(struct snd_soc_usb *usb, int session_id); int snd_soc_usb_set_session_state(struct snd_soc_usb *usb, int session_id, enum snd_soc_usb_dai_state state); +int snd_soc_usb_setup_offload_jack(struct snd_soc_component *component, + struct snd_soc_jack *jack); struct snd_soc_usb *snd_soc_usb_allocate_port(struct snd_soc_component *component, int num_supported_streams, void *data); diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c index 9c082129cb9f..f22fd1b6d294 100644 --- a/sound/soc/soc-usb.c +++ b/sound/soc/soc-usb.c @@ -4,8 +4,11 @@ */ #include <linux/of.h> #include <linux/usb.h> + +#include <sound/jack.h> #include <sound/soc.h> #include <sound/soc-usb.h> + #include "../usb/card.h" static DEFINE_MUTEX(ctx_mutex); @@ -42,6 +45,40 @@ static struct snd_soc_usb *snd_soc_find_usb_ctx(struct device_node *node) } /* SOC USB sound kcontrols */ + +/** + * snd_soc_usb_setup_offload_jack() - Create USB offloading jack + * @component: USB DPCM backend DAI component + * @jack: jack structure to create + * + * Creates a jack device for notifying userspace of the availability + * of an offload capable device. + * + * Returns 0 on success, negative on error. + * + */ +int snd_soc_usb_setup_offload_jack(struct snd_soc_component *component, + struct snd_soc_jack *jack) +{ + int ret; + + ret = snd_soc_card_jack_new(component->card, "SNDUSB OFFLD Jack", + SND_JACK_HEADPHONE, jack); + if (ret < 0) { + dev_err(component->card->dev, "Unable to add USB offload jack\n"); + return ret; + } + + ret = snd_soc_component_set_jack(component, jack, NULL); + if (ret) { + dev_warn(component->card->dev, "Failed to set jack: %d\n", ret); + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(snd_soc_usb_setup_offload_jack); + static int snd_soc_usb_get_offload_status(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) {