Message ID | 20240203023645.31105-52-quic_wcheng@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-50852-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp819619dyc; Fri, 2 Feb 2024 18:51:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqoDnWCVRKLxbbVMoHNjMkWA7RxWCiizeoVf8bZEwhvlVQ9COIylgYcLp3k9zDXmZy71nx X-Received: by 2002:ac2:446d:0:b0:50e:e1e6:d3ef with SMTP id y13-20020ac2446d000000b0050ee1e6d3efmr2404287lfl.21.1706928710187; Fri, 02 Feb 2024 18:51:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706928710; cv=pass; d=google.com; s=arc-20160816; b=uMe4qb/7c0Ei6Wf9lO9OKct/IKosOaR2TBAXSLMpeK3SE2YuknRDmhfpC4oOksQCSV MUzjPNtT26UFsvQNVqm5f30/Vt/dZWP0Aky4pBnSA57Tudrjkhcwmakz/vIr2zmXl447 F76Ltnu/FPQWJBE0MTdUT62kB9EKaU+6vA2BfAHPCDhT5ZvDHZ9sXz/UTIXaWytc40g6 O/gun/5Ch5TQewFCRX3ZIlANsGplz1UxGS/oMqvHUcLNnpbWMKXLwtbV6MswAzA/x7ex pGV6JytNpsr8UdqQYquDAEME2A5z4ppywWYlz5qwCmTpqQtRY0jDBOyykcz6xLPfC+5L 0r6A== 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=1gKa8uPfE60yWjTTUplQLsTc6cS2VTs4IFAWikb6MkA=; fh=5JOIWNVUcCveOuzKSuHWE3L5ipJF4L8bm2zSLJlqX7Y=; b=vwnr8365mVTEN2W1ExDWwoF9N07kTlGt+iWGguTrqUM/JM67oij931Qd6oQrYV/7TQ pP+z6cDuA2m5tV/d/j+wOExX5mxobOkWAUzC0cRQzE4wQENn+YqftPei5PYVc7UKb6Gl PPb2eOLp+0C2UAKY/+m+rmtAWLI9DriPQeg3gUzQu9UNDuesOpcLR/4tq+KwNS/Pz/DF KxiGIImZlMcMb8Z4EpoGlh+OGWpHWdYqOI4T7U/XFbIL66yfhWxxdAdtjEe9mp/gfwJt QuA9TPozvtAwoVv154YmyShyZwQ58WfA6UhrYGBNkwpXWUsDGiPFKKqp9t74A5RZGfLk d3GQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FIU68p+D; 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-50852-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50852-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=1; AJvYcCWUQ4AL08uSFLf+mGENCYObH7oHb9VDDtRS3IrZ/Y3i+hDW2NeqM257ulWEpphhigk8h+x9vj393EBsh8Cob+a4rbTLjQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id lk8-20020a170906cb0800b00a366a0a5ef8si1370194ejb.611.2024.02.02.18.51.49 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 18:51:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50852-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=FIU68p+D; 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-50852-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50852-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 989A91F24A38 for <ouuuleilei@gmail.com>; Sat, 3 Feb 2024 02:51:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B63B951005; Sat, 3 Feb 2024 02:38:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="FIU68p+D" 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 6E73119473; Sat, 3 Feb 2024 02:37:54 +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=1706927877; cv=none; b=oLR3s6kzinxypJJFQp/0elJ8MTRSd2STiQVEdV/mDljJc+97hyZrGurfzKtcp5W9FBTrLFs91gY32geGGOGAKaHVy9JEtwSZstRZqUq+BGQrr7Wk3NpZObpg/3wNdwPo6jGLJGI7yeU0tfhQA2g6uKjKQl5fiaONQa9Nuac5H2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706927877; c=relaxed/simple; bh=GgnICuH7GHv7SDlK6A+NlCN2HhLTGdZZc+5NwsH4lPE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ODIb3cUTOC2O1MwMgVc/f/oC5aTkkciWkUPzOqwJ5LfMPkQaApyLJBbsZc1ThCDEZATp5T8NnX2riQf+g8SzKaFGSMHAiLY6XD2M0uFlbGI0yzwzQnVbLVNNQCe3dkJ6fg+50WsyWIp71ze7Rb4rfJvkB38GTyssc4Rov+AgelQ= 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=FIU68p+D; 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 (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4132RUjw014040; Sat, 3 Feb 2024 02:37:34 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=1gKa8uPfE60yWjTTUplQ LsTc6cS2VTs4IFAWikb6MkA=; b=FIU68p+D2Hr/fliG/7ZASIcldR9rO26JGz1a yKy84AZVmBBjGaknOd2jiFmYt1WBGCuZtYOOzvRwICF+5NQ7b0tyXMGMDfQAs5tS Q4bE76irFiC/GD9sm81DFbOU4gO3e7RMgcz4k4kKZOsn24MrqaSPCXDK773LI+/r ahXPi2OAJFZkIZzrNxjF70FNXfnVBpzPcKH7T3wWELKhDViUxN4nmD9zTjqgOnXS Bsb/RyoS2812XWuccJUVr8hDfNtWSZPvM/w1pSJ3sEJw91X2klw2nIrvCOfqcJop ChtZKdf6PAN/g04n9W9Vq6eGjQsBNK65I5hJf1f8SdoojeKtQA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w0ptwawrh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 03 Feb 2024 02:37:34 +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 4132bXDA004333 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 3 Feb 2024 02:37:33 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, 2 Feb 2024 18:37:32 -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 v13 51/53] ASoC: usb: Rediscover USB SND devices on USB port add Date: Fri, 2 Feb 2024 18:36:43 -0800 Message-ID: <20240203023645.31105-52-quic_wcheng@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240203023645.31105-1-quic_wcheng@quicinc.com> References: <20240203023645.31105-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: 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-ORIG-GUID: fF25EnyuiHyp2kNNunyZP5ekd6I5gnsd X-Proofpoint-GUID: fF25EnyuiHyp2kNNunyZP5ekd6I5gnsd 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-02_16,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 mlxlogscore=999 adultscore=0 impostorscore=0 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402030015 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789844479306842966 X-GMAIL-MSGID: 1789844479306842966 |
Series |
Introduce QC USB SND audio offloading support
|
|
Commit Message
Wesley Cheng
Feb. 3, 2024, 2:36 a.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 dfd6f53898c5..4d6d6ab0601f 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);