Message ID | 20231215214955.12110-40-quic_wcheng@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-1718-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9608668dys; Fri, 15 Dec 2023 14:12:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGBhKkn8VWQ3KzliUrw1uYq+zjVIU8/rP8ztgsisl9U7AkGf3kqg6YsS8CP++J9z1Ffn+Kb X-Received: by 2002:a17:90a:d203:b0:286:6cd8:ef01 with SMTP id o3-20020a17090ad20300b002866cd8ef01mr15775613pju.25.1702678359057; Fri, 15 Dec 2023 14:12:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702678359; cv=none; d=google.com; s=arc-20160816; b=eynQ7NeIYxmAQ+FG97VZzQbxP0/IOmjfBjl9wgqweCu4EVOFjKjIfqY+764TLRCmAy Klg+tDnt7/KbLw7N8yXQi/+UeUTdHd02dLCLdKl3lxZOFypL6vaEu5wXa90XbUyJ8ZW6 pOJH3aGgg5dHjnAV9T7ZT7YTGvPDjpLG35edgfzVH3y9p5YhXapfdigdysDIxOADwhEQ 23E6EgB5SzzZuNE5T2DQj7OqT7TKUSaClk4mlFdF75aKG9T6EGW49B3ufoMDPhFksyIN g3z7+5i0FplWfNy1Hq6Fqc/MEZBcOVEdIW5Oq9xdqcOrgZR6/qKLWcSFYLczAfd9/ub5 1CYw== 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=2OiOvsQD7ZWPb6z4rtLBA/HS49iLIfIToMaiUYq1eM0=; fh=0KzismZj+xI0Z//ZGdqKIH/FO9LtSZM7Yj4P0VtrCz0=; b=hbi4bOCyOMFzQO/4BHIK1YFPCkoPW54146uPMp1x37qF77736xkYX0a8zGY/WjVjXe YgXlsD01eQGEx8auCQHFpo6Hx/gyJw8R4yZ+YCl2JOaP+iDRI7LLnVje0MxeVIo2Zx6P PKMuRg+8D22kCcYb9yvhFQ1L+OposbFTNf8GOZBbztWaLdr44IdXlKeIa0uwm1rQOrcd jEixnuP2YJl+L0m2UaAVQftFqyWAdKThTHmW+X2oJKng0f1E2VxuMFPej9Q+7MA78K/A 4VZr0bqFbiz5WFNxo3f8eoqvjvD8y9QCKlh/5/O9f894QVw6RZcisLmImFrly8Wyv4CO 51fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=LS5lD6PN; spf=pass (google.com: domain of linux-kernel+bounces-1718-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1718-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t3-20020a17090ad50300b0028b1af60160si2588137pju.93.2023.12.15.14.12.38 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 14:12:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1718-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=LS5lD6PN; spf=pass (google.com: domain of linux-kernel+bounces-1718-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1718-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 22232B2396F for <ouuuleilei@gmail.com>; Fri, 15 Dec 2023 22:06:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3F8C13A35D; Fri, 15 Dec 2023 21:50:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="LS5lD6PN" 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 DA05E138761; Fri, 15 Dec 2023 21:50:48 +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 (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BFLF22m025789; Fri, 15 Dec 2023 21:50:18 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=2OiOvsQD7ZWPb6z4rtLB A/HS49iLIfIToMaiUYq1eM0=; b=LS5lD6PN1BKOEsZNkkhOItOoijCli/y9gWIO vW7UuyC0WbzHMubx13CPzXn+QsJHjhFWGKhXb+j6Itpf2SsU6VxetBhBQRDB0hei KPI/reCj3uO2FBUdMY7Rirl+R5fDcZEoAEjBDstdOug2hTvUPbusbmMJ8Iv+39NA nqpG5QRpi8MCcajnVLK4BNCuiqpKnpMpb2mTtIRBbOWviLFByDHmGrThOwxPPeB+ g8E1ic1RNYIGwRolPoBc68Ml6ilzUf7ZQB9F73KSCWCZ+zPcLxjE97r08bwPIwSd H/MuvR5zTv2+RXNMREXdjxgm7iZg4yE0///C2YK6KJEbyj5Bvw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v0w1989h3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 21:50:18 +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 3BFLoHU0031505 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 21:50:17 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; Fri, 15 Dec 2023 13:50:17 -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 v10 39/41] ASoC: usb: Rediscover USB SND devices on USB port add Date: Fri, 15 Dec 2023 13:49:53 -0800 Message-ID: <20231215214955.12110-40-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231215214955.12110-1-quic_wcheng@quicinc.com> References: <20231215214955.12110-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-GUID: 6T2RwhlcRHVJbQugvxidi5KQ6qGSa68h X-Proofpoint-ORIG-GUID: 6T2RwhlcRHVJbQugvxidi5KQ6qGSa68h 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 priorityscore=1501 malwarescore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 adultscore=0 phishscore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312150152 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785387663544989583 X-GMAIL-MSGID: 1785387663544989583 |
Series |
Introduce QC USB SND audio offloading support
|
|
Commit Message
Wesley Cheng
Dec. 15, 2023, 9:49 p.m. UTC
In case the USB backend device has not been initialized/probed, USB SND
device connections can still occur. When the USB backend is eventually
made available, previous USB SND device connections are not communicated to
the USB backend. Call snd_usb_rediscover_devices() to generate the connect
callbacks for all USB SND devices connected. This will allow for the USB
backend to be updated with the current set of devices available.
The chip array entries are all populated and removed while under the
register_mutex, so going over potential race conditions:
Thread#1:
q6usb_component_probe()
--> snd_soc_usb_add_port()
--> snd_usb_rediscover_devices()
--> mutex_lock(register_mutex)
Thread#2
--> usb_audio_disconnect()
--> mutex_lock(register_mutex)
So either thread#1 or thread#2 will complete first. If
Thread#1 completes before thread#2:
SOC USB will notify DPCM backend of the device connection. Shortly
after, once thread#2 runs, we will get a disconnect event for the
connected device.
Thread#2 completes before thread#1:
Then during snd_usb_rediscover_devices() it won't notify of any
connection for that particular chip index.
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
---
sound/soc/soc-usb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c index b272945dcab0..f22bf5c0989f 100644 --- a/sound/soc/soc-usb.c +++ b/sound/soc/soc-usb.c @@ -437,6 +437,8 @@ int snd_soc_usb_add_port(struct snd_soc_usb *usb) list_add_tail(&usb->list, &usb_ctx_list); mutex_unlock(&ctx_mutex); + snd_usb_rediscover_devices(); + return 0; } EXPORT_SYMBOL_GPL(snd_soc_usb_add_port);