Message ID | 20231011002146.1821-34-quic_wcheng@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp221442vqb; Tue, 10 Oct 2023 17:25:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBioExftHHVu4XoLv9iF2kcRpyLYFUm1GgtkgloKHphjtZsONvhcf9swgoBiVbBjgNiwu7 X-Received: by 2002:a05:6a00:1d8f:b0:692:afaf:32b4 with SMTP id z15-20020a056a001d8f00b00692afaf32b4mr21319693pfw.0.1696983905664; Tue, 10 Oct 2023 17:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696983905; cv=none; d=google.com; s=arc-20160816; b=Scvs5N3gy5tnsaANFDoWMybFuKhyhJVsny8bxnZQ7KPFeJv3NN+cqv2z2KlFqCWpOI YBrYMiMP4quhGJN0ylM633ilzPvH2lM0y7PmvnZOX0Wp+6BG4M0sd0A1BmTTBQbXiv9u fqjuJiGDpPgFmL/dakUGUxxdEyU4z2rtXbGpWHI5fNBKDO8gsBIQE17XPqUXeWeg871D 40pDQEv0lfnnfrePAm83S7IY1QBRAsZGoF6mekjor+RlNIpzVSWmJa0O8D55OKhMkH0k SkmSprZDAgQtXmFC26nad795yBu3zn1PBfVraApQ093wbL9RIC+p1nTMOxWCbOS/3cnZ wbBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CL3FVM1qBZnRnbh0US8YjFD3CDy8ri2rtoQ7u0QpjGc=; fh=ASZxE/GudOQkGCAz0d02NHHSpg4iNHYOcDWl1imlof0=; b=IJpL3g/3WTuhgvdXDf6R+2CzNLBucIlds2dttNKmxXcILMO7/+Rw0i4LL7jy/+FjX+ IIUqBY9QjWmQLkgkxtLtzatU2roVNp0m+u7Th35dGYpH+ZIl/JmPMPU2trvuDjYM8Ouh 9jDiPZov9t+/zzV42xGayXc6x1JB5MQxD7swyJmPjPGXSOXylGjY2ixH9hfFg4001jRs uVtuI4zHCDm9AiB0ozhCIa8+Ehm8E4O6q6fQFEt9eKiqgzkgIhKIjLUN2EgXJIheqHRm +urIjSL49Vcpo8Q/zhakrLHqG/YI9mzVReVUXkNfFSo56tSTWaVaik/5ivxSVQ/dEnUx 63Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=jvnoGxix; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id 38-20020a631266000000b0056a1a149034si2735242pgs.650.2023.10.10.17.25.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 17:25:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=jvnoGxix; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 228EA81E0FC1; Tue, 10 Oct 2023 17:25:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344814AbjJKAYa (ORCPT <rfc822;rua109.linux@gmail.com> + 19 others); Tue, 10 Oct 2023 20:24:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344428AbjJKAXR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 10 Oct 2023 20:23:17 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67681EB; Tue, 10 Oct 2023 17:23:13 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39B0MJlv007450; Wed, 11 Oct 2023 00:22:40 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=CL3FVM1qBZnRnbh0US8YjFD3CDy8ri2rtoQ7u0QpjGc=; b=jvnoGxix+SvUnClNFNX3i1xW0fx4lmsQXxQU+Y4NurjDjHNYNHnCJpLaEkENe5DFAR55 yKzUJx+++dSRYGb2OtRfPfZui4WYZrxnID2cvJXETUUwXLvHU37saBsFl5YaE9g+KWPk JJYfxGr8xCQfypAbRH5NL2iJqCqM9e4vRh6RkT/vI8kkuzKveEQ5mKMKtA1dDyb1+zAu fgN/PSVUVeK1RBapMrWdYeEZGbXA64ziOaEsBZQjkJJBK0vaJuewizmXQQQ7GcOJjY2m BFEhFnsiTtwiftkwWsYBjbcTyX6wnmnLCtgdaUT/201eIIpsgqsE+WybqDHgFlou4UUJ cA== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tmxjpjf4j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Oct 2023 00:22:40 +0000 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 39B0MeCu008302 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Oct 2023 00:22:40 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.36; Tue, 10 Oct 2023 17:22:39 -0700 From: Wesley Cheng <quic_wcheng@quicinc.com> To: <mathias.nyman@intel.com>, <gregkh@linuxfoundation.org>, <lgirdwood@gmail.com>, <broonie@kernel.org>, <perex@perex.cz>, <tiwai@suse.com>, <agross@kernel.org>, <andersson@kernel.org>, <konrad.dybcio@linaro.org>, <robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <conor+dt@kernel.org>, <srinivas.kandagatla@linaro.org>, <bgoswami@quicinc.com>, <Thinh.Nguyen@synopsys.com> CC: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <alsa-devel@alsa-project.org>, <linux-arm-msm@vger.kernel.org>, <devicetree@vger.kernel.org>, Wesley Cheng <quic_wcheng@quicinc.com> Subject: [PATCH v8 33/34] ALSA: usb-audio: Allow for rediscovery of connected USB SND devices Date: Tue, 10 Oct 2023 17:21:45 -0700 Message-ID: <20231011002146.1821-34-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231011002146.1821-1-quic_wcheng@quicinc.com> References: <20231011002146.1821-1-quic_wcheng@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.49.16.6] 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-GUID: BILIqYRKXp-mqGUaZ63zC1YQAqfoEkxT X-Proofpoint-ORIG-GUID: BILIqYRKXp-mqGUaZ63zC1YQAqfoEkxT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-10_19,2023-10-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 phishscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 impostorscore=0 spamscore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310110001 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 10 Oct 2023 17:25:00 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779416595906602897 X-GMAIL-MSGID: 1779416595906602897 |
Series |
Introduce QC USB SND audio offloading support
|
|
Commit Message
Wesley Cheng
Oct. 11, 2023, 12:21 a.m. UTC
In case of notifying SND platform drivers of connection events, some of
these use cases, such as offloading, require an ASoC USB backend device to
be initialized before the events can be handled. If the USB backend device
has not yet been probed, this leads to missing initial USB audio device
connection events.
Expose an API that traverses the usb_chip array for connected devices, and
to call the respective connection callback registered to the SND platform
driver.
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
---
sound/usb/card.c | 19 +++++++++++++++++++
sound/usb/card.h | 2 ++
2 files changed, 21 insertions(+)
diff --git a/sound/usb/card.c b/sound/usb/card.c index 88f431917c15..7d3f470754ca 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -202,6 +202,25 @@ struct snd_usb_stream *snd_usb_find_suppported_substream(int card_idx, } EXPORT_SYMBOL_GPL(snd_usb_find_suppported_substream); +/* + * in case the platform driver was not ready at the time of USB SND + * device connect, expose an API to discover all connected USB devices + * so it can populate any dependent resources/structures. + */ +void snd_usb_rediscover_devices(void) +{ + int i; + + mutex_lock(®ister_mutex); + for (i = 0; i < SNDRV_CARDS; i++) { + if (usb_chip[i]) + if (platform_ops && platform_ops->connect_cb) + platform_ops->connect_cb(usb_chip[i]); + } + mutex_unlock(®ister_mutex); +} +EXPORT_SYMBOL_GPL(snd_usb_rediscover_devices); + /* * disconnect streams * called from usb_audio_disconnect() diff --git a/sound/usb/card.h b/sound/usb/card.h index 01f7e10f30f4..c0aeda17ed69 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -221,11 +221,13 @@ int snd_usb_unregister_platform_ops(void); #if IS_ENABLED(CONFIG_SND_USB_AUDIO) struct snd_usb_stream *snd_usb_find_suppported_substream(int card_idx, struct snd_pcm_hw_params *params, int direction); +void snd_usb_rediscover_devices(void); #else static struct snd_usb_stream *snd_usb_find_suppported_substream(int card_idx, struct snd_pcm_hw_params *params, int direction) { return NULL; } +static void snd_usb_rediscover_devices(void) { } #endif /* IS_ENABLED(CONFIG_SND_USB_AUDIO) */ #endif /* __USBAUDIO_CARD_H */